Return to the CL Tips
Determining whether a job is running Interactive or Batch in CL
In the last issue of the Club Tech Programming Tips Newsletter, I showed an RPG IV solution for determining whether a job is running in
interactive or batch mode. I heard from a couple of readers that I should have pointed out the CL solution, which uses RTVJOBA. Below is
a code snippet, offered by Mark Olson:
PGM DCL VAR(&JOBTYPE) TYPE(*CHAR) LEN(1) RTVJOBA TYPE(&JOBTYPE) IF COND(&JOBTYPE *EQ '0') THEN(GOTO START) /* Interactive Program Section */ SBMJOB CMD(CALL PGM(ITSELFCL)) JOB(SBMITSELF)< SNDPGMMSG MSG('Tell user program Itself Submitted') RETURN START: /* Mainline Batch Program */
If the Job Type is 0, it's running in batch, and if it's 1, it's interactive.
[report a broken link by clicking here]