IBM Support

USE JCL VARIABLES TO CUSTOMIZE JCL BASED ON THE DAY OF THE WEEK

Troubleshooting


Problem

User needs to submit the same JCL to do different tasks based on the day of the week the job is run.

Resolving The Problem

Of the several ways to do this, the following is one of the simplest:.

1. Create your 5 (or 7) separate variable tables. Name them DAY1,
DAY2, DAY3... where DAY1 is MONDAY, etc. 2. In your JCL, code a TABLE directive:
>
> //&%OPC TABLE NAME=(DAY&CDAY)
>
3. When the job is submitted, the table name will resolve and the
named table will be put at the head of the concatenation of all
tables associated with the job. For instance, I created seven
tables named DAY1-DAY7 and in each I put the single variable
DAYNAME. In table DAY1, DAYNAME's default value is Monday. in
DAY2, it's TUESDAY, and so on. I then put the following JCL
into a test job
>
> //*%OPC SCAN
> //*%OPC TABLE NAME=(DAY&CDAY)
> //* TODAY IS &DAYNAME
>
and scheduled the job through TWSZ. After submission, the JCL
was
>
> //*>OPC SCAN
> //*>OPC TABLE NAME=(DAY1)
> //* TODAY IS MONDAY
>
If the job is submitted on Thursday, the table name will resolve
to DAY4 and in the DAY4 table, DAYNAME is THURSDAY... and so on.

[{"Product":{"code":"SSRULV","label":"IBM Workload Scheduler for z\/OS"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"--","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Versions;Version Independent","Edition":"","Line of Business":{"code":"LOB35","label":"Mainframe SW"}}]

Product Synonym

TWSz TWS-z/OS 5697WSZ01

Document Information

Modified date:
13 September 2019

UID

swg21163910