Previous Topic

Next Topic

Book Contents

Book Index

Using AutoEdit System Variables in the JCL

Suppose that before a job submission you had to update the JCL with the current date, or the jobid of a previously run job. As mentioned in the introduction, such updates are inconvenient at best, and can be a source of errors, as well.

You can use AutoEdit terms to eliminate the need for such updates. In your exercise, you will use several AutoEdit variables in trivial comment lines, but these comment lines will nonetheless demonstrate the usefulness of AutoEdit terms.

  1. Edit the JCL of IDJOB6, add the following comment lines, and then exit:

    //* Today’s working date is: %%ODATE

    //* Today’s system date is:  %%DATE

    //* Today’s working day is: %%ODAY

    //* The current job order id is: %%ORDERID

  2. Enter the Scheduling Definition facility and order IDJOB6 (in table IDGS3). The Message screen is displayed indicating that the job ran.
  3. Go to the Active Environment screen and request the Sysout display for the job (enter option V for the job to display the Job Order Execution History screen, and then enter option S to display the Sysout Viewing screen). The Sysout for job IDJOB6 is displayed.
  4. Page down, or enter the command N (NEXT) in the COMMAND field (Command NEXT is discussed in Navigating The Active Environment.).

    The Sysout contains the comment lines you inserted in the JCL, as shown in Figure 43). Notice that the AutoEdit variables in the JCL resolved to their appropriate values.

    Figure 43 Sysout for Job IDJOB6

------------- CONTROL-M/CONTROL-R SYSOUT VIEWING ------   PAGE      2 OF      3

COMMAND ===>                                                    SCROLL===> CRSR

MEMNAME IDJOB6    OWNER ID          JOBNAME M21           ODATE 020201       

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8

         1 //M21  JOB APERLMAN,CLASS=A,                                        

           //    MSGCLASS=X,NOTIFY=M21,                                        

           //       MSGLEVEL=(1,1)                                             

           //*---- SUBMITTED BY CONTROL-M (FROM MEMLIB)   ODATE=010131         

           //*---- SCHEDULE CTM.TEST.SCHEDULE(IDGS3)                           

           //*---- JCL      CTM.TEST.JCL(IDJOB6)                               

           //*---- CONTROL-M JOB IDENTIFICATION:  ORDER ID=001S2  RUN NO.=00001

           //* TODAY'S WORKING DATE IS: 010202                                 

           //* TODAY'S SYSTEM DATE IS: 010202                                  

           //* TODAY'S WORKING DAY IS: 02                                      

           //* THE CURRENT JOB ORDER ID IS: 001S2                              

         2 //S1  EXEC  PGM=IEFBR14                                             

**** END OF DATA SET - ADDED BY CONTROL M **** DO NOT USE IT IN YOUR PROGRAM !!

ICH70001I STCUSER  LAST ACCESS AT 02:00:13 ON FRIDAY, FEBRUARY 02, 2001       

ICH70001I STCUSER  LAST ACCESS AT 02:00:13 ON FRIDAY, FEBRUARY 02, 2001       

IEF142I M21 S1 - STEP WAS EXECUTED - COND CODE 0000                           

---------------------------------  - BMC -  -----------------------------------

-                                        CPU (Total)  Elapsed      CPU (TCB)  

-Program  Stepname ProcStep    RC    I/O hh:mm:ss.th  hh:mm:ss.th  hh:mm:ss.th

COMMANDS: LEFT, RIGHT, FIND str, FIND str PREV, N n, P n, END          03.20.12

It you were to run this job again tomorrow, then the variables would resolve accordingly. It should be apparent, that use of AutoEdit system variables such as %%ODATE can eliminate the need to manually update the JCL before a job is run.

Before continuing with the exercise, take a closer look at certain date concepts and AutoEdit date variables.

Parent Topic

AutoEdit and JCL