COBscan - COBOL source program scan & search/replace jobs - CONTENTS

A1. 'COBscan' jobs -vs- 'SCANjobs' previously presented in SCANjobs.doc
B1. tables of search patterns & qualifiers - 2 types
C1. SCANjobs - review of previously documented jobs (scan1d,scan2d).
  - to be compared to the COBscan jobs presented in this section.
C1. scan1d - scan any directory for any 1 pattern & report matches.
C2.  scan2d - scan any directory for matches to a table of search patterns.
  type 1 - qualifier applies only to search pattern on that line.
  type 2 - search patterns & qualifiers are independent.
D1. COBscan - presented in this section - see list below & please
  compare these to the general purpose text jobs above.
D1. cobscan1d - scan a cobol directory for any 1 pattern & report matches
  - sample reports illustrated for options e1 & e0
  e1 ends COBOL stmt on next verb, period, or 'end-
  e0 ends COBOL stmt only on period or 'end-'
D3. cobscan2d - scan a cobol directory for matches to a table of patterns
  - sample reports illustrated for options e1 & e0
E1. COBreps - presented in this section - see list below & please
  compare these to the general purpose text jobs previously
  documented in REPjobs.doc
E1. cobrep1d - scan a cobol directory searching for any 1 pattern &
  replacing with an alternate (qualifier optional)
E2. cobrep2d - scan a cobol directory searching & replacing depending on
  a table of search & replace patterns (qualifier optional)
F1. Listings of the uvcopy parameter files for new jobs in this section
 (cobscan1d, cobscan2d, cobrep1d, cobrep2d)

Goto:   Begin this document End this document UVSI Home-Page

A1. 'COBscan' vs 'SCANjobs' previously presented in SCANjobs.doc

SCANjobs.doc is a previous section that included scan1d & scan2d. REPjobs.doc is a previous section that included rep1d & rep2d.

These were general purpose - you could use them to scan directories of variable length text records (no special format expected or respected).

This section documents: cobscan1d, cobscan2d, cobrep1d, cobrep2d.

These jobs are designed for scanning COBOL source programs & differ from the general purpose jobs as follows:

 1 - cobscans & cobreps will ignore the comment & eject records (*/ col 7)
   - will not scan for matches (cobreps will copy to output unchanged)

2 - cobscans/cobreps will table multiple lines until a period or end-verb so the complete statement can be searched & qualified by a pattern on a different line.

 3 - cobreps will not exceed column 72. If replacements cause column 72
     to be exceeded, the line is squeezed left to 1 blank between words.
   - If still exceeded, the line will be split into 2 lines.

4 - option 'q3' is provided to inhibit search/replace within quotes.

These differences will be illustrated by the test/demo report results which are presented in sub-sections C, D,& E.

C1. scan1d - scan any directory for any 1 pattern & report matches.
C2. scan2d - scan any directory for matches to a type 1 table.
C3. - scan any directory for matches to a type 2 table.
D1. cobscan1d - scan a cobol directory for any 1 pattern & report matches
D2.  cobscan2d - scan a cobol directory for matches to a type 1 table
D3.   - scan a cobol directory for matches to a type 2 table
E1. cobrep1d - search/replace 1 pattern with an alternate
E2.  cobrep2d - search/replace by a table of multiple patterns/alternates

Goto:   Begin this document End this document UVSI Home-Page

B1. COBscan: TABLES of SEARCH PATTERNS & QUALIFIERS - 2 types of tables

