contact image



Convert Iseries repors to PDF and/or HTML


DOWNLOAD
Download text files

Convert your spooled files to .HTML or .PDF to display on your intranet. Why put together inter-office packets of daily reports when you can email the reports to each user automatically every end-of-day in both .PDF and .HTML formats.

Objects

 
CVT2CLP     CLLE        convert to processor              
CVT2CMD     CMD         convert to streamfile           
CVT2HTML    RPGLE       convert to html spooled files   
CVT2PDF     RPGLE       convert to PDF spooled file        

The source physical file


The command that starts it all


Completion message


Use the WRKLNK command to find our file


Use option 5 to display our file


I know I switched directories but any how here it is option 5 to display.


The raw file see HTML code at top of text file.


Find it with Iseries navigator or Ops naviagtor if not yet on V5R2.


Last but not least the finished product.


The source to the convert to HTML program
 
 
     H
 
     Fcvtwork02 IF   F  382        DISK
 
     Fcvtwork01 UF A F  378        DISK
 
      * Standard HTML header lines
 
     D aaHeader        S             80A   DIM(2) CTDATA PERRCD(1)
 
      * Standard HTML footer line
 
     D aaFooter        S             80A   DIM(1) CTDATA PERRCD(1)
 
      * Input spooled file data including control characters
 
     D InputData       DS
     D   saSkipLine                   3A
     D   ssSkipLine                   3S 0 OVERLAY(saSkipLine:1)
     D   saSpceLine                   1A
     D   ssSpceLine                   1S 0 OVERLAY(saSpceLine:1)
     D   saInput                    378A
 
      * Output HTML-format data
 
     D OutputData      DS
     D   saOutput                   378A
 
      * Program parameters - title and page length in lines
 
     D paTitle         S             50A
     D piPageLen       S             10I 0
 
      * Line counter variable
 
     D wiLine          S             10I 0
 
      * Procedure prototypes
 
     D HTMLHeader      PR
 
     D HTMLFooter      PR
 
     D Convert         PR
 
     D Merge           PR                  LIKE(saOutput)
     D    iaOutput                         LIKE(saOutput)
     D    iaInput                          LIKE(saInput)
 
     D SpceLines       PR
     D    isSpceLine                       LIKE(ssSpceLine)
 
     D SkipLines       PR
     D    isSkipLine                       LIKE(ssSkipLine)
 
      * Program parameters
 
     C     *ENTRY        PLIST
     C                   PARM                    paTitle
     C                   PARM                    piPageLen
 
      * Output HTML header lines
 
     C                   CALLP     HTMLHeader
 
      * Convert spool file lines to HTML
 
     C                   READ      cvtwork02     InputData                LR
     C                   DOW       *INLR = *OFF
     C                   CALLP     Convert
     C                   READ      cvtwork02     InputData                LR
     C                   ENDDO
 
      * Output HTML footer lines
 
     C                   CALLP     HTMLFooter
 
     C                   RETURN
 
      **********************************************************************
      * Procedure to create HTML header lines                              *
      **********************************************************************
 
     P HTMLHeader      B
 
     D HTMLHeader      PI
 
     C                   EVAL      saOutput = aaHeader(1)
     C                   WRITE     cvtwork01     OutputData
 
     C                   IF        paTitle <> '*NONE'
     C                   EVAL      saOutput   = ''
     C                   WRITE     cvtwork01     OutputData
     C                   ENDIF
 
     C                   EVAL      saOutput = aaHeader(2)
     C                   WRITE     cvtwork01     OutputData
 
     P HTMLHeader      E
 
      **********************************************************************
      * Procedure to create HTML footer line                               *
      **********************************************************************
 
     P HTMLFooter      B
 
     D HTMLFooter      PI
 
     C                   EVAL      saOutput = aaFooter(1)
     C                   WRITE     cvtwork01     OutputData
 
     P HTMLFooter      E
 
      **********************************************************************
      * Procedure to convert spooled file data to HTML text                *
      **********************************************************************
 
     P Convert         B
 
     D Convert         PI
 
      * If 'space' position is zero, 'overprint' previous line
 
     C                   IF        saSpceLine = '0'
 
     C     *HIVAL        SETGT     cvtwork01
     C                   READP     cvtwork01     OutputData               99
     C                   EVAL      saOutput = Merge(saOutput:saInput)
     C                   UPDATE    cvtwork01     OutputData
 
     C                   ELSE
 
      * Skip to a line if specified
 
     C                   IF        saSkipLine <> *BLANKS
     C                   CALLP     SkipLines(ssSkipLine)
     C                   ENDIF
 
      * Space a number of lines if specified
 
     C                   IF        saSpceLine <> *BLANKS
     C                   CALLP     SpceLines(ssSpceLine)
     C                   ENDIF
 
      * 'Print' line
 
     C                   EVAL      saOutput   = saInput
     C                   WRITE     cvtwork01     OutputData
 
     C                   ENDIF
 
     C                   RETURN
 
     P Convert         E
 
      **********************************************************************
      * Procedure to merge two overlaid lines of text                      *
      **********************************************************************
 
     P Merge           B
 
     D Merge           PI                  LIKE(saOutput)
     D    iaOutput                         LIKE(saOutput)
     D    iaInput                          LIKE(saInput)
 
     D laOutput        S                   LIKE(saOutput)
 
     D i               S              5I 0
 
     C                   EVAL      i = 1
     C                   DOW            i <= %size(iaInput )
     C                             and  i <= %size(iaOutput)
     C                             and  i <= %size(laOutput)
     C                   IF        %subst(iaInput:i:1) = *BLANK
     C                   EVAL      %subst(laOutput:i:1) = %subst(iaOutput:i:1)
     C                   ELSE
     C                   EVAL      %subst(laOutput:i:1) = %subst(iaInput :i:1)
     C                   ENDIF
     C                   EVAL      i = i + 1
     C                   ENDDO
 
     C                   RETURN    laOutput
 
     P Merge           E
 
      **********************************************************************
      * Procedure to skip to a given line number                           *
      **********************************************************************
 
     P SkipLines       B
 
     D SkipLines       PI
     D    isSkipLine                       LIKE(ssSkipLine)
 
     C                   EVAL      saOutput = *BLANKS
 
     C                   IF        wiLine > isSkipLine
 
     C                   DOW       wiLine < piPageLen
     C                   WRITE     cvtwork01     OutputData
     C                   EVAL      wiLine = wiLine + 1
     C                   ENDDO
 
     C                   EVAL      saOutput   = '-------------------------'
     C                   WRITE     cvtwork01     OutputData
     C                   EVAL      saOutput = *BLANKS
     C                   EVAL      wiLine = 1
 
     C                   ENDIF
 
     C                   DOW       wiLine < isSkipLine
     C                   WRITE     cvtwork01     OutputData
     C                   EVAL      wiLine = wiLine + 1
     C                   ENDDO
 
     C                   RETURN
 
     P SkipLines       E
 
      **********************************************************************
      * Procedure to space a number of lines                               *
      **********************************************************************
 
     P SpceLines       B
 
     D SpceLines       PI
     D    isSpceLine                       LIKE(ssSpceLine)
 
     D liCount         S              5I 0
 
     C                   EVAL      wiLine  = wiLine  + 1
     C                   EVAL      saOutput = *BLANKS
     C                   DOW       liCount < isSpceLine - 1
     C                   WRITE     cvtwork01     OutputData
     C                   EVAL      wiLine  = wiLine  + 1
     C                   EVAL      liCount = liCount + 1
     C                   ENDDO
 
     C                   RETURN
 
     P SpceLines       E
**
 
**