ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Job information

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Job information

    Hi,
    Please let me know how to get job information (Job number) in below scenario...
    Submitted a job 1 then again submitted another job 2 within first job. How to get 2nd job information just after submitting from 1st job in CLLE.

  • #2
    If you have TAATOOLs you can use RTVJOBSTS.

    Otherwise, I'd have the first program submit itself, retrieve it's job information and then call (rather than submit) the 2nd program.

    Otherwise you'd have to use API qusljob - which will allow you to get what you're after.

    Comment


    • #3
      You could try using RCVMSG command to look back through the joblog for the CPC1221 message (Job x/x/x submitted...) and extract the job details from that.

      Comment


      • #4
        Sure - come up with the easy way... LOL

        Code:
        DCL        VAR(&MSGDTA) TYPE(*CHAR) LEN(255)      
        DCL        VAR(&MSGDTALEN) TYPE(*DEC) LEN(5 0)    
        DCL        VAR(&MSGID) TYPE(*CHAR) LEN(7)         
        DCL        VAR(&JOBNO) TYPE(*CHAR) LEN(6)    
        SBMJOB ...
        DOUNTIL    COND((&MSGDTALEN *EQ 0) *OR (&MSGID *EQ +
                     "CPC1221"))
          RCVMSG     KEYVAR(&KEYVAR) MSGDTA(&MSGDTA) +      
                     MSGDTALEN(&MSGDTALEN) MSGID(&MSGID)    
        ENDDO                                               
        
        CHGVAR     VAR(&JOBNO) VALUE(%SUBSTRING(&MSGDTA 21 6))
        &JOBNO will be the job number.

        Comment


        • Iceberg
          Iceberg commented
          Editing a comment
          What about &keyvar

        • Iceberg
          Iceberg commented
          Editing a comment
          No even with this getting blank, no job information.

        • Rocky
          Rocky commented
          Editing a comment
          &keyvar really shouldn't even be there, it doesn't do anything in regards to the question asked. It's the job number you said you're after. &JOBNO should have that. If not, use debug to step through the program to see where it fails - it works when I run it.
      Working...
      X