Samples of the 2 table types are listed below (datetbl1 & datetbl2). These tables are used in the DATEjobs.doc section to scan cobol programs for date field comparisons (re: the year 2000 problem).

 # datetbl1 - table of date field name patterns
 #
 # - this solution (datetbl1) is limited, we want to find all instances of
 #   date comparisons & calculations, so we have to repeat our date patterns
 #   with each different qualifier '>','<','add',& 'subtract' here, but we
 #   also need others ( greater than, less than, etc).
 # - see 'datetbl2' (a type 2 table) for a better solution
 #
 # table format - for table type #1
 # 01-30 - search pattern (pattern&qualifier lengths determined by 1st tilde)
 # 31-60 - presence qualifier (must appear on same line as search pattern)
 # 61-80 - absence qualifier, or 2nd presence qualifier if option p2
 #
 year~~~~~~~~~~~~~~~~~~~~~~~~~~ > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 date~~~~~~~~~~~~~~~~~~~~~~~~~~ > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 year~~~~~~~~~~~~~~~~~~~~~~~~~~ < ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 date~~~~~~~~~~~~~~~~~~~~~~~~~~ < ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 year~~~~~~~~~~~~~~~~~~~~~~~~~~ add ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 date~~~~~~~~~~~~~~~~~~~~~~~~~~ add ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 year~~~~~~~~~~~~~~~~~~~~~~~~~~ subtract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 date~~~~~~~~~~~~~~~~~~~~~~~~~~ subtract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 # datetbl2 - table of date field name patterns
 #
 # - datetbl2 (type 2) is a better solution for this problem than datetbl1
 #   (type 1) because of different table qualifier logic
 # - search & qualifier columns are independent here, vs type 1 tables where
 #   the qualifier applied only to the search pattern on that line
 #   (making it necessary to duplicate qualifiers for each set of patterns)
 #
 # table format:
 # - 01-30 search pattern, 31-60 qualifier present,
 #   61-80 absence qualifier, or 2nd presence qualifier if option p2
 # - must code dummy(nofind) entries in 01-30, if you had more qualifiers
 #   in 31-60 than search patterns in 01-30 since '~' col 1 ends table
 #
 year~~~~~~~~~~~~~~~~~~~~~~~~~~ greater ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 month~~~~~~~~~~~~~~~~~~~~~~~~~ less ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 day~~~~~~~~~~~~~~~~~~~~~~~~~~~ equal ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 yy~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  date~~~~~~~~~~~~~~~~~~~~~~~~~ < ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 -date~~~~~~~~~~~~~~~~~~~~~~~~~ = ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 -age~~~~~~~~~~~~~~~~~~~~~~~~~~ add ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 age-~~~~~~~~~~~~~~~~~~~~~~~~~~ subtract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Goto:   Begin this document End this document UVSI Home-Page

C1. COBscan: scan1d - scan directory for any 1 pattern & print matches

       (review of scan1d - originally presented in SCANjobs.doc)

demo operating instructions


 uvcopy scan1d  - will solicit input directory, search pattern,& options
 =============
                - or enter on command line to inhibit prompts
                  (quoted so '>' wont be interpreted as UNIX redirection)

 uvcopy "scan1d,fild1=bat1,arg1=date,arg2=<,arg8=i,uop=q0
 ========================================================
                directory,searchpat,qualifier,matchoptions,useroptions
 EOF fili1 149 rds, 0 wrts, 0 hits, 11771 size, fname=bat1/cobol1.bat
               - - - etc - - -
 EOF fili1 159 rds, 0 wrts, 0 hits, 12503 size, fname=bat1/cobol9.bat
 display/edit/print/none ? (enter: cat/vi/lp[-dp?]/null)
                                               --> cat  <-- display results

demo report

 JOB: scan1d  dir: bat1  search: date  qualpresent: <  absent:
  scanbgn:   scanend:   matchops: i  userops: q1a1b99999c0d256p1
 ====================================================== 1995/12/11_16:29:42
 00041 000041     IF EXPIRE-DATE < EXP-TEST-DATE                               COBOLW
 00044                             1 hits @EOF: bat1/cobolw.bat
 ====================================================== 1995/12/11_16:29:52
  EOD: 00001 hits in 0001 files of 0015 total (01654 lines)

notes

This is the scan1d result of searching for 'date' (case insensitive) qualified by '<' present on the same line.

Please compare this to the 'cobscan1d' report (see 'D2' ahead a few pages). Note that cobscan1d finds additional matches because it tables multi-line statements before searching & qualifying.

Goto:   Begin this document End this document UVSI Home-Page

C2. COBscan: scan2d - scan directory for matches to a table - type #1

       (review of scan2d - originally presented in SCANjobs.doc)

demo operating instructions


 uvcopy scan2d     - will solicit input directory, table filename,& options
 =============
                   - or enter on command line to inhibit prompts

 uvcopy scan2d,fild1=bat1,fili2=tf/datetbl1,arg8=iq3,uop=q0t1
 ============================================================
                   directory,   tablefile, matchoptions, useroptions
 EOF fili1 149 rds, 0 wrts, 0 hits, 11771 size, fname=bat1/cobol1.bat
               - - - etc - - -
 EOF fili1 159 rds, 0 wrts, 0 hits, 12503 size, fname=bat1/cobol9.bat
 display/edit/print/none ? (enter: cat/vi/lp[-dp?]/null)
                                               --> cat  <-- display results

