Submitting JCL to compile, link, and run jobs tutorial

About this tutorial

After you complete coding changes by using IBM Z Open Editor, you want to test your changes. In order to upload all the necessary files to z/OS and run jobs, you can use Zowe CLI commands, Zowe Explorer, or both for the operation.

Prerequisites

Procedure

  1. To ensure that you have a working set of files, switch your local workspace to the tutorial-complete Git branch that has the final updated set of programs and support files through the branch icon at the lower left.

  2. Allocate the data sets on z/OS. Sample JCL files such as ALLOCATE.jcl are provided to allocate the necessary files. Alternatively, you can use your own existing PDS, or create new data sets in the Data Sets view or with Zowe CLI commands.

    Before you use a JCL file, adjust it for your user name with these steps:

    1. Click the JCL file to open it in the editor.

      Note: Language support for JCl is unavailable now. But JCL syntax highlighting is enabled.

    2. Review the file. It creates data sets in the format HLQ.SAMPLE.*.

    3. Modify the value for the symbolic HLQ to the high-level qualifier you want to use and save the file. For example, replace TSOUSER with your value.

    4. Execute the JCL with one of the following methods:

      • Zowe CLI command:
       zowe jobs submit local-file "JCL/ALLOCATE.jcl"
      
      • The Submit Job option in Zowe Explorer

        Take ALLOCATE.jcl as an example. To execute the job, take the following steps:

        1. Switch to Zowe Explorer.
        2. Click the USER1.SAMPLE.JCL(ALLOCATE) data set member you created to open it in the editor.
        3. Copy and paste the contents of JCL/ALLOCATE.jcl in the file tree into the PDS member, and save the member.
        4. From the Zowe Explorer view, right-click the ALLOCATE member of SAMPLE.JCL, and select Submit Job.

        After you submit the job, a message box that shows the jcl was submitted and a job number in the lower right corner.

        You can go to the JOBS view in Zowe Explorer to see the return code of the job. If the job does not exist in JOBS view, you might need to set the job owner to your USERID by right-clicking the zoweCLI line and selecting Set Owner.

    5. Verify the creation of these data sets using your user name by refreshing your data sets view. You might see the following lines:

      HLQ.SAMPLE.COBOL
      HLQ.SAMPLE.COBCOPY
      HLQ.SAMPLE.COPYLIB
      HLQ.SAMPLE.OBJ
      HLQ.SAMPLE.LOAD
      HLQ.SAMPLE.CUSTFILE
      HLQ.SAMPLE.TRANFILE
      
  3. After the data sets are created, upload the sample files to the appropriate data sets. Replace the user name with your name. Take COBOL as an example.

    For COBOL and COPYBOOK PDS members, right-click the data set and select Create New Member to create files in MVS™ data set. You need to create the members as follows:

    • Upload the contents of the local files into the PDS data sets using the commands:
     zowe files ul dir-to-pds "COBOL" "USER1.SAMPLE.COBOL"
     zowe files ul dir-to-pds "COPYBOOK" "USER1.SAMPLE.COBCOPY"
     zowe files ul dir-to-pds "COPYLIB" "USER1.SAMPLE.COPYLIB"
     zowe files ul dir-to-pds "COPYLIB-MVS" "USER1.SAMPLE.COPYLIB"
    
    

    Limitation: Drag and drop support to upload files in MVS data sets from the local file system is unavailable now.

    For sequential files, use these Zowe CLI upload commands:

     zowe files ul ftds "RESOURCES/SAMPLE.CUSTFILE" "USER1.SAMPLE.CUSTFILE"
    
     zowe files ul ftds "RESOURCES/SAMPLE.TRANFILE" "USER1.SAMPLE.TRANFILE"
    

    After uploading to the data sets, click the COBOL data set members to open them in the editor. You see that the extension recognizes files as COBOL based on the defined files.associations preferences. Based on those settings, the editor is now using COBOL syntax highlight and provides all the other language server features mentioned earlier. Making changes and saving writes back to the MVS data set member directly.

  4. Before executing the RUN.jcl that contains the COMPILE, LINK, and RUN steps for the program, modify the data set names again by following these steps:

    1. Click RUN.jcl in the File view to open it in the editor.

    2. Perform the same modification to the HLQ symbolic, replacing TSOUSER with the same value used previously.

    3. You might or might not need to modify the other symbolics depending on the compile and link libraries your host system uses.

    4. You might or might not change the SPACE1 and SPACE2 symbolics, and save the file.

    5. Submit the job with this Zowe CLI command:

      zowe jobs submit local-file "JCL/RUN.jcl"
      
    6. Verify the completion of the job with Zowe JES Explorer or using this Zowe CLI command:

       zowe jobs ls js
      

      A response showing your job ID is displayed.

    7. Check the job status with this command, replacing the job ID with yours:

      zowe jobs view jsbj JOB03772
      
    8. Refresh the Remote Systems view to locate the data sets created by the RUN.jcl file.

    If the job succeeded, you can examine the results directly from the data sets explorer. Click the USER1.SAMPLE.CUSTOUT and USER1.SAMPLE.CUSTRPT data set. They are opened in the editor as text files that you can inspect.

    You can use Zowe CLI commands to download the files as well. Get the contents of SAMPLE.CUSTOUT and SAMPLE.CUSTRPT with the following commands using your user name:

    zowe files download ds "USER1.SAMPLE.CUSTOUT"
    zowe files download ds "USER1.SAMPLE.CUSTRPT"
    

    These two downloaded files are now on the left in your editor and ready for review. You also can open these files directly from the Remote Systems explorer by double-clicking each file or dragging these files to the editor.

    If you are exploring the REXX tutorial, you will notice a JCL called REXALLOC.jcl exists for allocating the necessary data sets to run the sample REXX program. There is not a JCL member to compile or run the REXX exec. After uploading RSAM1 and the input data files to your TSO data set, you can run it by using the following Zowe CLI command:

    zowe tso issue command "exec 'user1.sample.rexx(rsam1)'" -a <ACCT#>
    

    Note: If you create a TSO profile, -a ACCT# is not needed because it will be stored in that profile.

    While this REXX example is not interactive, it is possible to execute interactive REXX execs (and other commands) with the RSE CLI plug-in as demonstrated in Run interactive TSO commands.

Last Updated:
Contributors: Greg Lambert, Shi Kun Li, Greg Lambert, Peter Haumer, Billie Simmons, BillieJean-Simmons, Lauren Li