Ric Can you verify that there is indeed a message to be retrieved? Maybe the proprietary process removed the message? Or maybe there is a subsequent message AFTER the one about the SBMJOB? Do some investigating immediately after the SBMJOB is done. HTH Phil
Unconfigured Ad Widget
Collapse
Getting info from submitted jobs
Collapse
X
-
Getting info from submitted jobs
Hi Phil, Using DSPJOBLOG, I have verified that there is indeed a message to be retrieved. Here are my test programs: Here is a code that works: PGM DCL VAR(&MSGDTA) TYPE(*CHAR) LEN(128) SBMJOB CMD(DSPLIBL OUTPUT(*PRINT)) JOBQ(QS36EVOKE) RCVMSG MSGTYPE(*COMP) RMV(*NO) MSGDTA(&MSGDTA) SNDUSRMSG MSG('Data is' |> &MSGDTA) + MSGTYPE(*INFO) TOMSGQ(*EXT) ENDPGM Here is a code that does not work (&MSGDTA yields nothing): PGM DCL VAR(&MSGDTA) TYPE(*CHAR) LEN(128) CALL PGM(MYPGM) RCVMSG MSGTYPE(*COMP) RMV(*NO) MSGDTA(&MSGDTA) SNDUSRMSG MSG('Data is' |> &MSGDTA) + MSGTYPE(*INFO) TOMSGQ(*EXT) ENDPGM WHERE inside MYPGM PGM SBMJOB CMD(DSPLIBL OUTPUT(*PRINT)) JOBQ(QS36EVOKE) ENDPGM
-
-
Getting info from submitted jobs
As a guess, look at all the parameters of RCVMSG and the default values. I am not at my system so I cannot check it, but I suspect that one of the default parameters is not letting the first program "see" the message caused by the SBMJOB in the second program MYPGM. HTH Phil
Comment
-
-
Getting info from submitted jobs
Phil, When I used DSPJOBLOG and press F4 on the submit-completion message, I get this: Additional Message Information Message ID . . . : CPC1221 Severity . . . . : 00 Message type . . : Completion Date sent . . . : 07/19/01 Time sent . . . . : 11:22:58 Message . . . . : Job 207466/RIC2/QDFTJOBD submitted to job queue QS36EVOKE in library QGPL. I do not think there is any status "READ" or "OLD" anywhere in the message.
Comment
-
-
Getting info from submitted jobs
Phil, When I used DSPJOBLOG and press F4 on the submit-completion message, I get this: Additional Message Information Message ID . . . : CPC1221 Severity . . . . : 00 Message type . . : Completion Date sent . . . : 07/19/01 Time sent . . . . : 11:22:58 Message . . . . : Job 207466/RIC2/QDFTJOBD submitted to job queue QS36EVOKE in library QGPL. I do not think there is any status "READ" or "OLD" anywhere in the message.
Comment
-
-
Getting info from submitted jobs
Ric, The problem is that the submitting program has ended and is therefore no longer in the program stack. Ideally this program would have resent completion messages back up the stack before terminating, and you could then have received the resent message. However, you can't touch the submitting program so you're basically SNAFUed in that direction. As the message is in the job log, however, it is retrievable using the message handling APIs, but this is a non-trivial task. Specifically qmhljobl will list job log messages into a user space. So you can use this API in conjunction with the user space APIs to create the USRSPC and process the list. By the time you've put that little lot into your CL program it will be unrecognisable, so you might want to write an RPG (or any HLL) module to do the API handling. Pass the module the name of the submitting program and have it pass back the submitted job details. I hope someone comes up with a better solution, but that's the best one I've been able to think of so far. :-( Dave...
Comment
-
-
Getting info from submitted jobs
Whenever I need a CL program to extract the job information for a job that it submitted, I would always pair the SBMJOB command with a RCVMSG command like so: SBMJOB CMD(.......)) JOBQ(.......) RCVMSG MSGTYPE(*COMP) RMV(*NO) MSGDTA(&MSGDTA) This has always provided me with the info I need in the &MSGDTA variable. Recently however, I bumped into a road block. I discovered that if the SBMJOB command is nested inside another program, I cannot get the desired job information: CALL PGM(MYPGM) RCVMSG MSGTYPE(*COMP) RMV(*NO) MSGDTA(&MSGDTA) Nothing is returned in &MSGDTA even though the only code in MYPGM is the SBMJOB command. Can anyone help me get the SBMJOB completion message? I cannot embed the RCVMSG command in the MYPGM program because in the actual application I am working on, the submitting-program is a proprietary program object which I am not allowed to alter. Would appreciate any help.
Comment
-
Comment