TechTalk: Giving CL Progarms Option to be Sent to

System Administration
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

Program, JOBQ Thyself

If you have ever been frustrated with the need to write two programs in order to JOBQ a program (one to perform the task, another to do a SBMJOB), take heart. The program in 1a submits itself to the JOBQ or runs interactively, depending on the response by the operator.

If you have ever been frustrated with the need to write two programs in order to JOBQ a program (one to perform the task, another to do a SBMJOB), take heart. The program in Figure 1a submits itself to the JOBQ or runs interactively, depending on the response by the operator.

The display file declared in PROG01CL is shown in 1b. When the job is called initially, it is running interactively. If the operator types a Y option to the question, then the program submits this same job to the JOBQ and returns. Now the job is running in BATCH and the TYPE attribute is 0. When tested, the program "knows" it is running in batch and does not present the prompt screen to the operator. Instead, it branches over this and calls program PROG01.

The display file declared in PROG01CL is shown in Figure 1b. When the job is called initially, it is running interactively. If the operator types a Y option to the question, then the program submits this same job to the JOBQ and returns. Now the job is running in BATCH and the TYPE attribute is 0. When tested, the program "knows" it is running in batch and does not present the prompt screen to the operator. Instead, it branches over this and calls program PROG01.

Ted May Jefferson City, Missouri


TechTalk: Giving CL Progarms Option to be Sent to

Figure 1A CL program PROG01CL to JOBQ itself

 Figure 1a: CL Program to JOBQ Itself PROG01CL: PGM DCL VAR(&DSP) TYPE(*CHAR) LEN(10) DCL VAR(&JOBQ) TYPE(*CHAR) LEN(1) DCLF FILE(PROMPT) /* Retrieve job type. If '0', it is running in BATCH */ RTVJOBA TYPE(&JOBQ) IF COND(&JOBQ *EQ '0') THEN(GOTO CMDLBL(CALL)) /* If not, find out if the user wants to JOBQ it */ SNDRCVF IF COND(&ANSWER *EQ 'N') THEN(GOTO CMDLBL(CALL)) SBMJOB CMD(CALL PGM(PROG01CL)) JOB(PROG01) + JOBPTY(5) OUTPTY(5) LOGCLPGM(*NO) RETURN CALL: OVRDBF FILE(FILEA) TOFILE(PAYROLL) CALL PGM(PROG01) ENDPGM 
TechTalk: Giving CL Progarms Option to be Sent to

Figure 1B Display file used by program PROG01CL

 Figure 1b: Display File Used by Program PROG01CL A DSPSIZ(24 80 *DS3) A R JOBQ A BLINK A 6 12'Do you wish to submit this job to - A the JobQ?' A 13 12'Y=Yes, N=No:' A 16 12'Press Enter to continue' A ANSWER 1 B 13 36VALUES('Y' 'N') 
BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$0.00 Raised:
$