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


Reusable JCL: Deleting a data set

Reusable JCL collection

Modify this JCL sample to delete an existing 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.
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
//SYSPRINT DD  SYSOUT=*
//ddname   DD  DSN=dsname,
//     DISP=(OLD,DELETE,DELETE)
/*
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.

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. Optional: Include a SYSPRINT DD statement to tell the system where to print messages.
    //SYSPRINT DD  SYSOUT=*
    The SYSPRINT DD statement with SYSOUT=* tells the system to print the informational or error messages 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 define the data set to be deleted.
    //ddname   DD  DSN=dsname,
    //     DISP=(OLD,DELETE,DELETE)
    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 of the data set to be deleted.
    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 (OLD) tells the system that the data set already exists. Both subparameter values for job-end processing (DELETE) are specified, so the system will delete the data set whether the job step ends normally or abnormally.
  5. 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.

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