An important advantage of using KSL is that once a script is created, it can be stored in a member in a library. This enables requests to be submitted in batch mode as often as required (daily, weekly, monthly, and so on), and during off-peak hours not convenient for online requests.
The following example expands the previous script into a more general purpose script.
TYPE '2'
ENTER
TYPE 'DPTT.CTM.SCHEDULE'
CURSOR NEWLINE
TYPE 'APD'
CURSOR NEWLINE
TYPE 'APDP0020'
ENTER
LABEL PRTSCR
*Define a label to which we can later branch from another command (GOTO).
PRINTSCREEN 3 23
CURSOR POS 23 2
*Position the cursor on the last line of the job’s data on the screen.
IFSCREEN ' ' GOTO ENDREPORT
IFSCREEN '======= >' GOTO ENDREPORT
*If the last line of data on the screen is either blank or the end-of-data message, do *not print any more job data.
CURSOR HOME
*Position the cursor on the Command field in the screen.
PF08
*Scroll down one more page.
GOTO PRTSCR
*Go to label PRTSCR and print the screen (loop again).
LABEL ENDREPORT
END
This script is easy to define, but filling in a different library, table name or job name each time you want to print a job scheduling definition is awkward.
It would be much easier if you could supply the library name, table name and job name at the time the script is executed.
Scripts can be defined with special variables (for example, %A1, %A2, described later in this chapter) instead of "hard-coded" values. When activating the script, the values for the special variables can be passed as parameters.
In the following example, special variable %A3 represents the job name, %A2 represents the table name, and %A1 represents the library name. Other features, such as a header for the report produced by this script, are also presented.
HEADERSIZE 5
BOTTOMSIZE 1
HEADERLINE 3 1 'SCHEDULE DEFINITION OF JOB'
HEADERLINE 3 28 '%A3'
HEADERLINE 3 38 'TABLE'
HEADERLINE 3 48 '%A2'
HEADERLINE 3 58 'LIBRARY'
HEADERLINE 3 68 '%A1'
HEADERLINE 4 1 '-------------------------'
HEADERLINE 5
TYPE '2'
ENTER
TYPE '%A1'
CURSOR BTAB
CURSOR NEWLINE
TYPE '%A2'
CURSOR BTAB
CURSOR NEWLINE
TYPE '%A3'
ENTER
LABEL PRTSCR
PRINTSCREEN 3 23
CURSOR POS 23 2
IFSCREEN ' ' GOTO ENDREPORT
IFSCREEN '======= >' GOTO ENDREPORT
CURSOR HOME
PF08
GOTO PRTSCR
LABEL ENDREPORT
PF03
PF03
PF03
RETURN
Assume that the above script is kept in the REPJOB member. You can produce a printout of two jobs from a scheduling library by the following request:
//KSL EXEC IOARKSL
CALLMEM REPJOB DPTT.CTM.SCHEDULE APD APDP0020
CALLMEM REPJOB DPTT.CTM.SCHEDULE APD APDP0035
END
Parent Topic |