Le 28/06/2023 à 00:12, Gary Kuznitz a écrit :
In a CLP I want to show the user if program products are
installed.
I added these to a CLP to display the program products
results to the joblog:
CHKPRDOPT PRDID(5770SS1) OPTION(30)
CHKPRDOPT PRDID(5770SS1) OPTION(33)
CHKPRDOPT PRDID(5733SC1) OPTION(*Base)
CHKPRDOPT PRDID(5733SC1) OPTION(1)
I'd like to find a way to show the results in the joblog to
the user screen.
I thought it might be nice to do it like this:
DSPJOBLOG OUTPUT(*OUTFILE)
OUTFILE(QTEMP/JOBLOG)
CRTMSGQ MSGQ(QTEMP/JOBLOG)
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG)
MSGDTA('ERROR: +
Unable to Setup Environment') +
TOMSGQ(QTEMP/JOBLOG)
DSPMSG MSGQ(QTEMP/JOBLOG) OUTPUT(*)
I'd like to find a way to copy the file QTEMP/JOBLOG to
the Msgq.
An example when using JOBLOG_INFO table function and a QM query:
1- create an SQL QM query, named DSPJOBLOG, with this instruction
(columns to display are up to you)
SELECT MESSAGE_TIMESTAMP, MESSAGE_ID, MESSAGE_TYPE, MESSAGE_SUBTYPE,
TO_PROGRAM, MESSAGE_TEXT
FROM TABLE(QSYS2.JOBLOG_INFO('*'))
WHERE INTERPRET(MESSAGE_KEY AS INTEGER) >= &KEYVAR
2- create an ILE CLP program as follows, replace the CALL commands used
as example by your CHKPRDOPT commands.
/*-------------------------------------------------------------------*/
/* */
/* DSPJOBLOG : display joblog of events when running this program */
/* */
/*-------------------------------------------------------------------*/
PGM
DCL VAR(&KEYVAR) TYPE(*CHAR) LEN(4)
DCL VAR(&KEYVARINT) TYPE(*INT) LEN(8)
DCL VAR(&KEYVARCHAR) TYPE(*CHAR) LEN(8)
DCL VAR(&KEYVARVAL) TYPE(*CHAR) LEN(30)
DCL VAR("E) TYPE(*CHAR) LEN(1) VALUE('''')
/*-------------------------------------------------------------------*/
/* */
/* Send a specific message to mark the beginning of events we want */
/* to display. &KEYVAR will receive the essage key value which we */
/* will use to narrow the job log output. */
/* */
/*-------------------------------------------------------------------*/
SNDPGMMSG TOPGMQ(*SAME) MSGTYPE(*INFO) MSGID(CPI3701) MSGF(QSYS/QCPFMSG) +
MSGDTA('--- This is the beginning of looked at messages ---')
KEYVAR(&KEYVAR)
/*-------------------------------------------------------------------*/
/* */
/* Starting at this point, all messages in the job log will be */
/* displayed in the job log. */
/* You may want to monitor all commands so that the program does not */
/* fail. */
/* */
/*-------------------------------------------------------------------*/
CALL PGM(NOTFOUND)
MONMSG MSGID(CPF0000)
CALL PGM(DONTEXIST)
MONMSG MSGID(CPF0000)
CHGVAR VAR(&KEYVARINT) VALUE(%BIN(&KEYVAR))
CHGVAR VAR(&KEYVARCHAR) VALUE(&KEYVARINT)
CHGVAR VAR(&KEYVARVAL) VALUE("E *TCAT &KEYVARCHAR *TCAT "E)
STRQMQRY QMQRY(DSPJOBLOG) SETVAR((KEYVAR &KEYVARVAL))
ENDPGM
As an Amazon Associate we earn from qualifying purchases.