Advertisement
friedkiwi

Untitled

Sep 27th, 2023
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. 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.
  2.  
  3. Let's start with the COBOL program.
  4.  
  5. **1. Hello World COBOL Program (`HELLO.COB`)**:
  6.  
  7. ```cobol
  8. IDENTIFICATION DIVISION.
  9. PROGRAM-ID. HelloWorld.
  10. ENVIRONMENT DIVISION.
  11. DATA DIVISION.
  12. WORKING-STORAGE SECTION.
  13. 01 WS-MESSAGE PIC X(11) VALUE 'Hello World'.
  14. PROCEDURE DIVISION.
  15. DISPLAY WS-MESSAGE.
  16. STOP RUN.
  17. ```
  18.  
  19. **2. JCL to Compile, Link, and Execute the COBOL Program**:
  20.  
  21. 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.
  22.  
  23. ```
  24. // JOB HELLOJOB
  25. // LIBDEF PHASE,SEARCH=SYS2.COBLIB,SYS2.LINKLIB
  26. // LIBDEF DATA,SEARCH=SYS2.DATA
  27. // EXEC IGYWCLG
  28. // SYSIN DD *
  29. [your COBOL program here]
  30. /*
  31. // LKED.SYSLMOD DD DSN=HELLO.PHASE,DISP=(,CATLG)
  32. // EXEC HELLO
  33. ```
  34.  
  35. This JCL does the following:
  36.  
  37. - `LIBDEF` sets up the required libraries for the COBOL compiler and linker.
  38. - The first `EXEC` statement invokes the COBOL compiler.
  39. - The `LKED.SYSLMOD` DD statement specifies the output module of the link-edit step.
  40. - The second `EXEC` statement executes the compiled program.
  41.  
  42. **3. Catalog the phase in the `CYBER.PHASE` library**:
  43.  
  44. 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.
  45.  
  46. 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.
  47.  
  48. 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