Mainframe Playground

Defining workstations

Introduction

The best way to see workstation is as the way of processing Operations, workstation describes setting which is used for processing operations that run on it. Each Operation is associated to one workstation, there are four types of workstations: - Computer - manages started tasks and batch jobs. Operations here are automatically tracked to it's completion and are usually dependent on time, predecessors or resources. - Printer - with use of this workstations you can track output print. You cannot control output processing, you can only track it. For example Operation on such workstation is set to completed status when print starts or ends. - General – this workstation type is used for various activities. Most often Operations here are used for better control over Application's scheduling. Operation here may do nothing by itself but it waits for many predecessors, for manual completion, time, manual job-setup, completion etc. - Remote Engine - can be used to communicate with another TWS subsystem. This way Applications from one TWS instance can have dependencies scheduled in another subsystem. In TWS there should be a workstation for each kind of work that is done on system, here are basic types of activities done on workstations: - Manual job setup - Job submission - Started-task actions - Communication with NetView System Automation - Print Operations - Manual pre-processing or post-processing activity - Cross dependencies management - Dynamic scheduling - Scheduling control

Tasks

1. Create workstation on which standard batch jobs will run. 2. Create workstation that will control started tasks execution. 3. Create workstation that will be used for holding other Operations in Application. Operations on this workstations are not completed automatically (time, dependencies) only by manual completion done by operator, batch job etc. 4. Create workstation for sending WTO messages. 5. Create workstation on which dummy Operation will run for a specific amount of time. 6. Create workstation for standard dummy Operations that are used for better control of Operations execution. 7. Create job-setup workstation. It is used for manual preparation of JCL before job actually runs under TWS.

Hint 1-7

All you need is "IBM Tivoli Workload Scheduler for z/OS: Getting Started". For more detailed information see "IBM Tivoli Workload Scheduler for z/OS: Managing the Workload".

Solution 1

Enter panel 1.1.2, put * in "WORK STATION NAME" field. Here you can view all workstations that are defined in the TWS. To create new one use CREATE command:

Work station name : CPUJ DESCRIPTION ===> Computer workstation for batch__ WORK STATION TYPE ===> C G General, C Computer, P Printer R Remote Engine REPORTING ATTR ===> A A Automatic, S Manual start and completion C Completion only, N Non reporting PRINTOUT ROUTING ===> SYSPRINT The ddname of daily plan printout data set SERVER USAGE ===> B Parallel server usage C , P , B or N DESTINATION ===> ________ Name of destination Options: allowed Y or N SPLITTABLE ===> N JOB SETUP ===> N STARTED TASK, STC ===> N WTO ===> N AUTOMATION ===> N FAULT-TOLERANT AGENT ===> N WAIT ===> N Z-CENTRIC AGENT ===> N VIRTUAL ===> N DYNAMIC ===> N REMOTE ENGINE TYPE ===> _ Z z/OS or D Distributed Defaults: TRANSPORT TIME ===> 00.00 Time from previous work station HH.MM DURATION ===> ________ Duration for a normal operation HH.MM.SS

WORK STATION NAME - name should indicate workstation type and purpose. DESCRIPTION - describe the purpose of the workstation. REPORTING ATTR - this option defines how Operations on this workstation will be managed by TWS. For batch jobs always use A option, this way TWS will monitor status of a job. SERVER USAGE - servers in z/OS are refer to initiators. You can define here relations between number of inactive initiators and TWS workload management. "B" option defines that TWS will consider number of available initiators for both planning and controlling Operation execution. DURATION – this is time in which operation should complete. After that time TWS sends message that indicates that Operation is late which may or may not indicate some problems with it. Duration can be fixed or TWS can change it accordingly to previous Operation run. DESTINATION - normally Operations will run on the system where TWS Controller runs, here you can specify to submit them in remote system.

Solution 2

Started task workstations are defines the same way as in Task#1. The only difference is that "STARTED TASK" option is set to Yes. Operations on that workstation are treated as started tasks, JCL code must be a STC startup procedure. When starting such Operation TWS will issue MVS Start command for the task.

WORK STATION NAME ===> CPUS DESCRIPTION ===> Computer workstation for tasks__ WORK STATION TYPE ===> C G General, C Computer, P Printer R Remote Engine REPORTING ATTR ===> S A Automatic, S Manual start and completio n C Completion only, N Non reporting PRINTOUT ROUTING ===> SYSPRINT The ddname of daily plan printout data se t SERVER USAGE ===> B Parallel server usage C , P , B or N DESTINATION ===> ________ Name of destination Options: allowed Y or N SPLITTABLE ===> N JOB SETUP ===> N STARTED TASK, STC ===> Y WTO ===> N AUTOMATION ===> N FAULT-TOLERANT AGENT ===> N WAIT ===> N Z-CENTRIC AGENT ===> N VIRTUAL ===> N DYNAMIC ===> N REMOTE ENGINE TYPE ===> _ Z z/OS or D Distributed Defaults: TRANSPORT TIME ===> 00.00 Time from previous work station HH.MM DURATION ===> ________ Duration for a normal operation HH.MM.SS

Solution 3

Workstation that is used for holding operations until manual release can be either Computer or General workstation but General type is always used. Important here is "REPORTING ATTR" option, it has to be set to C. Initiators are not used in this case so "SERVER USAGE=N" is the best choice.

WORK STATION NAME ===> HOLD DESCRIPTION ===> Manual release work station WORK STATION TYPE ===> G G General, C Computer, P Printer R Remote Engine REPORTING ATTR ===> C A Automatic, S Manual start and completion C Completion only, N Non reporting PRINTOUT ROUTING ===> SYSPRINT The ddname of daily plan printout data set SERVER USAGE ===> N Parallel server usage C , P , B or N DESTINATION ===> ________ Name of destination Options: allowed Y or N SPLITTABLE ===> N JOB SETUP ===> N STARTED TASK, STC ===> N WTO ===> N AUTOMATION ===> N FAULT-TOLERANT AGENT ===> N WAIT ===> N Z-CENTRIC AGENT ===> N VIRTUAL ===> N DYNAMIC ===> N REMOTE ENGINE TYPE ===> _ Z z/OS or D Distributed Defaults: TRANSPORT TIME ===> 00.00 Time from previous work station HH.MM DURATION ===> ________ Duration for a normal operation HH.MM.SS

Solution 4

This workstation can be used to issue WTO message to operator console which can indicate that some kind of action is required before further Application run. It can be also issue messages to tasks such as NetView System Automation. This way operations on WTO workstation have ability to issue NetView commands and by it such Operation can start/stop subsystems that runs under NetView System Automation.

WORK STATION NAME ===> WTOM DESCRIPTION ===> WTO workstation_________________ WORK STATION TYPE ===> G G General, C Computer, P Printer R Remote Engine REPORTING ATTR ===> C A Automatic, S Manual start and completion C Completion only, N Non reporting PRINTOUT ROUTING ===> SYSPRINT The ddname of daily plan printout data set SERVER USAGE ===> P Parallel server usage C , P , B or N DESTINATION ===> ________ Name of destination Options: allowed Y or N SPLITTABLE ===> N JOB SETUP ===> N STARTED TASK, STC ===> N WTO ===> Y AUTOMATION ===> N FAULT-TOLERANT AGENT ===> N WAIT ===> N Z-CENTRIC AGENT ===> N VIRTUAL ===> N DYNAMIC ===> N REMOTE ENGINE TYPE ===> _ Z z/OS or D Distributed Defaults: TRANSPORT TIME ===> 00.00 Time from previous work station HH.MM DURATION ===> ________ Duration for a normal operation HH.MM.SS

Solution 5

Operations on WAIT workstation will run for a specific time after which they are set to complete status. This kind of operation can be used as timer. Set duration of the Operation to 10 minutes and it will run for exactly 10 minutes. It is useful when there needs to be a break between Operations.

WORK STATION NAME ===> WAIT DESCRIPTION ===> WAIT work station_______________ WORK STATION TYPE ===> G G General, C Computer, P Printer R Remote Engine REPORTING ATTR ===> N A Automatic, S Manual start and completion C Completion only, N Non reporting PRINTOUT ROUTING ===> SYSPRINT The ddname of daily plan printout data set SERVER USAGE ===> N Parallel server usage C , P , B or N DESTINATION ===> ________ Name of destination Options: allowed Y or N SPLITTABLE ===> N JOB SETUP ===> N STARTED TASK, STC ===> N WTO ===> N AUTOMATION ===> N FAULT-TOLERANT AGENT ===> N WAIT ===> Y Z-CENTRIC AGENT ===> N VIRTUAL ===> N DYNAMIC ===> N REMOTE ENGINE TYPE ===> _ Z z/OS or D Distributed Defaults: TRANSPORT TIME ===> 00.00 Time from previous work station HH.MM DURATION ===> ________ Duration for a normal operation HH.MM.SS

Solution 6

Non-reporting work station is most often used in two cases: 1. As first and last Operation in application. First operation often is used as the startup trigger for the entire Application. You could set it to first Operation on CPU workstation but DUMMY Operation is better practice – in case first CPU operation needs to be changed/removed you don't have to set external predecessors and time to the second one, DUMMY Operation is already responsible for that. 2. For easier control of Application dependencies. Imagine a situation that 10 Operations can run concurrently and another ten runs after all of them are completed. Instead of defining ten predecessors for each Operation of the latter group, it's much better to add one DUMMY Operation between those two groups. In this situation DUMMY Operation will have 10 predecessors and each later Operations will have only one predecessor - DUMMY Operation.

Work station name : NREP DESCRIPTION ===> Non-reporting work station______ WORK STATION TYPE ===> G G General, C Computer, P Printer R Remote Engine REPORTING ATTR ===> N A Automatic, S Manual start and completion C Completion only, N Non reporting PRINTOUT ROUTING ===> SYSPRINT The ddname of daily plan printout data set SERVER USAGE ===> B Parallel server usage C , P , B or N DESTINATION ===> ________ Name of destination Options: allowed Y or N SPLITTABLE ===> N JOB SETUP ===> N STARTED TASK, STC ===> N WTO ===> N AUTOMATION ===> N FAULT-TOLERANT AGENT ===> N WAIT ===> N Z-CENTRIC AGENT ===> N VIRTUAL ===> N DYNAMIC ===> N REMOTE ENGINE TYPE ===> _ Z z/OS or D Distributed Defaults: TRANSPORT TIME ===> 00.00 Time from previous work station HH.MM DURATION ===> ________ Duration for a normal operation HH.MM.SS

Solution 7

It's rare situation but sometimes JCL needs manual modification before Application continues processing. In such case another Operation as predecessor to the Operation of the batch job that needs to be prepared. Remember that this additional 'setup' Operation must have the same name as the batch job need to be checked. SPLITTABLE options specifies that Operation on such workstation can be safely interrupted and resumed at later time, this is clearly the case when preparing JCL. Often HOLD workstation can be also used in similar way.

Work station name : JOBS DESCRIPTION ===> Job setup work station__________ WORK STATION TYPE ===> G G General, C Computer, P Printer R Remote Engine REPORTING ATTR ===> S A Automatic, S Manual start and completion C Completion only, N Non reporting PRINTOUT ROUTING ===> SYSPRINT The ddname of daily plan printout data set SERVER USAGE ===> P Parallel server usage C , P , B or N DESTINATION ===> ________ Name of destination Options: allowed Y or N SPLITTABLE ===> Y JOB SETUP ===> Y STARTED TASK, STC ===> N WTO ===> N AUTOMATION ===> N FAULT-TOLERANT AGENT ===> N WAIT ===> N Z-CENTRIC AGENT ===> N VIRTUAL ===> N DYNAMIC ===> N REMOTE ENGINE TYPE ===> _ Z z/OS or D Distributed Defaults: TRANSPORT TIME ===> 00.00 Time from previous work station HH.MM DURATION ===> ________ Duration for a normal operation HH.MM.SS

Creating Calendars and Periods

Introduction

Calendar in TWS is basically the exactly the thing as normal calendar. Thank to it TWS can manage it's workload according to various calendar specific events such as holidays, quarterly business related reports etc. The most important concept here are Free Days and Work Days. All application depend on calendars because calendars define Free and Work days which are used by many application. You can schedule your Application to To run at first work day in a month or every 15th no matter if its work day or not. As addition to calendars you can also define periods. They enable you to schedule application in specific time intervals, for example every 10 days or every 20 work days.

Tasks

1. Create standard calendar, without any holidays. This calendar should be used as default TWS calendar. 2. Create second calendar this time it should include all days free of work in your country. 3. There is application that must run every 15 days - create period for it. 4. There are many application that are creating various business reports every quarter. Create period that can be used by those application. They need to run between 01 and 09 day of January, April, July and October because on 10th day of these months CEO holds a meeting where this data is analyzed. Each Application run will process data from one month, so every quarter 3 runs must be scheduled.

Hint 1

Note that default calendar must have specific name “DEFAULT”. If you're using test system where you are not System Administrator – don't name you calendar DEFAULT! Create standard calendar instead.

Hint 1-4

"IBM Tivoli Workload Scheduler for z/OS: Getting Started" and "IBM Tivoli Workload Scheduler for z/OS: Managing the Workload" documents are all you need for this Assignment.

Solution 1

To create calendar enter option 1.2.2. From there use CREATE command to create a new calendar. Follow on screen instructions to insert days and their status. If no calendar name is specified in Application Description TWS will use calendar with special name DEFAULT.

CALENDAR ID ===> DEFAULT_________ DESCRIPTION ===> Default calendar______________ WORK DAY END TIME ===> 00.00 Row Weekday or Comments Status cmd date YY/MM/DD '''' MONDAY________ ______________________________ W '''' TUESDAY_______ ______________________________ W '''' WEDNESDAY_____ ______________________________ W '''' THURSDAY______ ______________________________ W '''' FRIDAY________ ______________________________ W '''' SATURDAY______ ______________________________ F '''' SUNDAY________ ______________________________ F

Solution 2

This kind of calendar must be created each year because some holidays are in different days each years. This can be done manually or by batch job which should be scheduled at the end of the year. When adding holidays R (Repeat) option is useful. Here is example of such calendar with Polish holidays:

CALENDAR ID ===> POLISHCALENDAR__ DESCRIPTION ===> Polish holidays calendar______ WORK DAY END TIME ===> 00.00 Row Weekday or Comments Status cmd date YY/MM/DD '''' MONDAY________ ______________________________ W '''' TUESDAY_______ ______________________________ W '''' WEDNESDAY_____ ______________________________ W '''' THURSDAY______ ______________________________ W '''' FRIDAY________ ______________________________ W '''' SATURDAY______ ______________________________ F '''' SUNDAY________ ______________________________ F '''' 15/01/01______ NOWY ROK______________________ F '''' 15/01/06______ TRZECH KROLI__________________ F '''' 15/04/05______ WIELKANOC_____________________ F '''' 15/04/06______ PONIEDZIALEK WIELKANOCNY______ F '''' 15/05/01______ SWIETO PRACY__________________ F '''' 15/05/03______ SWIETO KONSTYTUCJI 3 MAJA_____ F '''' 15/05/24______ ZESLANIE DUCHA SWIETEGO_______ F '''' 15/06/04______ BOZE CIALO____________________ F '''' 15/08/15______ WNIEBOWZIECIE NMP_____________ F '''' 15/11/01______ WSZYSTKICH SWIETYCH___________ F '''' 15/11/11______ SWIETO NIEPODLEGLOSCI_________ F '''' 15/12/25______ BOZE NARODZENIE - DZIEN 1_____ F '''' 15/12/26______ BOZE NARODZENIE - DZIEN 2_____ F

Solution 3

Enter option 1.3.2. From there use CREATE command to create Period as below:

PERIOD NAME ===> EVERY15D Name of the period PERIOD TYPE ===> A A = cyclic based on all days, W = cyclic based on work days, N = non-cyclic DESCRIPTION ===> 15 DAYS PERIOD (ALL DAYS)_____ Descriptive text of the period INTERVAL ===> 015 Number of days between cyclic run period. VARIABLE TABLE ===> ________________ JCL variable table id Interval Interval Row origin end cmd YY/MM/DD YY/MM/DD '''' 15/01/01 ________

Many fields in this depends on type of Period we're creating. PERIOD TYPE - we want to run Application every 15 days so holidays mustn't be considered in this case. INTERVAL - amount of days in after which period is repeated. INTERVAL ORIGIN - date from which Period can be used. Any current of past date can be used here.

Solution 4

