News Stay informed about the latest enterprise technology news and product updates.

FNDMSGRC--Command processing program for FNDMSGR

Command processing program for FNDMSGR

 /*                                                                     */
/*  Note:  Change all occurrences of "yourlibrary" with the library    */
/*         name that you will use to store the source member in.       */
/*         This also matches that used in FNDMSGDC.                    */
/*                                                                     */
/********************************************************************/
/*                                                                  */
/* Program Name:                                                    */
/* -------------                                                    */
/* FNDMSGRC  ...Find Message Description -Rebuild List              */
/*                                                                  */
/* Function:                                                        */
/* ---------                                                        */
/* Used to rebuild the source member that contains the list of      */
/*  message descriptions from a message file.                       */
/*                                                                  */
/* Parameters:                                                      */
/* -----------                                                      */
/* (msgffull) Full Message File Name                                */
/*                                                                  */
/*     INPUT - CHAR(20)                                             */
/*        The full name of the message file being rebuild           */
/*          Pos  1 - 10 = Message file name                         */
/*          Pos 11 - 20 = Message file libraryu                     */
/*                                                                  */
/********************************************************************/

             PGM        PARM(&MSGFFULL)

             DCL        VAR(&MSGFFULL) TYPE(*CHAR) LEN(20)
             DCL        VAR(&MSGF) TYPE(*CHAR) LEN(10)
             DCL        VAR(&MSGFLIB) TYPE(*CHAR) LEN(10)
             DCL        VAR(&NEWTEXT) TYPE(*CHAR) LEN(50)

/* Parse out the message file name and library from the input       */
/* parameter                                                        */
             CHGVAR     VAR(&MSGF) VALUE(%SST(&MSGFFULL 01 10))
             CHGVAR     VAR(&MSGFLIB) VALUE(%SST(&MSGFFULL 11 10))

/* Create a listing of all message descriptions in the message file */
             OVRPRTF    FILE(QPMSGD) HOLD(*YES)
             DSPMSGD    RANGE(*FIRST *LAST) MSGF(&MSGFLIB/&MSGF) +
                          DETAIL(*BASIC) FMTTXT(*NO) OUTPUT(*PRINT)

/* Build the text description to use for the source file member.    */
             CHGVAR     VAR(&NEWTEXT) VALUE('1st Level Message Text +
                          For "' || &MSGFLIB |< '/' |< &MSGF |< '"')

/* Create a physical file to hold the spooled file output.          */
             CRTPF      FILE(QTEMP/QTXTSRC160) RCDLEN(160) +
                          TEXT(&NEWTEXT) SIZE(*NOMAX)
             MONMSG     MSGID(CPF9999)

/* Check the source file for a member of the correct name.          */
             CHKOBJ     OBJ(yourlibrary/QTXTSRC160) OBJTYPE(*FILE)
             MONMSG     MSGID(CPF9801) exec(do)
             CRTSRCPF   FILE(yourlibrary/QTXTSRC160) RCDLEN(172) TEXT('1st +
                          level message text')
             ENDDO

             RTVMBRD    FILE(yourlibrary/QTXTSRC160) MBR(&MSGF)
             MONMSG     MSGID(CPF9815) EXEC(DO)
             ADDPFM     FILE(yourlibrary/QTXTSRC160) MBR(&MSGF)
             ENDDO
             CHGPFM     FILE(yourlibrary/QTXTSRC160) MBR(&MSGF) +
                          TEXT(&NEWTEXT)

/* Copy the spooled file output to the work physical file.          */
             CPYSPLF    FILE(QPMSGD) TOFILE(QTEMP/QTXTSRC160) JOB(*) +
                          SPLNBR(*LAST) TOMBR(*FIRST) MBROPT(*REPLACE)
             DLTSPLF    FILE(QPMSGD) JOB(*) SPLNBR(*LAST)

/* Copy the work file's data to the source file.                    */
             CPYF       FROMFILE(QTEMP/QTXTSRC160) +
                          TOFILE(yourlibrary/QTXTSRC160) FROMMBR(*FIRST) +
                          TOMBR(&MSGF) MBROPT(*REPLACE) FMTOPT(*CVTSRC)

/* Now call the RPG program to clean up the output.                 */
             OVRDBF     FILE(SOURCE) TOFILE(yourlibrary/QTXTSRC160) +
                          MBR(&MSGF)
             CALL       PGM(FNDMSGRR)

   ENDPGM
 

Dig Deeper on iSeries programming commands

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

Close