demo report

 JOB: scan2d  dir: bat1  matchops: iq3dg  userops: q1a1b99999c0d256p1t1
 table-file: tf/datetbl1  scanbgn:   scanend:
 ====================================================== 1995/12/11_16:31:36
 year~~~~~~~~~~~~~~~~~~~~~~~~~~ > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 date~~~~~~~~~~~~~~~~~~~~~~~~~~ > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 year~~~~~~~~~~~~~~~~~~~~~~~~~~ < ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 date~~~~~~~~~~~~~~~~~~~~~~~~~~ < ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 year~~~~~~~~~~~~~~~~~~~~~~~~~~ add ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 date~~~~~~~~~~~~~~~~~~~~~~~~~~ add ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 year~~~~~~~~~~~~~~~~~~~~~~~~~~ subtract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 date~~~~~~~~~~~~~~~~~~~~~~~~~~ subtract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ====================================================== 1995/12/11_16:31:36
 00042 000042     SUBTRACT BIRTH-YEAR FROM AGE-CALC-YEAR GIVING EMP-AGE.       COBOLP
 00048                             1 hits @EOF: bat1/cobolp.bat
 00041 000041     IF EXPIRE-DATE < EXP-TEST-DATE                               COBOLW
 00044                             1 hits @EOF: bat1/cobolw.bat
 ====================================================== 1995/12/11_16:31:54
  EOD: 00002 hits in 0002 files of 0015 total (01654 lines)
note
  • Scan2d uses a type 1 table where the qualifier applies only to the
    search pattern on the same line.
  • Note the search pattern set is repeated for the '<' qualifier &
    would have to be repeated more times for 'greater','less',etc.

Goto:   Begin this document End this document UVSI Home-Page

C3. COBscan: scan2d - scan directory for matches to table - type #2

demo operating instructions


 uvcopy scan2d     - will solicit input directory, table filename,& options
 =============
                   - or enter on command line to inhibit prompts

 uvcopy scan2d,fild1=bat1,fili2=tf/datetbl2,arg8=iq3,uop=q0t2
 ============================================================
                 directory,   tablefile, matchoptions, useroptions
 EOF fili1 149 rds, 0 wrts, 0 hits, 11771 size, fname=bat1/cobol1.bat
               - - - etc - - -
 EOF fili1 159 rds, 0 wrts, 0 hits, 12503 size, fname=bat1/cobol9.bat
 display/edit/print/none ? (enter: cat/vi/lp[-dp?]/null)
                                               --> cat  <-- display results

demo report

 JOB: scan2d  dir: bat1  matchops: iq3dg  userops: q1a1b99999c0d256t1t2
 table-file: tf/datetbl2  scanbgn:   scanend:
 ====================================================== 1995/12/11_16:33:19
 year~~~~~~~~~~~~~~~~~~~~~~~~~~ greater ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 month~~~~~~~~~~~~~~~~~~~~~~~~~ less ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 day~~~~~~~~~~~~~~~~~~~~~~~~~~~ equal ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 yy~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  date~~~~~~~~~~~~~~~~~~~~~~~~~ < ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 -date~~~~~~~~~~~~~~~~~~~~~~~~~ = ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 -age~~~~~~~~~~~~~~~~~~~~~~~~~~ add ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 age-~~~~~~~~~~~~~~~~~~~~~~~~~~ subtract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ====================================================== 1995/12/11_16:33:19
 00042 000042     SUBTRACT BIRTH-YEAR FROM AGE-CALC-YEAR GIVING EMP-AGE.       COBOLP
 00044 000044     IF EMP-AGE > 64                                              COBOLP
 00048                             2 hits @EOF: bat1/cobolp.bat
 00004 000004*          IF THE EXPIRATION DATE IS LESS THAN AN ENTERED DATE    COBOLW
 00041 000041     IF EXPIRE-DATE < EXP-TEST-DATE                               COBOLW
 00044                             2 hits @EOF: bat1/cobolw.bat
 ====================================================== 1995/12/11_16:33:36
  EOD: 00004 hits in 0002 files of 0015 total (01654 lines)