In previous Task cyclic period was created. This time there isn't fixed number of days between Period dates. Because of this we need to create non-cyclic Period. Non-cyclic periods needs to have definitions for specific dates.

PERIOD NAME ===> QUARTERS Name of the period PERIOD TYPE ===> N A = cyclic based on all days, W = cyclic based on work days, N = non-cyclic DESCRIPTION ===> Period for quartely reports___ Descriptive text of the period INTERVAL ===> 000 Number of days between cyclic run period. VARIABLE TABLE ===> ________________ JCL variable table id Interval Interval Row origin end cmd YY/MM/DD YY/MM/DD '''' 16/01/03 16/01/06 '''' 16/04/03 16/04/06 '''' 16/07/03 16/07/06 '''' 16/10/03 16/10/06

This period was created for specific requirements. We know that Application that will run in it will process data from one month so to process data for each Month in quarter three instances must run. It must run from 01 to 09 so it's best to put it somewhere in the middle of this period. In most cases only one run is needed so Interval origin would be equal to Interval end. Note that Period dates are for specific year, because of this you have to update every Non-cyclic period each year. An application can be made that automatically updates Non-cyclic periods and holidays in Calendars each year.

Using Periods and Run Cycles

Introduction

Periods and Run Cycles are two ways in which you control scheduling in TWS. Both of them use Calendar as a definition of work and free days. Periods are used to set constant intervals in which Application run or specific dates. Run cycles depend much more on the calendar structure, for example every week or every work day. Run cycles are a part Application Description so they are specified separately for each Application. Periods are part of TWS database and many Applications can use the same Period. In this Assignment you'll need one calendar similar to one you've created in Task#2 of “Creating calendars and periods” Assignment. The purpose of the Applications used in this Assignment doesn't matter, you can simply use DUMMY Operations or WAIT workstation.

Tasks

1. Create Application that runs every day from Monday to Thursday at 10:00. If any of those days is free don't schedule it. 2. You have Application that gathers data only for you so it doesn't have to run when you're not at work. Schedule it for work days only. Create second rule that will exclude your nearest two week vacation. 3. Create Application that runs every 10 days at 10 PM. It's long running Application so set deadline at 2 AM next day. 4. Create Application that runs every 8.5 work day once at 6 AM and once at 6 PM but not on Mondays. If it is Monday or free day schedule it at the nearest Work Day. 5. Create Application that runs every 6 hours every day. 6. Create Application that runs only on the first Saturday and Sunday of the month in intervals. First run is scheduled at 6 AM, then it runs every hour until 8PM both days.

Hint 1-6

“Tivoli Workload Scheduler for z/OS : Getting Started” and “Tivoli Workload Scheduler for z/OS: Managing the Workload” are two documents that may be useful for this Assignment.

Solution 1

Run cycle:

Name of In Out of period/rule Input Deadline F day effect Effect Text HH.MM day HH.MM Type rule YY/MM/DD YY/MM/DD MONTHU__ 10.00 00 11.00 R 4 16/05/02 71/12/31

--- Frequency --- --- Day --- --- Cycle Specification --- ------------------------------------------------------------------------------ S Only | _ Day | S Week _ January _ July _ Every | _ Free day | _ Month _ February _ August | _ Work day | _ Year _ March _ September _ First _ Last | S Monday | _ April _ October _ Second _ 2nd Last | S Tuesday | _ May _ November _ Third _ 3rd Last | S Wednesday | _ June _ December _ Fourth _ 4th Last | S Thursday | Week number __ __ __ __ __ __ _ Fifth _ 5th Last | _ Friday | Period name ________ ________ ___ ___ ___ ___ | _ Saturday | ________ ________ ___ ___ ___ ___ | _ Sunday | ___ ___ ___ ___ | | Shift default origin by ___ days

It's important to always remember about 'Type' and 'F day rule' fields. Free Day Rule '4' means that Application won't be scheduled in Free Day and won't be rescheduled to other day. In this example you could as well use 'E' option instead of '4'. Remember to check Run Cycles with GENDAYS command available from 'Modifying a rule' panel.

Solution 2

First rule:

Name of In Out of period/rule Input Deadline F day effect Effect Text HH.MM day HH.MM Type rule YY/MM/DD YY/MM/DD PERSONAL 08.00 00 08.10 R E 16/05/02 71/12/31

--- Frequency --- --- Day --- --- Cycle Specification --- ------------------------------------------------------------------------------ _ Only | _ Day | _ Week _ January _ July S Every | _ Free day | _ Month _ February _ August | S Work day | S Year _ March _ September _ First _ Last | _ Monday | _ April _ October _ Second _ 2nd Last | _ Tuesday | _ May _ November _ Third _ 3rd Last | _ Wednesday | _ June _ December _ Fourth _ 4th Last | _ Thursday | Week number __ __ __ __ __ __ _ Fifth _ 5th Last | _ Friday | Period name ________ ________ ___ ___ ___ ___ | _ Saturday | ________ ________ ___ ___ ___ ___ | _ Sunday | ___ ___ ___ ___ | | Shift default origin by ___ days

This is probably the most typical Run Cycle out there. It doesn't matter if you'll choose Week, Month or Year in this case. The main goal here is to add Exclusion rule that will prevent Application from being scheduled when you'll have vacation. There are a few ways to achieve our goal, here are three of them: Method 1 – Create Non-Cyclic Period. Period description:

Period Name : VACATION DESCRIPTION ===> MY 2016 VACATION______________ PERIOD TYPE ===> N A = cyclic based on all days, W = cyclic based on work days, N = non-cyclic INTERVAL ===> 000 Number of days between cyclic run period. VARIABLE TABLE ===> ________________ JCL variable table id Last updated by : JSADEK on 16/05/02 at 21.32 Interval Interval Row origin end cmd YY/MM/DD YY/MM/DD '''' 16/05/30 16/06/12

Name of In Out of period/rule Input Deadline F day effect Effect Text HH.MM day HH.MM Type rule YY/MM/DD YY/MM/DD PERSONAL 08.00 00 08.10 R E 16/05/02 71/12/31 VACATION 08.00 00 08.10 X 3 16/05/02 71/12/31

While creating exclusion rule Input Arrival Time must be the same. Otherwise the rule won't work. Type field defines if your exclusion run in based on Period(X) or Run Cycle(E) but you can also use Period inside Run Cycle. To do so simply create normal Run Cycle and then specify your Period name inside it:

--- Frequency --- --- Day --- --- Cycle Specification --- ------------------------------------------------------------------------------ _ Only | S Day | _ Week _ January _ July S Every | _ Free day | _ Month _ February _ August | _ Work day | _ Year _ March _ September _ First _ Last | _ Monday | _ April _ October _ Second _ 2nd Last | _ Tuesday | _ May _ November _ Third _ 3rd Last | _ Wednesday | _ June _ December _ Fourth _ 4th Last | _ Thursday | Week number __ __ __ __ __ __ _ Fifth _ 5th Last | _ Friday | Period name VACATION ________ ___ ___ ___ ___ | _ Saturday | ________ ________ ___ ___ ___ ___ | _ Sunday | ___ ___ ___ ___ | | Shift default origin by ___ days

This method has one advantage – you can run GENDAYS command here which is impossible for standard Period rule. Method 2: Create standard exclusion rule valid only in specific period. This is even easier and faster method. It also fits this Task better because you're creating one-time exclusion rule for your vacation that will become obsolete soon:

Name of In Out of period/rule Input Deadline F day effect Effect Text HH.MM day HH.MM Type rule YY/MM/DD YY/MM/DD PERSONAL 08.00 00 08.10 R E 16/05/02 71/12/31 VACATION 08.00 00 08.10 E 3 16/05/30 16/06/13

'In effect' and 'Out of Effect' fields are used to define period in which exclusion rule is active. In Run Cycle definition you should select all days in that period:

--- Frequency --- --- Day --- --- Cycle Specification --- ------------------------------------------------------------------------------ _ Only | S Day | S Week _ January _ July S Every | _ Free day | _ Month _ February _ August | _ Work day | _ Year _ March _ September _ First _ Last | _ Monday | _ April _ October _ Second _ 2nd Last | _ Tuesday | _ May _ November _ Third _ 3rd Last | _ Wednesday | _ June _ December _ Fourth _ 4th Last | _ Thursday | Week number __ __ __ __ __ __ _ Fifth _ 5th Last | _ Friday | Period name ________ ________ ___ ___ ___ ___ | _ Saturday | ________ ________ ___ ___ ___ ___ | _ Sunday | ___ ___ ___ ___ | | Shift default origin by ___ days

Method 3 - define exclusion rule for specific weeks. In this case we simply specify in which weeks the rule is valid:

--- Frequency --- --- Day --- --- Cycle Specification --- ------------------------------------------------------------------------------- _ Only | S Day | _ Week _ January _ July S Every | _ Free day | _ Month _ February _ August | _ Work day | _ Year _ March _ September _ First _ Last | _ Monday | _ April _ October _ Second _ 2nd Last | _ Tuesday | _ May _ November _ Third _ 3rd Last | _ Wednesday | _ June _ December _ Fourth _ 4th Last | _ Thursday | Week number 22 23 __ __ __ __ _ Fifth _ 5th Last | _ Friday | Period name ________ ________ ___ ___ ___ ___ | _ Saturday | ________ ________ ___ ___ ___ ___ | _ Sunday | ___ ___ ___ ___ | | Shift default origin by ___ days

Solution 3

If you want to run Application in constant cycles like 10 days you must define Period for it:

Period Name : TENDAYS DESCRIPTION ===> EVERY TEN DAYS________________ PERIOD TYPE ===> A A = cyclic based on all days, W = cyclic based on work days, N = non-cyclic INTERVAL ===> 010 Number of days between cyclic run period. VARIABLE TABLE ===> ________________ JCL variable table id Last updated by : JSADEK on 16/04/24 at 23.15 Interval Interval Row origin end cmd YY/MM/DD YY/MM/DD '''' 01/01/01 ________

Interval origin doesn't matter much in case of cyclic Periods. We don't care about free days here so 'A' option is used. Type=N needs to be specified when using Periods. Because application usually ends after midnight we must set Deadline accordingly - 'Deadline day' field can be used to define day offset from Input Arrival Time:

Name of In Out of period/rule Input Deadline F day effect Effect Text HH.MM day HH.MM Type rule YY/MM/DD YY/MM/DD TENDAYS_ 22.00 01 02.00 N 3 16/05/02 71/12/31

Note: As mentioned previously you cannot use GENDAYS command in this case but you can quickly check it with few modifications: - change Type to 'R' - enter Run Cycle and set it to: Only|Day|Period name(xxx) - use GENDAYS command - leave Rule panel and change Type back to 'N' Note that in Cyclic Periods you must use: Only|Day|Period name(xxx) While in Non-cyclic Periods you must use: Every|Day|Period name(xxx)

Solution 4

To achieve desired results you'll need to create two Periods and a Calendar:

Period Name : CYCLE17A DESCRIPTION ===> ______________________________ PERIOD TYPE ===> A A = cyclic based on all days, W = cyclic based on work days, N = non-cyclic INTERVAL ===> 017 Number of days between cyclic run period. VARIABLE TABLE ===> ________________ JCL variable table id Last updated by : JSADEK on 16/05/03 at 01.30 Interval Interval Row origin end cmd YY/MM/DD YY/MM/DD '''' 16/06/06 ________

Period Name : CYCLE17B DESCRIPTION ===> ______________________________ PERIOD TYPE ===> A A = cyclic based on all days, W = cyclic based on work days, N = non-cyclic INTERVAL ===> 017 Number of days between cyclic run period. VARIABLE TABLE ===> ________________ JCL variable table id Last updated by : JSADEK on 16/05/03 at 01.29 Interval Interval Row origin end cmd YY/MM/DD YY/MM/DD '''' 16/06/14 ________

You need two periods because of 'Interval origin' field. When adding Application to LTP you must ensure that evening Application will be scheduled 8.5 day later. Interval origin can be used to set first Application occurrence to specific date. Notice that 'A' option is chosen here. With it you ensure that also free days are counted. Let's say that Interval is set to 4 and Application last ran in Thursday: - with Period Type=A next run will be at Monday next week. - with Period Type=W next run will be at Wednesday next week because Saturday and Sunday are not decreasing interval value. Monday here is treated as Free Day. If our goal was to totally exclude Application execution in Free Days we could simply add exclusion rule but we cannot do that in this task. We must ensure that it is rescheduled at next work day, because of this new calendar is needed. Simply copy your existing calendar with holidays and mark Monday as Free Day. 'F day rule' equal to 2 defines that Application will be scheduled at the closest Work Day:

Name of In Out of period/rule Input Deadline F day effect Effect Text HH.MM day HH.MM Type rule YY/MM/DD YY/MM/DD CYCLE17A 06.00 00 07.00 N 2 16/06/06 71/12/31 CYCLE17B 18.00 00 19.00 N 2 16/06/14 71/12/31

Results:

16/06/07 06.00 16/06/14 18.00 16/06/23 06.00 16/07/01 18.00 16/07/12 06.00 16/07/19 18.00 16/07/27 06.00 16/08/04 18.00

06.06 is Monday so App is scheduled at 7th but as you can see it doesn't delay further dates (06.06 + 17 days = 23.06) so although Application was rescheduled to 07.06 next run was calculated correctly. This is very important because without it the 8.5 day offset wouldn't be retained for long.

Solution 5

Specify standard Run Cycle:

Name of In Out of period/rule Input Deadline F day effect Effect Text HH.MM day HH.MM Type rule YY/MM/DD YY/MM/DD EVERY6H_ 00.00 00 00.30 R 3 16/05/02 71/12/31

--- Frequency --- --- Day --- --- Cycle Specification --- ------------------------------------------------------------------------------ _ Only | S Day | _ Week _ January _ July S Every | _ Free day | _ Month _ February _ August | _ Work day | S Year _ March _ September _ First _ Last | _ Monday | _ April _ October _ Second _ 2nd Last | _ Tuesday | _ May _ November _ Third _ 3rd Last | _ Wednesday | _ June _ December _ Fourth _ 4th Last | _ Thursday | Week number __ __ __ __ __ __ _ Fifth _ 5th Last | _ Friday | Period name ________ ________ ___ ___ ___ ___ | _ Saturday | ________ ________ ___ ___ ___ ___ | _ Sunday | ___ ___ ___ ___ | | Shift default origin by ___ days

From there issue 'E' (Repeat Every) command to specify if Application should be repeated many times during the day:

REPEAT EVERY ===> 06.00 Repeat every HH.MM FROM ===> 00.00 Input Arrival time UNTIL ===> 23.59 Repeat end time in the HH.MM format

That's all you need to run Application multiple times per day. Repeat Every option is also available for Periods.

Solution 6

Run Cycle:

Name of In Out of period/rule Input Deadline F day effect Effect Text HH.MM day HH.MM Type rule YY/MM/DD YY/MM/DD WEEKENDS 06.00 00 06.30 R 3 16/05/02 71/12/31

--- Frequency --- --- Day --- --- Cycle Specification --- ------------------------------------------------------------------------------ S Only | _ Day | _ Week _ January _ July _ Every | _ Free day | S Month _ February _ August | _ Work day | _ Year _ March _ September S First _ Last | _ Monday | _ April _ October _ Second _ 2nd Last | _ Tuesday | _ May _ November _ Third _ 3rd Last | _ Wednesday | _ June _ December _ Fourth _ 4th Last | _ Thursday | Week number __ __ __ __ __ __ _ Fifth _ 5th Last | _ Friday | Period name ________ ________ ___ ___ ___ ___ | S Saturday | ________ ________ ___ ___ ___ ___ | S Sunday | ___ ___ ___ ___ | | Shift default origin by ___ days

Repeat Every option:

REPEAT EVERY ===> 01.00 Repeat every HH.MM FROM ===> 06.00 Input Arrival time UNTIL ===> 19.00 Repeat end time in the HH.MM format

Creating Applications

Introduction

Application idea is similar to batch job. Batch job does particular activity on system in clear order – steps. Batch job has steps. Application have Operations. Application does pretty much the same thing but it provides much more options and possibilities. It can run batch jobs. It can start or stop subsystems, control resources. It also enables to define much more complicated dependencies. One operation may be dependent on many others from the same Application or other Applications that may even run on another z/OS in Sysplex.

Tasks

