The AS/400 allows you to send a message to a message queue by using the System Request key with option 5 (Send a message). This can even be done while your workstation is input inhibited--unlike the Attention key program. By using the following program the "Send a message" option can be used to send a command which gets executed by the operating system.
The program EXCMD (1) executes a command which is sent to it from a message queue. After creating the program, enter the commands in 2 or add them to your initial program.
The program EXCMD (Figure 1) executes a command which is sent to it from a message queue. After creating the program, enter the commands in Figure 2 or add them to your initial program.
To enter a command at any time, press the System Request key and enter a "5" followed by a command in single quotes and the parameter "tomsgq(q)". For example:
5 'wrksbmjob *job' tomsgq(q)
If you want to prompt the command put a question mark in front of the command (i.e. ?wrksbmjob). You may also want to use this technique to 'call qcmd' to see and error messages which may be generated.
Robin Klima San Diego, California
TechTalk: Using System Request to Execute a Comma
Figure 1 The EXCMD program
/* The following command must be executed before EXCMD can be + used: + ADDLIBLE LIB(QTEMP) + CRTMSGQ MSGQ(QTEMP/Q) + CHGMSGQ MSGQ(QTEMP/Q) DLVRY(*BREAK) PGM(EXCMD) */ EXCMD: + PGM PARM(&QUE &LIB &KEY) DCL VAR(&QUE) TYPE(*CHAR) LEN(10) DCL VAR(&LIB) TYPE(*CHAR) LEN(10) DCL VAR(&KEY) TYPE(*CHAR) LEN(4) DCL VAR(&CMD) TYPE(*CHAR) LEN(132) MONMSG MSGID(CPF0000) RCVMSG MSGQ(&LIB/&QUE) KEYVAR(&KEY) MSG(&CMD) CALL PGM(QCMDEXC) PARM(&CMD 132) ENDPGM
TechTalk: Using System Request to Execute a Comma
Figure 2 Commands to set up Q message queue
Figure 2 Commands To Set Up Q Message Queue ADDLIBLE LIB(QTEMP) CRTMSGQ MSGQ(QTEMP/Q) CHGMSGQ MSGQ(QTEMP/Q) DLVRY(*BREAK) PGM(EXCMD)
LATEST COMMENTS
MC Press Online