Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Certainly! Creating and executing a COBOL program in the z/VSE environment involves multiple steps: coding the program, preparing the JCL, compiling, linking, and executing the program.
- Let's start with the COBOL program.
- **1. Hello World COBOL Program (`HELLO.COB`)**:
- ```cobol
- IDENTIFICATION DIVISION.
- PROGRAM-ID. HelloWorld.
- ENVIRONMENT DIVISION.
- DATA DIVISION.
- WORKING-STORAGE SECTION.
- 01 WS-MESSAGE PIC X(11) VALUE 'Hello World'.
- PROCEDURE DIVISION.
- DISPLAY WS-MESSAGE.
- STOP RUN.
- ```
- **2. JCL to Compile, Link, and Execute the COBOL Program**:
- Here's a sample JCL to compile, link, and then execute the program. Note that exact dataset names and library names may differ based on your specific setup.
- ```
- // JOB HELLOJOB
- // LIBDEF PHASE,SEARCH=SYS2.COBLIB,SYS2.LINKLIB
- // LIBDEF DATA,SEARCH=SYS2.DATA
- // EXEC IGYWCLG
- // SYSIN DD *
- [your COBOL program here]
- /*
- // LKED.SYSLMOD DD DSN=HELLO.PHASE,DISP=(,CATLG)
- // EXEC HELLO
- ```
- This JCL does the following:
- - `LIBDEF` sets up the required libraries for the COBOL compiler and linker.
- - The first `EXEC` statement invokes the COBOL compiler.
- - The `LKED.SYSLMOD` DD statement specifies the output module of the link-edit step.
- - The second `EXEC` statement executes the compiled program.
- **3. Catalog the phase in the `CYBER.PHASE` library**:
- After successfully compiling and link-editing the program, you'll have your program phase in the dataset specified by `LKED.SYSLMOD`. To move this phase to the `CYBER.PHASE` library, you can use VSE utilities or tools available in your environment, such as the VSE File Utility.
- Remember, the exact dataset names, library names, and utility commands may differ based on your z/VSE setup, and you might need to adjust paths, dataset names, and some parameters based on your environment's configuration.
- Finally, be sure to test the entire process in a safe environment to ensure that everything works as expected and that there are no negative impacts on existing applications or jobs.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement