× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Todd wrote:

>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????

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       *CHAR            10

You can think of the 'field data' as a data structure.  The first 10
characters are &1 (job name), the next 10 are the user, the next 6 the job
number.  ADDMSGD has some explanation of how this works.
http://publib.boulder.ibm.com/pubs/html/as400/v5r1/ic2924/info/cl/addmsgd.ht
m as does the CL Programming book
http://publib.boulder.ibm.com/pubs/html/as400/v5r1/ic2924/books/c4157214.pdf
(chapters 7 and 8)  This question has been added to the FAQ.
  --buck


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 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.