1. Create application that does nothing but runs for exactly 3 minutes. Add it to Current Plan manually. 2. Find out what is the name of the library from where TWS takes JCL code for jobs used in Applications. 3. Create application that will send to you TSO message "Hello World": - JCL code for such job can be found in “JCL” tab. - Name your application SAYHELLO. - Application should have four Operations. Two of them are DUMMY. One is used as Job-setup Operation and one runs normal batch job. - It should run at specific time. - Add it to Current Plan manually. - When Application waits on Job-setup workstation, modify JCL so the message you'll receive will “Hello World from TWS”. - Complete Operation on Job-setup workstation and check Application execution. 4. Modify Application from Task #3 as specified: - Use only panel 5.2. Don't modify Application Description in TWS Database. - Remove Operation on Job-setup workstation. - Modify Application so that it will still wait for manual release before execution. - Modify JCL code so you will get different message on your screen. - Modify start time of the Application so it will after few minutes, not immediately. - Rerun entire application from 5.2 panel. 5. Modify Application Description from Task #3. Create Run Cycle. Schedule this application in each Free Day and use calendar you've created before (with holidays). Add it to Long Term Plan.

Hint 1

Use WAIT workstation you've created earlier. You can also search for other WAIT workstations: Enter panel 1.1.1, put '*' in WORK STATION NAME field and 'Y' in WAIT WORK STATION field.

Hint 2

EQQJBLIB DD statement in Controller start procedure indicates name of this data set. Most often it is concatenation of many libraries, each for different type of workload. One library may be for jobs related to RACF, another to DB2 etc.

Solution 1

Applications are normally added in option 1.4.2.

Application: ID ===> DUMMY3MINAPP____ TEXT ===> App that does nothing___ Descriptive text TYPE ===> A A - Application, G - Group definition Owner: ID ===> JSADEK__________ TEXT ===> ________________________ Descriptive text of application owner PRIORITY ===> 1 A digit 1 to 9 , 1=low, 8=high, 9=urgent VALID FROM ===> 15/08/30 Date in the format YY/MM/DD STATUS ===> A A - Active, P - Pending AUTHORITY GROUP ID ===> ________ Authorization group ID CALENDAR ID ===> ________________ For calculation of work and free days GROUP DEFINITION ===> ________________ Group definition id SMOOTHING FACTOR ===> ___ LIMIT ===> ___ Deadline Feedback options

TYPE - We're creating Application so A option is right here. Application groups can be useful when many applications are using the same setting and run cycles. OWNER - this is only information field, but it is mandatory. It can used for searching/filtering Applications. In production environment it can be very useful – if any Operation ends in error you can check there which group is responsible for it. PRIORITY – priority 5 is normally used here. It doesn't matter in most cases. Note that priority 8 and 9 should be used only for important production Applications - (1 Low, 2-7 Medium, 8 High, 9 Urgent). VALID FROM - application cannot be scheduled if it's not valid so you must use current or past date. STATUS - Pending means 'disabled', Application cannot be used when in this status. Use A(Active) option. AUTHORITY GROUP ID - RACF group can be specified here. If TWS has installed RACF support you can protect access to your Application via RACF. CALENDAR ID – if TWS have DEFAULT calendar you can left this field blank. SMOOTHING FACTOR - this value affects Application Deadline. TWS can correct Deadline accordingly to real execution time of the Application. This option specifies how much corrected Deadline value can deviate from the Deadline set by Application programmer. SMOOTHING FACTOR LIMIT - Sometimes Application can end in error. In this case and other critical cases execution time shouldn't be considered by Smoothing Factor. Feedback Limit sets boundaries in which execution time is used by Smoothing Factor. The next step is to create at least one Operation. To do it issue OPER command from panel described above.

Row Oper Duration Job name Operation text cmd ws no. HH.MM.SS '''' WAIT 010 00.03.00 ________ Wait 3 minutes__________

Oper ws - WAIT workstation needs to be used in this Task. no. - each Operation must have Operation number. This is important because all predecessor/successor dependencies are based on these numbers. It is good practice to use multiplication of 10 here, in case you'll have to add new Operation between the ones with number 10 and 20, you can simply use number 15. If you used 001, 002, 003, you would have to change numbers of all latter Operations. Operation is not saved yet, even when you've specified here all details it is saved when you go back (PF3) to the main Application panel. By default operations do not depend on time. Right now this operation will run when it will be added to Current Plan. To run Operation at specific time two options needs to changed - run time and Time Dependent option. Run time can be set in two ways: - By using Run Cycles & Periods (run time for the entire Application) - recommended way. - By setting run time in Operation Details (run time for a specific Operation) - for practice this option will be used in this solution. Note that with this option you cannot define any actual dates in which job will run. It's usually used to postpone specific operation. For example Application starts and 13:00 but 4th operation by some reason must run at 16:00 - option 6(Time) is used in such situations. Enter option 6(TIME).

Application time specifications: Input arrival time : Deadline day/time : Operation : WAIT 010 Wait 3 minutes Operation input arrival: DAY ===> 0_ The day the input arrives for operation, relative to application start day (0 means the start day). TIME ===> 17.15 Arrival time of the input in the format HH.MM Operation deadline: DAY ===> 0_ Deadline day for operation completion, relative to application start day (0 means the start day). TIME ===> 17.20 Deadline time of deadline day in the format HH.MM

Note that days here are relative to start time of the entire Application, 0 means that operation will run at the same day the Application does. Exit this screen with PF3. Second option that needs to be changed is time dependency itself. Enter option 4(Automatic Options) in Operation Details panel. From there we need to set TIME DEPENDENT option to Y(yes). Now Operation will wait for specific time. Application is ready for schedule. Add it to Current Plan via option 5.1:

Application : DUMMY3MINAPP App that does nothing Owner : JSADEK Operations : 1 External predecessors : 0 Dependency resolution options: AUTOMATIC DEP ===> N Automatic resolution of Conditional and External dependencies: Y P S or N RESOLVE REQUIRED ===> N Auto deps must be resolved: Y or N Input arrival: Deadline: DATE ===> 15/08/30 DATE ===> 15/08/30 (format YY/MM/DD ) TIME ===> 17.11 TIME ===> 17.20 (format HH.MM ) VARIABLE TABLE ===> ________________ JCL variable table to be used GROUP DEFINITION ===> ________________ PRIORITY ===> 1 1-9 ERROR CODE ===> ____ If this is a rerun

The simplest way is to press here CTRL two times, TWS will fill fields with current date and time. Only Deadline Time needs to be manually specified. In Operation Details you can check if your Operation waited for 3 minutes:

Date and time for : Planned Actual Input arrival : 15/08/30 17.15 15/08/30 17.15 Start : 15/08/30 17.15 End : 15/08/30 17.18 Deadline : 15/08/30 17.20 Duration : 00.03.00 00.03.00 Latest start : 15/08/30 17.17

Operation started at the exact time we wanted (Input arrival=Actual Start). It ran for three minutes (Actual End). You can also see that Latest start was calculated by subtracting Duration from Deadline.

Solution 2

The simplest way is to enter Controller output in SDSF. Search for EQQJBLIB DD definition:

//EQQJBLIB DD DISP=SHR,DSN=OPC.USER.TEST

Solution 3

1. JCL code we are using:

//SENDMSG JOB MSGLEVEL=(1,1) //********************************************************************* //* * //* IN CASE OF ERROR - COMPLETE OPERATION * //* * //********************************************************************* //STEP01 EXEC PGM=IEBGENER //SYSIN DD DUMMY //SYSPRINT DD SYSOUT=* //SYSUT1 DD DATA,DLM=## /*$VS,'D O' /*$VS,'SE 'HELLO!',USER=(JSADEK),LOGON' ## //SYSUT2 DD SYSOUT=(A,INTRDR)

It's a good practice to include operator instruction as part of JCL Code. Application will run no matter if user is logged on or not. Because of this 'LOGON' parameter needs to be used. Now when used if offline message will be saved and it will appear in his TSO screen. 2. Save this job in the library you've found in Task #2. 3. Create Application. Name it "SAYHELLO". 4. Define Operations. Duration times defined are used by TWS to detect if job is late or not. In such case it will issue massage to SYSLOG. Because of this it's better to give them higher value that actual execution time but withing a reason. First and last Operation is Dummy. In this example last one is not actually needed but it's a good habit to both of them in your applications unless they are very simple or created for testing purpose. Operation 10 will stop Application execution so operator could prepare JCL in Operation 20 for run.

Row Oper Duration Job name Operation text cmd ws no. HH.MM.SS '''' NREP 001 00.00.01 ________ Dummy-Start_____________ '''' JOBS 010 00.05.00 SENDMSG_ User ID specification___ '''' CPUJ 020 00.01.00 SENDMSG_ Send message to user____ '''' NREP 255 00.00.01 ________ Dummy-End_______________

5. Define dependencies. In the same panel use PRED command:

Row Oper Duration Job name Internal predecessors Morepreds No.of cmd ws no. HH.MM.SS -IntExt- Conds '''' NREP 001 00.00.01 ________ ___ ___ ___ ___ ___ ___ ___ 0 0 0 '''' JOBS 010 00.05.00 SENDMSG_ 001 ___ ___ ___ ___ ___ ___ 0 0 0 '''' CPUJ 020 00.01.00 SENDMSG_ 010 ___ ___ ___ ___ ___ ___ 0 0 0 '''' NREP 255 00.00.01 ________ 020 ___ ___ ___ ___ ___ ___ 0 0 0

Dependencies are easy to define simply use Operation number in the 'Internal predecessors' panel. If more than 8 predecessors are required they can be added in option 1 of 'Operation Details' panel, you can also add external predecessors in that panel. 6. Modify first operation so it will run at a specific time. See Task #1 solution for guidance. 7. Add Application to Current Plan with use of 5.1 option. 8. Application will start at a time specified in first DUMMY operation and after that it will wait on second operation completion. 9. It's time to prepare JCL. Change message that will be sent. It can be done from 5.2 -> M(Modify) -> OPER -> J(JCL Edit). 10. Now that JCL is prepared you can complete the Operation on Job-setup workstation. From the same panel as before set C(Complete) on Stat-N(New Status) field:

Row Operation Jobname PS Duration Opt Dep Res Stat cmd ws no. text HH.MM.SS S T S/P S R1 R2 N Cu ''' NREP 001 Dummy-Start_____________ ________ 1 00.00.01 Y Y 0 0 _ C ''' JOBS 010 User ID specification___ SENDMSG_ 1 00.10.00 Y N 0 0 C * ''' CPUJ 020 Send message to user____ SENDMSG_ 1 00.01.00 Y N 0 0 _ W ''' NREP 255 Dummy-End_______________ ________ 1 00.00.01 Y N 0 0 _ W

After pressing enter you'll see that Stat-Cu(Current Status) changed. Status isn't changed yet, to confirm your modification you have to leave Modify Occurrence panel (2 x PF3). If you want to cancel your modifications enter CANCEL command on main TWS command line – it can be done from almost any TWS panel. Note: Remember that C command in 5.4 panel completes Operation while C command in 5.2 completes entire Application.

Solution 4

1. Use panel 5.2 -> M(Modify) -> OPER. In this panel you can add or remove any Operation from Application occurrence with use of D(Delete) option. Occurrence means “Application instance”. 2. Enter Operation modification panel with 'S' line command. From there select AUTOMATIC OPTIONS. On the next panel you are able to set SUBMIT option to 'N' this way TWS won't submit the job automatically. 3. To modify Application start up time enter panel with Operations view and select first Operation. From there set appropriate time with via option 4(TIME). 4. Confirm you're modifications by going back to 5.2 panel. 5. Use 'R' action character to rerun Application occurrence. On the next panel you are able to specify from which operation Application will be restarted. Set 'S' on the first operation and confirm it, Application will be restarted from the beginning. 6. Application will wait for specified time to run. After that it starts and hangs on Operation that runs batch job. By turning off SUBMIT option for that Operation you've achieved very similar effect as in Task#3. 7. Modify SEND command in JCL code: 5.2 -> OPER -> J(JCL Edit). 8. To resume Application you need to turn back on job submit option. You can do it in the same panel you've turned it off but there is faster way to do it. On 5.2 -> OPER -> M(Modify) panel you can see Opt-S and Opt-T columns. Opt-T enables you to change Time Dependency. Opt-S enables to you to quickly change job submit option. As you can see it is set to 'N':

Row Operation Jobname PS Duration Opt Dep Res Stat cmd ws no. text HH.MM.SS S T S/P S R1 R2 N Cu ''' NREP 001 Dummy-Start_____________ ________ 1 00.00.01 Y Y 0 0 _ C ''' CPUJ 020 Send message to user____ SENDMSG_ 1 00.01.00 N N 0 0 _ * ''' NREP 255 Dummy-End_______________ ________ 1 00.00.01 Y N 0 0 _ W

From this view you can simply overwrite it with 'Y'. After confirming change Operation will start.

Solution 5

1. First you need to specify which calendar will be used by the Application. It can be done main panel for modifying Application details in TWS:

CALENDAR ID ===> POLISHCALENDAR__ For calculation of work and free days

2. Remove times set in Operation Details option 6(Time). You don't need it because Run Cycle will now define time in which Application runs. 3. From main panel for Application modification issue RUN command to define Run Cycle:

