|Job Message Queue in AS400|
Job Message Queue
Job Message Queues are used for receiving requests such as commands to be processed and sending messages that are the outcome of the processing requests. The messages are sent to the job requester. Job message queues exist for each job and it's available only up to the lifetime of the Job. Job message queue consists of an external message queue (*EXT) and a set of call stack entry message queues for the OPM program and ILE procedures within that job.
Example for sending a message to the Job(*EXT) Message queue
We can use the SNDPGMMSG command to send messages to the *EXT message queue.
SNDPGMMSG MSG('Hello This is AS400andSQLTricks.com')
Please note that we cannot run this command from the command line. So we will write a simple CL program for the demo.
Start Source Entry Utility (STRSEU) Type choices, press Enter. Source file . . . . . . . . . . SRCFILE > RPGLE Library . . . . . . . . . . . > EASYCLASS1 Source member . . . . . . . . . SRCMBR TEST Source type . . . . . . . . . . TYPE CLLE Text 'description' . . . . . . . TEXT Job Message Queue Demo
Write the source as below:
PGM SNDPGMMSG MSG('Hello This is AS400andSQLTricks.com') ENDPGM
Compile the source using option 14 against the source member or using the CRTBNDCL command. Once the object is created then call the program from the command line as follows:
Parameters or command ===> CALL TEST F3=Exit F4=Prompt F5=Refresh F6=Create F9=Retrieve F10=Command entry F23=More options F24=More keys
The message will be displayed at the bottom row.
Work with Members Using PDM File . . . . . . RPGLE Library . . . . EASYCLASS1 Position to . . . . . Type options, press Enter. 2=Edit 3=Copy 4=Delete 5=Display 6=Print 7=Rename 8=Display description 9=Save 13=Change text 14=Compile 15=Create mo Opt Member Type Text TEST CLLE Parameters or command ===> F3=Exit F4=Prompt F5=Refresh F6=Create F9=Retrieve F10=Command entry F23=More options F24=More ke Hello This is AS400andSQLTricks.com