× 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.



Donnie,
If I understand you correctly, you want the message(s) returned by the PING
command -

Example:  "Verifying connection to host system WWW.INTSVCS.COM at address
198.104.188.207"

to persist on the screen AFTER your command has finished.  If this
assumption is correct, after using QCMDEXC to execute the PING command, you
need to (in a loop, until all messages received) receive these messages from
the program message queue using the QMHRCVPM API, then use the QMHSNDPM API
to re-send the received message to the *PRV message queue.  In this way they
"bubble up" to the top of the program call stack, thus causing them to
appear on the screen after the command has finished.

Since these two API's function similarly to the RCVMSG and SNDPGMMSG
commands, here is a simple CL program that illustrates this concept
(sorry-no RPGIV examples handy).  This CL example also handles any other
messages like *ESCAPE or *DIAG messages as long as you have the global
MONMSG command coded correctly.

/**************************************************************/
/*
*/
/**************************************************************/
             PGM        PARM(&IPADDRESS)

             DCL        VAR(&IPADDRESS) TYPE(*CHAR) LEN(20)
             DCL        VAR(&FULLJOB) TYPE(*CHAR) LEN(26)
             DCL        VAR(&JOB) TYPE(*CHAR) LEN(10)
             DCL        VAR(&USER) TYPE(*CHAR) LEN(10)
             DCL        VAR(&JOBNBR) TYPE(*CHAR) LEN(6)
             DCL        VAR(&SPLNBR) TYPE(*CHAR) LEN(5)
             DCL        VAR(&ERRORSW) TYPE(*LGL) /* Std err */
             DCL        VAR(&MSGID) TYPE(*CHAR) LEN(7) /* Std err */
             DCL        VAR(&MSGDTA) TYPE(*CHAR) LEN(100) /* Std err */
             DCL        VAR(&MSGF) TYPE(*CHAR) LEN(10) /* Std err */
             DCL        VAR(&MSGFLIB) TYPE(*CHAR) LEN(10) /* Std err */

             MONMSG     MSGID(CPF0000 TCP0000) EXEC(GOTO STDERR1) /* Std err
*/

             PING       RMTSYS(&IPADDRESS)

 STEP01:     RCVMSG     PGMQ(*SAME (*)) MSGTYPE(*INFO) RMV(*YES) +
                          MSGDTA(&MSGDTA) MSGID(&MSGID) MSGF(&MSGF) +
                          MSGFLIB(&MSGFLIB) /* Receive the +
                          Informational messages */

             IF         COND(&MSGID *NE ' ') THEN(DO)
                SNDPGMMSG  MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) +
                             MSGDTA(&MSGDTA) /* Re-send the +
                             informational message to the *PRV message +
                             queue so it will persist on the screen */
                GOTO       CMDLBL(STEP01)
             ENDDO

             GOTO       CMDLBL(STEP99)

 STDERR1:               /* Standard error handling routine */
             IF         COND(&ERRORSW) THEN(SNDPGMMSG MSGID(CPF9999) +
                          MSGF(QCPFMSG) MSGTYPE(*ESCAPE)) /* Func +
                          chk */
             CHGVAR     VAR(&ERRORSW) VALUE('1') /* Set to fail ir +
                          error occurs */

 STDERR2:    RCVMSG     MSGTYPE(*DIAG) MSGDTA(&MSGDTA) MSGID(&MSGID) +
                          MSGF(&MSGF) MSGFLIB(&MSGFLIB)

             IF         COND(&MSGID *EQ '       ') THEN(GOTO +
                          CMDLBL(STDERR3))

             SNDPGMMSG  MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) +
                          MSGDTA(&MSGDTA) MSGTYPE(*DIAG)

             GOTO       CMDLBL(STDERR2) /* Loop back for addl +
                          diagnostics */

 STDERR3:    RCVMSG     MSGTYPE(*EXCP) MSGDTA(&MSGDTA) MSGID(&MSGID) +
                          MSGF(&MSGF) MSGFLIB(&MSGFLIB)

             SNDPGMMSG  MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) +
                          MSGDTA(&MSGDTA) MSGTYPE(*ESCAPE)

 STEP99:     RCLRSC

 STEP999:    ENDPGM

/**********************************************************/
/

Hope this helps,

Steve Landess
Austin, Texas
(512) 423-0935

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.