home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l360 / 3.ddi / TSTDEBUG.@BL / TSTDEBUG.CBL
Encoding:
Text File  |  1991-04-08  |  4.0 KB  |  96 lines

  1.       $set ans85 noosvs mf
  2.       ************************************************************
  3.       *                                                          *
  4.       *              (C) Micro Focus Ltd. 1989                   *
  5.       *                                                          *
  6.       *                      TSTDEBUG.CBL                        *
  7.       *                                                          *
  8.       *         This program demonstrates how to make use of     *
  9.       *         the ANSI DEBUGGER facility available within      *
  10.       *         COBOL. ANIMATOR debugging tool is also available *
  11.       *         and would normally be used in preference to      *
  12.       *         the ANSI debugger Essential lines to include     *
  13.       *         are in upper-case                                *
  14.       *                                                          *
  15.       *         To make use of the ANSI debugging facility       *
  16.       *         the program needs to be run with the +D run      *
  17.       *         time switch.                                     *
  18.       *                                                          *
  19.       *         Any line containing a D in column 7 will be      *
  20.       *         treated as a comment line when the               *
  21.       *         WITH DEBUGGING MODE option is removed from the   *
  22.       *         source.                                          *
  23.       *                                                          *
  24.       ************************************************************
  25.  
  26.  
  27.        environment division.
  28.        source-computer.  ibm-pc    with debugging mode.
  29.        object-computer.  ibm-pc.
  30.        special-names.
  31.                    console is crt.
  32.        file-control.
  33.        select file1 assign "tst.fil"
  34.        status is file1-stat.
  35.        data division.
  36.        fd file1.
  37.        01 f1-rec pic x(80).
  38.        working-storage section.
  39.        01 counts   pic 99 value 1.
  40.        01 file1-stat.
  41.            02 s1   pic x.
  42.            02 s2   pic x.
  43.        01 stat-bin redefines file1-stat pic 9(4) comp.
  44.        01 display-stat.
  45.            02 messag   pic x(16) value "RUN-TIME ERROR ".
  46.            02 s1-disp  pic x.
  47.            02 filler   pic x value space.
  48.            02 s2-disp  pic 9(4).
  49.        01 out-buff     pic x(80) value all "A".
  50.  
  51.       ***************************************************************
  52.       *                                                             *
  53.       * OUTS should be 56 bytes + the length of your longest record *
  54.       *                                                             *
  55.       ***************************************************************
  56.  
  57.          01 outs         pic x(136) value spaces.
  58.       /
  59.        procedure division.
  60.  
  61.       ***************************************************************
  62.       *                                                             *
  63.       *    DEBUG-ITEM is created by the compiler when the WITH      *
  64.       *    DEBUGGING MODE is specified, and can only be accessed    *
  65.       *    by the use of a MOVE to another 'PIC X(nnn)' field       *
  66.       *                                                             *
  67.       ***************************************************************
  68.  
  69.        declaratives.
  70.        animator section.
  71.              use for debugging on all procedures.
  72.            display "debugging line" at 2430.
  73.            add 1 to counts.
  74.              move debug-item to outs.
  75.              display outs at 2001.
  76.            display counts at 2445.
  77.        end declaratives.
  78.  
  79.        main section.
  80.            display spaces
  81.            open output file1.
  82.            if s1 not = 0 perform sect1.
  83.            write f1-rec from out-buff.
  84.            if s1 not = 0 perform sect1.
  85.        close-up section.
  86.            close file1.
  87.            if s1 not = 0 perform sect1.
  88.            stop run.
  89.        sect1 section.
  90.            move s1 to s1-disp.
  91.            move low-values to s1.
  92.            move stat-bin to s2-disp.
  93.            display display-stat.
  94.  
  95.  
  96.