note
  • scan2d uses a type 2 table where the search patterns & qualifiers
    are independent (match on any line from both columns).

Goto:   Begin this document End this document UVSI Home-Page

D1. COBscan: cobscan1d - scan directory for any 1 pattern & print matches

cobscan1d demo #1 (option 'e1')


 uvcopy cobscan1d,fild1=bat1       <-- will prompt for options & patterns
 ===========================
 uop=q1c0e1l1p1   - option defaults
       c1         - scan *comment lines
         e0       - end stmnts on PERIOD or END-verb
         e1       - end stmnts on next VERB (as well as period/end-)
           l1     - translate to lower case (except in quotes)
           l0     - disable translate to lower case
             p1   - 1 present qualifier & 1 absent qualifier
             p2   - 2 present qualifiers & NO absent qualifiers
 User OPtion (uop) defaults  = q1c0e1l1p1
  null to accept or re-specify (1 or more)   -->      <-- accept dflt optns
 enter your search pattern (max 64 bytes)    --> date <-- search pattern
 enter qualifier present (null to disable)   --> <    <-- qualifier '<'
 enter absent qualifier, or 2nd present qual -->      <-- null
 option to bypass until pattern ? or null    -->      <-- null
 option to end search ? - or null to disable -->      <-- null
 options: i=case-insen, p=patterns(@,#,etc)
 q1=no scan in singles,q2=doubles,q3=both
 enter match options: i,p,q1/q2/q3,n,or null -->      <-- null
 display/edit/print/none ? (more/vi/lp/null) --> more <-- display report

cobscan1d demo #1 report

 JOB: $jobname  dir: bat1  search: date  qualpresent: <  absent:
  searchbgn:   searchend:   matchops:   userops: q1c0e1l1p1
 ====================================================== 1999/09/16_10:32:46
 000048     if exp-test-date < '750101'
 000062     if wm-expiry < exp-test-date
 000069                  2 hits @EOF: bat1/cobolw.bat
 000067     if exp-test-date < '750101'
 000083        if expiry-date < exp-test-date
 000090                  2 hits @EOF: bat1/coboly.bat
 ====================================================== 1999/09/16_10:32:46
  EOD: 000004 hits in 0002 files of 0032 total (002370 lines)

notes

This is the cobscan1d result of searching for 'date', qualified by '>' present on the same statement (multi-line).

Compare this to the previous 'scan1d' report which found fewer matches because it is a general purpose text scanning job that does not table multi-lines (to a period or end-verb) before searching & qualifying.

Note default option 'e1' ends COBOL stmt on next verb, period, or end-. Compare this to the next page where we specify option 'e0' to end stmnts only on period & end-verb (will get more lines, sometimes too many ?)

Goto:   Begin this document End this document UVSI Home-Page

D2. COBscan: cobscan1d - scan directory for any 1 pattern & print matches

cobscan1d demo #2 (option 'e0')


 uvcopy cobscan1d,fild1=bat1       <-- will prompt for options & patterns
 ===========================
 uop=q1c0e1l1p1   - option defaults
       c1         - scan *comment lines
         e0       - end stmnts on PERIOD or END-verb
         e1       - end stmnts on next VERB (as well as period/end-)
           l1     - translate to lower case (except in quotes)
           l0     - disable translate to lower case
             p1   - 1 present qualifier & 1 absent qualifier
             p2   - 2 present qualifiers & NO absent qualifiers
 User OPtion (uop) defaults  = q1c0e1l1p1
  null to accept or re-specify (1 or more)   --> e0   <-- see NOTE1 below <--
 enter your search pattern (max 64 bytes)    --> date <-- search pattern
 enter qualifier present (null to disable)   --> <    <-- qualifier '<'
 enter absent qualifier, or 2nd present qual -->      <-- null
 option to bypass until pattern ? or null    -->      <-- null
 option to end search ? - or null to disable -->      <-- null
 options: i=case-insen, p=patterns(@,#,etc)
 q1=no scan in singles,q2=doubles,q3=both
 enter match options: i,p,q1/q2/q3,n,or null -->      <-- null
 display/edit/print/none ? (more/vi/lp/null) --> more <-- display report

cobscan1d demo #2 report

 JOB: $jobname  dir: bat1  search: date  qualpresent: <  absent:
  searchbgn:   searchend:   matchops:   userops: q1c0e1l1p1e0
 ====================================================== 1999/09/16_10:33:56
 000048     if exp-test-date < '750101'
               display 'EXPIRY TEST DATE INVALID' upon console stop run.
 000061     if wm-expiry < exp-test-date
               move warmas-rec to expire-rec
               write expire-rec before advancing 1 line.
 000066                  2 hits @EOF: bat1/cobolw.bat
 000067     if exp-test-date < '750101'
               display 'EXPIRY TEST DATE INVALID' upon console stop run.
 000080     if purchase-date not = spaces
               if expiry-date < exp-test-date
                  move warmas-rec to expire-rec
                  write expire-rec before advancing 1 line.
 000086                  2 hits @EOF: bat1/coboly.bat
 ====================================================== 1999/09/16_10:33:57
  EOD: 000004 hits in 0002 files of 0032 total (002370 lines)
NOTE1
  • option 'e0' (end stmts only on period & end-) causes more lines to
    be reported than 'e1' (end on next verb as well as period & end-).
    Compare this report to the previous page.

Goto:   Begin this document End this document UVSI Home-Page

D3. COBscan: cobscan2d - scan directory for matches to a table

cobscan2d - demo #1 (option e1)


 uvcopy cobscan2d,fild1=bat1,fili2=tf/datetbl1
 =============================================
 q1b2c0e1l1p1t2 - user option defaults (uop=...)
 q1             - prompt oprtr to change uops (q0 inhibits prompt)
   b2           - blank cols 73-80 before scan, b0 to inhibit
     c1         - scan *comment lines
       e0       - end stmnts on PERIOD or END-verb
       e1       - end stmnts on next VERB (as well as period/end-)
         l1     - translate to lower case (except in quotes)
         l0     - disable translate to lower case
           p1   - 1 presence qualifier(31-60) & 1 absence qualifier(61-80)
           p2   - 2 presence quals(31-60)+(61-80) & NO absence qual
             t1 - type 1 table (qualifiers apply only to current line)
             t2 - type 2 table (qualifiers independent of search pats)
 User OPtion (uop) defaults  = q1b2c0e1l1p1t2
  null to accept or re-specify (1 or more)   -->    <-- accept dflt options
 option to bypass until pattern - or null    -->    <-- null
 option to end search ? - or null to disable -->    <-- null
 match: i=case-insens, p=patterns(@,#,etc)
    q1=no scan in singles,q2=doubles,q3=both
 enter match options: i,p,q1/q2/q3,n,or null -->    <-- null
 display/edit/print/none ? (more/vi/lp/null) -->    <-- null

cobscan2d demo #1 - report

 JOB: $jobname  dir: bat1  matchops: dg  userops: q1b2c0e1l1p1t2
 table-file: tf/datetbl1  searchbgn:   searchend:
 ====================================================== 1999/09/16_11:56:07
 year~~~~~~~~~~~~~~~~~~~~~~~~~~ > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 date~~~~~~~~~~~~~~~~~~~~~~~~~~ > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 year~~~~~~~~~~~~~~~~~~~~~~~~~~ < ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 date~~~~~~~~~~~~~~~~~~~~~~~~~~ < ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 year~~~~~~~~~~~~~~~~~~~~~~~~~~ add ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 date~~~~~~~~~~~~~~~~~~~~~~~~~~ add ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 year~~~~~~~~~~~~~~~~~~~~~~~~~~ subtract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 date~~~~~~~~~~~~~~~~~~~~~~~~~~ subtract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ====================================================== 1999/09/16_11:56:07
 000040     subtract birth-year from age-calc-year giving emp-age.
 000046                  1 hits @EOF: bat1/cobolp.bat
 000027     if exp-test-date < '750101'
 000034     if wm-expiry < exp-test-date
 000037                  2 hits @EOF: bat1/cobolw.bat
 000037     if exp-test-date < '750101'
 000045        if expiry-date < exp-test-date
 000048                  2 hits @EOF: bat1/coboly.bat
 ====================================================== 1999/09/16_11:56:07
  EOD: 000005 hits in 0003 files of 0032 total (002370 lines)

Goto:   Begin this document End this document UVSI Home-Page

D4. COBscan: cobscan2d - scan directory for matches to a table

cobscan2d - demo #2 (option e0)


 uvcopy cobscan2d,fild1=bat1,fili2=tf/datetbl1
 =============================================
 q1b2c0e1l1p1t2 - user option defaults (uop=...)
 q1             - prompt oprtr to change uops (q0 inhibits prompt)
   b2           - blank cols 73-80 before scan, b0 to inhibit
     c1         - scan *comment lines
       e0       - end stmnts on PERIOD or END-verb
       e1       - end stmnts on next VERB (as well as period/end-)
         l1     - translate to lower case (except in quotes)
         l0     - disable translate to lower case
           p1   - 1 presence qualifier(31-60) & 1 absence qualifier(61-80)
           p2   - 2 presence quals(31-60)+(61-80) & NO absence qual
             t1 - type 1 table (qualifiers apply only to current line)
             t2 - type 2 table (qualifiers independent of search pats)
 User OPtion (uop) defaults  = q1b2c0e1l1p1t2
  null to accept or re-specify (1 or more)   --> e0 <-- see NOTE1 below
 option to bypass until pattern - or null    -->    <-- null
 option to end search ? - or null to disable -->    <-- null
 match: i=case-insens, p=patterns(@,#,etc)
    q1=no scan in singles,q2=doubles,q3=both
 enter match options: i,p,q1/q2/q3,n,or null -->    <-- null
 display/edit/print/none ? (more/vi/lp/null) -->    <-- null

See the output report on the next page --->

Option 'e0' makes the report longer than the 'e1' report on prior page because e0 ends COBOL statements only on period & 'end-', whereas option 'e1' ends stmnts on the next COBOL verb (as well as period/end-).

Goto:   Begin this document End this document UVSI Home-Page

D5. COBscan: cobscan2d - scan directory for matches to a table

cobscan2d demo #2 - report (option e0)

 JOB: $jobname  dir: bat1  matchops: dg  userops: q1b2c0e1l1p1t2e0
 table-file: tf/datetbl1  searchbgn:   searchend:
 ====================================================== 1999/09/16_11:58:20
 year~~~~~~~~~~~~~~~~~~~~~~~~~~ > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 date~~~~~~~~~~~~~~~~~~~~~~~~~~ > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 year~~~~~~~~~~~~~~~~~~~~~~~~~~ < ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 date~~~~~~~~~~~~~~~~~~~~~~~~~~ < ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 year~~~~~~~~~~~~~~~~~~~~~~~~~~ add ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 date~~~~~~~~~~~~~~~~~~~~~~~~~~ add ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 year~~~~~~~~~~~~~~~~~~~~~~~~~~ subtract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 date~~~~~~~~~~~~~~~~~~~~~~~~~~ subtract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ====================================================== 1999/09/16_11:58:20
 000040     subtract birth-year from age-calc-year giving emp-age.
 000046                  1 hits @EOF: bat1/cobolp.bat
 000027     if exp-test-date < '750101'
               display 'EXPIRY TEST DATE INVALID' upon console stop run.
 000034     if wm-expiry < exp-test-date
               move warmas-rec to expire-rec
               write expire-rec before advancing 1 line.
 000037                  2 hits @EOF: bat1/cobolw.bat
 000037     if exp-test-date < '750101'
               display 'EXPIRY TEST DATE INVALID' upon console stop run.
 000044     if purchase-date not = spaces
               if expiry-date < exp-test-date
                  move warmas-rec to expire-rec
                  write expire-rec before advancing 1 line.
 000048                  2 hits @EOF: bat1/coboly.bat
 ====================================================== 1999/09/16_11:58:21
  EOD: 000005 hits in 0003 files of 0032 total (002370 lines)

Option 'e0' makes the report longer than the 'e1' previous report because e0 ends COBOL statements only on period & 'end-', whereas option 'e1' ends stmnts on the next COBOL verb (as well as period/end-).

Goto:   Begin this document End this document UVSI Home-Page

E1. COBscan: cobrep1d - copy directory replacing 1 pattern with alternate

'cobrep1d' is similar to 'rep1d' but adapted for cobol programs.

The main difference is that cobrep1d will table lines until a period or end- verb reached & then scan for the search pattern & qualifiers on the complete cobol statement which may be multiple lines. cobrep1d also allows for replace patterns that exceed column 72 & will either squeeze left or split lines if required.

Cobrep1d will be somewhat slower than rep1d & you might use rep1d when you know you do not need the multi-line, squeeze,& line-split features.

demo operating instructions


 uvcopy cobrep1d,fild1=bat1       <-- search/rep patterns will be solicited
 ==========================
 uop=q1e1l1s1p1 - option defaults
       e0       - end stmnts on PERIOD or END-verb
       e1       - end stmnts on next VERB (as well as period/end-)
         l1     - translate to lower case (except in quotes)
         l0     - disable translate to lower case
           s1   - sequence# output records in cols 1-4
           s0   - do not seq# outrecs (audit file recs always seq#)
             p1 - 1 presence qual(31-60) & 1 absence qual(61-80)
             p2 - 2 presence quals(31-60)+(61-80) & NO absence quals
 User OPtion (uop) defaults  = q1e1l1s1p1
  null to accept or re-specify (1 or more)     -->         <-- accept defaults
 did you create out directory/remove files ?   --> y       <-- reply y
 enter search (";" matches blank,comma,period) -->  name;  <-- SEARCH PATTERN
 enter replace(";" matches any ";" in search)  -->  name1; <-- REPLACEMENT
 enter qualifier present (null to disable)     -->         <-- null
 enter qualifier absent, or 2nd present        -->         <-- null
 bypass until pattern - or null to disable     -->         <-- null
 end search pattern - or null to disable       -->         <-- null
 p=matchchars(@,#,etc), s=matchchars in replace
 q1=no scan in single quotes,q2=doubles,q3=both
 d1(default) ";" matches blank/comma/period
 enter match options: p,s,d1/d0,q1/q2/q3,n,    -->         <-- null
 display/edit/print/none ? (more/vi/lp/null)   -->         <-- null

Please see the audit report on the next page --->

The search pattern must be entered as ' name;' & replacement as ' name1;'

The leading blank is required to avoid matching words ending in name.

The trailing ';' (semi-colon) will match a blank, a period, or a comma. If you entered a trailing blank, you would not match the word when ended by a period or comma.

Goto:   Begin this document End this document UVSI Home-Page

E1a. cobrep1d - copy directory replacing 1 pattern with alternate

audit report from demo on prior page

 JOB: $jobname  indir: bat1  outdir: tmp
 search:  name;   replace:  name1;
 qual-present:   absent:   searchbgn:   searchend:
 match-options: d1  user-options: q1e1l1s1p1
 ====================================================== 1999/09/16_13:46:08
 0075uv     05 name1            pic x(25).
 0129uv     move cm-company to name1.
 0149                              2 reps @EOF: tmp/cobol1.bat
 0022uv     05 name1            pic x(25).
 0034uv     move cm-company to name1.
 0037                              2 reps @EOF: tmp/cobolb.bat
 ====================================================== 1999/09/16_13:46:09
  EOD: 00004 reps in 0002 files of 0032 total (02370 lines)

This illustrates just 1 of the differences between COBOL74 & COBOL85. 'name' is a reserved word in cobol85 & you might solve this problem by converting 'name' to 'name1'.

There are several other differences and it makes more sense to use an unlimited table of search & replace patterns.

See 'cobrep2d' on the following pages --->

Goto:   Begin this document End this document UVSI Home-Page

E2. COBscan: cobrep2d - copy directory searching/replacing by table

'cobrep2d' is similar to 'rep2d' but adapted for cobol programs.

Cobrep2d will table lines until a period or end-verb reached & then scan the complete statement using the table of search patterns & qualifiers. cobrep2d also allows for replace patterns that exceed column 72 & will either squeeze left or split lines if required.

cobrep2d demo Op. Instrns.


 uvcopy cobrep2d,fild1=bat1,fild2=tmp,fili3=tf/cobrep.tbl
 =========================================================
 uop=q1e1l1s1p1 - option defaults
       e0       - end stmnts on PERIOD or END-verb
       e1       - end stmnts on next VERB (as well as period/end-)
         l1     - translate to lower case (except in quotes)
         l0     - disable translate to lower case
           s1   - sequence# output records in cols 1-4
           s0   - do not seq# outrecs (audit file recs always seq#)
             p1 - 1 presence qual(31-60) & 1 absence qual(61-80)
             p2 - 2 presence quals(31-60)+(61-80) & NO absence quals
 User OPtion (uop) defaults  = q1e1l1s1p1
  null to accept or re-specify (1 or more)       -->    <-- accept defaults
 did you create out directory, remove files ?    --> y  <-- reply y
 enter bypass until pattern - or null to disable -->    <-- null
 enter end search pattern or null to disable     -->    <-- null
 p=matchchars(@,#,etc), s=matchchars in replace
 q1=no scan in single quotes,q2=doubles,q3=both
 enter match options: p,s,q1/q2/q3,n,or null     -->    <-- null
 display/edit/print/none ? (more/vi/lp/null)     -->    <-- null
NOTE
  • Please see the audit report on the next page --->

Goto:   Begin this document End this document UVSI Home-Page

E2a. cobrep2d - copy directory searching/replacing by table

audit report for demo on prior page

 JOB: $jobname  indir: bat1  outdir: tmp  table: tf/cobrep.tbl
 searchbgn:   searchend:   match-optns: dfg  user-optns: q1e1l1s1p1
 ====================================================== 1999/09/16_14:10:38
  name;~~~~~~~~~~~~~~~~~~~~~~~~ name1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  title;~~~~~~~~~~~~~~~~~~~~~~~ title1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  test;~~~~~~~~~~~~~~~~~~~~~~~~ test1;~~~~~~~~~~~~~~~~~~~~~~~ display ~~~~~~~~~~~ upon ~~~~~~~~~~~~~~
  class;~~~~~~~~~~~~~~~~~~~~~~~ class1;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ~~~~~~~~~~~~~~~end of table marker '~~' in col 1&2~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ====================================================== 1999/09/16_14:10:38
 0075uv     05 name1            pic x(25).
 0129uv     move cm-company to name1.
 0149                              2 reps @EOF: tmp/cobol1.bat
 0077uv     05 title1           pic x(20).
 0157                              1 reps @EOF: tmp/cobol5.bat
 0022uv     05 name1            pic x(25).
 0034uv     move cm-company to name1.
 0037                              2 reps @EOF: tmp/cobolb.bat
 ====================================================== 1999/09/16_14:10:39
  EOD: 00005 reps in 0003 files of 0032 total (02370 lines)

notes

Please note that the conversion from mainframe to MicroFocus cobol is usually performed by the 'cnvMF3' job which includes a table similar to the above, so you would not have to run this particular conversion.

Also note that cobrep1d/cobrep1d copy comments & blank lines immediately & table cobol text lines until a period or end-verb reached. The result is that if you code comments & blank lines in the midst of cobol text lines they will be brought to the front of that statement. If this is a problem for you, you can use rep1d/rep2d which never change line sequences (but do not handle multi-line search/qualifies).

Goto:   Begin this document End this document UVSI Home-Page

F1. COBscan: Listings of uvcopy jobs in this section

The uvcopy instructions may be listed here for the new & more significant jobs presented in this section - listed in the same sequence here at the end of the section as the documentation was presented at the front. As of Nov 98, no jobs are listed, but all are available in ~uvadm/pf/...

              '*' <-- indicates listing present
C1. SCANjobs - review of previously documented jobs (scan1d,scan2d).
  - to be compared to the COBscan jobs presented in this section.
C1.  scan1d - scan any directory for any 1 pattern & report matches.
C2.  scan2d - scan any directory for matches to a table (type 1 or 2).
D1. COBscan - presented in this section - see list below & please
  compare these to the general purpose text jobs above.
D1. cobscan1d - scan a cobol directory for any 1 pattern & report matches
D2. cobscan2d - scan a cobol directory for matches to a table of patterns
  type 1 - qualifier applies only to search pattern on that line
  type 2 - search patterns & qualifiers are independent
E1. COBreps - presented in this section - see list below & please
  compare these to the general purpose text jobs previously
  documented in REPjobs.doc (rep1d & rep2d).
E1. cobrep1d - scan a cobol directory searching for any 1 pattern &
  replacing with an alternate (qualifier optional)
  - You may examine in the uvadm/pf directory
E2. cobrep2d - scan a cobol directory searching & replacing depending on
  a table of search & replace patterns (qualifier optional)
  - You may examine in the uvadm/pf directory

Goto:   Begin this document End this document UVSI Home-Page

Visitor Counters for ThisYear and LastYear