A1. | cobmap1 - create COBOL record layouts from source programs or copy books |
(field lengths, types, start,& end bytes on the right side) |
For COBOL shops, cobmap is probably the most popular of the more than 400 pre-programmed jobs provided for the uvcopy interpreter. The cobmaps are especially valuable for conversions, Year 2000 projects, whenever you need to know field locations for internal or external use. I suggest generating cobmaps for the entire directory of copy-books & mounting in a 3 ring binder for easy availability.
cobmap2 - Alternate cobmap for Burroughs comp (1/2 byte aligned) fields
B1. | cleanup - source code maintenance utility job with options to: |
- translate to UPPER case | |
- translate to lower case (except within quotes) | |
- sequence# in cols 1-6 (or clear, or store from 73-78) | |
- gang program name in cols 73-80 (or clear) | |
- convert single quotes to double quotes (or vice-versa) | |
- translate copybook names to UPPER or lower case | |
- enclose copybook names in single or double quotes | |
- enclose call program names in single or double quotes | |
- insert TIP/ix FSE options control record (lower case, etc) |
C1. | cobcopy1 - copy cobol programs expanding the 'copy' statements. |
- makes it easier to investigate unfamiliar programs, because | |
you can then search for all references to any fieldname. | |
- pre-requisite to some other jobs, such as cross-referencing | |
selected field-names in all COBOL programs (see XREFjobs.htm). |
D1. | cobcopy2 - copy COBOL programs encoding group-names with field lengths & |
date-field components, to facilitate Year 2000 investigations. | |
- Refer to DATEjob1 to see how the output of this job is used. |
E1. | cobfil51 - create a report of files used in COBOL programs, showing: |
external-name,open-modes,org,access,copybookname,internal-name | |
- especially useful for conversion planning |
F1. | cpybook1 - scan a COBOL program directory & verify all copy-books present |
- write a report file with copy commands for missing copybooks | |
- write 2nd file with names of programs with missing copybooks |
G1. | uncopy1 - create new version of copybook with comp/binary removed, in |
preparation for reform2/3, which generates uvcopy jobs to | |
convert data files to all unpacked numeric fields. |
Goto: Begin this document , End this document , UVSI Home-Page
H1. | fixrpt1 - Fix reports with missing LineFeeds, caused by COBOL programs |
with 'write AFTER advancing' (vs write BEFORE advancing). | |
- Occurs when mainframe COBOL programs are converted to Unix. | |
- fixrpt1 replaces x'0D0C' with x'0D0A0C' (CR+FF with CR+LF+FF) |
H2. | fixrpt2 - A better solution to missing lineFeeds, fixrpt2 searches for |
any CR not followed by an LF, & inserts an LF when required. | |
- Only fixrpt2 is documented (fixrpt1 is present in uvadm/pf). | |
- As of Mar97, uvlist has options to perform these functions | |
directly while printing the file via scripts uvlp18, etc |
I1. | cobmod - the classic example of a mass change to a program library |
- your company name changes (hard-coded in hundreds of programs) | |
- will take weeks if edited manually | |
- 4 methods will be presented & compared: | |
- note that the last 2 methods are general purpose driven by a | |
table file of any desired search & replace patterns. |
J1. | cobmod1 - using 'sed' (UNIX stream editor) |
- inadequate if the new name is longer & would exceed col 72 | |
or if shorter any constants in 73-80 would be moved left | |
into the cobol text area. |
J2. | cobmod2 - 1st of 3 methods using 'uvcopy' |
- this is a simplistic solution that is also inadequate | |
- an improvement on sed since only cols 8-72 can be modified | |
but this method lacks the 'line-splitting' logic of the next 3. |
J3. | cobmod3 - this job allows for most of the shortcomings of methods 1 & 2. |
- will split lines if col 72 is exceeded & will adjust the length | |
of the preceding pic x(??), but only if on the same line. |
J4. | cobmod4 - this job allows the pic x(??) to be on the previous line. |
- this method tables lines until a period is reached, which allows | |
correction of preceding PIC X(??) length on the previous line. |
K1. | cobfix72 - correct cobol programs that have been processed by some mass |
change utility that did not have the ability to split lines | |
exceeding column 72. |
L1. | uvcopy parameter file listings for jobs in this section are listed |
at the end of the section in the same sequence as the operating | |
instructions are presented at the beginning of the section. |
Goto: Begin this document , End this document , UVSI Home-Page
M: COBOL aids documented in COBaids2.htm
cpyname1/vi/cpyflip1/rep2 - replacing old record layouts with copybooks
Legacy COBOL sites often have old programs with embedded record layouts (ie - not using copy-books). Many of these sites did subsequently create standard copybooks which were used for any newly developed programs. It is desirable to replace old embedded record layouts in the programs with 'copy' statements for our new standard copy-books. However, we cant just replace the record definitions with the copy commands because the fieldnames in the old programs (used thruout the procedure division) usually do not match the field names in the new copybooks. This section will present a plan to help automate this desired process.
1. cpyname1 - extract field names from copybooks for search/replace tables. 2. vi - add the old fieldnames (in old programs) to the tables. 3. cpyflip1 - reverse the search/replace table as required for rep2. 4. rep2 - convert old program fieldnames to standard copybook names using search/replace tables created by cpyname1/vi/cpyflip1
N: COBOL aids documented in COBcheck.htm
chkupsi2 - scan mainframe COBOL programs for DISPLAY UPON SYSSWCH.
chkadv0 - scan cobol for write printer without BEFORE/AFTER ADVANCING (mainframe defaulted space, but UNIXMicroFocus will overprint)
chkopen2 - scan COBOL programs for multiple 'open's to same printer file. (UNIX/MicroFocus will overwrite the previous file)
chkcomreg2 - scan COBOL for ACCEPT/DISPLAY FROM/UPON SYSCOM(COMREG).
chksyslst2 - scan mainframe COBOL programs for DISPLAY UPON <SYSLST>
occurs1 - scan cobmaps for occurs with mixed data types
occurs2 - scan cobmaps for occurs within occurs
O: COBOL aids documented in COBextra.htm
cobcsf1 - convert cobol sysin ACCEPTs to disc files
cobupsi1 - modify COBOL programs that set UPSI switches
comreg1 - modify COBOL programs that ACCEPT from/DISPLAY upon COMREG
advfix1 - fix COBOL programs with LINAGE or omitted ADVANCING lines
acceptU1 - force UPPER-case on data 'ACCEPT'ed from console. (recommended for COBOL programs converted from mainframes)
Goto: Begin this document , End this document , UVSI Home-Page
1 copybook at a time - see ENTIRE DIRECTORY 2 pages ahead --->
uvcopy cobmap1,fili1=cpy/cshrec <-- try this ===============================
uop=b0c0f1i0l1m1n0p1r0s0t1 - option defaults, changes will be solicited uop=b1 - bypass *comments before level 01 (b0 to show) uop=__c0 - column zero relative, c1 for one relative uop=____f1 - sequence# fillers (see reform2) (f0 inhibits) uop=______i0 - display operator messages, "i7" to inhibit uop=________l1 - level# to begin record def (l5 for TIP) uop=__________m1 - minimum lines to be reported (bypass if less) uop=____________n0 - newpage between layouts (n1 activates) uop=______________p1 - prompt rpt disposition (vi,more,uvlp,uvlp12) uop=________________r1 - separate report files for each 01 level uop=__________________s1 - source program vs copybook (default s0) uop=__________________s3 - report work storage in source prgm (s1+s2=s3) uop=____________________t1 - truncate after col 66 to fit 8 1/2 paper uop=____________________t2 - no truncate, print via uvlp12 fit 8 1/2 uop=____________________t4 - expand for multiline stmts 90 cols (uvlp14) uop=____________________t8 - expand for multiline stmts 110 cols (uvlp16) User OPtion (uop) defaults = q1b0c0f1i0l1m1n0p1r0s0t1 null to accept or re-specify (1 or more) -->
enter: more/vi/uvlp/null, report file = tmp/cshrec or uvlp (10cpi,66 cols), uvlp12 (all text), uvlp14 (expanded) --> vi <-- to display output
cobmap1 start-end bytes for cobol record fields 199906211405 pg# 0001 cpy1/cshrec RCSZ=0256 bgn-end lth typ * customer sales history record 05 cshrec. 10 cs-num pic 9(6). 000-0005 006 n 06 10 cs-type pic x. 006-0006 001 10 cs-del pic x(3). 007-0009 003 10 cs-history. 15 cs-mth-hist occurs 24. 20 cs-amt pic s9(9)v99 comp-3. 010-0015 006pns 11 20 cs-yymm pic 9(4). 016-0019 004 n 04 15 cs-life-sales pic s9(9)v99 comp-3. 250-0255 006pns 11 * customer comment record - id by '*' in cs-type 10 cs-cmt-rec redefines cs-history. 15 cs-comment pic x(100). 010-0109 100 15 filler001 pic x(146). 110-0255 146 *RCSZ=0256 0256
Goto: Begin this document , End this document , UVSI Home-Page
cobmap1 start-end bytes for cobol record fields 199906211406 pg# 0001 cpy1/rcprec RCSZ=2815 bgn-end lth typ * recap master record layout (recap) 05 rcp-rec. 10 rcp-key1. 15 rcp-k1-date pic 9(8). 000-0007 008 n 08 88 rcp-control-rec value zero. * 10 rcp-control-record. 15 rcp-cont-items occurs 20 indexed rcpa. 20 rcp-cont-type pic x. 008-0008 001 88 rcp-cont-type-beer value 'B'. 88 rcp-cont-type-soda value 'S'. 88 rcp-cont-type-tea value 'T'. 88 rcp-cont-type-unassigned value 'X'. 88 rcp-cont-type-valid value 'B' 'S' 'T' 'X'. 20 rcp-cont-color pic x. 009-0009 001 88 rcp-cont-color-flint value 'F'. 88 rcp-cont-color-emerald value 'E'. 88 rcp-cont-color-valid value 'F' 'E'. 20 rcp-cont-capacity pic 99v999 comp-3. 010-0012 003pn 05 15 rcp-cont-warehouses occurs 30 indexed rcpb. 20 rcp-cont-wh-id pic x. 108-0108 001 20 rcp-cont-wh-desc pic x(15). 109-0123 015 20 rcp-cont-wh-cust pic 9(4). 124-0127 004 n 04 20 rcp-cont-wh-cap pic s9(7) comp-3. 128-0131 004pns 07 20 rcp-cont-wh-freight pic s9(5)v99 comp-3. 132-0135 004pns 07 15 filler001 pic x(1867). 948-28141867 * 10 rcp-data-record redefines rcp-control-record. 15 rcp-furnace occurs 4 indexed rcpw. 20 rcp-furn-elec-kw pic s9(5) comp-3. 008-0010 003pns 05 20 rcp-furn-gas-mcf pic s9(5) comp-3. 011-0013 003pns 05 20 rcp-furn-seed-ct pic s9(5) comp-3. 014-0016 003pns 05 20 rcp-furn-tons-pull pic s9(6)v999 comp-3. 017-0021 005pns 09 15 rcp-items occurs 20 indexed rcpx. 20 rcp-quantities occurs 2 indexed rcpy. 25 rcp-beg-bal pic s9(9)v99 comp-3. 064-0069 006pns 11 25 rcp-production pic s9(9)v99 comp-3. 070-0075 006pns 11 25 rcp-label-losses pic s9(9)v99 comp-3. 076-0081 006pns 11 25 rcp-alvey-losses pic s9(9)v99 comp-3. 082-0087 006pns 11 25 rcp-adjustments pic s9(9)v99 comp-3. 088-0093 006pns 11 25 rcp-shipments pic s9(9)v99 comp-3. 094-0099 006pns 11 25 rcp-returned-ware pic s9(9)v99 comp-3. 100-0105 006pns 11 25 filler002 pic s9(9)v99 comp-3. 106-0111 006pns 11 25 filler003 pic s9(9)v99 comp-3. 112-0117 006pns 11 25 filler004 pic s9(9)v99 comp-3. 118-0123 006pns 11 15 rcp-warehouses occurs 30 indexed rcpz. 20 rcp-wh-tot-stored pic s9(7) comp-3. 2464-2467 004pns 07 20 rcp-wh-tot-gross pic s9(9)v99 comp-3. 2468-2473 006pns 11 15 filler005 pic x(51). 2764-2814 051 *RCSZ=2815 2815
Goto: Begin this document , End this document , UVSI Home-Page
This page will show you how to create record layout reports for all copybooks in the directory. I suggest you laser print these reports, 3 hole punch,& file the reports in a 3 ring binder.
* These layouts are a valuable resource both during & after the conversion.* * It is a big help to have these layouts immediately available for many * * reasons such as determining sort field keys, etc. They are especially * * valuable during the conversion for checking the validity of the file * * transfer & field conversions. Use in conjunction with the 'uvhd' utility * * which will display data files in vertical hex with byte# scales. *
1. mkdir maps - make directory to receive the reports ==========
2. uvcopyx cobmap1 cpy maps uop=q0i7p0t1 - create all record layouts ===================================== at 10 cpi (60 cols of text)
3. uvlpd maps - print all record layouts at 10 cpi ==========
3a. uvlp maps/filexx - OR print separate layouts as required ================
'uvcopyx' is a script that repeats a uvcopy job (cobmap1 in this case) for all files in the input directory (copy) & writes the generated reports to the output directory (map).
option 'q0' |
|
option 'i7' |
|
option 'p0' |
|
option 't1' |
|
Goto: Begin this document , End this document , UVSI Home-Page
If your copy books are more complex you might want to allow more text columns via option 't'. Then print with uvlp12, uvlp14, or uvlp18. To print all layouts in directory use uvlpd12, uvlpd14, or uvlpd18.
option 't1' |
|
option 't2' |
|
option 't4' |
|
option 't8' |
|
2. uvcopyx cobmap1 cpy map2 uop=q0i7p0t2 - generate reports for 12 cpi ===================================== but inhibit query for print
3. rmzf maps - remove zero length reports, caused by copy-books ========= for procedures vs record layouts.
4. uvlpd12 map2 - print all cobmaps in the map2 directory ============
Note |
|
4a. uvlp12 map2/filexx - print layout for desired copybooks ================== from previously generated cobmaps (#2 above).
4b. cobmapx cpy/filexx - script to run cobmap1 using original copybook ================== as input, writing a tmp file,& printing that (see listing below)
# cobmapx - generate & print record layout from COBOL copybook # - this script simplifies uvcopy 'cobmap1' job # #usage: cobmapx copybookname # ==================== # if [[ ! -f "$1" ]] then echo "usage: cobmapx filename ($1 not a file)"; exit 99; fi # uvcopy cobmap1,fili1=$1,uop=q0i7t2p0 # crate layout, inhibit prompt # uvlp12 cobmap.tmp # print the created tmp file # exit 0
Goto: Begin this document , End this document , UVSI Home-Page
'cobmap2' is an alternate version (of cobmap1) for Burroughs comp fields which can be 1/2 byte aligned. Cobmap2 calculates field lengths in nibbles & then converts back to bytes when creating the output report. Cobmap2 indicates 1/2 byte alignments with < = > vs '-' start-end separator. Burroughs binary field lengths are calculated differently than in cobmap1 - the length varies from 1 to 8 depending on digits in picture definition.
uvcopy cobmap2,fili1=cpy1/spanrec,filo1=tmp/spanrec create demo cobmap1 ===================================================
cobmap2 start-end bytes for cobol record fields 199804041306 pg# 0001 cpy1/spanrec span-rec RCSZ=0140 lth typ bgn-end
01 span-rec . 05 span-rec-type pic 9 comp . 001kn 000>0000 05 span-acct-status pic 9 comp . 001kn 000<0000 05 span-cycle pic 99 comp . 001kn 001-0001 05 span-acct-no pic x(18). 018 002-0019 05 span-name pic x(24). 024 020-0043 05 span-serv-addr pic x(24). 024 044-0067 05 span-cust-memo pic x(40). 040 068-0107 05 span-prev-bal pic s9(9)v99 binary. 006bns 108-0113 05 span-acct-bal pic s9(9)v99 binary. 006bns 114-0119 05 span-credit-status pic 9 comp . 001kn 120>0120 05 span-hold-code pic 9 comp . 001kn 120<0120 05 span-mbs-flag pic 9 comp . 001kn 121>0121 05 span-deff-amt pic 9(8)v99 comp . 006kn 121=0126 05 span-deff-amt-date pic 9(6) comp . 004kn 126=0129 05 span-deff-no-mths pic 99 comp . 002kn 129=0130 05 span-msg-no pic 9(2) comp . 002kn 130=0131 05 span-area-code1 pic 999 comp. 002kn 131<0132 05 span-phone-no1 pic 9(7) comp. 004kn 133>0136 05 span-filler pic 9 comp . 001kn 136<0136 05 span-rec-id pic 999. 003 n 137-0139 *RCSZ=0140 0140
NOTE |
|
'-' - start nibble even, nibble length even '>' - start nibble even, nibble length odd, 1/2 byte aligned on right '<' - start nibble odd, nibble length odd, 1/2 byte aligned on left '=' - start nibble odd, nibble length even, 1/2 byte aligned left & right
Goto: Begin this document , End this document , UVSI Home-Page
This job will copy a source code (COBOL,JCL,etc) with options to modify as shown below on the demo operating instructions.
uvcopy cleanup,fili1=bat1/cobol1.bat,filo1=cobol1.tmp,uop=c1g8s8t1e2 ==================================================================== uvcopy cleanup <-- minimum entry, will prompt for options & filenames ==============
uop=q1a0b0c0d0e0f0g0j0k0n0p0s0t0v1w0x0 - dflt options (copy no changes) q0 - inhibit option prompt (uop=q0?? on cmd line) b1 - drop all blank lines b2 - drop lines blank in cols 2-128 (ignore col 1) c1 - translate COBOL copy BOOKNAMES to lower case c2 - translate COBOL copy booknames to UPPER case c4 - translate to UPPER if prefix TC- (c4+c1=c5) c8 - remove any "of tip" on copy stmnt (c13) d1 - convert double quotes to singles d2 - convert single quotes to doubles e1 - enclose COBOL copy `booknames` in single quotes e2 - enclose COBOL copy "booknames" in double quotes e4 - append copybook names with ".cpy" (in programs) f1 - insert FSE CTLREC (& drop any existing) f2 - don't insert, drop any existing FSE ctlrec g1 - sequence number columns 73-80 incrementing by 1 g2 - sequence number columns 73-80 incrementing by 10 g4 - gang program name in 73-80 (any .ext removed) g8 - clear columns 73-128 to blanks j1 - translate call subrtn names to lower case j2 - translate call subrtn NAMES to UPPER case k1 - enclose call subrtn names in single quotes k2 - enclose call subrtn names in double quotes l1 - COBOL inhibit changes to lines with "*" col 7 l2 - Assembler inhibit mods to lines with "*" col 1 l4 - script inhibit changes to lines with "#" col 1 n1 - translate output filename to lowercase p1 - convert " picture " to " pic " s1 - sequence# in columns 1-6 incrementing by 1 s2 - sequence# in columns 1-6 incrementing by 10 s4 - copy to cols 1-6 from cols 73-78 s8 - clear columns 1-6 to blanks t1 - translate text to lower (except in quotes) t2 - translate text to UPPER v1 - convert tabs to blanks (v2 = 2 blanks, etc) w1 - drop lines with " PAGE " anywhere in 80-128 w2 - drop lines with "MEMBER NAME" anywhere in 1-80 x# - shift left #columns (x6 shifts 7-128 to 1-122) y1 - concatenate assembler continued lines NB col 72 y2 - squeeze assembler *cmt lines to 1 blank between words User OPtion (uop) defaults = q1a0b0c0d0e0f0g0j0k0n0p0s0t0v1w0x0 null to accept or re-specify (1 or more) --> c1g8s8t1e2
note |
|
Goto: Begin this document , End this document , UVSI Home-Page
000001 IDENTIFICATION DIVISION. COBOLB 000002* COBOLB - TEST/DEMO PRINT TELEPHONE# LIST FROM CUSTOMER MASTER COBOLB 000003 PROGRAM-ID. COBOLB. COBOLB 000004 ENVIRONMENT DIVISION. COBOLB 000005 CONFIGURATION SECTION. COBOLB 000006 SPECIAL-NAMES. COBOLB 000007 SYSCHAN-7 IS TOP-OF-PAGE. COBOLB 000008 INPUT-OUTPUT SECTION. COBOLB 000009 FILE-CONTROL. COBOLB 000010 SELECT CUSMAS ASSIGN TO DISC-CUSMAS-F COBOLB 000011 ORGANIZATION IS SEQUENTIAL COBOLB 000012 ACCESS MODE IS SEQUENTIAL. COBOLB 000013 SELECT CUSLIST ASSIGN TO PRINTER-CUSLIST-F. COBOLB 000014 DATA DIVISION. COBOLB 000015 FILE SECTION. COBOLB 000016 FD CUSMAS RECORD CONTAINS 256 CHARACTERS. COBOLB 000017 01 CMR. COPY CMRECORD. COBOLB
*******$FSE$-000$C$L$N$N$DATE $N$16$04$ identification division. * cobolb - test/demo print telephone# list from customer master program-id. cobolb. environment division. configuration section. special-names. syschan-7 is top-of-page. input-output section. file-control. select cusmas assign to disc-cusmas-f organization is sequential access mode is sequential. select cuslist assign to printer-cuslist-f. data division. file section. fd cusmas record contains 256 characters. 01 cmr. copy "CMRECORD".
Goto: Begin this document , End this document , UVSI Home-Page
2. uvcopyx cleanup bat1 bat2 uop=q0i7c2d2e2f1g8s8t1 ================================================ - convert all programs in bat1 to bat2
Goto: Begin this document , End this document , UVSI Home-Page
'cobcopy1' can be used to to investigate programs that are not familiar to you. You can expand the copy books with cobcopy1 & print the result. You can then study the complete program without having to refer separately to the various copybooks. You can search the result with the editor & find all references to any given fieldname.
The 'cobcopy1' job is the 1st step for various cobol diagnostic jobs in the Vancouver Utilities (such as Y2K investigations). Rather than build copybook directory access into the several diagnostic jobs, the cobcopy1 job can be run once to copy your cobol source library to an alternate directory while expanding any 'copy' statements. The alternate directory is then used for the various cobol diagnostic jobs.
XREFjobs.htm illustrates using cobcopy1 as the 1st step in a plan to cross-reference COBOL fieldnames identified by a table file of fieldnames or partial name patterns.
cobcopy1 |
|
cobxtbl2 |
|
cobxrpt3 |
|
Please see the operating instructions on the next page --->
Please see a sample output program 2 pages ahead --->
Goto: Begin this document , End this document , UVSI Home-Page
The following demo may be run in subdir /home/uvadm/mvstest, which contains the following relevant subdirectories:
cbls |
|
cpys |
|
#1. mkdir cblsx - make alternate directory to receive output
#2. uvcopy cobcopy1,fild2=cbls,fild3=cblsx,fild4=cpys =================================================
uop=q1l3r0 |
|
User OPtion (uop) defaults = q1l3r0 null to accept or re-specify (1 or more) --> null to accept or re-specify (1 or more) --> <-- accept defaults
cobcopy1:040215:143545: EOF fili01 53 rds, 0 wrts, 2124 size; cbls/cap100.cbl cobcopy1:040215:143545: EOF filo02 0 rds, 53 wrts, 4293 size; cblsx/cap100.cbl cobcopy1:040215:143545: EOF fili03 16 rds, 0 wrts, 735 size; cpys/custmas.cpy cobcopy1:040215:143545: EOF fili01 39 rds, 0 wrts, 1526 size; cbls/car100.cbl cobcopy1:040215:143545: EOF filo02 0 rds, 55 wrts, 4455 size; cblsx/car100.cbl cobcopy1:040215:143545: EOF fili01 53 rds, 0 wrts, 2124 size; cbls/cgl100.cbl cobcopy1:040215:143545: EOF filo02 0 rds, 53 wrts, 4293 size; cblsx/cgl100.cbl cobcopy1:040215:143545: EOF fild01 5 rds, 0 wrts, 4096 size; cbls cobcopy1:040215:143545: EOF fild02 0 rds, 0 wrts, 4096 size; cblsx cobcopy1:040215:143545: EOF fild03 0 rds, 0 wrts, 4096 size; cpys
Please see car100.cbl output illustrated on the next page --->
Goto: Begin this document , End this document , UVSI Home-Page
000001 identification division . 000002* car100 - test mainframe conversion to micro focus cobol 000003 program-id . car100 . 000004 environment division . 000005 input-output section . 000006 file-control . 000007 select custmas assign custmas 000008 organization sequential access mode sequential . 000009 select nalist assign nalist organization line sequential . 000010 data division . 000011 file section . 000012 fd custmas record contains 256 characters . 000013 01 cm1 . copy "custmas.cpy" . 1* custmas - cobol copy "book.cpy" for customer.master file mvsjcl 2 10 cm-cust pic 9(6) . 3 10 cm-delete pic x(4) . 4 10 cm-nameadrs . 5 20 cm-name pic x(25) . 6 20 cm-adrs pic x(25) . 7 20 cm-city pic x(16) . 8 20 filler pic x . 9 20 cm-prov pic x(2) . 10 20 filler pic x . 11 20 cm-postal pic x(10) . 12 10 cm-telephone pic x(12) . 13 10 cm-contact pic x(18) . 14 10 cm-thisyr-sales pic s9(7)v99 comp-3 occurs 12 . 15 10 cm-lastyr-sales pic s9(7)v99 comp-3 occurs 12 . 16 10 filler pic x(16) . 000014 fd nalist record contains 120 characters . 000015 01 listrec . 000016 05 list-cust pic 9(6) . 000017 05 list-delete pic x(4) . 000018 05 list-nameadrs pic x(80) . 000019 05 list-telephone pic x(12) . 000020 05 list-contact pic x(18) . 000021 working-storage section . 000022 01 wrk-flds . 000023 05 cm1-eof pic x value " " . 000024 procedure division . 000025 mainline . 000026 open input custmas . open output nalist . 000027 read custmas at end move "1" to cm1-eof . 000028 perform dtlrtn until cm1-eof = "1" . 000029 close custmas nalist . 000030 stop run . 000031 dtlrtn . 000032 move spaces to listrec . 000033 move cm-cust to list-cust . 000034 move cm-delete to list-delete . 000035 move cm-nameadrs to list-nameadrs . 000036 move cm-telephone to list-telephone . 000037 move cm-contact to list-contact . 000038 write listrec before advancing 1 line . 000039 read custmas at end move "1" to cm1-eof .
Goto: Begin this document , End this document , UVSI Home-Page
Cobcopy2 will append field lengths & date field component names onto group-names, so that the Year 2000 analysis jobs can recognize group names used in comparisons of group field names.
Cobcopy2 depends on a table of date-field-names. A sample table tf/y2tbl2 is supplied & you can add to it depending on site conventions.
'cobcopy2' would be preceded by 'cobcopy1' (see previous sub-section) which copied the COBOL source programs to an alternate directory while expanding the copy-books.
'cobcopy2' will now copy the output of cobcopy1 to a 3rd directory while while encoding the group field names. Please see section DATEjob1.doc to see how the output directory can be used for Year 2000 investigations.
cobcopy1 cobcopy2 bat1 -----------------> bat2 --------------------> bat3 (original) (copy-books expanded) (group-names encoded)
input: 05 expiry 10 expiry-year pic 9(2). 10 expiry-month pic 9(2). 10 expiry-day pic 9(2). 05 expiry-test pic 9(6). ------------------------------------------------ if expiry less than expiry-test ... ------------------------------------------------
output: 05 wm-expiry@6@year . <--lth&grp-name encoded 10 wm-exp-year@2 pic 9(2) . 10 wm-exp-month pic 9(2) . 10 wm-exp-day pic 9(2) . 05 filler pic x(14) . ----------------------------------------- if wm-expiry@6@year < exp-test-date@6 <--lth&grp-name encoded -----------------------------------------
year~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ yy~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ yr~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ date~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ dte~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ymd~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mdy~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ julian~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ age-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -age~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note |
|
Goto: Begin this document , End this document , UVSI Home-Page
3. uvcopy cobcopy2,fili1=Flist,fild2=bat2,fild3=bat3,fili4=tf/y2tbl2 ===================================================================
note |
|
initialization - load the table of date-field-names - date,year,yr,yy, + any user additions for site usage
phase#1 - process DATA DIVISION field definitions - lines starting with 2 numerics (level#), quit when PROCEDURE DIV reached - scan each line for matches to the date-field-name table if match: build table item-lth entry for phase 2 copy/search/replace
_itemname_~~~~~~~~~~~~~_itemname@lth_~~~~~~~~~~~~~~~~~~
_groupname_~~~~~~~~~~~~_groupname@lth@datecomp_~~~~~~~~~
phase#2 - close files, reopen,& copy program to output file - searching/replacing via the groupname table built on phase#1
Goto: Begin this document , End this document , UVSI Home-Page
000001 identification division . 000002* cobolw - program to demo year 2000 date problems (datejobs.doc) 000003* - this program reads a file of warranty records & prints 000004* if the expiration date is less than an entered date 000005 program-id . cobolw . 000006 environment division . 000007 configuration section . 000008 special-names . 000009 sysconsole is con74 . 000010 input-output section . 000011 file-control . 000012 select warmaster assign to disc-warmas-f . 000013 select expirelist assign to printer-explist-f . 000014 data division . 000015 file section . 000016 fd warmaster record contains 64 characters . 000017 01 warmas-rec . copy warmasr replacing ==(wm)== by ==wm== . 1*warmasr - warranty master record 2 05 wm-cust pic x(6) . 3 05 wm-prod pic x(6) . 4 05 wm-descrip pic x(18) . 5 05 wm-purchase pic 9(6) . 6 05 wm-policy pic x(8) . 7 05 wm-expiry@6@year . <-- 8 10 wm-exp-year@2 pic 9(2) . <-- 9 10 wm-exp-month pic 9(2) . 10 10 wm-exp-day pic 9(2) . 11 05 filler pic x(14) . 000018 fd expirelist record contains 132 characters . 000019 01 expire-rec pic x(132) . 000020 working-storage section . 000021 01 exp-test-date@6 pic 9(6) . <-- 000022 01 warmaster-eof pic x value " " . 000023* 000024 procedure division . 000025 mainline . 000026 display "ENTER DATE FOR EXPIRATION TEST - YYMMDD" 000027 upon con74 . 000028 accept exp-test-date@6 from con74 . <-- 000029 if exp-test-date@6 < "750101" <-- 000030 display "EXPIRY TEST DATE INVALID" upon con74 stop run . 000031 open input warmaster . open output expirelist . 000032 read warmaster at end move "1" to warmaster-eof . 000033 perform dtlrtn until warmaster-eof = "1" . 000034 close warmaster expirelist . stop run . 000035 dtlrtn . 000036 if wm-expiry@6@year < exp-test-date@6 <-- 000037 move warmas-rec to expire-rec 000038 write expire-rec before advancing 1 line . 000039 read warmaster at end move "1" to warmaster-eof .
Goto: Begin this document , End this document , UVSI Home-Page
Cobfil51 creates a report of files referenced in COBOL programs. (programname,externalname,openmodes,org,access,copybookname,internalname)
This report is especially useful for conversion planning, for example:
** Operating Instructions ** (demo using uvadm/bat1)
usage: uvcopy cobfil51,fild1=directory(cobol source),filo1=report ==========================================================
example: uvcopy cobfil51,fild1=bat1,filo1=cobfiles.rpt - generate report =============================================
uvlp12 cobfiles.rpt - print report ===================
cobfil51 COBOL Files/Copybooks Dir=bat1 1997/12/05_11:18:42 program external-name I/O modes org acc copybook internal-name ========================================================================
cobol4.bat disc-cusmas-f I S S cmrecord cusmas cobol4.bat disc-cusmas2-f O I S cusmas2 cobol4.bat printer-cuslist-f O S S cuslist
cobol6.bat disc-cusdtl-f I S S cusdtl cobol6.bat tape-dtltape-f O I S S dtltape cobol6.bat printer-cuslist-f O O O S S cuslist
cobol9.bat tape-custape-f O I S S custape cobol9.bat disk-outdisk-f s s outdisk cobol9.bat disc-cusmas-f I S S cusmrec cusmas cobol9.bat disc-cusmas1-f O S S cusmrec cusmas1 cobol9.bat printer-cuslist-f s s cuslrec cuslist
cobolw.bat warmas I S S warmasr warmaster cobolw.bat explist I S S expirelist
cobolx.bat warmas I S S warmasr war-master cobolx.bat warpurg I I S warmasr war-purged cobolx.bat sortfile s s sort-file
Goto: Begin this document , End this document , UVSI Home-Page
Please see the cobfil51 sample report on the previous page. You can sort & select these records as you desire to create reports that are useful to your projects.
For example, selecting all tape files would be especially useful when converting from the mainframe, because tape files usually have to be modified for Unix Microfocus COBOL.
1. grep 'tape-' cobfiles.rpt >cobfiles.tape - select tape files ========================================
2. uvlp cobfiles.tape - print selected report ==================
cobol5.bat tape-dtltape-f I S S dtltape cobol6.bat tape-dtltape-f O I S S dtltape cobol9.bat tape-custape-f O I S S cmrecord custape
The cobfil51 job will report the programs in the sequence that the filenames appear within the directory (not necessarily alphabetical). I recommend you sort your COBOL source directory before this report. Assuming your COBOL source directory is cobsrc, you could sort as follows: (see uvadm/sf/util/sortcpio documented in scripts1.htm).
1. mv cobsrc cobsrc.save - rename your current COBOL src dir =====================
2. mkdir cobsrc - make a new COBOL src dir ============
3. sortcpio cobsrc.save cobsrc - sort from the backup dir to the new dir ===========================
The following scan3d could be used to select the entire FILE-CONTROL section from each program, but this would be a very lengthy report and would not have the OPEN I/O modes.
uvcopy scan3d,fild1=bat1,arg1=FILE-CONTROL,arg2u=DATA_DIVISION =============================================================== - would scan all programs in the bat1 directory for line groups that begin with 'FILE-CONTROL' & end with 'DATA DIVISION' - would include all SELECT statements
Goto: Begin this document , End this document , UVSI Home-Page
cpybook1 |
|
usage: uvcopy cpybook1,fild1=cobdir,fild2=cpydir,filo1=rpt,filo2=cobnames ==================================================================
uvcopy cpybook1,fild1=bat1,fild2=cpy,filo1=tmp/cb1.rpt,filo2=tmp/cb1.names ==========================================================================
cpybook1 COBOL Programs with missing CopyBooks 1997/12/30_13:50:21 COBOL program dir: bat1 COBOL copybook dir: cpy ========================================================================
cobol7.bat 01 cusrec copy cusmrec . cobol7.bat 01 cusrec1 copy cusmrec . cobol7.bat 01 cusrec2 copy cusprec . cobol7.bat 01 cusrec3 copy cusqrec . cobol8.bat 01 cusrec0 copy cusmrec . cobol8.bat 01 cusrec1 copy cusmrec . cobol8.bat 01 cusrec2 copy cusprec . cobol9.bat 01 cusrec copy cusmrec . cobol9.bat 01 cusrec1 copy cusmrec . cobol9.bat 01 cusline copy cuslrec .
Note |
|
Goto: Begin this document , End this document , UVSI Home-Page
# uncopy1 - modify copybooks to convert comp/binary data files to unpacked # - copies existing copybook to an alternate, removing comp/binary # creating unpacked numeric fields & expanding the record layout # - in preparation for reform2/3, which generates uvcopy jobs to # convert data files to all unpacked numeric fields. # #usage: uvcopy uncopy1,fili1=cpy1/Bdemo1,filo1=cpy2/Bdemo2 # ================================================== # # - used in preparation for reform2 or reform3 which generate uvcopy jobs # to perform the actual data file reformatting. # - see REFORMjobs.doc &/or DATAcnvt3.doc # opr='$jobname - modify copybooks to convert comp/binary data files to unpacked' opr='uop=q0t1 - option defaults' opr=' t1 - generate 1 byte filler at end cpybk for LF insert by reform2/3' uop=q1t1 fili1=?cpy1/spanrec,typ=LST,rcs=128 filo1=?cpy2/spanrec,typ=LSTt,rcs=128 @run opn all open I/O files # # begin loop to get/convert/rewrite lines until EOF man20 get fili1,a0(128) get next record skp> eof (cc set > at EOF) mvc b0(128),a0 move inrec to output area trlq3 b0(128) ensure lower case (except in quotes) clr b0(6),' ' ensure cols 1-6 cleared clr b72(66),' ' ensure cols 73-128 cleared repp b0(80),' comp-#',' ' remove any comp-3 or comp-4 repd b0(80),' comp;',' ;' remove comp (dflt comp-4 or Burroughs) repd b0(80),' binary;',' ;' remove binary put filo1,b0(128) write result to output file skp man20 return to get next # # EOF - if option t1, generate extra 1 byte filler for LF insert by reform2/3 eof cmn $uopbt,1 option to insert 1 byte filler ? skp< clsa clr b0(128),' ' clear out area mvf b11(40),'02 filler pic x.' put filo1,b0(128) write result to output file clsa cls all eoj
Goto: Begin this document , End this document , UVSI Home-Page
Problem |
|
Solution |
|
uvcopy fixrpt2,fili1=infile,filo1=outfile - for 1 file at a time =========================================
uvcopyx fixrpt2 indir outdir uop=q0i7 - for all files in a directory =====================================
note |
|
# fixrpt.dat - test data for jobs fixrpt1 & fixrpt2 # which insert LF's after CR's without LF's # - correction for COBOL reports generated by # write heading AFTER advancing TOP-OF-FORM # vs write blank-line BEFORE advancing TOP-OF-FORM # - should always use write BEFORE advancing on Unix # ##1 dtl-line before hdr-line (CR+FF, no LF):\x0D\x0C-hdr-line # ^^^^^^^^ <-- NOTE ##2 dtl-lines no LF between (CR+data, no LF):\x0D-next-dtl-line # ^^^^^ <-- NOTE # # fixrpt1 inserts LF on #1, after x'0D'(CR) directly followed by x'0C'(FF) # fixrpt2 inserts LF on #1, after any x'0D'(CR) not followed by x'0A' # # This test file must be processed by the 'enterHEX1' uvcopy job # (before using as input to the fixrpt1 &/or fixrpt2 jobs) # to convert the '\x0D' & '\x0C' to their true hex values, for example: # # uvcopy enterHEX1,fili1=tf/fixrpt.dat,filo1=tmp/dat2 # uvcopy fixrpt2,fili1=tmp/dat2,filo1=tmp/dat3 # lp tmp/dat3 - test for proper printing
Note |
|
Goto: Begin this document , End this document , UVSI Home-Page
note |
|
2. uvcopy enterHEX1,fili1=tmp/dat1,filo1=tmp/dat2 ============================================== - prepare test file for fixrpt2, converting pseudo codes for CR & FF to actual codes
3. uvcopy fixrpt2,fili1=tmp/dat2,filo1=tmp/dat3 ============================================ - insert LF's where missing
4. lp tmp/dat1 tmp/dat2 tmp/dat3 ============================= - print the test files to demonstrate the problem reports & the corrected reports - see below
5. uvhd tmp/dat1 tmp/dat2 tmp/dat3 =============================== - display the test files to see the hexadecimal codes for the CR,s LF's,& FF's - see next page
##1 dtl-line before hdr-line (CR+FF, no LF):\x0D\x0C-hdr-line ##2 dtl-lines no LF between (CR+data, no LF):\x0D-next-dtl-line
##1 dtl-line before hdr-line (CR+FF, no LF): <--- FormFeed here -hdr-line (OK on some printers) XXXXXXXXXXXXXXno LF between (CR+data, no LF): <--- overprinting
##1 dtl-line before hdr-line (CR+FF, no LF): <--- FormFeed here -hdr-line ##2 dtl-lines no LF between (CR+data, no LF): <--- problem corrected -next-dtl-line
Goto: Begin this document , End this document , UVSI Home-Page
5. uvhd tmp/dat1 tmp/dat2 tmp/dat3 =============================== - display the test files to see the hexadecimal codes for the CR,s LF's,& FF's
new/dat1 bytes=127 records=0 mdate=1970083109 today=1970083111 r# 0 1 2 3 4 5 6 b# 0 1234567890123456789012345678901234567890123456789012345678901234 0 ##1 dtl-line before hdr-line (CR+FF, no LF):\x0D\x0C-hdr-line.# 2232676266662666676266726666222452442266244235734573426672666602 331044CDC9E50256F250842DC9E500832B66C0EF0C69AC804C803D842DC9E5A3 64 #2 dtl-lines no LF between (CR+data, no LF):\x0D-next-dtl-line. 232676266667266244266776662245266762266244235734266772676266660 32044CDC9E530EF0C60254755E0832B4141C0EF0C69AC804DE584D44CDC9E5A
new/dat2 bytes=118 records=0 mdate=1970083109 today=1970083111 r# 0 1 2 3 4 5 6 b# 0 1234567890123456789012345678901234567890123456789012345678901234 0 ##1 dtl-line before hdr-line (CR+FF, no LF):..-hdr-line.##2 dtl 2232676266662666676266726666222452442266244230026672666602232676 331044CDC9E50256F250842DC9E500832B66C0EF0C69ADCD842DC9E5A332044C 64 -lines no LF between (CR+data, no LF):.-next-dtl-line. 266667266244266776662245266762266244230266772676266660 DC9E530EF0C60254755E0832B4141C0EF0C69ADDE584D44CDC9E5A
new/dat3 bytes=120 records=0 mdate=1970083109 today=1970083111 r# 0 1 2 3 4 5 6 b# 0 1234567890123456789012345678901234567890123456789012345678901234 0 ##1 dtl-line before hdr-line (CR+FF, no LF):...-hdr-line.##2 dt 2232676266662666676266726666222452442266244230002667266660223267 331044CDC9E50256F250842DC9E500832B66C0EF0C69ADACD842DC9E5A332044 64 l-lines no LF between (CR+data, no LF):..-next-dtl-line. 62666672662442667766622452667622662442300266772676266660 CDC9E530EF0C60254755E0832B4141C0EF0C69ADADE584D44CDC9E5A
tmp/dat1 |
|
tmp/dat2 |
|
tmp/dat3 |
|
Goto: Begin this document , End this document , UVSI Home-Page
This is the classic example of a mass change to a program library.
Your company name changes & it is hard-coded in hundreds of programs (will take weeks to change if edited manually)
Let us assume we wish to change the name as follows:
'ABC COMPANY LTD.' to 'ABCXYZ COMPANY LTD.'
--------------- 4 methods will be presented & compared ------------------
J1. | cobmod1 - using 'sed' (UNIX stream editor) |
- inadequate if the new name is longer & would exceed col 72 | |
or if shorter any constants in 73-80 would be moved left | |
into the cobol text area. |
J2. | cobmod2 - 1st of 3 methods using 'uvcopy' |
- this is a simplistic solution that is also inadequate | |
- an improvement on sed since only cols 8-72 can be modified | |
but this method lacks the 'line-splitting' logic of the next 3. |
J3. | cobmod3 - this job allows for most of the shortcomings of methods 1 & 2. |
- will split lines if col 72 is exceeded & will adjust the length | |
of the preceding pic x(??), but only if on the same line. |
J4. | cobmod4 - this job allows the pic x(??) to be on the previous line. |
- this method tables lines until a period is reached, which allows | |
correction of preceding PIC X(??) length on the previous line. |
*** NOTE ***
The 'cobmod' series of jobs is presented as an example of a SPECIFIC mass change to COBOL programs & also as an EDUCATIONAL exercise.
Also see the 'cobscan' & 'cobrep' jobs in COBscans.htm section which you will find much more useful because they are general purpose & can be used for most mass changes you might require.
The cobscan & cobrep jobs are more powerful because they process the entire directory of cobol programs. The 'cobmod' jobs process only 1 program at a time, although the 'uvcopyx' script can be used to repeat any uvcopy job for all files in the directory.
The cobscan & cobrep jobs also produce an audit trail report showing matching lines & line#s within the file.
Goto: Begin this document , End this document , UVSI Home-Page
You could change 1 program as follows:
sed -e s/'ABC COMPANY LTD.'/'ABCXYZ COMPANY LTD.'/\ bat1/cobol1.bat >cobol1x
'sed' SCRIPT to change names in all programs in a directory -----------------------------------------------------------
# cobmod1 - script to change company name (using sed) # from: ABC COMPANY LTD. # to: ABCXYZ COMPANY LTD. # # - copies directory (of cobol programs) to an alternate directory # using 'sed' (UNIX stream editor) to make the change # #usage: cobmod1 indir outdir # for i in $1/* do f=${i##*/} sed -e s/'ABC COMPANY LTD.'/'ABCXYZ COMPANY LTD.'/\ $1/$f >$2/$f done exit
sed script cobmod1 operating instructions -----------------------------------------
note |
|
Goto: Begin this document , End this document , UVSI Home-Page
# cobmod2 - perform mass changes to cobol programs (method #2 of 4) # - see COBaids1.doc which compares 4 methods # # change "ABC COMPANY LTD." to "ABCXYZ COMPANY LTD." # #note - if the new pattern is longer than the old (as in this case) # the cobol text might get truncated at column 72 # - see cobmod3 & 4 which split lines & correct preceding pic x(??) # - this method could be used for simple changes when you know # the new pattern will not exceed column 72 # opr='$jobname - mass change to cobol source program (method#2)' fili1=?bat1/cobol1.bat,typ=LST,rcs=a80 # use sample program for test filo1=?$jobname.tmp,typ=LSTt,rcs=b80 # output file @run opn all # begin loop to copy records until EOF loop get fili1,a0(80) get current record skp> eof mvc b0(80),a0 move input record to output area #--------------------------------------------------------------------------- rep b7(65),'ABC COMPANY LTD.','ABCXYZ COMPANY LTD.' #--------------------------------------------------------------------------- put filo1,b0(80) write record to output file skp loop return to get next record # end of file - close files & end job eof cls all eoj
1. uvcopy cobmod2,fili1=bat1/cobol1.bat,filo1=cobol1x ================================================== 2. vi cobol1x - inspection to verify results 3. mv cobol1x bat1/cobol1.bat - if ok, change name back to original
2. uvcopy cobmod2 bat1 bat2 - use script to execute uvcopy/cobmod2 ======================== on all programs in directory 3. vi bat2/* - inspection to verify results 4. mv bat2 bat1 - if ok, change name back to original
note |
|
Goto: Begin this document , End this document , UVSI Home-Page
These methods provide for the shortcomings of methods 1 & 2.
These methods are implemented as 'general purpose' & 'table-driven'. You can easily modify the patterns & add any number of additional patterns for any other changes desired.
First we will edit these patterns into a search & replace table whose name will be supplied to the uvcopy job.
# cobmod.tbl - search/replace table for cobmod3 & cobmod4 # - documented in COBaids1.doc, example company name change, # - this table has only 1 entry, but it could have multiple # entries for different name formats # or for any other search/replacements desired # ABC COMPANY LTD.~~~~~~~~~~~~~~~~~~~~~~~~ABCXYZ COMPANY LTD.~~~~~~~~~~~~~~~~~~~~~ ~~
First we will run the job on just 1 program (for testing?), then we will use the uvcopyx script to process the entire directory (see next page).
The instructions are written for the 'cobmod3' job, but are equally valid for the cobmod4.
** operating instructions - for 1 program ** commands/prompts responses ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
uvcopy cobmod3 - execute uvcopy with prmfile cobmod3 ==============
bat1/cobol3.bat = default input, ok or change ? ---> null to accept
tf/cobmod.tbl = default fili2 tbl file ok ? ---> null to accept
cobmod3.tmp = default output, ok or change ? ---> null to accept
--------------------------------------------------
vi bat1/cobol3.bat - examine the input program look for: 'ABC COMPANY LTD.'
vi cobmod3.tmp - examine the output program, look for: 'ABCXYZ COMPANY LTD.' - notice line-splitting & PIC X(??) increase
Goto: Begin this document , End this document , UVSI Home-Page
** op instructions - for entire directory ** commands/prompts responses ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mkdir cob.tmp - make a directory to receive the output
uvcopyx cobmod3 bat1 cob.tmp fili2=cobmod.tbl =============================================
- script for cobmod3 & table file cobmod.tbl to copy files from bat1 dir to cob.tmp dir
vi bat1/* - examine input (15 programs in bat1)
vi cob.tmp - examine output programs & note changes (variety of 1 line & 2 line defs)
[ mv bat1 bat1.old ] [ mv cob.tmp bat1 ] - don't do this to the uv demo directory but in a real situation, you would now change the name of the output directory back to the original
Goto: Begin this document , End this document , UVSI Home-Page
There is a bug in cobmod3 which depends on how the name was coded.
05 FILLER PIC X(30) VALUE 'ABC COMPANY LTD.' - will be fixed ok as follows: 05 FILLER PIC X(39) VALUE 'ABCXYZ COMPANY LTD.'
05 FILLER PIC X(30) VALUE 'ABC COMPANY LTD.' - but this has a problem: 05 FILLER PIC X(30) VALUE 'ABCXYZ COMPANY LTD.'
Note that the PIC X(30) is properly changed to PIC X(39) when the company name appears on the same line, but not when on separate lines
Cobfix4 solves this problem by tabling lines in memory until a period so we can modify the previous line since it is not written out until all changes have been made.
These jobs are listed at the end of the section, for your convenience in case you want to inspect or modify them.
Note that this is just 1 example of a mass change technique that might apply to other similar problems that could occur in your shop.
Goto: Begin this document , End this document , UVSI Home-Page
This job was written to correct cobol programs that have been processed by some utility that did not respect column 72.
Cobfix72 will split lines that exceed col 72, by scanning back to the preceding blank and split the line at that point, moving the data on the right to a new line beginning in column 12.
This job first scans cols 73+ for the program-name & blanks it out. It then assumes that any data exceeding col 72 is a cobol statement that had been pushed past col 72 by some previous mass change utility that did not include the logic to split lines.
If desired, you could test this job by modifying 1 of the demo programs. You could create some deliberate overflow statements by joining existing statements. (the job logic allows for overflows up to col 128)
3. uvcopy cobfix72,fili1=cobol1.bat,filo1=cobol1x ============================================== 4. vi cobol1x - inspection to verify results 5. mv cobol1x bat1/cobol1.bat - if this were production (vs testing) move back to original directory
2. uvcopy cobfix72 bat1 bat2 - use script to execute uvcopy/cobmod2 ========================= on all programs in directory 3. vi bat2/* - inspection to verify results 4a. mv bat1 bat1.old - if ok, change directory name 4b. mv bat2 bat1 back to the original input dir 4c. rm bat1.old/* 4d. rmdir bat1.old
Goto: Begin this document , End this document , UVSI Home-Page
The uvcopy jobs are not listed here, but are available in /home/uvadm/pf. I suggest you list jobs of interest to you & file them here. For example to list cobmap1: uvlp /home/uvadm/pf/cobmap1 ===========================
A1. | cobmap1 - create cobol record layouts from source programs or copy books |
- prints field lengths, types, start,& end byte values |
cobmap2 - Alternate cobmap for Burroughs comp (1/2 byte aligned) fields
B1. | cleanup - source code maintenance utility job with options to: |
- translate to UPPER or lower case, seq# in cols 1-6 (or clear) | |
gang progname in cols 73-80 (or clear), convert quotes, etc. |
C1. | cobcopy1 - copy a cobol program expanding the copy statements. |
- makes it easier to investigate unfamiliar programs | |
- pre-requisite to some cobol diagnostic jobs (see COBcheck.doc) |
D1. | cobcopy2 - copy COBOL programs encoding group-names with date-field-name |
components & lengths, to facilitate Year 2000 investigations. |
E1. | cobfil51 - create a report of files used in COBOL programs, showing: |
external-name,open-modes,org,access,copybookname,internal-name | |
- especially useful for conversion planning |
F1. | cpybook1 - scan a COBOL program directory & verify all copy-books present |
- write a report file with copy commands for missing copybooks | |
- write 2nd file with names of programs with missing copybooks |
G1. | uncopy1 - create new version of copybook with comp/binary removed |
H1. | fixrpt1 - Fix reports with missing LineFeeds, caused by COBOL programs |
with 'write AFTER advancing' (vs write BEFORE advancing). |
H2. | fixrpt2 - A better solution to missing lineFeeds, fixrpt2 searches for |
any CR not followed by an LF, & inserts an LF when required. |
I1. | cobmod - the classic example of a mass change to a program library |
J1. | cobmod1 - using 'sed' (UNIX stream editor) |
J2. | cobmod2 - 1st of 3 methods using 'uvcopy' (simplistic solution) |
J3. | cobmod3 - this job allows for most of the shortcomings of methods 1 & 2. |
- splits lines if col 72 exceeded & adjusts preceding pic lth. |
J4. | cobmod4 - this method tables lines until period reached, which allows |
correction of preceding PIC X(??) length on the previous line. |
K1. | cobfix72 - correct cobol programs that have been processed by mass change |
utility that did not have the ability to split lines. |
Goto: Begin this document , End this document , UVSI Home-Page