Application : SENDMSG Send Message to User Name of rg/ In Out of Row period/rule Input Deadline F day effect Effect Variable table cmd HH.MM day HH.MM Type rule YY/MM/DD YY/MM/DD '''' FREEDAYS 12.00 00 12.05 R 3 15/09/08 71/12/31 ________________ Text : __________________________________________________ Shift: ___0 Shift Day Type: _

Input - Input Arrival Time, it specifies when the application should be ready to run. Deadline-day - This is the difference in days between Input Arrival Time and Deadline. 00 means that start and end time are in the same day. Deadline - Time when the Application should be completed. Type - R is the most common choice here. Is simply means that it is standard Rule-based Run Cycle. F day Rule - This parameter defines if Application will be rescheduled from free day to work day. If you'll set that you're app runs on 1st every month and 1st is Free day you can specify here if it will run on a Free day or on the closest work day before of after free day. 4. Enter Run-cycle with S line command. In the displayed panel you're able to define days on which the Application will run:

--- Frequency --- --- Day --- --- Cycle Specification --- ------------------------------------------------------------------------------ _ Only ! _ Day ! _ Week _ January _ July S Every ! S Free day ! S Month _ February _ August ! _ Work day ! _ Year _ March _ September _ First _ Last ! _ Monday ! _ April _ October _ Second _ 2nd Last ! _ Tuesday ! _ May _ November _ Third _ 3rd Last ! _ Wednesday ! _ June _ December _ Fourth _ 4th Last ! _ Thursday ! Week number __ __ __ __ __ __ _ Fifth _ 5th Last ! _ Friday ! Period/RG ________ ________ ___ ___ ___ ___ ! _ Saturday ! name ________ ________ ___ ___ ___ ___ ! _ Sunday ! ___ ___ ___ ___ ! ! Shift default origin by ___ days

In this example Application will run every Free Day in a Month. By using custom calendar you are sure that will also run on Holidays. 5. That's all. You can still add this Application to Current Plan via 5.1 panel but now it will be also scheduled automatically. 6. Changes were made in Application Description but not in Long Term Plan and Current Plan. It will be added to scheduling during Long Term Plan extension or update but you can also do it manually. Use option 2.2.2 (Modify LTP for One Application). After that the Application will be included in LTP and it will be added to Current Plan on the next CP extend. If you need to include it in CP immediately you can do it manually via panel 3.1 (Replan Current Plan). Note: If your Application has defined Run Cycle and it is Active it will be automatically added to LTP during LTP extend or update. Usually that's the goal and special Application runs each day in order to update LTP with latest changes in TWS database. There are also situations in which Application is run on demand, only when specific activity is needed. In such case you shouldn't define Run Cycle but rather set time for the first Operation in the Application as shown in Task#1. In this case it won't be added to LTP automatically.

Creating Special Resources

Introduction

Special Resource is only representation of the resource, it isn't connected to it in any way. If you know that two jobs are using the same data set you can create resource that will be taken by one job, until it is released second job will not be started. In similar way you can used Special Resources to represent any resource you desire. Basically Special Resource definition limits access to the resource so only specific number of Operations can use it at a time.

Tasks

1. Create Special Resource that will represent a data set. To ensure data integrity make sure that in case of error Special Resource is freed only if Operation has SHR access over it. 2. Create Application with five Operations. Use WAIT workstation to ensure that each Operation runs for some time. Use Special Resource created in Task#1 to ensure that only one Operation at a time uses it. 3. Create Special Resource that will represent a task. Many jobs require specific task to be active and will abend otherwise. In this example let's assume it's CICS. It is active between 6AM and 8PM from Monday to Friday. Make sure that Special Resource is unavailable when CICS is down. 4. Create application with three Operations. As in Task#2 all operations should run for some time to simulate real workload. This time use BPXBATCH Utility and UNIX 'sleep' command in those jobs. Use Special Resource you've created in Task#3. Test if it works correctly by scheduling the Application just before Resource release. 5. Create Special Resource that will represent Storage Group. It is used by many jobs as temporary storage. There is not enough space for all those jobs so many of them ends in error. This Storage Group have 1 TB. You have report with space usage by each job that uses that storage. Figure out the most effective way to utilize this Storage Group and avoid job abends. 6. Use Application you've created in Task#4. Copy BPXBATCH jobs few more times so application has seven Operations with different run times. Copy this Application so now you have 14 jobs total. Assign to each job Special Resource created in Task#5. Schedule both applications and observe how resource availability influences their execution.

Hint 1-3

Check “IBM Tivoli Workload Scheduler for z/OS: Managing the Workload” to learn more about Special Resources.

Hint 4

BPXBATCH Utility can be used for issuing OMVS commands from batch job. Command you need to use: 'sh sleep 30'. More details about BPXBATCH Utility are available in “Running shell scripts or executable files under MVS environments” chapter of “z/OS UNIX System Services Command Reference” manual. You can change Special Resource status in 5.7 panel.

Solution 1

Enter option 1.6.2:

SPECIAL RESOURCE ===> JSADEK.TEST.DATA____________________________ TEXT ===> REPRESENTS DATA SET JSADEK.TEST.DATA__________ SPECRES GROUP ID ===> ________ Hiperbatch ===> N DLF object Y or N USED FOR ===> C Planning and control C , P , B or N ON ERROR ===> FS On error action F , FS , FX , K or blank ON COMPLETE ===> Y On Complete action Y , N , R or blank MAX USAGE LIMIT ===> 0_____ Max number of allocations before usage reset MAX USAGE TYPE ===> R Status change type Y , N or R Defaults QUANTITY ===> 1_____ Number available 1-999999 AVAILABLE ===> Y Available Y or N

SPECIAL RESOURCE – Name of special resource. TEXT – Description should point to the actual system resource that is represented here. SPECRES GROUP ID – Resource groups are created for easier management of Special Resources (filtering, searching etc.). USED FOR - C(Control) means that TWS will consider resource availability only when managing current workload, not during Current Plan extension. ON ERROR - this is important field. It defines whether resource is freed when Operation that was using it ends in error. If job with Exclusive access abends it may leave data set corrupted, in this case other jobs shouldn't use it. Because of this Resource is freed only when job ends fine or abends but with SHR access (FS option). ON COMPLETE – when the Operation completes data set should be available to use for other Operations so Y is the right choice here. MAX USAGE LIMIT – number or the resource allocation after which Global Availability Status is set to value defined in MAX USAGE TYPE. Those parameters aren't needed here. LIMIT=0 means that this functions isn't used. QUANTITY – how many copies of the resources are available. AVAILABLE – defines if by default resource is turned on. Let's say that resource represents some task. In this case it should be always available but let's say you will be editing the data set manually for an hour. You can set Resource Availability status to N for that time avoiding any possible problems. Adding special resource does not require Current Plan replan/extend. It will be automatically included in CP when Application which uses it is added.

Solution 2

First you need to create Operations that will simulate normal batch job run. Here are few ways you can do it: - You can create job that waits for specific about of time with REXX script. This method was described in one of the Assignments in JCL Category. - You can create job that uses BPXBATCH Utility and UNIX Wait function. This method will be used later. - You can simply create Operation on WAIT workstation. In this case you don't have to create any job but you won't be able to test 'ON ERROR' option. This method is used in this Task. Application description:

Oper Duration Job name Internal predecessors Morepreds ws no. HH.MM.SS -IntExt- NREP 001 00.00.01 ________ ___ ___ ___ ___ ___ ___ ___ ___ 0 0 WAIT 010 00.00.36 ________ 001 ___ ___ ___ ___ ___ ___ ___ 0 0 WAIT 020 00.01.02 ________ 001 ___ ___ ___ ___ ___ ___ ___ 0 0 WAIT 030 00.00.32 ________ 001 ___ ___ ___ ___ ___ ___ ___ 0 0 WAIT 040 00.00.11 ________ 001 ___ ___ ___ ___ ___ ___ ___ 0 0 WAIT 050 00.00.24 ________ 001 ___ ___ ___ ___ ___ ___ ___ 0 0 NREP 255 00.00.01 ________ 010 020 030 040 050 ___ ___ ___ 0 0

You can see here another use of dummy start/end Operations. All other Operations will run at the same time so there must be some additional Operation before them. Only first operation is Time Dependent. Each operation on WAIT workstation you must have definition of Special Resource (Option 3):

Special Qty Shr Keep On Avail on Resource Ex Error Complete JSADEK.TEST.DATA____________________________ ______ X _ _

Only Resource name and Shr/Ex access are required fields. You can override 'ON ERROR' and 'ON COMPLETE' values here. If you leave them blank defaults from Resource description are taken. Share/Exclusive access to the TWS resource works the same way as standard ENQ/DEQ mechanism so when using exclusive access (X option) only one Operation will run at a time:

Operation Op. text P Planned Actual Duration ws no. start start HH.MM.SS NREP 001 5 00.00.00 WAIT 010 5 04 01.55 00.00.36 WAIT 020 5 04 01.54 00.01.02 WAIT 030 5 04 01.56 00.00.32 WAIT 040 5 04 01.57 00.00.11 WAIT 050 5 04 01.56 00.00.24 NREP 255 5 00.00.00

Waiting Operation will wait with following status: “Status of operation : Ready,pred nonrep Waiting for special resource” You can also check resource status from Operation Details panel (option 5). All Special Resources used by the Operation are displayed there. You can also view two queues: - In use list – list of Operations that are currently using the Resource. - Waiting list – list of Operations that are waiting for the Resource availability.

Solution 3

Resource definition:

SPECIAL RESOURCE ===> CICSTS______________________________________ TEXT ===> REPRESENTS STC CICSTS (UP 6AM-8PM)____________ SPECRES GROUP ID ===> ________ Hiperbatch ===> N DLF object Y or N USED FOR ===> B Planning and control C , P , B or N ON ERROR ===> F_ On error action F , FS , FX , K or blank ON COMPLETE ===> R On Complete action Y , N , R or blank MAX USAGE LIMIT ===> 0_____ Max number of allocations before usage reset MAX USAGE TYPE ===> R Status change type Y , N or R Defaults QUANTITY ===> 999999 Number available 1-999999 AVAILABLE ===> N Available Y or N

In Task#1 you had to block access to Resource so only one Operation could use it. In this Task you need to block access in specific time period. Because of this Quantity value doesn't matter but you need set Available=N so by default resource in unavailable. You can set specific availability periods in Intervals panel (Option 1):

Day of From To Qty A week or Date Time Time MONDAY________ 06.00 19.00 999999 Y TUESDAY_______ 06.00 19.00 999999 Y WEDNESDAY_____ 06.00 19.00 999999 Y THURSDAY______ 06.00 19.00 999999 Y FRIDAY________ 06.00 19.00 999999 Y

CICS is active from 6AM to 8PM so you should put the Resource to unavailable status earlier jobs that are using it have some time to end successfully. This kind of Special Resource can be even more useful during planned CICS outages. Let's say that CICS is updated and will be down since 8AM to 11AM. You can simply modify Special Resource in Current Plan (option 5.7):

16/05/10______ 06.00 07.30 999999 Y 16/05/10______ 07.30 11.00 999999 N 16/05/10______ 11.00 20.00 999999 Y

Now all jobs that require the task will wait until CICS is up again. Note that intervals are not updated by Current Plan extend/replan: “You cannot alter intervals that you have already modified in the current plan, the daily planning job never replaces a changed interval with values from the database.” Because of this difficulty sometimes you'll need to change intervals in two places. Special Resource definition in TWS database (option 1.6) and Special Resource already include in Current Plan (option 5.7).

Solution 4

First you need to create jobs in TWS PROCLIB. Enter TWS Controller output in SDSF and look for EQQJBLIB DD statement. JCL Code:

//BPXWAIT1 JOB //STEP1 EXEC PGM=BPXBATCH,PARM='sh sleep 30'

You need to remember that UNIX and Linux systems are case-sensitive so UNIX command must be in lower case. Often ISPF editor automatically converts text to upper case. If that's your case simply issue 'CAPS OFF' command to turn this function off. The fastest way to copy member is 'CREATE' command. It is used from the level of ISPF editor. First you must mark the text you want to copy 'C999' and then issue 'CREATE memname' command:

Command ===> CREATE BPXWAIT2 Scroll ===> CSR ****** ***************************** Top of Data ****************************** C99900 //BPXWAIT1 JOB 000200 //STEP1 EXEC PGM=BPXBATCH,PARM='sh sleep 30' ****** **************************** Bottom of Data ****************************

You can also use '/' and copy it in more traditional manner. Remember to change job names so they match member names, otherwise TWS Operation will end in OSUF error. Now it's time to create Application that will use those jobs:

Row Oper Duration Job name Internal predecessors Morepreds cmd ws no. HH.MM.SS -IntExt- '''' NREP 001 00.00.01 START___ ___ ___ ___ ___ ___ ___ ___ ___ 0 0 '''' CPUM 010 00.01.00 BPXWAIT1 001 ___ ___ ___ ___ ___ ___ ___ 0 0 '''' CPUM 020 00.01.00 BPXWAIT2 001 ___ ___ ___ ___ ___ ___ ___ 0 0 '''' CPUM 030 00.01.00 BPXWAIT3 001 ___ ___ ___ ___ ___ ___ ___ 0 0 '''' NREP 255 00.00.01 END_____ 010 020 030 ___ ___ ___ ___ ___ 0 0

Special Resource assignment (S.3 option in 'Row cmd'):

Special Qty Shr Keep On Avail on Resource Ex Error Complete CICSTS______________________________________ ______ S _ _

Modify Special Resource in 5.7 panel so it becomes available 10 minutes from now. Then add the Application to Current Plan and observe it. At first it will be in “Waiting for special resource” status. When Resource becomes available it should start normally. Note 1: Special resource can be modified in 5.7 panel only when it isn't currently used by any Application. Note 2: Special resource is not added to Current Plan during its extend/replan so it's not visible in 5.7 panel at first. It's added there when Application that uses is added to Current Plan.

Solution 5

The Special Resource represents 1TB of storage space so you can use resource quantity as the representation of the actual space in storage group, for example 1 resource = 1GB:

SPECIAL RESOURCE ===> WORKGRP_____________________________________ TEXT ===> REPRESENTS STORAGE GROUP 'WORKGRP'____________ SPECRES GROUP ID ===> ________ Hiperbatch ===> N DLF object Y or N USED FOR ===> B Planning and control C , P , B or N ON ERROR ===> F_ On error action F , FS , FX , K or blank ON COMPLETE ===> Y On Complete action Y , N , R or blank MAX USAGE LIMIT ===> 0_____ Max number of allocations before usage reset MAX USAGE TYPE ===> R Status change type Y , N or R Defaults QUANTITY ===> 950__ Number available 1-999999 AVAILABLE ===> Y Available Y or N

'ON ERROR' field value depends in this case on how job are using the storage group. In this example let's assume that storage is freed when job abends. In that case 'F' value is appropriate. Storage group has 1024GB but since the point of this resource is to prevent jobs from abends there should be some space left for backup. You must also remember that some jobs may still abend if they'll request too large extends, this additional limit may also prevent from such issues. The difficulty of using resource of this kind is that you need to know much space each job will use. In some cases this is more or less constant value and can be set and maintained manually. Usually environments are much more unstable than that and the best way would be to create an Application that calculates storage needed by particular jobs and then assigns appropriate amount of the Resource to the their Operations.

Solution 6

Below you can see that Resource assignment equal to 246 GB storage space:

Special Qty Shr Keep On Avail on Resource Ex Error Complete WORKGRP_____________________________________ 246___ X _ _

Since the second Application is exactly the same you can simply copy the one you already have. Choose option C(Copy) in 1.4 panel. You have to modify two things: - Application name. - Jobname of each Operation. TWS tracks jobs by their names so when two Applications are using the same job, both Operations will be completed by single job run and second one won't run at all. You can monitor Resource usage from 5.7 panel:

Special A RDM Adjust Used Used W Resource AQD Qty Shared Excl WORKGRP Y NNN 950 0 914 Y

In this example all jobs are using Exclusive access. Note that this panel is not refreshed automatically or by pressing Enter(Ctrl). To refresh data you must reenter the panel. “In use list” shows every Operation that is using the Resource along with allocated Resource quantity:

Actual Start Operation Jobname Est Dur S Qty Type Date Time ws no. HH.MM.SS 16/05/07 20.32 CPUM 010 BPXWAITA 00.01.00 S 223 X 16/05/07 20.32 CPUM 060 BPXWAITF 00.01.00 S 380 X 16/05/07 20.32 CPUM 020 BPXWAITB 00.01.00 S 311 X

“Waiting queue” shows all Operations that are waiting for the Resource availability:

Latest Out Operation Jobname Pri Qty Type Reason Date Time ws no. Wait 16/05/07 08.28 CPUM 010 BPXWAITC 5 153 X TOOFEW 16/05/07 08.28 CPUM 040 BPXWAIT4 5 487 X TOOFEW 16/05/07 08.28 CPUM 020 BPXWAIT2 5 433 X TOOFEW 16/05/07 08.28 CPUM 060 BPXWAITD 5 380 X TOOFEW 16/05/07 08.28 CPUM 050 BPXWAITE 5 945 X TOOFEW 16/05/07 08.28 CPUM 020 BPXWAIT7 5 351 X TOOFEW

Managing Application Execution

Introduction

Applications scheduling can be very complex. Both business and technical requirements must be taken into consideration when planning Application run time and dependencies. In this Assignment you'll learn various ways in which you can control Application flow.

Tasks

1. Create job that does nothing but runs for random amount of time between 30 and 180 seconds. You'll use this job to simulate workload in your Applications. 2. Create three Applications. Each with and least four Operations. Use job created in Task#1. Create following dependencies: - App#1 and App#2 can start at the same time. - Job#3 from App#1 must start only when Job#1 from App#2 is completed. - App#3 must start after Job#3 from App#1 is finished but before Job#4 from App#2 starts. - Job#2 from App#3 can start only when both App#1 and App#2 are completed. - Jobs from App#3 can run at the same time. - Jobs from App#1 and App#2 must run one after another. 3. Add Applications created in Task#2 and test if dependencies are working correctly. 4. Create Application Group for Applications created in Task#2 and add it to Current Plan. 5. Use Application Group created in Task#4: - Schedule App#2 only. - It shouldn't run at specific time but when operator releases it. - Modify it so it could be released in two phases. - First release should allow first two jobs to start. - Second release should free other Operations. Add it to Current Plan and check if your hold/release mechanism works. Repeat this task again, this time for App#3. 6. Use Application Group you've created in Task#4. This time you must change execution order manually. Operations should run in following order: - First two jobs from App#2. - All jobs except Job#3 from App#1. Job#3 shouldn't run at all. - Remaining jobs from App#2. - Entire App#3 except Job#2 and Job#4, these two jobs shouldn't run at all. 7. Create Application that checks if another Application is delayed: - Use REXX or BPXBATCH program to simulate long running Application (App#1). - Check Application will run after it (App#2). - If App#1 ends before App#2, App#2 should also end correctly. - If App#1 has some delay or is in error, App#2 should end in error. 8. Use Applications you've created in Task#7. This time App#2 should: - Write record about App#1 completion to data set (with date and time). Additionally if App#1 is delayed: - Save record about App#1 delay to the same data set. - Send message about the delay to your user ID (ensure you get message even if you're not logged on). - Send the same message to SYSLOG. 9. Imagine that you have Application that executes some non critical jobs. Those jobs are using data sets needed for CICS that must be fully operational at 8AM. - Simulate this Application. Create four Operations that will run for some time. - Create second Application that will run at 7AM. - Second Application should cancel all jobs from the first Application and set them to complete status.

Hint 1

Very similar job was discussed in JCL category. You'll need to use RANDOM REXX function. Check details in “TSO/E REXX Reference” manual.

Hint 3

By default dependencies between Applications are removed when using 5.1 panel. To preserve them you'll need to use “Automatic Dep” option.

Hint 7

You'll need to use EQQEVPGM program. It is described in "Tivoli Workload Scheduler for z/OS: Managing the Workload". You can use OPSTAT control statement to change Operation status.

