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


Reusable JCL: Copying a data set to tape

Reusable JCL collection

Modify this JCL sample to copy one cataloged data set to a tape device, 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.
  • For storing or backing up data on tape, determine which tape device volume numbers and types are available for your use.
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=(NEW,CATLG),
//     UNIT=tapedevice,
//     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 to copy a data set to tape, 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 IEBGENER messages.
  • The SYSIN DD statement identifies a control data set that IEBGENER uses in some cases.
  • The SYSUT1 DD statement identifies the input data set; that is, the data set that IEBGENER is to copy onto tape.
  • The SYSUT2 DD statement identifies the output data set and its location; that is, the copied data set (which may have a different name than the original), and the tape device on which the copied data set will reside. To use a tape device, you will need to consult with your mentor to find out how to get a tape and have it mounted before you run this job. Your mentor can help you determine how to correctly modify this output DD statement.

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 details about 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. Required: 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. Required: Include a SYSIN DD statement to identify a control data set that contains additional instructions for IEBGENER.
    //SYSIN    DD  DUMMY
    When you are copying a data set to tape, IEBGENER does not need a control data set, but you must include the SYSIN DD statement in your JCL anyway. Using the DUMMY parameter tells the system that no resources are required for the control data set. Although you may use other parameter values for SYSIN, no changes are required for this DD statement.
  5. Required: Modify this input DD statement to identify the cataloged data set that IEBGENER is to copy onto tape, 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 cataloged 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 (the abbreviation for "share") 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.

  6. Required: Modify this output DD statement to name the new copy and its location on tape.
    //SYSUT2   DD  DSN=dsname,DISP=(NEW,CATLG),
    //     UNIT=tapedevice,
    //     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 that you want to use for the copy of your data set on tape.
    3. If necessary, modify the disposition for the copied data set. As coded in this sample, this DISP parameter tells the system to create the data set (NEW) on tape, and add an entry for it in the system or user catalog (CATLG), whether the job step ends normally or abnormally. 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 tape devices (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 tapedevice with a value that identifies tape devices. The value is usually the symbolic name of a group of devices; for example, UNIT=SYS3480R (SYS3480R is an IBM-assigned group name that includes several models of Magnetic Tape Subsystems).
      • 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.




Copyright IBM Corporation 1990, 2010