NB Frogs To The Rescue: Using WAPL To Solve Life's Little Problems
NB Frogs To The Rescue: Using WAPL To Solve Life's Little Problems
Variables, Functions,
SENDMAIL, SENDMSG, IF/THEN/ELSE, REXX,
CONSOLE, DISPLAY etc DO/UNTIL/WHILE etc
Post Processing
▪ The key thing to consider is that a batch job must do all of its own checking and set return codes
• There are no processes reading output files looking for problems (though it can be done)
• Only return codes will make a job fail in ordinary circumstances
If you want your job to fail, you MUST set a return code
100 Continue 301 Moved permanently 408 Request timeout 428 Precondition required
101 Switching protocols 302 Found 409 Conflict 429 Too many requests
102 Processing 303 See other 410 Gone 431 Request header fields too big
103 Early hints 304 Not modified 411 Length required 451 Unavailable for legal reasons
2xx Success 305 Use proxy 412 Precondition failed 5xx Server error
200 OK 306 Switch proxy 413 Payload too large 500 Internal server error
201 Created 307 Temporary redirect 414 URI Too long 501 Not implemented
202 Accepted 308 Permanent redirect 415 Unsupported media type 502 Bad Gateway
203 Non-authoritative information 4xx Client error 416 Range not satisfiable 503 Service unavailable
204 No content 400 Bad request 417 Expectation failed 504 Gateway timeout
205 Reset content 401 Unauthorized 418 I’m a teapot 505 HTTP version not supported
206 Partial content 402 Payment required 421 Misdirected request 506 Variant also negotiates
207 Multi-status 403 Forbidden 422 Unprocessable entry 507 Insufficient storage
208 Already reported 404 Not found 423 Locked 508 Loop detected
206 IM used 405 Method not allowed 424 Failed dependency 510 Not extended
3xx Redirect 406 Not acceptable 425 Too Early 511 Network authentication required
300 Multiple choices 407 Proxy authority required 426 Upgrade required
VARSUB SCAN
Find predecessor
SELECT CPOP ADID(!OADID) IA(!OYMD1.!OHHMM.) OPNO(!OOPNO.) OBJECT(THISJB)
VARSET PREDMAX @V(@THISJB-#CPPRE) Get number of predecessors
IF "!PREDMAX" <> 1 THEN DO
DISPLAY "## UNABLE TO IDENTIFY A SINGLE PREDECESSOR"
Assumptions
DISPLAY "## PREDCESSOR COUNT = !PREDMAX."
• WAPL job only has 1 predecessor
EXIT 20 • It is the job to check
END • It is in the same application
VARSET PREDOP @V(@THISJB-CPPRE-1-CPPRENO) Get 1st predecessor
WAPL can clear out the plan for you in a could of steps
//RUNWAPL EXEC EQQYXJPX
//OUTDEL DD DISP=SHR,DSN=MY.DELETE.STMTS
//SYSIN DD * DELETE CPOC ADID('Z2D#PROD') IA('1910280643')
OPTIONS DELETE(D) DEFERRED
The output can then be run into WAPL to delete the occurrences
What if you could stop stuff being planned in the first place
▪ RESET the plan
▪ Set all your applications PENDING
▪ Create you plans, and they’re empty – Yay!
▪ BUT you can’t add PENDING applications to the plan
Dynamic Intervals?
This is a
Work in Progress
Interval Enter the GENDAYS command to display the dates generated by this rule
settings Enter the E command to specify EVERY options
Enter S and user data in the fields below to define a rule
--- Frequency --- --- Day --- --- Cycle Specification ---
Rule once -------------------------------------------------------------------------------
a day _ 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/RG ________ ________
___ ___ ___ ___ | _ Saturday | name ________ ________
___ ___ ___ ___ | _ Sunday |
___ ___ ___ ___ | | Shift default origin by ___ days
-------------------------------------------------------------------------------
00:00 00:05 00:10 00:15 00:20 00:25 00:30 00:35 00:40 00:45 00:50 00:55 01:00
----+----+----+----+----+----+----+----+----+----+----+----+----
00.00 X
00:15 run
00.05 X overruns
00.10 X
00:20 – 00:40 run
00.15 XXXXXXXXXXXXXXXXXXXXX in quick succession
00.20 X
00.25 X
00.30 X
00.35 X
00.40 X
00.45 X
00.50 X
00.55 X
20 Copyright © 2018 HCL Technologies Limited | www.hcltech.com
Dynamic interval scheduling (WAPL)
--------------------------------- OPERATIONS ----------------- Row 1 to 3 of 3
Command ===> Scroll ===> CSR
• Create a single application to run for the first instance (just like in the Fixed method)
• Add a WAPL job/task as the last application
• This will add a new occurrence when this one finishes
• If delays have occurred any backlog will be skipped – new occurrence will wait for next interval
21 Copyright © 2018 HCL Technologies Limited | www.hcltech.com
Simple WAPL resubmit command
---------------------------- OPERATION USER FIELDS ----------- Row 1 to 1 of 1
Command ===> Scroll ===> CSR
• Whilst this doesn’t fill the plan with 288 occurrences all day, by the end of the day there may still be that many
• Though less might be in the plan if backlog gets skipped
• If you only expect 1 file per day you can make the WAPL step only run when a file isn’t found
• Then it could run considerably less occurrences per day
• A new WAPL feature will allow the current occurrence to be restarted for the next interval
• This means only 1 application and only 1 occurrence per day
• You schedule it once, for the 1st instance and it stops restarting itself once it reaches the until time
• This method also skips backlogs when delays occur
• Because of the way it restarts, traditional conditional dependencies cannot be used within it
Business Scenario: To process a file within 5 minutes of it arriving, without restarting every 5 minutes
This way the occurrence will spend most of its time waiting for files
▪ When a timeout occurs, it will restart at the next interval (within 5 minutes)
▪ When a file is found, it will process the file immediately and restart at the next interval (within 5 minutes)
▪ But the large timeout will reduce the likelihood of running 288 times a day
Whilst the process works well running this method via WAPL incurs an overhead
▪ Not much for a few instances
▪ The large amount needed by the customer may not scale well
Where next?
▪ WAPL is a generic tool so does many things to set up its environment
▪ There may be scope to improve performance by making some start-up processes “just in time”
▪ It may also be possible to emulate what we are doing with WAPL in the product directly
Watch this
space
Session NB
https://www.ibm.com/developerworks/community/groups/community/zGlue