Hint 8

OPSTAT and SRSTAT TWS commands may be useful here. See "Tivoli Workload Scheduler for z/OS: Managing the Workload" for more details. Also remember that OPSTAT command won't work for Operations in W(Waiting) status. You can send message to user with MVS 'SEND' command. You can send message to SYSLOG with MVS 'LOG' command.

Solution 1

REXX script:

/* REXX */ I = RANDOM(30,180) SAY I ETIME = TIME(R) DO WHILE ETIME < I NOP ETIME = TIME(E) END EXIT

JCL Code:

//JSADEK01 JOB NOTIFY=&SYSUID //STEP1 EXEC PGM=IKJEFT01,REGION=4M //SYSEXEC DD DSN=JSADEK.MY.REXX,DISP=SHR //SYSTSPRT DD SYSOUT=* //SYSTSIN DD * %REXXWAIT

Job uses IKJEFT01 Utility to execute REXX script but first it allocates REXX library to SYSEXEC DD statement. You could omit SYSEXEC DD statement but in such case you'll have to use following command in SYSTIN DD statement: “EXEC 'JSADEK.MY.REXX(REXXWAIT)' EXEC” or “EXEC 'JSADEK.MY.REXX(REXXWAIT)'” Second version requires “/* REXX */” string in first record in the script. Without it system will interpret the script as CLIST.

Solution 2

OPER panel enables you to define up to 8 internal predecessors. If you need to add external predecessors or more than 8 internal ones, you can do that in Operation Details panel via option 1(Predecessors):

Oper Transport time Application id Jobname ws no. HH.MM (for ext pred only) CPUM 020 _____ ________________ REXWAITH NREP 255 _____ TESTAPP3________ ________

First predecessor it the one defined in main OPER panel. There is no Application ID there which means it's internal. Second predecessor is external. To add such predecessor write Application ID or Jobname and press Enter. TWS will search it's database and display all matching Operations. Transport time can be left empty. It defines how much time is allowed between predecessor completion and successor start. App#1 definition:

Oper Duration Job name Internal predecessors Morepreds ws no. HH.MM.SS -IntExt- NREP 001 00.00.01 ________ ___ ___ ___ ___ ___ ___ ___ ___ 0 0 CPUM 010 00.05.00 REXWAITA 001 ___ ___ ___ ___ ___ ___ ___ 0 0 CPUM 020 00.05.00 REXWAITB 010 ___ ___ ___ ___ ___ ___ ___ 0 0 CPUM 030 00.05.00 REXWAITC 020 ___ ___ ___ ___ ___ ___ ___ 0 1 CPUM 040 00.05.00 REXWAITD 030 ___ ___ ___ ___ ___ ___ ___ 0 0 NREP 255 00.00.01 ________ 040 ___ ___ ___ ___ ___ ___ ___ 0 0

Only one external predecessor is defined here as shown in “Morepreds-Ext” column. This is Job#1 from App#2. App#2 definition:

Oper Duration Job name Internal predecessors Morepreds ws no. HH.MM.SS -IntExt- NREP 001 00.00.01 ________ ___ ___ ___ ___ ___ ___ ___ ___ 0 0 CPUM 010 00.05.00 REXWAITG 001 ___ ___ ___ ___ ___ ___ ___ 0 0 CPUM 020 00.05.00 REXWAITH 010 ___ ___ ___ ___ ___ ___ ___ 0 0 CPUM 030 00.05.00 REXWAITI 020 ___ ___ ___ ___ ___ ___ ___ 0 0 CPUM 040 00.05.00 REXWAITJ 030 ___ ___ ___ ___ ___ ___ ___ 0 1 NREP 255 00.00.01 ________ 040 ___ ___ ___ ___ ___ ___ ___ 0 0

According to Task description App#3 must be already started before Job#4 in App#2 could start. First Operation of App#3 is defined as Job#4 predecessor. App#3 definition:

Oper Duration Job name Internal predecessors Morepreds ws no. HH.MM.SS -IntExt- NREP 001 00.00.01 ________ ___ ___ ___ ___ ___ ___ ___ ___ 0 1 CPUM 010 00.05.00 REXWAITS 001 ___ ___ ___ ___ ___ ___ ___ 0 0 CPUM 020 00.05.00 REXWAITT 001 ___ ___ ___ ___ ___ ___ ___ 0 2 CPUM 030 00.05.00 REXWAITU 001 ___ ___ ___ ___ ___ ___ ___ 0 0 CPUM 040 00.05.00 REXWAITV 001 ___ ___ ___ ___ ___ ___ ___ 0 0 NREP 255 00.00.01 ________ 010 020 030 040 ___ ___ ___ ___ 0 0

This is the only App in which jobs can run at the same time so they're not connected with each other. First Operation has Job#3 from App#1 as dependency. Second job have two external predecessors - last Operations from App#1 and App#2. Notice that all three Applications use DUMMY Operation at the beginning and the end. Sometimes they are needed like in App#3. Every Operation must have at least one internal predecessor, so if you want to run all of them at the same time you need to create Dummy operation that connects them. It also makes Application management easier. Suppose you need to remove first or last job in there. In such cases you'd need to remember about “Time Dependent” option and external dependencies. Having DUMMY operation makes such modification faster because you don't have to worry about those things. Overall it's good practice to put DUMMY start/end Operations in each Application that has multiple Operations or external dependencies.

Solution 3

Applications with external dependencies are added in the same way as single Application. The only difference is that you must use “AUTOMATIC DEP” option:

Application : TESTAPP3 Owner : JSADEK Operations : 6 External predecessors : 3 AUTOMATIC DEP ===> Y Automatic resolution of external dependencies, Y P S or N Input arrival: DATE ===> 16/05/09 Date in format YY/MM/DD TIME ===> 23.40 Time in format HH.MM Deadline: DATE ===> 16/05/09 Date in format YY/MM/DD TIME ===> 23.55 Time in format HH.MM VARIABLE TABLE ===> ________________ JCL variable table to be used GROUP DEFINITION ===> ________________ PRIORITY ===> 5 1-9 ERROR CODE ===> ____ If this is a rerun

'AUTOMATIC DEP=Y' means that TWS will try to connect the Application with its external predecessors. You need to add all Applications that way. Note that TWS isn't very intelligent about detecting dependencies. It simply connects all Occurrences in Current Plan:

T Application id Input Operation Jobname St arrival ws no. text P TESTAPP2 09 00.05 CPUM 020 REXWAITG C P TESTAPP2 09 01.00 CPUM 020 REXWAITG W S TESTAPP3 09 01.00 NREP 001 W S TESTAPP3 09 02.40 NREP 001 C S TESTAPP3 09 01.00 CPUM 020 REXWAITT W S TESTAPP3 09 02.40 CPUM 020 REXWAITT C

It's usually not a problem, but it's good to be aware of it.

Solution 4

When you have two or more Applications that usually run together it's a good idea to connect them in Application group. Application Group defines calendar and schedule (Run Cycles/Periods) so you don't have to code them in particular Applications. This may save a lot of time. Let's say that you have 10 Applications that run together. Customer decided to reschedule them two hours later. Without Application Group you'll have to change 10 definitions instead of 1. Groups also simplify Application addition via 5.1 panel. In Task#3 you needed to add three Applications, with Groups they're added simultaneously. Application Group is defined in the same panel as standard Applications:

Application: ID ===> TESTGRP_________ TEXT ===> ________________________ Descriptive text TYPE ===> G A - Application, G - Group definition Owner: ID ===> JSADEK__________ TEXT ===> ________________________ Descriptive text of application owner PRIORITY ===> _ A digit 1 to 9 , 1=low, 8=high, 9=urgent VALID FROM ===> 16/05/09 Date in the format YY/MM/DD STATUS ===> A A - Active, P - Pending AUTHORITY GROUP ID ===> ________ Authorization group ID CALENDAR ID ===> POLISH__________ For calculation of work and free days GROUP DEFINITION ===> ________________ Group definition id SMOOTHING FACTOR ===> ___ LIMIT ===> ___ Deadline Feedback options

'TYPE=G' option indicates that you're creating Group. Operations and Priority is not allowed here but you have to create Run Cycle in which Application Group will run. Each Application that is to be included in the group must have appropriate definition:

Application id : TESTAPP1 Valid from - to : 16/05/08 - 71/12/31 APPLICATION TEXT ===> ________________________ Descriptive text TYPE ===> A A = Application, G = Group definition OWNER ID ===> JSADEK__________ OWNER TEXT ===> ________________________ PRIORITY ===> 5 A digit 1 to 9 , 1=low, 8=high, 9=urgent VALID FROM ===> 16/05/08 Date in the format YY/MM/DD STATUS ===> A A - Active, P - Pending AUTHORITY GROUP ID ===> ________ Authorization group ID CALENDAR ID ===> ________________ For calculation of work and free days GROUP DEFINITION ===> TESTGRP_________ Group definition id SMOOTHING FACTOR ===> ___ LIMIT ===> ___ Deadline Feedback options

There are only three differences between the Groups and standalone Applications: - They cannot contain Run Cycles/Periods. - They cannot use calendar. - They must have defined group name in “GROUP DEFINITION” field. Now you can add your Application group to the Current Plan via 5.1 panel. You can find it by either Group name or the name of specific Application. Issue 'G' command to immediately add the entire Group to the Current Plan. Remember that only in this panel you need to set “AUTOMATIC DEP” option to 'Y':

AUTOMATIC DEP ===> Y Automatic resolution of external dependencies, Y P S G or N IA DATE ===> 16/05/09 Date in format YY/MM/DD IA TIME ===> 08.00 Time in format HH.MM DL DATE ===> 16/05/09 Date in format YY/MM/DD DL TIME ===> 09.00 Time in format HH.MM VARIABLE TABLE ===> ________________ JCL variable table to be used PRIORITY ===> _ 1-9 Cmd Application Description Pty Owner ' TESTAPP1 5 JSADEK ' TESTAPP2 5 JSADEK ' TESTAPP3 5 JSADEK

Applications in App Group can be also added on their own. External dependencies are removed in such case.

Solution 5

Note that Application is not added after you choose it in 5.1 panel. It is added when you leave this panel with PF3. Before that you can modify each Operation in it. To do so enter 'OPER' command. Your goal is to make it ready for manual release. Currently it is time dependent so you need to change that. You can do that in one of two ways: - You can simply change Input Arrival Time to past time. - You can turn off 'Time Dependent' option via Operation Details panel. - The simplest way is from main Operations panel:

Operation Jobname PS Duration Opt Ext Res Stat ws no. text HH.MM.SS S T S/P S R1 R2 N Cu NREP 001 ________________________ ________ 1 00.00.01 Y Y 0 0 _ A CPUM 010 ________________________ REXWAITG 1 00.05.00 Y N 0 0 _ W CPUM 020 ________________________ REXWAITH 1 00.05.00 Y N 0 0 _ W CPUM 030 ________________________ REXWAITI 1 00.05.00 Y N 0 0 _ W CPUM 040 ________________________ REXWAITJ 1 00.05.00 Y N 0 0 _ W NREP 255 ________________________ ________ 1 00.00.01 Y N 0 0 _ W

There are two very useful columns here: - Opt-S – Job Submit – defines if TWS is allowed to submit the job. - Opt-T – Time Dependent – defines if Operation is started at Input Arrival Time. Both options are also available via “Automatic Options” in Operation details. Here you can simply override Time-Dependent option to N and Application will start immediately after it is added to Current Plan. To create two hold/release points you can simply set 'Submit' option to N. So all you need to change are three fields:

Operation Jobname PS Duration Opt Ext Res Stat ws no. text HH.MM.SS S T S/P S R1 R2 N Cu NREP 001 ________________________ ________ 1 00.00.01 Y N 0 0 _ A CPUM 010 ________________________ REXWAITG 1 00.05.00 N N 0 0 _ W CPUM 020 ________________________ REXWAITH 1 00.05.00 Y N 0 0 _ W CPUM 030 ________________________ REXWAITI 1 00.05.00 N N 0 0 _ W CPUM 040 ________________________ REXWAITJ 1 00.05.00 Y N 0 0 _ W NREP 255 ________________________ ________ 1 00.00.01 Y N 0 0 _ W

'Submit' option is turned off for the first and third job so this are points where you'll need to manually release Application. Note that 'Job Submit' option defines if batch job can be started or not so it won't work for DUMMY Operations. If you want to hold Operations that are not batch jobs use 5.3 panel and put them in Manual Hold status (MH command). After addition to Current Plan, the second Operation will be held with “No automatic job submission” status:

Application id Operation Jobname S Input Deadline Latest Crit ws no. arrival start path TESTAPP2 NREP 001 C 09 12.00 09 13.00 09 12.39 N N TESTAPP2 CPUM 010 REXWAITG * 09 12.00 09 13.00 09 12.39 N N TESTAPP2 CPUM 020 REXWAITH W 09 12.00 09 13.00 09 12.44 N N TESTAPP2 CPUM 030 REXWAITI W 09 12.00 09 13.00 09 12.49 N N TESTAPP2 CPUM 040 REXWAITJ W 09 12.00 09 13.00 09 12.54 N N TESTAPP2 NREP 255 W 09 12.00 09 13.00 09 12.59 N N

To release it enter the Application with M(Modify) command and then enter OPER panel. From there change 'Job Submit' option to Y. Wait until first two job ends and check if third Operation is stopped in the same way. Note that before such activities you should always check dependencies between Operations. In this example it works because each Operation is successor of the previous one. But it will fail in case of App#3 where all jobs can run at the same time. In that case you have to turn off Job Submit for all jobs and then release them two at a time:

Operation Jobname PS Duration Opt Ext Res Stat ws no. text HH.MM.SS S T S/P S R1 R2 N Cu NREP 001 ________________________ ________ 1 00.00.01 Y N 0 0 _ A CPUM 010 ________________________ REXWAITS 1 00.05.00 N N 0 0 _ W CPUM 020 ________________________ REXWAITT 1 00.05.00 N N 0 0 _ W CPUM 030 ________________________ REXWAITU 1 00.05.00 N N 0 0 _ W CPUM 040 ________________________ REXWAITV 1 00.05.00 N N 0 0 _ W NREP 255 ________________________ ________ 1 00.00.01 Y N 0 0 _ W

Solution 6

When adding Application Group you cannot modify one of them before they are added to the Current Plan. Because of this you have to either: - Add them with Input Arrival Time set in future and then modify them in Current Plan. - Add them as separate Applications. There are few way you can achieve the goal here. Here is example how you can control Operation flow in this Task: 1. Check if all Applications are Time Dependent. In our example they are but sometimes only first Application in the group could be Time Dependent so other Applications would run after dependency removal. 2. Remove all dependencies. This will simplify further activities. Enter Application with 'M' option and then enter 'DEP' (Resolving external dependencies) panel. 3. Modify App#2: - Turn off 'Submit' option for Job#3. - Set Input Arrival Time to past so Application could start. - Confirm 'Remove from Occurrence Group' dialog. Applications in the Application Group are using the same Run Cycle and Input Arrival Time to change it you must remove the Application from the Group. 4. Modify App#1: - Job#3 must not run. In the same panel you change 'Time Dependent' or 'Job Submit' you can also set Operation status:

Operation Jobname PS Duration Opt Ext Res Stat ws no. text HH.MM.SS S T S/P S R1 R2 N Cu NREP 001 ________________________ ________ 1 00.00.01 Y Y 0 0 _ A CPUM 010 ________________________ REXWAITA 1 00.05.00 Y N 0 0 _ W CPUM 020 ________________________ REXWAITB 1 00.05.00 Y N 0 0 _ W CPUM 030 ________________________ REXWAITC 1 00.05.00 Y N 0 0 _ W CPUM 040 ________________________ REXWAITD 1 00.05.00 Y N 0 0 _ W NREP 255 ________________________ ________ 1 00.00.01 Y N 0 0 _ W

'Stat N' column can be used to change Operation status but we cannot do that just yet. This is because each Operation in App#3 is predecessor to the next one. - First set Job Submit option for Job#3 to 'N'. - Change Input Arrival Time to release the Application. - When first two jobs are Completed enter OPER panel and change status of Job#3 to 'C'. After leaving Modify panels remaining Operations will start. 5. Release other Operations in App#2. - Enter OPER panel again and turn Job Submit option to 'Y'. 6. Modify App#3. - Set status of Job#2 and Job#4 to C. Jobs in App#3 are connected only to DUMMY start and end Operations. Because of this you can complete them independently from each other:

