Upload
voque
View
314
Download
8
Embed Size (px)
Citation preview
And what WAPL can do for your workload
Dean HarrisonNovember 2016
NC - What is WAPL?
Workload Automation Programming Language for z/OS
2
WAPLBatch/STC/TSO
90 commands
Function commands
ADD LISTJOB LISTSTATGETDATES etc
Occurrence commands
RUNIF ALTIF Commands in USRF etc
Current Plan Commands
HOLD RELEASE NOPUNNOP ALTER BIND etc
Data commands (PIF)
LIST SELECT DELETEMODIFY INSERT etc
Programming language
Variables, FunctionsIF/THEN/ELSE REXXDO/UNTIL/WHILE etc
TSO commands
OPSTAT SRSTATWSSTAT OPINFO etc
Batch Loader
ADSTART CLSTART ETTSTART WSSTART etc
Communication
SENDMAIL SENDMSGCONSOLE DISPLAY etc
Areas of use
3
BatchAutomation
DevOps
Communication
Life-CycleManagement
TestAutomation
DynamicBatch
DataAccess
How do I use it? Batch
//RUNWAPL EXEC EQQYXJCL, // SUBSYS=WSMC//REPORT DD SYSOUT=* //SYSIN DD * OPTIONS FIELDSEP(,) OUTPUT CPOPCOM DATA(REPORT) LABEL(NONE) FIELDS(CPOPADI,CPOPWSN,CPOPNO,CPOPJBN,CPOPJES,CPOPST,CPOPERR)LIST CPOPCOM//*
DAILYPLANNING ,NONR,001,ZFIRST , ,C, ,DAILYPLANNING ,CPU1,005,WSMCLTEX,JOB09628,C, ,DAILYPLANNING ,CPU1,010,WSMCCPEX,JOB09630,C, ,DAILYPLANNING ,CPU1,015,WSMCJES2,JOB09629,C, ,DAILYPLANNING ,NONR,255,ZLAST , ,C, ,DAILYPLANNING ,NONR,001,ZFIRST , ,*, ,DAILYPLANNING ,CPU1,005,WSMCLTEX, ,W, ,DAILYPLANNING ,CPU1,010,WSMCCPEX, ,W, ,DAILYPLANNING ,CPU1,015,WSMCJES2, ,W, ,DAILYPLANNING ,NONR,255,ZLAST , ,W, ,
How do I use it? From within an application
---------------------------- OPERATION USER FIELDS ----------- Row 1 to 1 of 1Command ===> Scroll ===> CSR Enter/Change data in the rows, and/or enter any of the following row commands: I(nn) - Insert, R(nn),RR(nn) - Repeat, D(nn),DD - Delete Application : DEMO1 Operation : CMD1 255 Jobname : WSMCDMD1 Row User Field Name User Field Value cmd ----+----1----+----2----+----3----+----4----+----5---- '''' EQQ-SYSIN-01 SRSTAT 'MY.RESOURCE' AVAIL(Y) ******************************* Bottom of data ********************************
Enable a Specialresource without
writing a jobSpecial user
field prefix
Commands runin alphabetical
order
Reusable WAPL task
Allows up to 100 linesEach 54 characters
Use INCLUDE for more
Batch AutomationReducing manual effort from your batch
Embed decisions in your batch Don't be time dependent all the time -
7
---------------------------- OPERATION USER FIELDS ----------- Row 1 to 1 of 1Command ===> Scroll ===> CSR Enter/Change data in the rows, and/or enter any of the following row commands: I(nn) - Insert, R(nn),RR(nn) - Repeat, D(nn),DD - Delete Application : DEMO1 Operation : CMD1 001 Jobname : WSMCDMD1 Row User Field Name User Field Value cmd ----+----1----+----2----+----3----+----4----+----5---- '''' EQQ-SYSIN-01 VARSUB SCAN TABLE(DATACHEK) '''' EQQ-SYSIN-02 IF @(TUE) & ("!DATA" = "Y") THEN'''' EQQ-SYSIN-03 ALTER JOB005 == TIMEDEP(N) ******************************* Bottom of data ********************************
Activates variable
substitution
Points to JCLVariable
Table DATACHEK
Is IA day aTuesday?
Is variableDATA set to Y?
Alter JOB005in this
occurrence
Turn time dependency
off
Dynamic From/Until/Every You don't have to run every time -
8
---------------------------- OPERATION USER FIELDS ----------- Row 1 to 1 of 1Command ===> Scroll ===> CSR Enter/Change data in the rows, and/or enter any of the following row commands: I(nn) - Insert, R(nn),RR(nn) - Repeat, D(nn),DD - Delete Application : DEMO3 Operation : CMD1 255 Jobname : WSMCDMD1 Row User Field Name User Field Value h cmd ----+----1----+----2----+----3----+----4----+----5---- '''' EQQ-SYSIN-01 ADD FROM(1200) UNTIL(1800) EVERY(005)******************************* Bottom of data ********************************
The lastoperation in the
application
Submits theapplication again
within limits
Will skip intervalsif running late
Gap intervalsare anotheralternative
ADD couldbe within IF
clause toend early
Completely dynamic batch Have programs generate applications directly to the Current Plan
9
VARSUB SCAN ADSTART ACTION(SETDEFAULT) ADOP OPNO(005) DURATION(1) ADSTART ACTION(SUBMIT) ADID(DYNAPPL!CHHMM) OWNER(DEAN) GROUP(ADCDMST) ADOP WSID(NONR) OPNO(001) JOBN(ZFIRST) AUTOPRED(PREV) ADOP WSID(CPU1) JOBN(JOB005) ADOP WSID(CPU1) JOBN(JOB010) ADOP WSID(CPU1) JOBN(JOB015) ADOP WSID(CPU1) JOBN(JOB020) ADOP WSID(NONR) OPNO(255) JOBN(ZLAST)
Creates a uniquename to avoid
running out of IA
List of dynamic jobs inserted into
template
Action View Help------------------------------------------------------------------------------ OPERATIONS IN THE CURRENT PLAN Command ===> Scroll ===> CSR View: Compact (EQQMOPRT) Row 57 of 67 >> Row Application ID Operation Input Arrival Dep Cond Dep SXU cmd WS No. Jobname Date Time Suc Pre Suc Pre DYNAPPL0904 NONR 001 ZFIRST 16/10/07 09.04 1 0 0 0 C N DYNAPPL0904 CPU1 005 JOB005 16/10/07 09.04 1 1 0 0 C N DYNAPPL0904 CPU1 010 JOB010 16/10/07 09.04 1 1 0 0 C N DYNAPPL0904 CPU1 015 JOB015 16/10/07 09.04 1 1 0 0 C N DYNAPPL0904 CPU1 020 JOB020 16/10/07 09.04 1 1 0 0 C N DYNAPPL0904 NONR 255 ZLAST 16/10/07 09.04 0 1 0 0 C N
DevOpsGetting more out of IWSz at the development stage
Batch Loader for everything
11
WSSTART WSNAME(CPU1) TYPE(C) REPATTR(A) DESCR('CPU workstation') USAGE(B) DEST(WSMTXCF)
DevOps
CLSTART CALENDAR(DEFAULT) DESCR('Default calendar')CLDAY DAY(MONDAY) STATUS(W) CLDAY DAY(TUESDAY) STATUS(W) CLDAY DAY(WEDNESDAY) STATUS(W) CLDAY DAY(THURSDAY) STATUS(W) CLDAY DAY(FRIDAY) STATUS(W) CLDAY DAY(SATURDAY) STATUS(F)CLDAY DAY(SUNDAY) STATUS(F) PRSTART PERIOD(ONREQ) PRTYPE(N)
DESCR('On request')PRDATE START(010101)
ADSTART ADID(DEMO1) ADVALFROM(161006) AUTHGRP(ADCDMST) OWNER(TWS)ADOP WSID(CMD1) OPNO(001) JOBN(WSMCCMD1) DURATION(1)ADUSF UFNAME(EQQ-SYSIN-01) UFVALUE('SRSTAT ''MY.RESOURCE'' AVAIL(Y)')
SRSTART RESNAME(MY.RESOURCE.DEF)
ETTSTART ETTTYPE(R) ETTNAME(MY.RESOURCE.DEF) ADID(DEMO1) JR(N) DR(N) AS(N)
JCLVSTART JCLVTAB(DATACHEK) OWNER(TWS) JCLVVAR VARNAME(DATA) DEFAULT(N) SETUP(N)
RGSTART RGID(WAPLTEST) IATIME(0000) RGDESCR('Test WAPL check of run cycle group') RGRUN NAME(WEDS) VALFROM(160802) VALTO(711231) DLDAY(0)ADRULE EVERY DAY(WEDNESDAY) WEEK
OISTART ADID(MYAPPL) OPNO(005) DLM(-END-OF-INPUT-TEXT-) If this job fails, run away and pretend you didn't notice -END-OF-INPUT-TEXT-
Life-cycle translation
12
//RUNWAPL EXEC EQQYXJCL, // VER=V920, // SUBSYS=WSLC //OUTBL DD SYSOUT=* //SYSIN DD * OPTIONS SHOWDFLT(N) STRIP(Y) INCLUDE EQQFILE(AD) TRANSLATE AD FILTER(TST*) OVERLAY(PRD*)TRANSLATE JS FILTER(T*) OVERLAY(P*) SELECT AD ADID(TSTLIFECYCLE01)
ADSTART ADID(TSTLIFECYCLE01) ADVALFROM(151029) DESCR('Lifecycle demo') OWNER(TWS) ADOP WSID(NONR) OPNO(001) JOBN(ZFIRST) DURATION(1) ADOP WSID(CPU1) OPNO(005) JOBN(TJOB0005) DURATION(1)ADDEP PREWSID(NONR) PREOPNO(001) ADOP WSID(CPU1) OPNO(010) JOBN(TJOB0010) DURATION(1)ADDEP PREWSID(CPU1) PREOPNO(005) ADOP WSID(CPU1) OPNO(015) JOBN(TJOB0015) DURATION(1)ADDEP PREWSID(CPU1) PREOPNO(010) ADOP WSID(CPU1) OPNO(020) JOBN(TJOB0020) DURATION(1)ADDEP PREWSID(CPU1) PREOPNO(015) ADOP WSID(CPU1) OPNO(025) JOBN(TJOB0025) DURATION(1)ADDEP PREWSID(CPU1) PREOPNO(020) ADOP WSID(NONR) OPNO(255) JOBN(ZLAST) DURATION(1) ADDEP PREWSID(CPU1) PREOPNO(025)
ADSTART ADID(PRDLIFECYCLE01) ADVALFROM(151029) DESCR('Lifecycle demo') OWNER(TWS) ADOP WSID(NONR) OPNO(001) JOBN(ZFIRST) DURATION(1) ADOP WSID(CPU1) OPNO(005) JOBN(PJOB0005) DURATION(1)ADDEP PREWSID(NONR) PREOPNO(001) ADOP WSID(CPU1) OPNO(010) JOBN(PJOB0010) DURATION(1)ADDEP PREWSID(CPU1) PREOPNO(005) ADOP WSID(CPU1) OPNO(015) JOBN(PJOB0015) DURATION(1)ADDEP PREWSID(CPU1) PREOPNO(010) ADOP WSID(CPU1) OPNO(020) JOBN(PJOB0020) DURATION(1)ADDEP PREWSID(CPU1) PREOPNO(015) ADOP WSID(CPU1) OPNO(025) JOBN(PJOB0025) DURATION(1)ADDEP PREWSID(CPU1) PREOPNO(020) ADOP WSID(NONR) OPNO(255) JOBN(ZLAST) DURATION(1) ADDEP PREWSID(CPU1) PREOPNO(025)
TRANSLATEcommand defines
rules
SELECTcommand picksobject to export
TST changed toPRD in application
names
P changed toT at the start of
job names
Job namesbeginning with
Z left unchanged
Packaging all connected objects
13
//RUNWAPL EXEC EQQYXJCL, // VER=V920, // SUBSYS=WSLC //OUTBL DD SYSOUT=* //OUTBL2 DD SYSOUT=* //SYSIN DD * OPTIONS DATA() SHOWDFLT(N) STRIP(Y) EXPAND(Y) INCLUDE EQQFILE(EQQADW,EQQSR,EQQPR,EQQETT) OUTPUT ADCOM LOADER(OUTBL2)
LIST AD ADID(DAILYPLANNING) SELECT(Y)
Turns the expandfeature on
Defines whichobjects to
export
Points AD outputto separate file,as it is writtenfirst, but needs
to be loaded lastPicks the root
obect(s) to expand.
Must use LISTand SELECT(Y)
for expand feature
Send in the clones
14
OPTIONS DBMODE(REPLACE) VARSUB SCAN VARSET PHASE = "T" VARSET BIZ = "BB" ADSTART ADID(!PHASE.!BIZ.#APPL) ADVALFROM(161011) DESCR('DEMO SKELETON') AUTHGRP(!BIZ.USER) OWNER(!BIZ.GROUP) ADOP WSID(NONR) OPNO(001) JOBN(ZFIRST) DESCR('START OF APPLICATION') DURATION(1) ADOP WSID(CPU1) OPNO(005) JOBN(!PHASE.!BIZ.JOB01) DESCR('JOB 01') DURATION(600) ADDEP PREWSID(NONR) PREOPNO(001) ADSR RESOURCE(!BIZ..TABLE01) QUANTITY(1) ADOP WSID(CPU1) OPNO(010) JOBN(!PHASE.!BIZ.JOB02) DESCR('JOB 02') DURATION(1200) ADDEP PREWSID(CPU1) PREOPNO(005) ADSR RESOURCE(!BIZ..TABLE02) USAGE(X) ADOP WSID(NONR) OPNO(255) JOBN(ZLAST) DURATION(1) ADDEP PREWSID(CPU1) PREOPNO(010)
Allow objects to be replaced
Turn on variablesubstitution
Set the variables
Annual maintenance
15
VARSUB SCAN VARDATE = RULE(AFTER) YEAR(+1) VARDATE PH_NEW_YEAR ONLY(1) MONTH(JAN) VARDATE PH_GOOD_FRIDAY BASE(EASTER) OFFSET(2) VARDATE PH_EASTER_MONDAY BASE(!PH_GOOD_FRIDAY) OFFSET(3) OPTIONS DBMODE(UPDATE) CLSTART CALENDAR(DEFAULT) CLDATE DATE(!PH_NEW_YEAR) STATUS(F) DESC("NEW YEAR'S DAY") CLDATE DATE(!PH_GOOD_FRIDAY) STATUS(F) DESC("GOOD FRIDAY") CLDATE DATE(!PH_EASTER_MONDAY) STATUS(F) DESC("EASTER_MONDAY")
Turn on variablesubstitution
Moves weekend datesto nearest weekday after
Set Year to next year
Calculate holiday variables
Special base for Easter
Update NOT Replace
Use the variables
Life-cycle management process
16
IWSzDB
TEST
LMPRepository
TestController
Life-cycle management product
Import Build
WAPL
IWSzDB
ACPT
AcceptanceController
Build
WAPLWAPLWAPL
IWSzDB
PROD
ProductionController
Build
WAPL
RawBLCS
TranslatedBLCS
TranslatedBLCS
Text Edit
UI Edit
Batch Loader Control Statement text format
IWSz VSAM database internal record format
Pre-defining test runs
● In a development environment you probably don't want every run planned
● WAPL can be used to add applications to the plan in a simple wayADD ADID(ADHOC) HOLD(START)
● Or how about a groupADD GROUPDEF(CROSSGROUP)
● Or how about a group and an application combinedADD GROUPDEF(CROSSGROUP)ADD ADID(CROSSGROUPEXTRA)
● All inter-dependencies will be honoured just as if they're planned
● For easy testing developers can keep members to assemble each test run
● These can then be repeated over and over again
17
TEST4 TEST3
TEST2TEST1
CommunicationGetting the IWSz message out
Making simple markers on SYSLOG---------------------------- OPERATION USER FIELDS ----------- Row 1 to 1 of 1Command ===> Scroll ===> CSR Enter/Change data in the rows, and/or enter any of the following row commands: I(nn) - Insert, R(nn),RR(nn) - Repeat, D(nn),DD - Delete Application : DEMO5 Operation : CMD1 255 Jobname : WSMCDMD1 Row User Field Name User Field Value cmd ----+----1----+----2----+----3----+----4----+----5---- '''' EQQ-SYSIN-01 VARSUB SCAN '''' EQQ-SYSIN-02 SENDMSG TEXT(OCC:!OADID !OYMD1 !OHHMM STARTED)******************************* Bottom of data ********************************
Issue messageto SYSLOG
Eye catcher tofind events in
the log
Application IDand IA
14.52.38 STC09822 +OCC:DEMO5 161007 1452 STARTED START1
User ID thatran WAPL
Send an email about an error and carry on
LISTSTAT: LISTSTAT CPOP ADID(TESTAPP1118X) IA(!OYMD1.!OHHMM.) WSNAME(W705) OPNO(005) JOBNAME(OPER0001) POLICY(E=99,S=08,W=02,CX=00,4)
IF @CMD(LISTSTAT.EQ.99) THEN DO SENDMAIL FROM(<[email protected]>) TO([email protected]) SUBJECT(JOB OPER0001 FAILED) TXT(Hello USER, OPER0001 is in error. Error will be cleared) ALTER JOBNAME(OPER0001) STATUS(E) NEW_STATUS(C)END
LISTSTAT checksthe status
POLICY sets thereturn code
Send an email
Mark the job complete
Simple extract of data
//RUNWAPL EXEC EQQYXJCL, // SUBSYS=WSMC//REPORT DD SYSOUT=* //SYSIN DD * OPTIONS FIELDSEP(,) OUTPUT CPOPCOM DATA(REPORT) LABEL(NONE) FIELDS(CPOPADI,CPOPWSN,CPOPNO,CPOPJBN,CPOPJES,CPOPST,CPOPERR)LIST CPOPCOM//*
DAILYPLANNING ,NONR,001,ZFIRST , ,C, ,DAILYPLANNING ,CPU1,005,WSMCLTEX,JOB09628,C, ,DAILYPLANNING ,CPU1,010,WSMCCPEX,JOB09630,C, ,DAILYPLANNING ,CPU1,015,WSMCJES2,JOB09629,C, ,DAILYPLANNING ,NONR,255,ZLAST , ,C, ,DAILYPLANNING ,NONR,001,ZFIRST , ,*, ,DAILYPLANNING ,CPU1,005,WSMCLTEX, ,W, ,DAILYPLANNING ,CPU1,010,WSMCCPEX, ,W, ,DAILYPLANNING ,CPU1,015,WSMCJES2, ,W, ,DAILYPLANNING ,NONR,255,ZLAST , ,W, ,
Create commaseparated file
Write to REPORT DD
statement Suppress record and field
labels
Choose whichfields to use
Putting it all together
//WORKFILE DD DISP=(NEW,DELETE),DSN=&&WORK,// RECFM=FB,LRECL=80,SPACE=(TRK,(75,1))//SYSIN DD *VARSUB SCANFINDIT: FIND JOBNAME(MYJOB*) STATUS(W) DATE(!OYMD1.) WSNAME(ISOP) OBJECT(JOBS) COUNT(0) SAVELIST(TSWLIST)
IF @CMD(FINDIT.EQ.0) THEN DO VARSET MAX = WORDS("!@JOBS-@FILTER") DO IJOB = 1 TO !MAX VARSET OJOB = WORD("!@JOBS-@FILTER","!IJOB.") VARSET JOB = @V(@JOBS!OJOB.-CPOPJBN) VARSET WS = @V(@JOBS!OJOB.-CPOPWSN) VARSET ST = @V(@JOBS!OJOB.-CPOPST) WRITE WORKFILE "!WS. !JOB. !ST. " END CLOSE WORKFILE
SENDMAIL FROM([email protected]) TO([email protected]) SUBJECT(TS* jobs in W status) TXT(The following MYJOB* jobs are in W status. All jobs will now be skipped) TXT( ) TEXTDD(WORKFILE)
NOP USELIST(TSWLIST)END
Find all waiting'MYJOB jobs
for today
Objectvariable
Find out how many
Loop through them all
Get each variable
Write a record to WORKFILE
Send an email
Include the workfile in the email text
Store list for later use
NOP all the jobs
Warning: z/OS 2.2 and Initiators above the line
● WAPL has a problem with z/OS 2.2 and Initiators above the line
● With z/OS 2.2 the way Virtual addresses are calculated has been changed
● The z/OS development team thought this would be an invisible change
● They update the SWAREQ macro, but languages such as REXX use other methods
● A new solution has been identified, watch out for a forthcoming fix
● Until then run WAPL on a job class below the line when using z/OS 2.2
Any questions
https://www.ibm.com/developerworks/community/groups/community/zGlue