EXTOL RPG - Create Readable Inbound 830 Report

EXTOL RPGLE - 830 x12 Inbound HTML Report

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

     FEI830HL0  IF   E           K DISK
     FEI830DL1  IF   E           K DISK
     FEI830FL1  IF   E           K DISK
     FEI830SL1  IF   E           K DISK
     FEI830NL1  IF   E           K DISK
     FQPRINT    O    F  132        PRINTER OFLIND(*INOF) FORMLEN(66) FORMOFL(64)
     F                                     USROPN
      *-------------------------------------------------------------------------
     D N1PN            S             49
     D N1ST            S             50
     D COMM            S             36
     D IDPS            S             40
     D LINE132         S            132    INZ(*ALL'-')
      *-------------------------------------------------------------------------
      * setup parm & key lists
     C     KML           PLIST
     C                   PARM                    CMD             256
     C                   PARM      256           LEN              15 5

     C     KEYLNN        KLIST
     C                   KFLD                    MSGLOG
     C                   KFLD                    IDLNNO

      * get message log# & message class from local dataarea
     C     *DTAARA       DEFINE    *LDA          LDA              21
     C                   IN        LDA
     C                   MOVEL     LDA           MSGLOG           11 0
     C                   MOVE      LDA           MSGCLS           10

      * get header record current order
     C     MSGLOG        CHAIN     IH830R                             LR
     C                   IF        *INLR = *OFF

      * print header record
     C                   EVAL      N1PN = %TRIM(IHIDCA) + ' - ' + IHENNA
     C                   EVAL      N1ST = %TRIM(IHIDCC) + ' - ' + IHENNC
     C                   OPEN      QPRINT
     C                   MOVE      *ON           *IN10
     C                   EXCEPT    #HEADER

      * get all detail records
     C                   EXSR      @GETDTL

      * print footer record, close printer file
     C                   EXCEPT    #FOOTER
     C                   CLOSE     QPRINT

      * set splf attributes to Keyesmail outque for emailing
     C                   EVAL      CMD = 'CHGSPLFA FILE(QPRINT) +
     C                             SPLNBR(*LAST) OUTQ(QUSRSYS/KMLOUTQ) +
     C                             USRDFNDTA(''¬Email KMLEDI/' + %TRIM(MSGCLS)
     C                             + ' ¬Subj EDI 830 PLANNING DOCUMENT RECVD +
     C                             FROM ' + %TRIM(IHCUSN) + ' ¬Trans 6'')'
     C
     C                   CALL      'QCMDEXC'     KML                    13
     C                   MOVE      *ON           *INLR
     C                   ENDIF

     C                   RETURN
      *---------------------------------------------------------------
     C     @GETDTL       BEGSR
      *---------------------------------------------------------------
      * get & print detail records
     C     MSGLOG        CHAIN     ID830R                             01
     C                   DOW       *IN01 = *OFF

     C                   MOVEL     IDCNNM        COMM
     C                   MOVEL     IDPS02        IDPS
      * get & print LINE#  records
     C                   EXCEPT    #DETAIL
     C
      * get corresponding forcast, ship/rcv & spec inst for current line
     C                   EXSR      @GETFST
     C                   EXSR      @GETDSR
     C                   EXSR      @GETNTE

     C     MSGLOG        READE     ID830R                                 01
     C                   ENDDO

     C                   ENDSR
      *---------------------------------------------------------------
     C     @GETFST       BEGSR
      *---------------------------------------------------------------
      * get & print ALL forecast records
     C     KEYLNN        CHAIN     IF830R                             02
     C                   MOVE      *OFF          *IN22

     C                   DOW       *IN02 = *OFF
     C                   EXCEPT    #FORCAST
     C  N22              MOVE      *ON           *IN22
     C     KEYLNN        READE     IF830R                                 02
     C                   ENDDO
     C
     C                   ENDSR
      *---------------------------------------------------------------
     C     @GETDSR       BEGSR
      *---------------------------------------------------------------
      * get & print ship/receive records
     C     KEYLNN        CHAIN     IS830R                             03
     C                   MOVE      *OFF          *IN33

     C                   DOW       *IN03 = *OFF
     C                   EXCEPT    #SHPRCV
     C  N33              MOVE      *ON           *IN33
     C     KEYLNN        READE     IS830R                                 03
     C                   ENDDO
     C
     C                   ENDSR
      *---------------------------------------------------------------
     C     @GETNTE       BEGSR
      *---------------------------------------------------------------
      * get & print detail notes records
     C     KEYLNN        CHAIN     IN830R                             04
     C                   MOVE      *OFF          *IN44

     C                   DOW       *IN04 = *OFF
     C                   EXCEPT    #NOTES
     C  N44              MOVE      *ON           *IN44
     C     KEYLNN        READE     IN830R                                 04
     C                   ENDDO
     C
     C                   ENDSR
      *-------------------------------------------------------------------------
     OQPRINT    E            #HEADER           1
     O                                           78 'EDI 830 PLANNING SCHEDULE'
     O          E            #HEADER     2
     O                                              'TRADING PARTNER: '
     O                       IHCUSN
     O                                           72 'TYPE: '
     O                       IHPURD
     O                                              ' / '
     O                       IHFCTD
     O                                              ' / '
     O                       IHFCQD
     O          E            #HEADER     1
     O                                              'PURCHASE ORDER#: '
     O                       IHPO
     O                                           78 'START DATE: '
     O                       IHF1DT                 '    /  /  '
     O                                              ' END DATE: '
     O                       IHF2DT                 '    /  /  '
     O                                              ' ENTERED: '
     O                       IHF3DT                 '    /  /  '
     O          E            #HEADER     1
     O                                           17 'RELEASE#       : '
     O                       IHRELN
     O                       IHENDA              81
     O                                              ': '
     O                       N1PN
     O          E            #HEADER     1
     O                       IHENDC
     O                                              ': '
     O                       N1ST
     O          E            #HEADER     1
     O                       IHNM1C             +17
     O          E            #HEADER     1
     O                       IHNM2C             +17
     O          E            #HEADER     1
     O                       IHAD1C             +17
     O                       IHAD2C
     O          E            #HEADER     1
     O                       IHAD3C             +17
     O                       IHAD4C
     O          E            #HEADER     1
     O                       IHCTYC             +17
     O                       IHSTC               +1
     O                       IHZIPC              +1
     O                       IHCOUC
     O          E            #HEADER     2
     O                                              'TOTAL LINES: '
     O                       IHTLIN        J
     O                                           +8 'TOTAL QTY: '
     O                       IHTOTL        J
     O          E            #HEADER     1
     O                       LINE132
      *-------------------------------------------------------------------------
     O          E    OF      #DETAIL           1
     O          EF           #DETAIL     2
     O                                              'LINE#: '
     O                       IDASLN
     O                       IDPQ1D             -10
     O                                              ': '
     O                       IDPS01
     O                       IDPQ2D              -6
     O                       IDPS                +1
     O          E            #DETAIL     1
     O                       IDPQ3D
     O                                              ': '
     O                       IDPS03
     O                       IDUOMD
     O          E            #DETAIL     1
     O                       IDCNFD
     O                                              ': '
     O                       IDCNFN
     O                       IDCNQD
     O                                              ': '
     O                       COMM
      *-------------------------------------------------------------------------
     O          E    OF      #FORCAST          1
     O          EF  N22      #FORCAST    1
     O                                              '-'
     O          EF           #FORCAST    1
     O              N22                             'FORCAST SCHEDULE| '
     O                       IFFCQD
     O                       IFQTY         J
     O              N22                          +8 'TIMING: '
     O                       IFTMQD
     O                       IFDT01              +1 '    /  /  '
      *-------------------------------------------------------------------------
     O          E    OF      #SHPRCV           1
     O          EF  N33      #SHPRCV     1
     O                                              '-'
     O          EF           #SHPRCV     1
     O              N33                             'SHIP/RCVNG INST.| '
     O                       ISQTQD
     O                       ISQTY         J
     O                       ISDTQD              +8
     O                       ISDT01                 '    /  /  '
     O                       ISDT02              +1 '    /  /  '
      *-------------------------------------------------------------------------
     O          E    OF      #NOTES            1
     O          EF  N44      #NOTES      1
     O                                              '-'
     O          EF           #NOTES      1
     O              N44                             'SPECIAL INSTRUCT| '
     O                       INNT1D
     O                                              ': '
     O                       INNT02
      *-------------------------------------------------------------------------
     O          E            #FOOTER     2
     O                                              '*** END OF REPORT ***'



By: on