Operation Jobname PS Duration Opt Ext Res Stat ws no. text HH.MM.SS S T S/P S R1 R2 N Cu NREP 001 ________________________ ________ 1 00.00.01 Y Y 0 0 _ C CPUM 010 ________________________ REXWAITS 1 00.05.00 Y N 0 0 _ R CPUM 020 ________________________ REXWAITT 1 00.05.00 Y N 0 0 _ C CPUM 030 ________________________ REXWAITU 1 00.05.00 Y N 0 0 _ R CPUM 040 ________________________ REXWAITV 1 00.05.00 Y N 0 0 _ C NREP 255 ________________________ ________ 1 00.00.01 Y N 0 0 _ W

As you can see here not only Job#2 and Job#4 were put in Completed status but also first DUMMY Operations because it was their predecessor. Change Input Arrival Time to release remaining Operations.

Solution 7

This kind of checks are often done manually, especially for the most critical Applications. Check Application decreases probability of error and can save you up a lot of time. Here is example how you can create such Application. CHECKTESTAPP Operations:

Oper Duration Job name Internal predecessors Morepreds ws no. HH.MM.SS -IntExt- NREP 001 00.00.01 ________ ___ ___ ___ ___ ___ ___ ___ ___ 0 0 CPUM 010 00.00.10 CHKTSTAP 001 ___ ___ ___ ___ ___ ___ ___ 0 1 CPUM 020 00.00.01 CHKDUMMY 001 ___ ___ ___ ___ ___ ___ ___ 0 0 NREP 255 00.00.01 ________ 010 020 ___ ___ ___ ___ ___ ___ 0 0

Check application consists of two jobs. Actually only one because the purpose of CHKDUMMY Operation is to end in error every time it starts. There is no CHKDUMMY job in TWS PROCLIB which means that CHKDUMMY will always end in OSUF error. CHKDUMMY don't have JCL code so it's best to put the description in 'Operator Instruction' panel available via option 7:

**** OPERATION DESCRIPTION **** THIS JOB ENDS IN ERROR IF TESTAPP IS NOT COMPLETED UNTIL 6AM. CHKTSTAP JOB SETS CHKDUMMY OPERATION TO 'C' STATUS WHEN TESTAPP ENDS. **** ERROR HANDLING **** FOR 'OSUF' ERROR: PASS THE ISSUE TO CUSTOMER. FOR ANY OTHER ERROR: CALL APPLICATION OWNER.

CHKTSTAP job issues command that completes CHKDUMMY Operation. It has one predecessor – TESTAPP so if this Application is completed when CHKTSTAP starts and completes the next Operation:

//CHKTSTAP JOB //*********************************************************************/ //* CHKTSTAP COMPLETES CHCDUMMY OPERATION WHEN TESTAPP */ //* APPLICATION IS COMPLETED */ //*********************************************************************/ //COMPLETE EXEC PGM=EQQEVPGM //EQQMLIB DD DSN=SYS1.TWS.SEQQMSG0,DISP=SHR //EQQMLOG DD SYSOUT=* //SYSIN DD * OPSTAT SUBSYS(OPCT) WSNAME(CPUM) JOBNAME(CHKDUMMY) STATUS(C)

OPSTAT control statement is used for changing Operation status. In this case CHKDUMMY status will be changed to C(Completed). SUBSYS value must point to TWS Tracker name and WSNAME to the workstation on which CHKDUMMY runs. In case TESTAPP ends before CHECKTESTAPP: - CHKTSTAP will start. It will set CHKDUMMY status to 'C'. In case TESTAPP ends after CHECKTESTAPP: - CHKTSTAP won't start because TESTAPP is it's predecessor. - CHKDUMMY will end in OSUF error. This will send alert to system operators. - Operator instruction will provide them with information what to do in such situation. - When TESTAPP ends, even after CHKDUMMY error, CHKTSTAP will start and complete CHKDUMMY so system operators will have clear indication that TESTAPP ended.

Solution 8

Application description:

Oper Duration Job name Internal predecessors Morepreds ws no. HH.MM.SS -IntExt- NREP 001 00.00.01 ________ ___ ___ ___ ___ ___ ___ ___ ___ 0 0 CPUM 010 00.00.30 CHKRESOF 001 ___ ___ ___ ___ ___ ___ ___ 0 0 CPUM 020 00.00.30 CHKCPLOP 010 ___ ___ ___ ___ ___ ___ ___ 0 1 CPUM 030 00.00.30 CHKDSCPL 010 ___ ___ ___ ___ ___ ___ ___ 0 1 WAIT 040 00.00.10 ________ 010 ___ ___ ___ ___ ___ ___ ___ 0 0 CPUM 050 00.00.30 CHKRESON 040 ___ ___ ___ ___ ___ ___ ___ 0 0 CPUM 060 00.00.30 CHKCOMMD 010 ___ ___ ___ ___ ___ ___ ___ 0 0 CPUM 070 00.00.30 CHKDSDLY 010 ___ ___ ___ ___ ___ ___ ___ 0 0 NREP 255 00.00.01 ________ 020 030 050 060 070 ___ ___ ___ 0 0

CHKRESOF – turns off Special Resource. By doing it at the beginning we don't have to care about it's original status. CHKCPLOP – completes CHKCOMMD and CHKDSDLY Operations. CHKDSCPL – writes record about TESTAPP completion to data set. WAIT Operation – delay used to ensure that command issued by CHKCPLOP will have enough time to complete. CHKRESON – sets Special Resource to available status which triggers start of two next Operations. CHKCOMMD – send information about TESTAPP delay to SYSLOG and the user. CHKDSDLY – saves record about TESTAPP delay to data set. In Task#7 we didn't used Special Resource so both Operations started at the same time. Even if there was no delay CHKDUMMY ended in error but it was completed immediately so it was not a problem. In this example we cannot do that because we would send invalid data to SYSLOG, user and data set. Because of this issue we need a delay so commands issued by CHKCPLOP have time to end. OPSTAT command doesn't work for Operations in W(Waiting) status so we cannot use dependencies for this purpose. If CHKCOMMD and CHKDSDLY had a predecessor they would be in 'W' status until it ends. This is the reason why Special Resource was used for creating needed delay:

SPECIAL RESOURCE ===> WAIT RES FOR CHECK APPS_____________________ TEXT ===> ______________________________________________ SPECRES GROUP ID ===> ________ Hiperbatch ===> N DLF object Y or N USED FOR ===> C Planning and control C , P , B or N ON ERROR ===> F_ On error action F , FS , FX , K or blank ON COMPLETE ===> Y On Complete action Y , N , R or blank MAX USAGE LIMIT ===> 0_____ Max number of allocations before usage reset MAX USAGE TYPE ===> R Status change type Y , N or R Defaults QUANTITY ===> 1_____ Number available 1-999999 AVAILABLE ===> Y Available Y or N

CHKRESOF:

//CHKRESOF JOB //*********************************************************************/ //* **** DESCRIPTION **** //* JOB MAKES SPEC_RES 'WAIT RES FOR CHECK APPS' UNAVAILABLE //* //* **** ERROR HANDLING **** //* IF IT ENDS IN ANY ERROR: //* - SET 'WAIT RES FOR CHECK APPS' RESOURCE TO UNAVAILABLE STATUS //* - COMPLETE THE JOB //* - SEND E-MAIL WITH ERROR DESCRIPTION TO APPLICATION OWNER //* //*********************************************************************/ //COMPLETE EXEC PGM=EQQEVPGM //EQQMLIB DD DSN=SYS1.TWS.SEQQMSG0,DISP=SHR //EQQMLOG DD SYSOUT=* //SYSIN DD * SRSTAT 'WAIT RES FOR CHECK APPS' SUBSYS(OPCT) AVAIL(NO)

You can use the same program (EQQEVPGM) to change status of any Special Resource. In this case job ensures that 'WAIT RES FOR CHECK APPS' resource is unavailable when other jobs from the Application start. CHKCPLOP:

//CHKCPLOP JOB //*********************************************************************/ //* **** DESCRIPTION **** //* JOB COMPLETES CHKCOMMD AND CHKDSDLY OPERATIONS WHEN //* TESTAPP IS NOT DELAYED //* //* **** ERROR HANDLING **** //* IF IT ENDS IN ANY ERROR: //* - COMPLETE MANUALLY CHKCPOP, CHKCOMMD AND CHKDSDLY OPERATIONS //* - SEND E-MAIL WITH ERROR DESCRIPTION TO APPLICATION OWNER //* //*********************************************************************/ //COMPLETE EXEC PGM=EQQEVPGM //EQQMLIB DD DSN=SYS1.TWS.SEQQMSG0,DISP=SHR //EQQMLOG DD SYSOUT=* //SYSIN DD * OPSTAT SUBSYS(OPCT) WSNAME(CPUM) JOBNAME(CHKCOMMD) STATUS(C) OPSTAT SUBSYS(OPCT) WSNAME(CPUM) JOBNAME(CHKDSDLY) STATUS(C)

CHKDSCPL:

//CHKDSCPL JOB //*********************************************************************/ //* **** DESCRIPTION **** //* JOB SAVES INFO ABOUT TESTAPP COMPLETION TIME TO SYSUT2 DATA SET //* //* **** ERROR HANDLING **** //* IN CASE OF SPACE PROBLEM ON SYSUT2 DATA SET: //* - REMOVE MANUALLY 80% OF THE OLDEST RECORDS //* //* FOR ANY OTHER ERROR: //* - COMPLETE THE OPERATION //* - SEND E-MAIL WITH ERROR DESCRIPTION TO APPLICATION OWNER //* //*********************************************************************/ //*%OPC SCAN //*%OPC SETFORM CDATE=(CCYY.MM.DD) //*%OPC SETFORM CTIME=(HH:MM) //*********************************************************************/ //STEP1 EXEC PGM=IEBGENER //SYSPRINT DD SYSOUT=* //SYSIN DD DUMMY //SYSUT2 DD DSN=USER.TWS.CHECK.TESTAPP,DISP=(MOD,CATLG), // SPACE=(CYL,(1,1)),BLKSIZE=27920,RECFM=FB,LRECL=80 //SYSUT1 DD * &CDATE, &CTIME - TESTAPP COMPLETION

OPC SCAN and SETFORM directives are used to insert current time into SYSUT1 DD statement. SETFORM directive defines display format. CC means century (YYYY would result in 1616 not 2016). There is one thing you should be aware of when it comes to using OPC variables in-stream. You must ensure that Auto-numeration is turned off. Use 'NUM OFF' command to see if numeration is included in data set, for example:

//SYSUT2 DD DSN=USER.TWS.CHECK.TESTAPP,DISP=(MOD,CATLG), 00220007 // SPACE=(CYL,(1,1)),BLKSIZE=27920,RECFM=FB,LRECL=80 00230007 //SYSUT1 DD * 00240007 &CDATE, &CTIME - TESTAPP COMPLETION 00250007

This is not a problem for JCL statements because only 72 columns are read anyway, but in case of in-stream data the entire row is read. So in above example 00250007 is taken as part of SYSUT1 data which may lead to various errors. You can fix this issue by using 'NUM ON' and then 'UNNUM' commands in ISPF Editor. CHKRESON:

//CHKRESON JOB //*********************************************************************/ //* **** DESCRIPTION **** //* JOB MAKES SPEC_RES 'WAIT RES FOR CHECK APPS' AVAILABLE //* //* **** ERROR HANDLING **** //* IF IT ENDS IN ANY ERROR: //* - SET 'WAIT RES FOR CHECK APPS' RESOURCE TO AVAILABLE STATUS //* - COMPLETE THE JOB //* - SEND E-MAIL WITH ERROR DESCRIPTION TO APPLICATION OWNER //* //*********************************************************************/ //COMPLETE EXEC PGM=EQQEVPGM //EQQMLIB DD DSN=SYS1.TWS.SEQQMSG0,DISP=SHR //EQQMLOG DD SYSOUT=* //SYSIN DD * SRSTAT 'WAIT RES FOR CHECK APPS' SUBSYS(OPCT) AVAIL(YES) QUANTITY(1)

CHKCOMMD:

//CHKCOMMD JOB //********************************************************************/ //* **** DESCRIPTION **** //* JOB SENDS INFOR ABOUT TESTAPP DELAY TO SYSLOG AND SPECIFIED USER //* //* **** ERROR HANDLING **** //* IN CASE OF ANY ERROR: //* - COMPLETE THE OPERATION //* - SEND E-MAIL WITH ERROR DESCRIPTION TO APPLICATION OWNER //* //********************************************************************/ //LOGCMD EXEC PGM=SDSF //ISFOUT DD SYSOUT=* //ISFIN DD * /LOG 'TESTAPP DELAYED' //SENDCMD EXEC PGM=SDSF //ISFOUT DD SYSOUT=* //ISFIN DD * /SEND 'TESTAPP DELAYED',USER=(JSADEK),LOGON

As always when it comes to system commands you may need appropriate authorization for TWS user in RACF. To ensure that TSO user receives the message LOGON keyword must be used. With it message will be saved in broadcast data set and user will receive it via his TSO welcome screen at nearest logon. CHKDSDLY:

//CHKDSDLY JOB //*********************************************************************/ //* **** DESCRIPTION **** //* JOB SAVES INFO ABOUT TESTAPP DELAY TO SYSUT2 DATA SET //* //* **** ERROR HANDLING **** //* IN CASE OF SPACE PROBLEM ON SYSUT2 DATA SET: //* - REMOVE MANUALLY 80% OF THE OLDEST RECORDS //* //* FOR ANY OTHER ERROR: //* - COMPLETE THE OPERATION //* - SEND E-MAIL WITH ERROR DESCRIPTION TO APPLICATION OWNER //* //*********************************************************************/ //*%OPC SCAN //*%OPC SETFORM CDATE=(CCYY.MM.DD) //*%OPC SETFORM CTIME=(HH:MM) //*********************************************************************/ //STEP1 EXEC PGM=IEBGENER //SYSPRINT DD SYSOUT=* //SYSIN DD DUMMY //SYSUT2 DD DSN=USER.TWS.CHECK.TESTAPP,DISP=(MOD,CATLG), // SPACE=(CYL,(1,1)),BLKSIZE=27920,RECFM=FB,LRECL=80 //SYSUT1 DD * &CDATE, &CTIME - TESTAPP DELAY

If TESTAPP ends before CHECKTESTAPP: - CHKRESOF job puts Special Resource in unavailable status. - CHKCPLOP completes CHKCOMMD and CHKDSDLY jobs that are currently waiting for Special Resource. - At the same time CHKDSCPL writes info about TESTAPP completion to the data set. - After 10 seconds CHKRESON starts and puts Special Resource in available status which doesn't matter at that point because both CHKCOMMD and CHKDSDLY are already completed. If TESTAPP ends with delay: - CHKRESOF job puts Special Resource in unavailable status. - Both CHKDSCPL and CHKCPLOP wait for TESTAPP completion. - In the meantime CHKRESON starts after 10 seconds and puts Special Resource in available status, which triggers start of CHKCOMMD and CHKDSDLY. - CHKCOMMD and CHKDSDLY send info about delay to SYSLOG, data set and TSO user. - When TESTAPP finally ends CHKCPLOP and CHKDSCPL are started. - CHKCPLOP does nothing because the jobs are already completed. - CHKDSCPL writes info about TESTAPP completion to the data set. Note: In this kind of situation you must always think about storage. In this Task we save very small amount of data per Application (max 2 records). But eventually data set will become full, because of this you should take care of clearing it periodically. For this purpose you can create second Application that will do that or you can simply add specific instructions to JCL. Note 2: In this example all jobs in the Application starts with CHK* prefix. It's good programming practice to use the same prefix for all jobs in the Application. Your installation should also have some job naming convention. For example CHK* - check jobs, DRB* - backups for disaster recovery, RCF* - RACF related jobs etc. With conventions like that you immediately know who's responsible for the job, is it critical issue and what aspect of z/OS system may be affected.

Solution 9

Names used is following solution: - CICSSTATS – Application that must end before 7AM. - CANCELCICSSTATS – Application that cancels CICSSTATS jobs. The structure of CANCELCICSSTATS can be the same as in Task#8:

