SeanHoppe.com > Cleo Code Samples > CLEO CLP: RCVESXDTA

EXTOL/CLP: RCVESXDTA -- CL copy data received by Extol Secure and import the data into Extol EDI Integrator.

 
		PGM        PARM(&MSGQ &USRD &FPTH &FLNM)

/*Z: CRTCLPGM  LOG(*NO)                                                      */
/*T: Default program to import data from ESX into EEI                        */
/*H: System     : ExtoL EDI Integrator                                       */
/*H: Date       : 04/20/04                                                   */
/*H: (C) Copyright 2004 ExtoL, Inc.                                          */

/*H:  Synopsis:                                                              */
/*H:   This program is used to copy data received by Extol Secure, and       */
/*H:     import the data into Extol EDI Integrator.                          */
/*H:     This program is identified in the EXTESXPRC data area as the        */
/*H:     program to be called when the ESX activity monitor receives         */
/*H:     inbound EDI data and is forwarding to EEI.                          */

/*M: 07/16/04 RLK: Changed CRTPF of file IN to use *NOMAX for member size.   */
/*M: Iss 2992                                                                */

/*M: 04/09/08 SAY: Added file name input parameter                           */
/*M: Iss 1791                                                                */

/*M: &USRD VALUES                                                            */


             DCL        VAR(&MSGQ) TYPE(*CHAR) LEN(20)
             DCL        VAR(&USRD) TYPE(*CHAR) LEN(20)
             DCL        VAR(&FPTH) TYPE(*CHAR) LEN(255)
             DCL        VAR(&FLNM) TYPE(*CHAR) LEN(255)

             DCL        VAR(&MSGQN) TYPE(*CHAR) LEN(10)
             DCL        VAR(&MSGQL) TYPE(*CHAR) LEN(10)

/* NON-EXTOL DEFINED VARIABLES */
             DCL        VAR(&ENVI) TYPE(*CHAR) LEN(10)
             DCL        VAR(&TRNS) TYPE(*CHAR) LEN(1)

/* Standard error routine */
             DCL        VAR(&ERRORSW  ) TYPE(*LGL) /* STDERR */

             MONMSG     MSGID(CPF0000 UEX0000 Y2U0000 RPG0000 +
                          MCH0000) EXEC(GOTO CMDLBL(STDERR1))

             CHGVAR     VAR(&MSGQN) VALUE(%SST(&MSGQ 1 10))
             CHGVAR     VAR(&MSGQL) VALUE(%SST(&MSGQ 11 10))

/* If necessary, check user defined data in &USRD to determine what      */
/*   process to perform or which EEI system to forward data to.          */
             CHGVAR     VAR(&ENVI) VALUE(%SST(&USRD 1 10))
             CHGVAR     VAR(&TRNS) VALUE(%SST(&USRD 11 1))



/* Issue 2992 - Change member size to *NOMAX           */
             CLRPFM     FILE(QTEMP/IN)
             MONMSG     MSGID(CPF3142) EXEC(CRTPF FILE(QTEMP/IN) +
                          RCDLEN(256) SIZE(*NOMAX))

/* Copy the data to QTEMP */
             CPYFRMSTMF FROMSTMF(&FPTH) +
                          TOMBR('/QSYS.LIB/QTEMP.LIB/IN.FILE/IN.MBR') +
                          MBROPT(*ADD) CVTDTA(*AUTO) +
                          STMFCODPAG(*STMF) DBFCCSID(*FILE) +
                          ENDLINFMT(*FIXED) TABEXPN(*NO)
             MONMSG     MSGID(CPFA095 CPFA096) EXEC(DO)
               SNDPGMMSG  MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('An +
                            error occurred while copying data from +
                            stream file' |> &FPTH |< '.  The file was +
                            received from ESX.  User data from ESX +
                            is' |> &USRD || '.') +
                            TOMSGQ(&MSGQL/&MSGQN) MSGTYPE(*ESCAPE)
             ENDDO

/* Create the connection and submit the translation */
/* Check &TRNS variable. If '0' then TRANSLATE(*IMMED)                     */
/* If '1' then TRANSLATE(*NO)                                              */
             IF         COND(&TRNS = '0') THEN(DO)
             CRTCNNIMP  FILE(QTEMP/IN) MBR(IN) TRANSLATE(*SUBMIT) +
                          NETPORT(IN) SCRIPT(INBOUNDAS2) +
                          SCRIPTPARM('') NETID(*ESX) +
                          IMPORTSCR(*NONE)
             ENDDO

             IF         COND(&TRNS = '1') THEN(DO)
             CRTCNNIMP  FILE(QTEMP/IN) MBR(IN) TRANSLATE(*NO) +
                          NETPORT(IN) SCRIPT(STERTRAN) +
                          SCRIPTPARM('') NETID(*ESX) +
                          IMPORTSCR(*NONE)
             ENDDO


/* Delete the stream file from ESX */
             RMVLNK     OBJLNK(&FPTH)

             RETURN     /* Normal end of program                   */
/**********                                                    ***********/
 STDERR1:               /* Standard error handling routine */
             IF         COND(&ERRORSW) THEN(SNDPGMMSG MSGID(CPF9999) +
                          MSGF(QCPFMSG) MSGTYPE(*ESCAPE)) /* Fn chk */
             CHGVAR     VAR(&ERRORSW) VALUE('1') /* Set to fail if +
                          another error occurs */

/* Send messages back to caller                                          */
             MOVPGMMSG  MSGTYPE(*DIAG)
             MONMSG     MSGID(CPF0000)

             RSNESCMSG
             MONMSG     MSGID(CPF0000)
             RETURN     /* Error end of program                   */

 COPYRIGHT:  XCOPYRIGHT COPYRIGHT('(C) COPYRIGHT 2004 EXTOL, INC.')

ENDPGM




By: on