Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1298656
  • 博文数量: 287
  • 博客积分: 11000
  • 博客等级: 上将
  • 技术积分: 3833
  • 用 户 组: 普通用户
  • 注册时间: 2007-08-16 08:43
文章分类
文章存档

2013年(15)

2012年(17)

2011年(17)

2010年(135)

2009年(85)

2008年(18)

分类: 系统运维

2009-03-24 11:34:13

The source of spool file 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
**
**
 
阅读(1055) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~