Oper Duration Job name Internal predecessors Morepreds ws no. HH.MM.SS -IntExt- NREP 001 00.00.01 ________ ___ ___ ___ ___ ___ ___ ___ ___ 0 0 CPUM 010 00.00.30 CHKRESOF 001 ___ ___ ___ ___ ___ ___ ___ 0 0 CPUM 020 00.00.30 STOPCSCO 010 ___ ___ ___ ___ ___ ___ ___ 0 1 WAIT 030 00.00.10 ________ 010 ___ ___ ___ ___ ___ ___ ___ 0 0 CPUM 040 00.00.30 CHKRESON 030 ___ ___ ___ ___ ___ ___ ___ 0 0 CPUM 050 00.00.30 STOPCSCL 010 ___ ___ ___ ___ ___ ___ ___ 0 0 CPUM 060 00.00.30 STOPCSCP 010 ___ ___ ___ ___ ___ ___ ___ 0 0 NREP 255 00.00.01 ________ 020 040 050 060 ___ ___ ___ ___ 0 0

As you can see even the same Special Resource is used. You should be careful when sharing this kind of Resource among Applications. If they are scheduled at the same time they may be unpredictable results. - CHKRESOF – ensures that Special Resource is in unavailable status before other Operations start. - STOPCSCO – completes STOPCSCL and STOPCSCP jobs if CICSSTATS is completed. - CHKRESON – after 10s countdown done by WAIT workstation this job sets Special Resource status to Available. - STOPCSCL – cancels all jobs from CICSSTATS. - STOPCSCP – it runs at the same time as STOPCSCL so Operations in CICSSTATS can be in one of two statuses 'E' (if Cancel command was already executed by STOPCSCL) or 'S' (if Cancel command wasn't executed yet). In both cases Operation status is set to 'C'. Both STOPCSCL and STOPCSCP jobs will be hanged in 'R' status until Special Resource is Available. Since Resource has Quantity=1 both jobs should have shared access if you want to executed them at the same time. STOPCSCO:

//STOPCSCO JOB //*********************************************************************/ //* **** DESCRIPTION **** //* JOB COMPLETES LAST TWO OPERATIONS FROM THE APPLICATION //* //* **** ERROR HANDLING **** //* IF IT ENDS IN ANY ERROR: //* - COMPLETE MANUALLY STOPCSCL AND STOCSCP OPERATIONS //* - SEND E-MAIL WITH ERROR DESCRIPTION TO APPLICATION OWNER //* //*********************************************************************/ //COMPLETE EXEC PGM=EQQEVPGM //EQQMLIB DD DSN=SYS1.TWS.SEQQMSG0,DISP=SHR //EQQMLOG DD SYSOUT=* //SYSIN DD * OPSTAT SUBSYS(OPCT) WSNAME(CPUM) JOBNAME(STOPCSCL) STATUS(C) OPSTAT SUBSYS(OPCT) WSNAME(CPUM) JOBNAME(STOPCSCP) STATUS(C)

STOPCSCL:

//STOPCSCL JOB //********************************************************************/ //* **** DESCRIPTION **** //* JOB CANCELS ALL JOBS FROM CICSSTATS APPLICATION //* //* **** ERROR HANDLING **** //* IN CASE OF ANY ERROR: //* - CANCEL MANUALLY ALL JOBS FROM CICSSTATS APPLICATION //* - COMPLETE THE OPERATION //* - SEND E-MAIL WITH ERROR DESCRIPTION TO APPLICATION OWNER //* //********************************************************************/ //SENDCMD EXEC PGM=SDSF //ISFOUT DD SYSOUT=* //ISFIN DD * /C REXWAITA /C REXWAITB /C REXWAITC /C REXWAITD

STOPCSCP:

//STOPCSCP JOB //*********************************************************************/ //* **** DESCRIPTION **** //* JOB COMPLETES ALL OPERATION FROM CICSSTATS APPLICATION //* //* **** ERROR HANDLING **** //* IF IT ENDS IN ANY ERROR: //* - CANCEL ALL JOBS FROM CICSSTATS APPLICATION (IF NEEDED) //* - COMPLETE THE ENTIRE CICSSTATS APPLICATION //* - COMPLETE THIS OPERATION //* - SEND E-MAIL WITH ERROR DESCRIPTION TO APPLICATION OWNER //* //*********************************************************************/ //COMPLETE EXEC PGM=EQQEVPGM //EQQMLIB DD DSN=SYS1.TWS.SEQQMSG0,DISP=SHR //EQQMLOG DD SYSOUT=* //SYSIN DD * OPSTAT SUBSYS(OPCT) WSNAME(CPUM) JOBNAME(REXWAITA) STATUS(C) OPSTAT SUBSYS(OPCT) WSNAME(CPUM) JOBNAME(REXWAITB) STATUS(C) OPSTAT SUBSYS(OPCT) WSNAME(CPUM) JOBNAME(REXWAITC) STATUS(C) OPSTAT SUBSYS(OPCT) WSNAME(CPUM) JOBNAME(REXWAITD) STATUS(C)

Extending Long Term Plan and Current Plan

Introduction

Long Term Plan contains all applications scheduled for long period of time (usually 1 to 6 months). It is the base on which Current Plan is created. EQQBATCH Utility is used to create, extend and update Long Term Plan. Current Plan is short term (usually 1 to 3 days) plan. CP is the plan that is used for actual workload scheduling, if it's not in CP it won't run. CP is made of Applications scheduled for that period in LTP, Applications from previous CP that hasn't completed yet and any manually added Occurrences.

Tasks

1. Extend Long Term Plan. It should be extended until 15th of the next month. 2. Create two applications: - TWSTRLTP - application runs Trial LTP extend batch job. - TWSEXLTP - application makes actual LTP extend. Create dependency between them so TWSEXLTP will run after TWSTRLTP only if it ends successfully. Schedule both applications so they will run at the 15th day of each month at 16:00. 3. Extend Current Plan so it covers 8 more hours counting from now. 4. Create another two applications: - TWSTRDP - application runs Trial Current Plan extend batch job. - TWSEXDP - application makes actual Current Plan extend. Create dependency between them so TWSEXDP will run after TWSTRDP only if it ends successfully. Schedule both applications so they will run every work days at 08:00. Current Plan should be extended until 10:00 next work day. 5. Applications you've created in previous Tasks are flawed. Their Run Cycles are not connected in the right way. Try to answer following questions: - What problems may appear because of unsynchronized Run Cycles? - Design Run Cycles for each Application that will fix those problems. - Test your solution on paper, study various examples with different dates. After that apply changes to your Applications. 6. In Tasks #2 and #4 you had to modify LTP in order to include new Applications in LTP immediately. Create another application, it has to modify LTP the same way you did via panel 2.2.1. Schedule this application so it will run an hour before Current Plan Extend.

Hint 1

Use "IBM Tivoli Workload Scheduler for z/OS : Managing the Workload" document for guidance. It a good habit to always run Trial extend before real extend is done. This way you'll avoid some problems in TWS scheduling.

Hint 2

Use JCL code from jobs generated by TWS you've used in Task #1. OPC SETVAR directive can be used to create dynamic date substitution at each run. See "Variable substitution" chapter in "IBM Tivoli Workload Scheduler for z/OS : Managing the Workload".

Hint 5

Both CP and LTP should be extended for longer periods of time than that are scheduled. If TWSEXLTP runs every 30 days it must extend LTP more than those 30 days. The same rule applies to CP, there cannot be period which is not cover by both LTP and CP. Current Plan cannot be extended beyond Long Term Plan range.

Solution 1

Job for Trial LTP extension is useful for two purposes: - It will detect any errors during batch job run without any risk to actual Long Term Plan. - It creates report about workload that will be included in LTP. You can use it to check if changes you did in LTP will work as intended. 1. Use option 2.2.4 to generate job for Trial LTP extend. On the first screen you can see date when LTP ends. LTP is always created for the entire 24 hour day so time is not needed here. You can extend LTP to a date or for specific number of days. In this case date is used so Extension Length field should be blank.

Current end : 15/09/20 NEW START DATE ===> 15/09/08 New long term plan start date in format YY/MM/DD NEW END DATE ===> 15/10/15 New long term plan end date in format YY/MM/DD EXTENSION LENGTH ===> ____ DDDD Extend plan by

3. On the second screen you need to fill up only two fields, other are optional. Use Option E(Edit) to see job before submitting it.

SUBMIT/EDIT JOB ===> E S to submit JOB, E to edit Job statement : ===> //JSADEK01 JOB NOTIFY=&SYSUID________________________________________

4. On the next panel you'll be able to modify JCL as needed. If TWS is correctly configured no changes are required here. At the end of the JCL you'll find SYSIN DD statement which contains data you've specified in first panel. Enter "SUB" command to submit batch job. By default report from Trial LTP extend will be stored in userid.twsname.LTTRY.LIST data set. If Trial LTP extend ends with CC=0 you can go proceed to actual LTP extend. 5. Use option 2.2.3 (Extending the Long Term Plan), and proceed the same way as before. After job ends with CC=0 use option 2.4 to check LTP was correctly extended: Long term plan end : 15/10/15

Solution 2

1. First you must copy JCL code from batch job generated by TWS into separate member. Here is the fastest way how to do it: - Enter TWS panel in with JCL Code for LTP Trial extend. - Use following command to copy entire JCL into new member: CREATE 'tws.joblib.name(member)' 2. Copied JCL needs to modified in few places. - Job statement is personalized for specific user, you need to change that:

//TWSTRLTP JOB

- After job statement you need to add SETVAR TWS directive:

//*%OPC SCAN //*%OPC SETVAR TDATE=(CYYMMDD+1MO)

OPC SCAN is a directive which defines that TWS will scan JCL code after it to perform TWS Variable Substitution. OPC SETVAR can do simple operations on numbers, dates and strings. In this case we're simply adding one month to the data on which the job will run. - You need to replace fixed data in SYSIN DD statement of LTPRYS step with variable used in OPC SETVAR directive:

//SYSIN DD * &TDATE

Note that meaning of this parameter depends on columns so make sure you use the right one:

//* YYMMDD = NEW START DATE OR BLANK //* YYMMDD = NEW END DATE OR BLANK

- Data set names where TWS will store report about Trial LTP extend also needs to be changed. They should be reference in three places:

//OLDLIST DD DSN=JSADEK.TWSC.LTTRY.LIST, ... //NEWLIST DD DSN=JSADEK.TWSC.LTTRY.LIST, ... //LTREPORT DD DSN=JSADEK.TWSC.LTTRY.LIST,DISP=SHR,

It's best to store it under the same HLQ that other TWS data sets use. 3. Do the same thing with batch job for actual LTP extend. Note that parameters passed in SYSIN DD statement of LTEXTEND have slightly different column definition. 4. Now that you have both jobs in TWS library you can define Application for each of them. You could execute both jobs in one Application but separate Applications give you more flexibility. For example you would probably like to run Trial CP extend and hour or two before actual extend to have some time to fix a problem if such appears.

LTP extend runs every 15th day of month no matter if its Free or not: Name of rg/ In Out of Row period/rule Input Deadline F day effect Effect Variable table cmd HH.MM day HH.MM Type rule YY/MM/DD YY/MM/DD '''' HALFMNTH 16.00 _0 16.15 R 3 15/09/09 71/12/31 ________________

--- Frequency --- --- Day --- --- Cycle Specification --- ------------------------------------------------------------------------------- S Only ! S Day ! _ Week _ January _ July _ Every ! _ Free day ! S Month _ February _ August ! _ Work day ! _ Year _ March _ September _ First _ Last ! _ Monday ! _ April _ October _ Second _ 2nd Last ! _ Tuesday ! _ May _ November _ Third _ 3rd Last ! _ Wednesday ! _ June _ December _ Fourth _ 4th Last ! _ Thursday ! Week number __ __ __ __ __ __ _ Fifth _ 5th Last ! _ Friday ! Period/RG ________ ________ 015 ___ ___ ___ ! _ Saturday ! name ________ ________ ___ ___ ___ ___ ! _ Sunday ! ___ ___ ___ ___ ! ! Shift default origin by ___ days

Use GENDAYS command to check difference between 'Only' and 'Every' option. 'Only' means "Run App only at 15th day of month" while Every option means "Run App every 15 days in month, so 1st and 16th of each month. After the end of a month Cycle goes from the beginning, when you'll change Month to Year you'll see that now Cycle isn't restarted each month and days vary in each month. 5. Make sure to define TWSTRLTP as the external dependency of TWSEXLTP. Enter panel for modification first Operation in TWSEXLTP and select option 1(Predecessors):

Dependency Oper Transport time Application id Jobname Resl Mand ws no. HH.MM (for ext pred only) C N NREP 255 _____ TWSTRLTP________ ________

Enter Application id and confirm your choice. Next screen will appear on which you have to select predecessor Operation from TWSTRLTP. In case of external dependencies almost always last Operation is used as predecessor. 6. Update LTP to include your Applications in it. Note that when adding them manually (via 5.1 panel) dependency between them won't be retained. For this reason use option 2.2.3(Extend LTP) if current LTP does not cover closest 15th day of a month, or option 2.2.2(Modify LTP for one App) if LTP covers 15th day of this or next month. 7. Verify that your Applications works during closest LTP extension.

Solution 3

Use option 3.3 to submit Trial Current Plan extent at first. On this panel you'll see when Current Plan was created and when it ends:

Current plan created : 15/09/10 02.30 Current plan ends : 15/09/11 03.00 For trial replan, only report selection indicators required For future period : START DATE ===> ________ Format YY/MM/DD TIME ===> _____ Format HH.MM END DATE ===> 15/09/11 Format YY/MM/DD TIME ===> 11.00 Format HH.MM For extend/future: In effect if no end date above EXTENSION LENGTH ===> _____ HHHMM TYPE ===> A A - includes all days W - includes only work days

You want to extend it only for 8 more hours, until 11.00 AM in this case. You can also use 'Extension Length = 00800'. Note that all times in TWS are in 24h format. Current Plan already exists so you can leave start date and time fields blank. On the next screen use default values. After that Procedure is very similar to running trial job for Long Term Plan extend. After trial job ends with CC=0 run batch job for normal Current Plan extend via option 3.2. Verify if Current Plan was extended in option 6.6:

Current plan created : 15/09/10 02.30 Planning period end : 15/09/11 11.00

Solution 4

The procedure is similar to the one used in Task#2 where you've create Applications for LTP extension. 1. Copy JCL for trial and actual Current Plan extend generated by TWS into TWS Joblib. 2. Modify JCL Code in both jobs: - Jobcard. - Data set names where report about Current Plan extend will be stored. Search by your User ID places where it is used in JCL code. Use the same convention as you did during Long Term Plan extend - replace userid.twsname.DPEXT.LIST with OPC.twsname.DPEXT.LIST. - Add OPC SCAN directive after job statement:

//*%OPC SCAN //*%OPC SETVAR TVAR=(CYYMMDD+1WD)

- Add symbolic variable in SYSIN DD statement of EQQDTTOP(TWSTRDP) or DNTOP(TWSEXDP) step in place of date. Note that by adding one WD(Work Day) TWS will calculate date for the closest work day. If TWSEXDP will run at Friday TWS will add to current date three days (until Monday).

//SYSIN DD * &TVAR.1000N11101010NNNN

Current Plan needs to be always extended until 10:00 so you can leave this value fixed in JCL. Note that in this case symbolic variable value is followed immediately by more parameters, in such case we must use delimiter '.'. 3. Create Application for each of these jobs. Remember that TWSTRDP Application must be predecessor of TWSEXDP Application.

Name of rg/ In Out of period/rule Input Deadline F day effect Effect Variable table HH.MM day HH.MM Type rule YY/MM/DD YY/MM/DD WORKDAYS 08.00 _0 08.10 R E 15/09/12 71/12/31 ________________

Applications are scheduled at 08.00, Current Plan is extended until 10 so there will be 2 hours to fix possible errors.

--- Frequency --- --- Day --- --- Cycle Specification --- ------------------------------------------------------------------------------- _ Only ! _ Day ! S Week _ January _ July S Every ! _ Free day ! _ Month _ February _ August ! S Work day ! _ Year _ March _ September _ First _ Last ! _ Monday ! _ April _ October _ Second _ 2nd Last ! _ Tuesday ! _ May _ November _ Third _ 3rd Last ! _ Wednesday ! _ June _ December _ Fourth _ 4th Last ! _ Thursday ! Week number __ __ __ __ __ __ _ Fifth _ 5th Last ! _ Friday ! Period/RG ________ ________ ___ ___ ___ ___ ! _ Saturday ! name ________ ________ ___ ___ ___ ___ ! _ Sunday ! ___ ___ ___ ___ ! ! Shift default origin by ___ days

Applications must run every work day so it doesn't matter if you select Week, Month or Year here. 4. Remember to create external dependency between TWSTRDP and TWSEXDP Applications. You can view it in OPER panel:

Oper Duration Job name Internal predecessors Morepreds No.of ws no. HH.MM.SS -IntExt- Conds NREP 001 00.00.01 ________ ___ ___ ___ ___ ___ ___ ___ 0 1 0 CPUJ 010 00.05.00 TWSEXDP_ 001 ___ ___ ___ ___ ___ ___ 0 0 0 NREP 255 00.00.01 ________ 010 ___ ___ ___ ___ ___ ___ 0 0 0

On this screen you can see that first Operation have defined one external predecessor – (Morepreds-Ext=1). 5. Add your Applications to Long Term Plan, both of them have defined Run Cycles so you can update LTP via option 2.2.1 (Modify Long Term Plan for all Applications). 6. Add your Applications to Current Plan. Make sure they will run at the day when Current Plan ends. If TWSEXDP will try to extend Current Plan until moment in which Current Plan is still valid, it will end in error. You have scheduled jobs that will automatically extend both Long Term and Current Plan. It is all that is needed for continuous TWS work.

Solution 5

TWSEXDP is scheduled at 8:00 while TWSEXLTP at 16:00. So at 15th day every month Current Plan needs to be extended until 10:00 the next day but LTP ends at midnight. TWSEXDP cannot extend CP beyond LTP, this issue will cause error every month. Rescheduling TWSEXLTP to 6:00 won't be enough in this case consider another situation: TWSEXLTP runs at 15th day of each month, while TWSEXDP runs at every work day. Error will appear when 15th day of month will be also a free day. In such case TWSEXDP will try to extend Current Plan to next working day - a day after Long Term Plan end. TWSEXDP job will end with following error: PERIOD 'date' 'hour' - 'date' 'hour' OUTSIDE LONG TERM PLAN Example: At 13.11.2015 (Friday) TWSEXDP job will run. It will try to extend Current Plan for next work day so until Monday 16.11.2015, but Long Term Plan ends on Sunday 15.11.2015. TWSEXDP will end in error describes above. Temporary fix for such problem is to extend LTP manually. - Check if job for LTP Extend is scheduled. In this example it is scheduled in LTP but not in CP so it won't actually run. - First you'll need to manually extend LTP to date used in TWSEXDP job as Current Plan end. In our case it will be Monday 16.11.2015. You can either use panel 2.2.3 or schedule TWSEXLTP Application. - After job ends with CC=0 verify if LTP extended to specified date. - Now you can restart Operation from TWSEXDP, it should end fine now. - Verify if there won't be further conflict between TWSEXLTP and TWSEXDP. Check if TWSEXLTP is scheduled before next TWSEXDP. In this example TWSEXLTP should run 15.09.2015 at 16:00 TWSEXDP 16.09.2015 at 8:00. Permanent fix description: As you can see scheduling can be quite tricky thing but remember that both LTP and CP can be extended for longer period than it is scheduled. In this example TWSEXDP runs every 24 hours but extends CP for 26 hours. If you do the same thing with LTP error described above will be fixed. TWSEXLTP is scheduled every month, simply modify TWSEXLTP job so it will extend LTP not for exactly one month but for 40 days or simply two months. This is simplest way to avoid this problem and it is used on many production systems. Another advantage of this solution is that in case TWSTRLTP will end in serious error there is entire month for fixing it.

Solution 6

Procedure is similar to Task#2 and Task#4: - Copy JCL from panel 2.2.1 into TWS Joblib. - Modify JOB statement - Change names of the data sets that store report from LTP update. - Create Application TWSMODAL. - Set Run Cycle to every work day at 7:00 so it will run an hour before TWSEXDP.

Name of rg/ In Out of period/rule Input Deadline F day effect Effect Variable table HH.MM day HH.MM Type rule YY/MM/DD YY/MM/DD WORKDAYS 07.00 _0 07.10 R E 15/09/22 71/12/31 ________________

- Create Operation in the same manner as before. Remember to set 'Time Dependent=Y' option for the first operation.

Oper Duration Job name Internal predecessors Morepreds No.of ws no. HH.MM.SS -IntExt- Conds NREP 001 00.00.01 ________ ___ ___ ___ ___ ___ ___ ___ 0 0 0 CPUJ 010 00.10.00 TWSMODAL 001 ___ ___ ___ ___ ___ ___ 0 0 0 NREP 255 00.00.01 ________ 010 ___ ___ ___ ___ ___ ___ 0 0 0

- Use panel 2.2.2 (Modify LTP for one Application) to include TWSMODAL in LTP. It will be added to Current Plan during it's next extend. With TWSMODAL application any changes to you'll made in TWS Database will be automatically included in LTP each morning and an hour later – also in CP. This was the goal. In case you'll need to update LTP immediately, we can schedule TWSMODAL manually. Note: After you have all those application created, it is better to use them instead of TWS panels. TWS configuration may change over time and often changes are not included in TWS setting, but they always are present in those jobs. Another reason is that report from LTP or CP extend uses TWS HLQ which means that users that don't have access to view your data sets will be able to view the report.

Performing TWS(OPC) Audit

Introduction

TWS stores detailed information about job execution in data set called Tracklog. This information can be very useful for audit purposes. You can find there information about each action performed in TWS, which user changed Application occurrence, who added Application via 5.1 panel etc. Who restarted particular Operation or completed it. Tracklogs are stored in compressed format, to view them you need to convert it to user readable format. This is what TWS Audit is all about.

Tasks

1. What options you can specify during audit? 2. Find data set names of active and archived tracklogs on your system. 3. Perform Audit. Use archived Tracklog and search for any information related to Application that extends Current Plan. 4. Perform another Audit. This time use active Tracklog and extract all possible data from previous hour. 5. By default archived Tracklog is overwritten at each Current Plan extend. This means that you could only Audit events from current and previous Current Plan period. Use GDG to store 30 last Tracklogs on system.

Hint 1

JCL generated by TWS includes comments with short description of each option available in TWS Audit. Look for SYSIN DD statement of AUDIT step. For more details check "IBM Tivoli Workload Scheduler for z/OS : Managing the Workload".

Hint 2

These files are defined in TWS start procedure and in Audit job generated via panel 10.2. You can use "IBM Tivoli Workload Scheduler for z/OS : Managing the Workload" document to find out more about them.

Hint 5

It is usually done in one of two ways. Tracklog is overwritten by job that extends Current Plan – you could modify it. Second way is to create separate Application that offloads Tracklog to GDG.

Solution 1

Here are comments included in Audit job generated by TWS(AUDIT step, SYSIN DD statement):

THESE ARE THE PARMS YOU CAN PASS ON TO THE EQQAUDIT PROGRAM POS 01-03: 'JTX' or 'TRL' TO DEFINE WHAT INPUT FILES TO USE POS 04-57: STRING TO SEARCH FOR IN INPUT RECORD OR BLANK POS 58-67: FROM_DATE/TIME AS YYMMDDHHMM OR BLANK POS 68-77: TO_DATE/TIME AS YYMMDDHHMM OR BLANK

- JTX - active tracklog will be used. This data set contains data about events that occurred during active Current Plan. - TRL - archived tracklog will be used. This data sets contains archived data from previous Current Plan extends. - STRING – search string. Only records containing this string will be included in Audit output. - FROM_DATE/TIME - only records after this time will be included in Audit output. - TO_DATE/TIME - only records before this time will be included in Audit output.

Solution 2

In JCL generated through panel 10.2 we can see:

//*---------------------------------------------------------------- //* FILE BELOW IS CREATED IN DAILY PLANNING BATCH AND USED IF INPUT //* OPTION IS 'TRL' //EQQTROUT DD DISP=SHR,DSN=OPC.TSTTWS92.TRACKLOG //*---------------------------------------------------------------- //* //*---------------------------------------------------------------- //* FILES BELOW ARE THOSE SPECIFIED IN STC-JCL FOR THE TWSz //* CONTROLLER SUBSYSTEM AND USED IF INPUT OPTION IS 'JTX'. //EQQCKPT DD DISP=SHR,DSN=OPC.TSTTWS92.CKPT //EQQJTARC DD DISP=SHR,DSN=OPC.TSTTWS92.JTARC //EQQJT01 DD DISP=SHR,DSN=OPC.TSTTWS92.JT1 //EQQJT02 DD DISP=SHR,DSN=OPC.TSTTWS92.JT2 //EQQJT03 DD DISP=SHR,DSN=OPC.TSTTWS92.JT3 //EQQJT04 DD DISP=SHR,DSN=OPC.TSTTWS92.JT4 //EQQJT05 DD DISP=SHR,DSN=OPC.TSTTWS92.JT5

Let's check active Tracklog first (JTX option). Data sets defined here are cleared during Current Plan extend. The same DD definitions should be present in TWS Controller start up procedure. When you want to Audit events that occurred before present Current Plan you'll need to use archived Tracklogs. EQQTROUT DD statement defines data set to which active Tracklogs are offloaded during CP extend. TWS are not archiving Tracklogs automatically. This is by done by job for Current Plan extend. Check job you've created TWSEXDP for EQQTROUT DD statement:

//* In the EQQTROUT DD CARD it is suggested to leave DISP=OLD //* for the reasons explained in the APAR PN72766. //EQQTROUT DD DISP=OLD,DSN=OPC.TSTTWS92.TRACKLOG

By default Tracklog is archived to data set OPC.TSTTWS92.TRACKLOG in this example. DISP=OLD defines that it is rewritten at each Current Plan extend. Note: You can check OPC.TSTTWS92.TRACKLOG data set details with option S, it is a good example of data set with variable length record:

Organization . . . : PS Record format . . . : VB Record length . . . : 32756 Block size . . . . : 32760

Block size = 32760 = LRECL + Block descriptor field(4B) LRECL = Data + Record descriptor field(4B) So actual record can have up to 32752 bytes. Remember that this is the maximum size of record, in reality each record can have different length.

Solution 3

You can generate JCL for TWS Audit via panel 10.2. AUDITPRT DD statement defines data set in which Audit will be stored. In this example archived Tracklog is used. In such case we need to first verify if in EQQTROUT DD statement points to data set that contain data from needed date. If you're not sure about time we can concatenate many archived Tracklogs. Except that you need to set correct Audit options:

//* POS 01-03: 'JTX' or 'TRL' TO DEFINE WHAT INPUT FILES TO USE //* POS 04-57: STRING TO SEARCH FOR IN INPUT RECORD OR BLANK //* POS 58-67: FROM_DATE/TIME AS YYMMDDHHMM OR BLANK //* POS 68-77: TO_DATE/TIME AS YYMMDDHHMM OR BLANK //*------------------------------------------------------------ //SYSIN DD * TRLTWSTRDP /*

After job completion you can view extracted records. Report consists of three parts: Header Page, Report Page and Summary Page. We're interested in Report Page, in contains records we wanted to extract in readable format. Note: Report crated by TWS Audit is another example of more rare data set format:

Organization . . . : PS Record format . . . : FBA Record length . . . : 133 Block size . . . . : 6650

It has FBA record format which stands for Fixed Blocked with ASA carriage control characters (this is one byte character at the begging of the record that is used for data formatting during print). When browsing this data set you'll notice that ISPF editor displays only 132 columns not 133 (Use COLS command). But when you'll enter the data set with V(View) or E(Edit) option you will be able to see all 133 columns. The first one is ASA character.

**************************************************** 1DATE/TIME OF THIS RUN: 150926 22.38

Most lines have blanks, like the first record above. Blank indicates standard move by one line. 1 means to use channel 1 of the printer. Channels indicates where cursor should start printing data on page.

Solution 4

Audit is done in the same way as in Task#3. You only need to change control statements passed in SYSIN DD statement. You must code data and time in specific columns, see comments for SYSIN DD statement for detailed instructions. Use COLS command to be see column numeration.

//SYSIN DD * JTX 15092507001509250800

Normal JCL code has maximum 72 characters. Record length equals 80 but 8 characters are used for record numeration. NUM option in ISPF editor defines if those 8 character are reserved for numeration. With NUM=ON you can use only 72 columns in JCL code. With NUM=OFF you'll be able to use full 80 columns. JCL code itself still has to end in 71 column (72 is reserved for continuation), but you'll able to use 80 columns for in-stream data or for comments. You need to do it in this example because data passed in SYSIN DD statement uses 77 columns.

Solution 5

There are many ways it can be done. We'll consider two most popular. Both will require GDG so first define GDG base with IDCAMS, we'll use OPC.TSTTWS92.GDG.TRACKLOG data set name:

//JSADEK01 JOB NOTIFY=&SYSUID,MSGLEVEL=(1,1) //STEP1 EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * DEFINE GDG(NAME(OPC.TSTTWS92.GDG.TRACKLOG) - LIMIT(30) - SCRATCH)

Note that instead of GDG you can use date and time to ensure unique data set names. Both methods have their advantages. GDG can automatically remove oldest generation when new one is created while using date and time makes identification of needed data sets easier. The first way is to modify TWSEXDP job so it saves Tracklog to the GDG. First check archived Tracklog to find out what allocation parameters are needed:

Organization . . . : PS Record format . . . : VB Record length . . . : 32756 Block size . . . . : 32760

Modify EQQTROUT DD statement as follows:

//EQQTROUT DD DSN=OPC.TSTTWS92.GDG.TRACKLOG(+1),RECFM=VB,LRECL=32756, // BLKSIZE=32760,SPACE=(CYL,(1,10),RLSE),DISP=(NEW,CATLG)

Note that track-logs are actually archived by two jobs: Current Plan Extend and Current Plan Replan. Replan job is done very rarely so panel 3.1 is normally used for this purpose. When you'll decide to use this solution you have to remember to modify this job in the same you've modified TWSEXDP or you'll have to always Replan Current Plan with custom job instead of the one generated via panel 3.1. This problem may lead to losing some data during CP Replan because of it second method described below is recommended, it does not have this problem. The second solution is to create new Application that will offload Tracklog at specific time. Application will first copy OPC.TSTTWS92.TRACKLOG to GDG data set and then it will clear it. First you need to change OPC.TSTTWS92.TRACKLOG disposition in TWSEXDP data set to MOD. This way TWSEXDP or job for CP Replan won't overwrite archived Tracklog before it is offloaded by the new Application:

//EQQTROUT DD DISP=MOD,DSN=OPC.TSTTWS92.TRACKLOG

JCL code of a job that offloads Tracklog to GDG:

//TWSTLOFF JOB MSGLEVEL=(1,1) //STEP1 EXEC PGM=IEBGENER //SYSPRINT DD SYSOUT=* //SYSIN DD DUMMY //SYSUT1 DD DSN=OPC.TSTTWS92.TRACKLOG,DISP=SHR //SYSUT2 DD DSN=OPC.TSTTWS92.GDG.TRACKLOG(+1),RECFM=VB,LRECL=32756, // BLKSIZE=32760,SPACE=(CYL,(1,10),RLSE),DISP=(NEW,CATLG) //STEP2 EXEC PGM=IEBGENER,COND=(0,NE) //SYSPRINT DD SYSOUT=* //SYSIN DD DUMMY //SYSUT1 DD DUMMY //SYSUT2 DD DSN=OPC.TSTTWS92.TRACKLOG,DISP=OLD

STEP1 - copies data from archived Tracklog to newly created GDG data set. STEP2 - DISP=OLD is used so data set is rewritten from beginning. By using DUMMY data set you ensure that end-of-file character is written to OPC.TSTTWS92.TRACKLOG. Now all you have to is to schedule new application. It should run on the same day that TWSEXDP does. Hour doesn't matter much in this case. No predecessors are needed.

Application: ID ===> TWSTRLOGOFFLOAD_ TEXT ===> Offload of TWS Tracklog_ Descriptive text TYPE ===> A A = Application, G = Group definition Owner: ID ===> JSADEK__________ TEXT ===> ________________________ Descriptive text of application owner PRIORITY ===> 1 A digit 1 to 9 , 1=low, 8=high, 9=urgent VALID FROM ===> 15/10/01 Date in the format YY/MM/DD STATUS ===> A A - Active, P - Pending AUTHORITY GROUP ID ===> ________ Authorization group ID CALENDAR ID ===> ________________ For calculation of work and free days GROUP DEFINITION ===> ________________ Group definition id SMOOTHING FACTOR ===> ___ LIMIT ===> ___ Deadline Feedback options

You can wait for TWSMODAL and TWSEXDP to run and include you Application in Current Plan automatically. If you want to include TWSTRLOGOFFLOAD in Current Plan immediately you'll need to schedule two jobs: TWSMODAL and job for Current Plan Replan via panel 3.1.