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


Reusable JCL: Copying a sequential data set

Reusable JCL collection

Modify this JCL sample to copy one cataloged sequential data set into another existing sequential data set, using the DFSMSdfp™ utility IEBGENER.

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.
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=IEBGENER
//SYSPRINT DD SYSOUT=* 
//SYSIN    DD DUMMY 
//SYSUT1   DD DSN=dsname,DISP=SHR
//SYSUT2   DD DSN=dsname,DISP=OLD,
//     UNIT=unit,
//     VOL=SER=volser
/*
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 the program IEBGENER, which is a DFSMSdfp utility with a variety of uses.
When you use the IEBGENER utility, you must define several input and output data definition (DD) statements in the job step:
  • The SYSPRINT DD statement tells the system where to print the informational or error messages from IEBGENER.
  • The SYSIN DD statement identifies a control data set that IEBGENER uses in some cases.
  • The SYSUT1 DD statement identifies the cataloged sequential data set that you want IEBGENER to copy.
  • The SYSUT2 DD statement identifies the output data set where your sequential input data set is to be copied.

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.

Another useful reference is z/OS DFSMSdfp Utilities (SC26-7414), which contains instructions for using IEBGENER.

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=IEBGENER
    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. Include a SYSPRINT DD statement to tell the system where to print IEBGENER messages.
    //SYSPRINT DD SYSOUT=* 
    The SYSPRINT DD statement with SYSOUT=* tells the system to print the informational or error messages from IEBGENER in the job log. Although you may use other parameter values for SYSPRINT, no changes are required for this DD statement.
  4. Include a SYSIN DD statement.
    //SYSIN    DD DUMMY
    The SYSIN DD statement identifies a control data set that IEBGENER uses in some cases. When you are copying a sequential data set, however, IEBGENER does not need a control data set unless the input data set is to be edited as part of the copy operation, or the output data set is a partitioned data set. In this case, the output data set is sequential, so this DUMMY parameter tells the system that no resources are required for the control data set. No changes are required for this DD statement.
  5. Modify this input DD statement to identify the sequential data set that you want to copy, and the data set disposition.
    //SYSUT1   DD DSN=dsname,DISP=SHR
    1. Do not replace SYSUT1 as the name for this JCL DD statement. Although you may select your own labels (known as ddnames) for most DD statements, the IEBGENER utility requires the use of SYSUT1 for the input data set.
    2. Replace dsname with the name of the sequential data set to be copied. Although this sample assumes you are using a cataloged data set for input, you may use an uncataloged data set. If you are, however, the JCL requirements for this input DD statement are slightly different: If your uncataloged data set is not SMS-managed, you need to add UNIT and VOL=SER parameters to this input DD statement. Use the instructions in the following step for modifying the output DD statement.
    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 SHR tells the system that your data set already exists, and can be used by other programs while your job is running. The subparameter values for job-end processing are not specified, so default values are in effect. Whether the job ends normally or not, the system will keep, rather than delete, this data set. No changes are required for this parameter.

      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.

  6. Modify this output DD statement to identify the existing sequential data set to which IEBGENER is to copy the input data set.
    //SYSUT2   DD DSN=dsname,DISP=OLD,
    //     UNIT=unit,
    //     VOL=SER=volser
    1. Do not replace SYSUT2 as the name for this JCL DD statement. The IEBGENER utility requires the use of SYSUT2 for the output data set.
    2. Replace dsname with the name of the data set to which IEBGENER is to copy the input sequential data set.
    3. Change the value for the DISP parameter, if necessary. The disposition in this sample is OLD, which indicates that the output data set exists before this step and that this step requires exclusive (unshared) use of the data set. The subparameter values for job-end processing are not specified, so default values are in effect. Whether the job ends normally or not, the system will keep, rather than delete, this data set. No changes are required for this parameter.
    The remaining parameters that you use for the output DD statement depend on whether your company uses SMS.
    • If you are using SMS, replace the UNIT parameter with the STORCLAS parameter and a storage class name that your company uses for PDSes (for example, STORCLAS=SCLAS01). Also, remove the VOL=SER parameter.
    • If you are not using SMS and the output data set is cataloged, you may remove the UNIT and VOL=SER parameters. If the output data set is not cataloged:
      • Replace the UNIT parameter value unit with an appropriate value, which usually is the symbolic name of a group of devices; for example, UNIT=SYSALLDA (SYSALLDA is an IBM-assigned group name that includes contains all direct access devices defined to the system).
      • Check with your mentor to determine whether you need to specify the VOL=SER parameter; company guidelines determine what you supply for it.
  7. 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.

  8. 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.

One possible error condition that you might encounter is a region size that is too small to successfully complete the job step. If your job ends with system completion code 804 or 80A, which result when this condition is true, you can add a REGION parameter to the EXEC statement and resubmit the job. The optional REGION parameter overrides the default limit of storage that the system allocates to a particular job step. Check with your mentor to determine an appropriate value to specify for REGION; it is not a parameter to be used without advice.





Copyright IBM Corporation 1990, 2010