Preparing the payroll jobs

About this task

Consider these problems:
  1. The PAYWEEK job can process data from many departments. Each department produces its own transaction data set, which must be concatenated with the head office data set, which is always present.
  2. The PAYWEEK job uses the date of the Friday of the week in which the job is run. The job is usually run on Thursday, but if Thursday is a holiday, the job runs on the previous work day.
Both problems can be solved using variable substitution. Follow these steps:
  1. Use the JCL VARIABLE TABLE panel (1.9.2 from the main menu) to create a variable table called PAY.
  2. Specify a variable DEPT, as shown in Creating a variable.
    Figure 1. Creating a variable
    EQQJVVML -------------- MODIFYING VARIABLES IN A TABLE ------  ROW 1 TO 1 OF 1
    Command ===>                                                  Scroll ===> PAGE
    
    Enter/change data in the rows below,
    and/or enter any of the row commands below
    I(nn) - Insert, R(nn),RR(nn) - Repeat, D(nn),DD - Delete, S - Select
    variable details.
    
    Variable table        : PAY
    OWNER ID           ===> SAMPLE__________
    TABLE DESCRIPTION  ===> paymore applications____
    
    Row Variable Subst.   Setup  Val  Default
    cmd Name     Exit            req  Value
    '' DEPT____ ________ N      N__  N______________________________________
    ******************************* BOTTOM OF DATA *******************************
  3. Code the JCL for PAYWEEK like the following example:
    //PAYWEEK  JOB  …
    //*%OPC SCAN                                                           1
    //*       PAYMORE PAYROLL SAMPLE -- PAYWEEK
    //*       THIS JOB RUNS PAY07, PAY10, AND PAY16
    //*%OPC SETFORM OCDATE=(MM/DD/CCYY)                                    2
    //*%OPC BEGIN ACTION=INCLUDE,COMP=(&ODAY..EQ.1)                        3
    //*%OPC SETVAR TFRIDAY=(OCDATE+4CD)                                    4
    //*%OPC END   ACTION=INCLUDE
    ⋮
    //*%OPC BEGIN ACTION=INCLUDE,COMP=(&ODAY..EQ.7)
    //*%OPC SETVAR TFRIDAY=(OCDATE-2CD)
    //*%OPC END   ACTION=INCLUDE
    //PAY07    EXEC PGM=PAY07,PARM='&TFRIDAY.'                             5
    //STEPLIB  DD DSN=XRAYNER.OPC.LOADLIB,DISP=SHR
    //PAYFILE  DD DSN=XRAYNER.HEAD.PAYTRANS,DISP=SHR
    //*%OPC BEGIN PHASE=SUBMIT,ACTION=INCLUDE,COMP=(&DEPT..NE.N)           6
    //         DD DSN=XRAYNER.&DEPT..PAYTRANS,DISP=SHR                     7
    //*%OPC END ACTION=INCLUDE                                             8
    //PAYDB    DD DSN=XRAYNER.PAYROLL.DATABASE,DISP=SHR
    //SYSPRINT DD SYSOUT=*

    This is an explanation of the marked lines:

    1 is a statement that tells HCL Workload Automation for Z to perform variable substitution on the following lines. You need this unless you have VARSUB set to YES on the OPCOPTS initialization statement.

    2 tells HCL Workload Automation for Z to use the format MM/DD/CCYY for OCDATE. If the input arrival date is 16 March 2003, for example, HCL Workload Automation for Z substitutes 03/16/2003 for &OCDATE.

    3 tests the day of the week. If the input arrival day is Monday (ODAY=1), it includes a SETVAR statement 4 to add 4 calendar days, giving Friday's date. This is repeated for the other days of the week. OCDATE and ODAY do not have to be in your variable table because they are predefined by HCL Workload Automation for Z.

    5 passes Friday's date to the PAY07 program.

    6 tests whether the variable DEPT has its default value N, and if not, it adds the extra line of JCL 7, which is the extra data set for another department.

    8 marks the end of the lines to be included.

  4. Put the JCL into the partitioned data set that is allocated to the ddname EQQJBLIB. HCL Workload Automation for Z never updates this JCL. It always makes a copy and stores the modified copy in the job repository (a group of VSAM clusters used cyclically with DD names in the format EQQJSnDS). HCL Workload Automation for Z takes a fresh copy of the JCL from EQQJBLIB for each occurrence, but once the JCL is changed, the changed copy in the job repository is used.
HCL Workload Automation for Z changes JCL:
  • When you set up the JCL for an operation. You use the READY LIST to perform setup and complete the operation on the job setup workstation.
  • On request from the MODIFY CURRENT PLAN (MCP) panel. This is independent of the job setup operation. If you change the JCL for an occurrence, HCL Workload Automation for Z puts your edited job in the repository, where it will be picked up by any subsequent setup operation using the Ready list.
  • On request from the LONG-TERM PLAN panel. This is how you change the JCL for an individual occurrence that is not yet in the current plan, without affecting the JCL for other occurrences of the job.
  • When a job or started task completes successfully. HCL Workload Automation for Z removes the JCL for the previous occurrence from the job repository.
  • When you specify automatic recovery. HCL Workload Automation for Z checks the JCL for HCL Workload Automation for Z recovery statements. If there are recovery statements, HCL Workload Automation for Z changes the JCL and stores it in the job repository.

See Job tailoring for more details of variable substitution.

Note: PAYWEEK is a z/OS® job, but you can use variable substitution for jobs that run on other operating systems. The syntax of the directives is the same. Job setup and variable substitution is always performed on the z/OS® system that runs the controller, and the prepared job is then passed to the system where it will run.