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

OUTFILEP - Program to Retrieve information to a OutFile

/*********************************************************************/
/*                                                                   */
/* System............ Utilities                                      */
/* Program........... OUTFILEP - Program to Retrieve information     */
/*                               to a OutFile.                       */
/* Written by........ Sudhakar Ramakrishnan Kunji                    */
/* Date.............. Dec 11th, 2000.                                */
/*                                                                   */
/*                                                                   */
/*                       Program Description?                       */
/*                                                                   */
/* This program prints the information to be retrieved and then      */
/* copies the Spool File to a Database file. and then Deletes the    */
/* Spool File based on the Parameter passed.                         */
/*                                                                   */
/* NOTE: Always issue the command with *PRINT option while using it  */
/*       inside OUTFILE Command.                                     */
/*                                                                   */
/*       If used inside another process, give DLTSPLF as *YES.       */
/*                                                                   */
/*? * * * * * * * * * * Maintenance Log? * * * * * * * * * * * * * */
/* Req#.       Date      Programmer     Modification Reason          */
/*                                                                   */
/* 28823      02/07/01   Krish T        Remove ALWRTVSRC(*NO)        */
/*                                      Compiler Directive.          */
/*                                                                   */
/* 30381     04/15/01    Sud Kunji      Included Notes.              */
/*                                                                   */
/*                                                                   */
/*********************************************************************/
             PGM        PARM(&COMMAND &OUTFILE &MBROPT &RCDLEN +
                          &DLTSPLF)

             DCL        VAR(&COMMAND) TYPE(*CHAR) LEN(3000)
             DCL        VAR(&CMDLEN) TYPE(*DEC) LEN(15 5) VALUE(3000)
             DCL        VAR(&DLTSPLF) TYPE(*LGL) LEN(1)
             DCL        VAR(&FILE) TYPE(*CHAR) LEN(10)
             DCL        VAR(&LIB) TYPE(*CHAR) LEN(10)
             DCL        VAR(&MBROPT) TYPE(*CHAR) LEN(8)
             DCL        VAR(&OUTFILE) TYPE(*CHAR) LEN(20)
             DCL        VAR(&RCDLEN) TYPE(*DEC) LEN(3)


             MONMSG     MSGID(CPF0000 MCH0000) EXEC(GOTO CMDLBL(ERROR))

   /* Break qualified outfile name */
             CHGVAR     VAR(&FILE) VALUE(%SST(&OUTFILE 1 10))
             CHGVAR     VAR(&LIB) VALUE(%SST(&OUTFILE 11 10))

   /* Create outfile if nonexistent */
             CHKOBJ     OBJ(&LIB/&FILE) OBJTYPE(*FILE)
             MONMSG     MSGID(CPF0000) EXEC(DO)
               RCVMSG     PGMQ(*SAME (*)) MSGTYPE(*LAST) WAIT(0) +
                            RMV(*YES)
               CRTPF      FILE(&LIB/&FILE) RCDLEN(&RCDLEN)
             ENDDO

   /* Override printer file, execute command, and copy to outfile */

             OVRPRTF    FILE(*PRTF) HOLD(*YES) SPLFNAME(OUTFILE) +
                          OVRSCOPE(*JOB)
             CALL       PGM(QCMDEXC) PARM(&COMMAND &CMDLEN)
             CPYSPLF    FILE(OUTFILE) TOFILE(&LIB/&FILE) JOB(*) +
                          SPLNBR(*LAST) TOMBR(*FIRST) +
                          MBROPT(&MBROPT) CTLCHAR(*NONE)
             DLTOVR     FILE(*PRTF) LVL(*JOB)

   /* Delete spooled file if so requested */
             IF         COND(&DLTSPLF) THEN(DO)
               DLTSPLF    FILE(OUTFILE) JOB(*) SPLNBR(*LAST)
             ENDDO

             RETURN

 ERROR:      SNDPGMMSG  MSG('Function Check! Error Found in Command')

             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