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


Reusable JCL: Copying a partitioned data set

Reusable JCL collection

Modify this JCL sample to copy one cataloged partitioned data set (PDS) to a new PDS, using the DFSMSdfp™ utility IEBCOPY.

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=IEBCOPY
//SYSPRINT DD SYSOUT=* 
//SYSUT1   DD DSN=dsname,DISP=SHR 
//SYSUT2   DD DSN=dsname,DISP=(NEW,CATLG),
//     SPACE=(CYL,(1,1,45)), 
//     DCB=(RECFM=FB,LRECL=80,BLKSIZE=6160),
//     UNIT=unit,
//     VOL=SER=volser 
//SYSIN    DD *
    COPY INDD=SYSUT1,OUTDD=SYSUT2
/* 
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 IEBCOPY, which is a DFSMSdfp utility for copying or merging full or partial members between one or more partitioned data sets.
When you use the IEBCOPY 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 IEBCOPY.
  • The SYSUT1 DD statement identifies the input data set to be copied.
  • The SYSUT2 DD statement identifies the output data set where the copy of the input data set is to be placed.
  • The SYSIN DD statement contains instructions for IEBCOPY to process.

You might want to refer to z/OS MVS™ JCL Reference (SA22-7597), which contains other syntax rules and statement parameter descriptions that might help if you modify this sample to complete more complex tasks, or if you encounter JCL errors.

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

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=IEBCOPY
    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: Include a SYSPRINT DD statement to tell the system where to print IEBCOPY messages.
    //SYSPRINT DD SYSOUT=* 
    The SYSPRINT DD statement with SYSOUT=* tells the system to print the informational or error messages from IEBCOPY in the job log. Although you may use other parameter values for SYSPRINT, no changes are required for this DD statement.
  4. Required: Modify this input DD statement to identify the cataloged PDS that you want to copy, and the data set disposition.
    //SYSUT1   DD DSN=dsname,DISP=SHR 
    1. You may replace SYSUT1 as the label (or ddname) for this JCL DD statement. If you use a ddname other than SYSUT1, you must also replace SYSUT1 on the SYSIN DD statement with the new ddname.

      Syntax rules for ddnames are identical to those listed for job and step names on JOB and EXEC statements. By default, SYSUT1 is used as the ddname for the DD statement that identifies the input data set.

    2. Replace dsname with the name of the data set to be copied. This sample assumes that your input data set is cataloged. If you are copying an uncataloged data set that is not SMS-managed, you must add the UNIT parameter to this input DD statement; you might need to add the VOL=SER parameter as well. Use the instructions in the following step (modifying the output DD statement SYSUT2) for providingUNIT and VOL=SER parameter values.
    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.

      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.

  5. Required: Modify this output DD statement to create a new PDS to which IEBCOPY is to copy the contents of the input PDS.
    //SYSUT2   DD DSN=dsname,DISP=(NEW,CATLG),
    //     SPACE=(CYL,(1,1,45)), 
    //     DCB=(RECFM=FB,LRECL=80,BLKSIZE=6160),
    //     UNIT=unit,
    //     VOL=SER=volser 
    1. You may replace SYSUT2 as the label (or ddname) for this JCL DD statement. If you use a ddname other than SYSUT2, you must also replace SYSUT2 on the SYSIN DD statement with the new ddname.

      By default, SYSUT2 is used as the ddname for the DD statement that identifies the output data set.

    2. Change dsname to the name that you want to use for the copy of your input data set.
    3. If necessary, modify the disposition for the output data set. Because this sample assumes you want to create a new PDS to contain a copy of the input data set, the code provided for the DISP parameter tells the system to create the data set (NEW), and add an entry for it in the system or user catalog (CATLG), whether the job step ends normally or abnormally. Although you may change these parameter values to use an existing 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 the SMS.

    • If you are using SMS, replace the SPACE, DCB, UNIT and VOL=SER parameters with this sample code:
      //   DATACLAS=dataclassname,
      //   STORCLAS=storageclassname
      • Replace dataclassname with a data class name with data set characteristics that are similar to those of the input data set. Check with your mentor to find an appropriate data class value.
      • Replace storageclassname with a storage class name that your company uses for PDSes (for example, STORCLAS=SCLAS01).
    • If you are not using SMS:
      • Change the SPACE parameter values to space attributes that are similar to those of the input data set. The SPACE parameter values are positional, so use the syntax diagram in z/OS MVS JCL Reference to make sure you code it correctly. The SPACE parameter in this sample is:
        SPACE=(CYL,(1,1,45))
        These parameter values tell z/OS to allocate space for the data set:
        • In cylinders (CYL), which is one of the four different ways in which z/OS measures space for data set allocation.
        • In quantities indicated by the set of parameter values (1,1,45) as follows:
          • The first number (1) is the primary quantity of cylinders.
          • The second number (1) is the secondary quantity of cylinders, which are allocated only when the primary quantity is not sufficient to hold the data set's contents.
          • The last number (45) is the number of 256-byte records needed for the directory of the new PDS.
      • Change the DCB subparameter values to space attributes that are similar to those of the input data set. The DCB parameter in this sample defines three attributes:
        DCB=(RECFM=FB,LRECL=80,BLKSIZE=6160)
        As written, this code tells z/OS to allocate a data set with:
        • A record format (RECFM) of fixed blocks (FB).
        • A logical record length (LRECL) of 80 bytes.
        • A block size (BLKSIZE) of 6160 bytes.
        You have a lot of flexibility with syntax for these parameters, so it's best to check with your mentor or read the descriptions of each parameter in z/OS MVS JCL Reference.
      • 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.
  6. Required: Include a SYSIN DD statement, which contains instructions for IEBCOPY to process.
    //SYSIN    DD *
        COPY INDD=SYSUT1,OUTDD=SYSUT2
    /*
    The SYSIN DD statement identifies an in-stream data set as the source of input for IEBCOPY to process. DD * or DD DATA marks the beginning of the in-stream data set; the delimiter /* marks the end of data.
    The instream data set in this sample contains one job control statement for IEBCOPY: The COPY statement tells IEBCOPY to copy the input data set (INDD=SYSUT1) to the output data set (OUTDD=SYSUT2).
    • If you used a ddname other than SYSUT1 for your input data set DD statement, replace SYSUT1 with that new ddname.
    • If you used a ddname other than SYSUT2 for your output data set DD statement, replace SYSUT2 with that new ddname.
  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