- Re-writing of select JCL and VSAM Tutorials is under-way, orientation would be more hands-on, and practical
- New Tutorials on COBOL-VSAM programs shall be put up pretty soon
- IMS DB/DC Tutorials to start up in April, 2010
Q. In the previous tutorial, you’ve stated what is compiling, linking and running.. Can you show me a Compiler and Linking JCL/Job Stream that does this?
Sure, as you know, the Compiler takes a SYSIN DD Input Dataset, which is the Source COBOL Program. The COBOL Compiler IGYWC(or IGYCRCTL) produces SYSOUT DD Dataset containing the JOB Log and Status messages, and more importantly, SYSLIN DD which is Object Module and Input for the Linker.
The Linker IEWL takes the SYSLIN DD Object Module as Input, and then links all the Object Modules together to produce SYSLMOD DD LOAD MODULE as Output. This is basically the executable file.
Q. Show me a simple JCL/JOB Stream to run my COBOL Program(LOAD MODULE).
On Windows, to run a program, we simply click on the Executable File. In the same way, to run our COBOL Program on Mainframes, we are going to use the LOAD MODULE(Executable).
To run a program on the MVS, you write JCL. You specify the name of the Program(LOAD MODULE) to be run in the EXEC PGM statement. But, your LOAD MODULE(Executable) is not visible to the MVS O/S. So, you need to declare the place(PDS) of which your LOAD MODULE is a member. In the above scenario, AGY0155.DEMO.LOADLIB is the Load Library, in which the LOAD PGM is present. If you don’t specify a user-defined private library, the MVS O/S searches System-defined Default Library. Typically, as a rule, when you make a LOAD LIBRARY, it should always a PDS with LRECL=0, BLKSIZE=0, RECFM=U. In this JCL, you must also supply the necessary DD Cards, corresponding to Input, Output and other efiles used in the COBOL Program. This is how a typical JOB Stream to run a Program looks.
Q. What is the ENVIRONMENT DIVISION? What purpose does it serve in the COBOL Program?
The ENVIRONMENT DIVISION provides information about the computer equipment/configuration upon which the COBOL program will run. It also gives the name of the input and output files used in the program. It assigns the file-names to ddnames(DD Statements in the Run JCL indicate the input and output datasets). There are two main sections in the ENVIRONMENT DIVISION – CONFIGURATION SECTION and INPUT-OUTPUT SECTION. CONFIGURATION SECTION mainly tells the model of the computer on which the COBOL Source code and the COBOL Object code is stored. It has two paragraphs – SOURCE-COMPUTER and OBJECT-COMPUTER.
INPUT-OUTPUT SECTION contains the FILE CONTROL paragraph. The FILE CONTROL paragraph assigns file names to specific ddnames. Let us see how it is done. The syntax of the SELECT clause is : SELECT file-name ASSIGN TO DD-name
Suppose we are reading data in the COBOL program from input file INPUT-FILE, peforming some processing(operations) on data and writing the results one-by-one to the output file OUTPUT-FILE, then we will code as follows :
SELECT INPUT-FILE ASSIGN TO INDD. SELECT OUTPUT-FILE ASSIGN TO OUTDD.
But, how does the MVS System know, which datasets on disk, do these logical names like INDD and OUTDD refer to? It doesn’t! Instead, you need to set INDD and OUTDD to point to the Input and Output Datasets, while executing your Program’s LOAD MODULE. Thus, while running the Program, you will have to supply INDD and OUTDD DD Cards.
0 comments:
Post a Comment