|
Hi Tim,
> I have a CL, that submits a job, is there any way, to retrieve the job
> number of the submitted job?
When you submit a job it puts a message in your program queue that
contains the submitted job's name/user/number. So, it's relatively easy
to retrieve that message and get the job id from the msgdta. Here's a
sample:
DCL VAR(&MSGDTA) TYPE(*CHAR) LEN(26)
DCL VAR(&JOBNAME) TYPE(*CHAR) LEN(10)
DCL VAR(&JOBUSER) TYPE(*CHAR) LEN(10)
DCL VAR(&JOBNBR) TYPE(*CHAR) LEN(6)
SBMJOB CMD(CALL MYPGM)
RCVMSG MSGTYPE(*LAST) MSGDTA(&MSGDTA)
CHGVAR VAR(&JOBNAME) VALUE(%SST(&MSGDTA 1 10))
CHGVAR VAR(&JOBUSER) VALUE(%SST(&MSGDTA 11 10))
CHGVAR VAR(&JOBNBR) VALUE(%SST(&MSGDTA 21 6))
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.