Gaou Chrys
Gaou Chrys

Reputation: 11

Get a message during a submitted job

Hello everyone (first thing sorry for my english, it's not my native language),

I have a basic clle program, the purpose is to count the file total size in a library. At the end the programm should send a message with the total size, here is a part of the code


start:                                                                          
         RTVJOBA    USER(&USER)                                              
         DSPOBJD    OBJ(&LIB/*ALL) OBJTYPE(*FILE) +                          
                      OUTPUT(*OUTFILE) OUTFILE(QTEMP/QADSPOBJ)               
                                                                             
         OVRDBF     FILE(QADSPOBJ) TOFILE(QTEMP/QADSPOBJ)                    
         DOWHILE    COND(&LEC)                                               
         rcvf                                                                
         MONMSG     MSGID(CPF0864) EXEC(LEAVE)                               
         chgvar  var(&TOTSIZE) value(&TOTSIZE + &ODOBSZ)                     
         enddo                                                               
                                                                             
       /* SNDPGMMSG msg('Total size of files in library ' -                  
                     !! &lib !< ' is ' !! %char(&TOTSIZE) !! ' bytes.') */   
         SNDMSG     MSG('Total size of files in library ' !! +               
                      &LIB !< ' is ' !! %CHAR(&TOTSIZE) !> ' +               
                      bytes.') TOUSR(&USER)                                  
         return   

When I call the prog everything is ok, I get the message, but if I submit the program using a sbmjob, the job ends normally but no message. I have 2 question:

  1. where does the msg go?
  2. is there a better way to send the message back to the message queue of the user who submitted the batch job?

Merci

Upvotes: 1

Views: 72

Answers (1)

Charles
Charles

Reputation: 23813

You would expect SNDMSG to work, particularly if you are sending it to your own user ID from a batch job being run under your user id.

You would need to use the DSPMSG command to show your messages.

If the batch job isn't running under your user profile, then check to see if the profile it's running under has sufficient authority.

Restrictions:

  • You must have object operational (*OBJOPR) and add (*ADD) authorities for the message queue.
  • You must have use (*USE) authority for the specified message queues and *USE authority for the libraries in which they are located.

You may also want to consider using Send User Message (SNDUSRMSG) as suggested in the docs, "Completion and diagnostic messages"

Upvotes: 1

Related Questions