Reusable JCL collection
Previous topic | Next topic | Contents | Glossary | Contact z/OS | PDF


Reusable JCL: Creating a data set

Reusable JCL collection

Modify this JCL sample to create a new data set, using the IBM® program IEFBR14.

Before you begin
  • If you have not already done so, allocate a data set to contain your modified version of this JCL sample. Use the instructions in JCL exercise: Creating and submitting a job to create this data set.
  • Determine the information (account number, programmer name, and so on) your company requires for each job that you submit.
  • Determine whether your company uses the Storage Management Subsystem (SMS) to automate the use of storage for data sets. The JCL parameters for SMS-managed (also called system-managed) data sets are different from some parameters used for non-SMS data sets.
  • For direct-access storage devices (DASD), determine which naming conventions are used, as well as default or recommended values for data set attributes.
About this task
The steps that follow provide line-by-line instructions for modifying this JCL sample:
//jobname  JOB  (start of JOB statement parameters)
//stepname EXEC PGM=IEFBR14  
//ddname   DD   DSN=dsname,
//     DISP=(NEW,CATLG),   
//     UNIT=SYSALLDA,SPACE=(TRK,1)
/*
In the JCL statements that appear in code examples, lowercase text indicates items that you need to modify. Except for a few cases, lowercase alphabetic characters cannot be used in JCL.
All jobs require JOB and EXEC statements, so this sample contains both:
  • The JOB statement marks the beginning of a job, specifies the job name, and also might provide company-specific details or JCL parameters that apply to all job steps within the job.
  • The EXEC statement marks the beginning of a job step. In this case, the job step is to run IEFBR14, which is a program that simply passes control back to z/OS. For steps that call IEFBR14, then, other JCL statements within the step specify any work that z/OS does.

If you modify this sample to complete more complex tasks, or if you encounter JCL errors, see z/OS MVS™ JCL Reference (SA22-7597), which is the comprehensive source of syntax rules and statement parameter descriptions.

Other useful references include:
  • z/OS MVS JCL Guide (SA22-7598), which contains instructions and examples for using IEFBR14 to test your JCL.
  • z/OS DFSMS™ Using Data Sets (SC26-7410), which contains instructions for using IEFBR14 to create different types of data sets, including HFS files.
Procedure
  1. Required: Modify the JOB statement to uniquely identify your job and to provide additional company-specific information.
    //jobname  JOB  (start of JOB statement parameters)
    1. Replace jobname with a unique name to identify this job. A common convention is to use your TSO logon ID followed by a number (for example: ZUSER031).
      Syntax rules for the name field are:
      • The name must begin in column 3 of the JCL statement.
      • The name can be one through eight characters in length.
      • The first character in the name must be an alphabetic character (the letters A through Z) or a special character (the symbols #, @, and $).
      • The remaining characters can be alphanumeric (the letters A through Z and numbers 0 through 9) or special characters.
      • Blank spaces cannot be included in a name.
    2. Replace (start of JOB statement parameters) with parameters and values that conform to guidelines set at your company.
  2. Required: Modify the EXEC statement to uniquely identify the job step and the utility to be run.
    //stepname EXEC PGM=IEFBR14 
    1. Replace stepname with a unique name to identify this step. Syntax rules for stepname are identical to those listed for jobname. Aside from changing the step name, no further changes are required.
  3. Required: Modify this input DD statement to define the data set to be created.
    //ddname   DD   DSN=dsname,
    //     DISP=(NEW,CATLG),   
    //     UNIT=SYSALLDA,SPACE=(TRK,1)
    1. Replace ddname with a unique name for this JCL DD statement; this label in the name field of a DD statement is known as a ddname. Syntax rules for ddnames are identical to those listed for job and step names on JOB and EXEC statements.
    2. Replace dsname with the name that you want to use for your new data set. Naming and syntax rules for DSN parameter values vary depending on the type of data set you are identifying. If you want to create a permanent data set to store your own collection of JCL samples, you can specify a qualified name that starts with your TSO logon ID; for example: DSN=ZUSER03.JCL
    3. Change the value for the DISP parameter, if necessary. The DISP parameter tells the system about the status of your data set and what to do with it when your job ends, either normally or abnormally. As coded in this sample, the status subparameter value NEW tells the system to create your data set. Only one subparameter value for job-end processing is specified, so the system will add an entry in the system or user catalog (CATLG), whether the job step ends normally or abnormally.

      If you want to understand more about disposition processing, refer to the summary of disposition processing in z/OS MVS JCL Reference (SA22-7597), in the DD statement topic for the DISP parameter.

    4. Change or replace the UNIT parameter, if necessary. Coding UNIT=SYSALLDA tells z/OS to find the most appropriate storage unit for your new data set. You may use this parameter and value to define either an SMS-managed or non-SMS-managed data set. If you are using SMS, however, you may replace the UNIT parameter with the STORCLAS parameter and a storage class name that your company uses.
    5. Change or replace the SPACE parameter, if necessary. Coding SPACE=(TRK,1) tells z/OS to do one of the following:
      • For a non-SMS-managed data set, allocate one track of space for your new data set.
      • For an SMS-managed data set, override the space attributes specified through the default data class. If you are defining an SMS-managed data set, you have these choices:
        • Leave the SPACE parameter as shown in the sample.
        • Replace the SPACE parameter value to specify different space attributes.
        • Replace the SPACE parameter and its value with a DATACLAS parameter and data class name that your company uses.
        • Remove the SPACE parameter and its value to accept the space attributes defined in the default data class.
  4. Optional: Check for JCL syntax errors by submitting the job with TYPRUN=SCAN on the JOB statement.
    //jobname  JOB  (start of JOB statement parameters),TYPRUN=SCAN
    Using TYPRUN=SCAN does not catch all possible JCL errors, but it's a good start to ensuring that your job will run. TYPRUN=SCAN requests that the system scan this job's JCL for syntax errors, without executing the job or allocating devices. This parameter asks the system to check for:
    • Spelling of parameters and some subparameters that is not correct.
    • Characters that are not correct.
    • Unbalanced parentheses.
    • Misplaced positional parameters on some statements.
    • In a JES3 system only, parameter value errors or excessive parameters.
    • Incorrect syntax on JCL statements in cataloged procedures invoked by any scanned EXEC statements.

    You might still encounter JCL errors after using TYPRUN=SCAN, because this request checks the JCL only through the converter, not the interpreter. The difference is that the converter basically checks all expressions to the left of an equal sign plus some expressions to the right of an equal sign (and issues messages that start with IEFC), while the interpreter checks all expressions to the right of an equal sign (and issues messages that start with IEF). For example, a data set name containing a qualifier that exceeds eight characters, such as DSN=L9755TB.JCL.TEST19970103 would not be flagged by TYPRUN=SCAN but would be caught by the interpreter.

  5. Required: Remove TYPRUN=SCAN from the JOB statement and submit the job. The system response is:
    JOB jobname(jobnumber) SUBMITTED
    ***
Results
When the job ends, you will receive a message indicating one of three conditions: job successful, JCL error, or program abend. Use your installation's viewing facility (for example, SDSF) to view the output and determine whether the job completed successfully.




Copyright IBM Corporation 1990, 2010