Inbound Exit Point using Long Parm List to Send Email When Inbound PO (850) is Translated

EXTOL RPGLE - Inbound Exit Point using Long Parm List to Send Email When Inbound PO (850) is Translated, using CMD: EXENOTE

For additional EXTOL EDI Integrator RPGLE Examples: Sean Hoppe Consulting Group Coding Samples

     h Debug(*Yes) Datedit(*Ymd)
      **************************************************************************
      *
      * Warning: This program does not set on the LR.
      *
      **************************************************************************
      * SYNOPSIS :
      *  External call program which uses the "long
      *  parameter list".
      **************************************************************************
      * Maintenance   : Manually modified Synon program.
      **************************************************************************
      *   BMR    Date    Description
      *   ---- ---------- ----------------------------------------------------------------
      **************************************************************************
      *
     fExmmtrl0  if   e           k Disk
      * Extol Message Class constants
     fExllmrl1  if   e           k Disk
      * Extol Log of Message File
      *
      * Data structures:
     d*Pgmds         EsDs                  Extname(EXPGSDS)
      * Program data structure
     d Jbdttm          Ds
      * Job date/time
      * Parameter declarations
 
       <---- LONG PARM LIST ---->



     d Optrtn          ds
      * Listing of valid Return Request Qualifiers
      *   @@ in retruned value replace with the field prefix.
     d  @@UpdateFlag           1     10    Inz('UPDATEFLG')
      *
      * CL Commands to Perform
     d Command         s            100    Dim(6) Ctdata Perrcd(1)              Commands
      *
     d @@Cmd           s           3000
     d @@Cmdlength     s             15  5 Inz(3000)
      *
     d P0rtn           s                   Like(W0rtn)
      *
     d @Cnln           s              7                                         Trans status
     d @MSG            s             10                                         Trans status
     d @TP             s              6                                         TP Code
     d @STAT           s              3                                         State
     d @PO             s             10                                         PO Number
     d @TO             s             37                                         To email address
     d @SUBJ           s             33                                         Subject line
     d @BODY           s            240                                         Email body
     d @Email          s           3000                                         Email cmd
     d @Const          s              5    INZ('ADD')                           Msgclss const
      **************************************************************************
      * Mainline Program.
      **************************************************************************
     c                   Exsr      Srinit
      *
      * Perform Functions to Override, Update and Close Files
     c                   Exsr      Mod0s1                                       Override Database
      *
      * A "Return code" of non-blank will be logged as a translation error:
     c                   Eval      W0Rtn = *Blanks                              *Return code
     c                   Return
      **************************************************************************
      * Srdefn - Definitions
      **************************************************************************
     c     Srdefn        Begsr
      *
      * Entry parameters
     c     *Entry        Plist
 
       <---- LONG PARAMETER LIST ---->



      *
      * Parameters for 'QCMDEXC'
     c     Qcmd          Plist
     c                   Parm                    @Email
     c                   Parm      3000          @@Cmdlength
      *
      * Key to the EXMMTRL0 - Message class constants
     c     KeyExmmtrl0   Klist
     c                   Kfld                    P4MSID
     c                   Kfld                    P4MSCL
     c                   Kfld                    @CONST
      *
     c     Endefn        Endsr
      **************************************************************************
      * Srinit - Initialization.
      **************************************************************************
     c     Srinit        Begsr
      *
      * Initialise indicators for re-entry
     c                   Move      '0'           *In
      *
     c     Eninit        Endsr
      **************************************************************************
      * Mod0s1 - Override the Address Book Master to the Correct Library.
      **************************************************************************
     c     Mod0s1        Begsr
      *
      * Retrieve the Message Log data.
      * This data will determine if inbound message was translated or error'd
     c     P4Msln        Chain     Exllmrl1                           98
      *
      * If the Function Status is Translated then move 'Translated' into @MSG
     c                   If        LmFstm = 'T'
     c                   Eval      @MSG   = 'Translated'
     c                   ENDIF
      *
      * If the Function Status is Trans err then move 'Trans error' into @MSG
     c                   If        LmFstm = 'E'
     c                   Eval      @MSG   = 'Trans err'
     c                   ENDIF
      *
     C                   Eval      @PO = LMREF1
     C                   Eval      @STAT = LMREF3
     C                   Eval      @SUBJ = P4TPC1
     C                   Eval      @TP   = P4TPC1
      *
      * Setup of @SUBJ variable to for email subject
      * Transation status and PO # are placed into subject line
     c                   Eval      %Subst(@SUBJ:8:2) = 'PO'
     c                   Eval      %Subst(@SUBJ:11:10) = @MSG
     c                   Eval      %Subst(@SUBJ:21:1)  = '-'
     c                   Eval      %Subst(@SUBJ:22:10) = @PO
     C
      * Setup of @body variable to for email body
      * Connection log number, msg control # (element ST02), and state (element N402)
      * are passed into email body
     C                   Eval      @Body   = 'Connection log:'
     c                   MOVEL     P4CNLN        @Cnln
     c                   Eval      %Subst(@Body:16:7) = @Cnln
     c                   Eval      %Subst(@Body:24:5) = 'EDI#:'
     c                   Eval      %Subst(@Body:29:9) =  P4Mscr
     c                   Eval      %Subst(@Body:39:6) = 'State:'
     c                   Eval      %Subst(@Body:45:2) =  P4REf3
     c*                  Eval      %Subst(@Body:47:2) =  ' )'
      *
      *
      * Chain out to message class constant file
      * PGM will retrieve all constant values from ADD1 thru ADD9
      * Note: If > 9 ADDx constants are utilized, then increase size of @COUNT var
     C                   MOVE      1             @COUNT            1 0
     C                   MOVEL     @COUNT        @COUNTA           1
     c                   Eval      %Subst(@CONST:4:1) = @COUNTA
     c     KeyExmmtrl0   Chain     Exmmtrl0                           95
      *
      * If constants:ADDx exsist in respective message class
      * Message class is determined by parms passed from extol, in long parm list
     C                   DOW       *in95 = *off
      *
      * Clear To-email address variable. Move MTCDAT from EXMMTRL0 to @TO var.
     C                   CLEAR                   @TO
     C                   MOVEL     MTCDAT        @TO
      *
      * Move to-email address to first record of table data
     c                   Clear                   @@Cmd
     c                   Eval      @@Cmd = Command(1)
     c                   Eval      %Subst(@@Cmd:15:37) = @TO
     c                   Eval      @Email = @@Cmd
      *
      * Move subject line to second record of table data
     c                   Clear                   @@Cmd
     c                   Eval      @@Cmd = Command(2)
     c                   Eval      %Subst(@@Cmd:37:32) = @SUBJ
     c                   Eval      %Subst(@Email:71:70) = @@Cmd
      *
      * Move body line to third record of table data
     c                   Clear                   @@Cmd
     c                   Eval      @@Cmd = Command(3)
     c                   Eval      %Subst(@@Cmd:11:50) = @Body
     c                   Eval      %Subst(@Email:141:65) = @@Cmd
      * Call EXENOTE command
     c                   Call      'QCMDEXC'     Qcmd                   96
     C*
     C                   ADD       1             @COUNT
     C                   MOVEL     @COUNT        @COUNTA           1
     c                   Eval      %Subst(@CONST:4:1) = @COUNTA
     c     KeyExmmtrl0   Chain     Exmmtrl0                           95
     C                   enddo
      *
     c                   Endsr
** Command Override DBF Array
EXENOTE TOADR(                                     ) FROMADR(ABCDE@ABC
DEFGH.com) FROMNAME(JOHND) SUBJECT('                                ')
 MESSAGE('                                                   ')

By: on