Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

iSeries / AS400 FAQ : (Category) Programming : (Category) CL : How can I get information out of a system message?

0
Posted

iSeries / AS400 FAQ : (Category) Programming : (Category) CL : How can I get information out of a system message?

0

Q. In a CL program, what’s the best way to get the job number of a job that was just submitted. This is what we are currently doing… SBMJOB CMD(CALL PGM(program)) RCVMSG MSGTYPE(*LAST) MSG(&RMSG) MSGID(&MID) IF COND(&MID *EQ ‘CPC1221’) THEN(DO) CHGVAR VAR(&JOBNO) VALUE(%SST(&RMSG 5 6)) ENDDO This works fine, but sometimes the message text will be in Spanish and the job number is in a different position. Is there a better way to do it so that it doesn’t matter what language is used???? A. You’re very close! Instead of using the MSG() parameter, use the MSGDTA() parameter. MSGDTA() contains the substitution data, not the “finished” message. Do a DSPMSGC CPC1221, option 1 and you’ll see Job &3/&2/&1 submitted to job queue &4 in library &5. Those ‘&1’, etc. notations are parameter markers. They say that the program sending the message can substitute actual data in those places. Now look at option 2 and you’ll see Field Data Type Length &1 *CHAR 10 &2 *CHAR 10 &3 *CHAR 6 &4 *CHAR 10 &5 *C

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123