| A1. | Introduction & Overview |
| A2. | Summary of FUNCTIONS available. |
| - browse, search, update, print, iprint, write, drop, check, tally, verify |
| B1. | Pre-Requisites (preparation for use) |
| - generate cobmaps from copybooks & export RUNLIBS |
| C1. | Illustration of 'cobmap' record-layout & 'uvhdcob' display |
| D1. | Operation Instructions & command line options |
| E1. | Help Screens - commands available |
| - browse, search, update, print, iprint, write, drop, check, tally, verify |
| F1. | Inter-Operation of uvhdcob & uvhd |
| - may 'e'xit to uvhd & 'q'uit back to uvhdcob |
| G1. | copybooks for the demo datafiles |
| - vendormas, vendorpay, vendorpaymas, vendorpaymasa |
| H1. | demo Data-Files - EBCDIC-Fixed & ASCII-Fixed,Text,RDW,IDXf3 |
| - vendormas#, vendorpay#, vendorpaymas# | |
| - suffix # 0=EBCDIC-fixed, 1=ASCII-fixed, 2=Text, 3=RDW, 4=IDXf3 |
| I1. | demo uvhdcob for Multi-Record-Type files |
| - demo display for vendorpaymas (vendor names & vendor payments) |
| K1. | Scripts uvhdc1/uvhdc2 make it easier to use the 'uvhdcob' program |
| - requires only the data-file-name (no copybookname, no record-size, | |
| - requires initial setup of a control file to relate data file names | |
| to the corresponding copybooks & filetype options | |
| - requires $CTLMAPDIR or $CNVDATA or $RUNLIBS or $RUNDATA (in profile) | |
| to define superdir for the control-file & copybookmap |
| L1. | Repeat above demo using 'uvhdc2' (vs uvhdc1 above) |
| - uvhdc2 more relevant to mainframe conversion sites & filename conventions | |
| - uvhdc1 relevant as follow on for vendormas,vendorpay,vendorpaymas demos |
| M1. | demo the 'Verify' command (using dat1/custmas1x with known bad data) |
| verify searches the file for unprintable characters in pic x fields & | |
| invalid digits or signs in unpacked or packed numeric fields. |
| N1. | 'find' command to find records by record# |
| - for variable length record files (Text, RDW, IDXFORMAT3/8) | |
| - N/R for Fixed length files since we can calc offset & jump to any record# |
| U1. | UVHDCOBROP env-var to specify favorite options (such as 50 lines/screen) |
| U2. | UVHDCOBPRINT env-var to specify immediate printing script (uvlp12 default) |
| V1. | uvhddif2 - script to compare 2 data files using uvhdcob & diff |
Copyright 1997-2010, UV Software Inc, All rights reserved
Goto: Begin this document , End this document , UVSI Home-Page
What is the difference between 'uvhd' & 'uvhdcob' ?
uvhdcob datafile=dat1/custmas1 20090222:0844 copybook=cobol/maps/custmas1 options= record#=1 totalrecs=32 recsize=256 filesize=8192 fileptr=0 rec# 1 fieldname occurs bgn end typ<------ data (hex if typ=p/b) -----> 001 cm-num 0 5 n 130140 002 cm-delete 6 9 003 cm-name 10 34 EVERGREEN MOTORS LTD. 004 cm-adrs 35 59 1815 BOWEN ROAD 005 cm-city 60 75 NANAIMO 006 filler001 76 76 007 cm-prov 77 78 BC 008 filler002 79 79 009 cm-postal 80 89 V9S1H1 010 cm-phone 90 101 250-754-5531 011 cm-contact 102 119 LARRY WRENCH 012 cm-thisyr-sales 012 120 124pns 001234567C 013 cm-lastyr-sales 012 180 184pns 001234567D 014 filler003 240 255 C 19950531 rec#=1 rcount=32 rsize=256 fsize=8192 dat1/custmas1 null=next,r#=rec,s=search,u=update,x=undo,p=print,i=iprint,w=write,t=tally ,v=verify,c=chkseq#,e=exit to uvhd,q=quit,?=help -->
Goto: Begin this document , End this document , UVSI Home-Page
Goto: Begin this document , End this document , UVSI Home-Page
We will demo uvhdcob for supplied copybook directory /home/uvadm/cobol/cpys Try this demo, then substitute your copybook directory for cobol/cpys in whatever parent directory makes sense at your site.
#1. cd /home/uvadm <-- change to the uvadm home dir
==============
#2. l cobol <-- list subdirs in cobol directory
=======
/home/uvadm/cobol
:-----cbls
:-----cblst
:-----cblx
:-----cpys <-- COBOL copybooks
:-----ctl
:-----maps <-- copybooks converted to record layouts (cobmaps)
#3. mkdir cobol/maps <-- you may need to make maps subdir for your site
================
#4. uvcopyx cobmap1 cobol/cpys cobol/maps uop=q0i7p0
================================================
- generate cobmaps from copybooks
#5. export RUNLIBS=/home/uvadm/cobol
================================
Exporting the cobol directory allows you to enter only the cobmap basename on the uvhdcob command line (add the export to your profile).
#6a. uvhdcob dat1/custmas1 cobol/maps/custmas1 - test with demo file & cobmap
========================================= (explicit cobmap path)
#6b. uvhdcob dat1/custmas1 maps/custmas1 <-- retest using RUNLIBS option
=================================== for cobmap directory path
| Note |
|
| Note |
|
Goto: Begin this document , End this document , UVSI Home-Page
uvhdcob requires prior generation of 'cobmaps' from the COBOL copybooks. You could regenerate the cobmaps for uvadm as follows:
#1. Login as uvadm --> /home/uvadm
#2. uvcopyx cobmap1 cobol/cpys cobol/maps uop=q0i7p0
================================================
- generate cobmaps for all files in directory
#2a. uvcopy cobmap1,fili1=cobol/cpys/custmas1,filo1=cobol/maps/custmas1
==================================================================
- generate cobmap for 1 copybook at a time
cobmap1 start-end bytes for cobol record fields 199905101503 pg# 0001
cpys/custmas1 RCSZ=0256 bgn-end lth typ
* custmas1 - cobol copy book for custmas1 file (see uvtrain.
10 cm-num pic 9(6). 000-0005 006 n 06
10 cm-delete pic x(4). 006-0009 004
10 cm-name pic x(25). 010-0034 025
10 cm-adrs pic x(25). 035-0059 025
10 cm-city pic x(16). 060-0075 016
10 filler001 pic x. 076-0076 001
10 cm-prov pic x(2). 077-0078 002
10 filler002 pic x. 079-0079 001
10 cm-postal pic x(10). 080-0089 010
10 cm-phone pic x(12). 090-0101 012
10 cm-contact pic x(18). 102-0119 018
10 cm-thisyr-sales pic s9(7)v99 comp-3 occurs 12. 120-0124 005pns 09
10 cm-lastyr-sales pic s9(7)v99 comp-3 occurs 12. 180-0184 005pns 09
10 cm-thisyr-xft pic s9(7)v99 comp-3. 240-0244 005pns 09
10 cm-lastyr-xft pic s9(7)v99 comp-3. 245-0249 005pns 09
10 filler003 pic x(6). 250-0255 006
*RCSZ=0256 0256
Note that this sample cobmap was used for the uvhdcob sample illustrated on the previous page (please relate the fieldnames & locations).
Also note that the 'cobmaps' are very useful to COBOL shops for other reasons (when you need to know field locations for sorting, verifying data, etc).
You may find it convenient to print cobmaps for all copybooks, and mount in a 3 ring binder for easy reference. See documentation for the 'cobmap' utility in COBaids.doc .
Goto: Begin this document , End this document , UVSI Home-Page
Here is the 'uvhd' (hexdump) display vs the uvhdcob display above.
uvhd dat1/custmas1 r256 =======================
filename=/home/uvadm/tmp1/cm1 options=
records=32 filesize=8192 recsize=256 fsize%rsize(remainder)=0
10 20 30 40 50 60
r# 1 0123456789012345678901234567890123456789012345678901234567890123
0 130140 EVERGREEN MOTORS LTD. 1815 BOWEN ROAD NANA
3333332222454545444244545524542222233332445442544422222222224444
130140000056527255E0DF4F230C44E0000181502F75E02F140000000000E1E1
64 IMO BC V9S1H1 250-754-5531 LARRY WRENCH ..4V|...
4442222222222442535343222233323332333324455525544442222201357000
9DF00000000002306931810000250D754D55310C12290725E38000000246C000
128 .........W0....`........)X}..f3.....\.................4V}...f...
0000000005300016000000002570063100095000000000000000013570016000
0C0000C0270D0540C0000C0098D0263C0444C0000C0000C0000C0246D0056C00
192 .E|...V}.......................f.....<........f.C 19950531
0470005700000000880000000018000680001300000000694233333333222222
35C0046D0000C0023C0000C0083C0056D0012C0000C0016D3019950531000000
rec#=1 rcount=32 rsize=256 fsize=8192 tmp1/cm1
null=next,r#=rec,s=search,u=update,x=rollback,p=print,i=iprint,w=write,e=count
,g=genseq#,c=chkseq#,t=translate(ta=Asc,te=Ebc,tu=Upr,tl=Lwr,tc=Chars,tp=Pers)
,R#=Recsize,h1=char,h2=hex,q=quit,?=help -->
Goto: Begin this document , End this document , UVSI Home-Page
uvhdcob datafile cobmap(copybook-layout) [options] <-- format ==================================================
uvhdcob dat1/custmas1 cobol/maps/custmas1 <-- demo datafile & copybook =========================================
uvhdcob dat1/custmas1 cobol/maps/custmas1 r257 <-- option 'r' for Record size ============================================== - overrides RCSZ=... in cobmap
If the 'r' record-size option is omitted, the rcsz will be picked up from the 'RCSZ=value' in the cobmap file. If indexed, (datafile.idx present), then rcsz is incremented by 1, to allow for the x'0A' delete flag on end of ISAM records.
RCSZ override for ISAM records only required if indexed file naming conventions not followed (data suffix '.dat' & index suffix '.idx').
uvhdcob dat1/custmas0 cobol/maps/custmas1 r257am50 <-- example multiple options ==================================================
| option 'r257' |
|
| option 'a' |
|
| option 'm50' |
|
| Note |
|
cobmap may specify record types on *TYPE comment lines, to cause display screens to start with the first cobmap fieldname matching the fieldname on the *TYPE statements, for example:
*TYPE=0(1),='N','NAME-RECORD' <-- data records with 'N' in byte 0 *TYPE=0(1),='P','PAY-RECORD' <-- data records with 'P' in byte 0
Goto: Begin this document , End this document , UVSI Home-Page
| help01 |
|
| help02 |
|
| help03 |
|
| help04 |
|
| help05 |
|
| help06 |
|
| help07 |
|
| help08 |
|
| help09 |
|
| help10 |
|
| help11 |
|
| help12 |
|
| help13 |
|
uvhdcob version 20100605 - Copyright (C) UV Software Inc. 1993-2010
uvhdcob datafile copybook-map [options] <-- uvhdcob format
================================================
uvhdcob dat1/custmas1 cobol/maps/custmas1 r256m50 <-- example
================================================
options 'r256m50' - must be contiguous (alpha+digits+alpha+digits+...)
r256 - rec-size, omit to use RCSZ= in map, specify to override
m50 - max lines per screen, default 25, use 50 for PC terminal
uvhdc2 dat1/custmas1 <-- uvhdc2 format - uvhdc2 script omits copybook-map
==================== via ctlfile54I relating datafile to copybook-map
- may specify options as arg2 to override defaults
Note - uvhdc2 script needs to be setup & customized at each site
- see http://www.uvsoftware.ca/uvhdcob.htm#I1 - I6
Goto: Begin this document , End this document , UVSI Home-Page
| a |
|
| d1 |
|
| c1 |
|
| e1 |
|
| f# |
|
| i1 |
|
| i2 |
|
| m# |
|
| n1 |
|
| r# |
|
| s2 |
|
| t |
|
| u |
|
| v |
|
| w1 |
|
| z# |
|
| z2 |
|
| z4 |
|
| z8 |
|
| z1 |
|
| null |
|
| b# |
|
| r# |
|
| f# |
|
| r# |
|
| f# |
|
| fi |
|
| f# |
|
| r1 |
|
| f999999m123 |
|
| f999999m50n90 |
|
| ff |
|
| ff |
|
| R# |
|
Goto: Begin this document , End this document , UVSI Home-Page
| s 'ABC' |
|
| s 40(40),'ABC' |
|
| s 20(3),!'000' |
|
| s 0(80),=x'0C' |
|
| s 0(80),>x'7F' |
|
| s 'ABC',,'XYZ' |
|
| s 'ABC',|,'XYZ' |
|
s 0(40),'AB',40(40),'CD' - search for 'AB' in cols 1-40 & 'CD' in cols 41-80 s 0(1),'1',|0(1),'9' - search for '1' OR '9' in byte 0 (col 1) s 0(1),'1',|,'9' - same as above, op3 start(lth) defaults to op1 s 0(1),>'0',,<'9' - search for records wwith 1-8 in the 1st byte
| ss |
|
| sss |
|
u=UPDATE records (must have specified 'u' option on command line) u - update the current record, examples follow: u 0(3),'ABC' - update 1st 3 bytes of current record to 'ABC' u 78(2),x'0D0A' - update bytes 79 & 80 of current record to x'0D0A' uu - repeat last update (on current record)
u999 0(3),'ABC' - update next 999 records, or until EOF (no rollback) u999 10(1),'*',8(1),'D' - update byte 10 to '*', IF byte 8 is 'D' u999 8(1),'X',8(1),'D' - change any 'D' in column 9 to 'X'
| x |
|
| X |
|
u99s 77(2),'AB',,'AL' - update bytes 77-78 with 'AB' if currently 'AL'
s <-- note option 's' on 'u99s' saves update args in search args
1 for subsequent reset to BOF (by goto record #1)
ss <-- and 'ss' to verify updates (without re-entering arguments)
Goto: Begin this document , End this document , UVSI Home-Page
print - write formatted records to a file for subsequent lp,uvlp,vi,etc
- writes tmp/filename.yymmddhhmmP (concatenated for uvhd session)
p5 - print 5 recs from current position
p 'ABC' - search for & print records with 'ABC' anywhere in record
p5 0(40),'ABC' - search & print 5 max with ABC within 1st 40 bytes
p 40(3),e'ABC' - print if EBCDIC 'ABC' 41-43 (use with cmdline a optn)
p9f3 - print 9 records, formfeed after every 3rd record
pp - repeat last print command (from current position)
>>> iprint - write formatted records to a file for immediate uvlp
- writes tmp/filename.yymmddhhmmI, then uvlp issued immediately
i5 - iprint 5 recs from current position
i <' ' - iprint records with any bytes < space char
i5 0(40),<x'20' - iprint 5 max with any bytes < space in 1st 40 bytes
i24f4 - iprint 24 records, formfeed after every 4th record
ii - repeat last iprint command (from current position)
>>> write - write data records only for later use (test files,etc)
- write output is written to tmp/filename.yymmddhhmmW
- multiple write command outputs collected into 1 common file
- writes start at current position & end at EOF (or max count)
w5 - write (unformatted) 5 records from current position w ' SMITH ' - write records with ' SMITH ' anywhere in record w5 0(3),>'400' - write 5 max records whose 1st 3 bytes > 400 ww - repeat last write command (from current position)
w 77(2),'BC' - select province BC in bytes 77-78 (zero relative) w 0(1),'2',0(64),'ABC' - write recs with '2' byte 0 & ABC anywhere in 0-64
| wi |
|
| we10 |
|
| w100e5 |
|
| we10 77(2),'VA' |
|
Goto: Begin this document , End this document , UVSI Home-Page
| w100r64t2 |
|
| w99z2a1c1 |
|
| a1 |
|
| c1 |
|
| n1 |
|
| n2 |
|
| r# |
|
| t1 |
|
| t2 |
|
| t3 |
|
| t4 |
|
| z# |
|
| z2 |
|
| z4 |
|
| z1 |
|
>>> check - check sequence in specified field - until EOF or SEQUENCE ERR c 0(6) - check sequence in columns 1-6, show 1st record out of sequence cd 0(6) - check sequence descending (vs ascending default) ce 0(6) - check seq equal not allowed (may use with ascending/descending) cc - repeat last sequence check (from current position to EOF)
>>> tally - count records from current point to EOF t - count records from current position to EOF t 'ABC' - count records with 'ABC' anywhere in record t500 10(3),'ABC' - count (within next 500 recs) recs with ABC in cols 11-13
t 10(1),'A',77(2),'BC' - count records with 'A' col 11 AND 'BC' col 78-79 t 8(1),'D',|8(1),'X' - count records with 'D' OR 'X' col 9 t 0(1),>'2',0(1),<'7' - count records with 1st byte 3,4,5,or 6 t 0(1),>'2',,<'7' - same op3 omitted (,,) defaults same as op1
ts 'ABC' - count records with 'ABC' anywhere in record s <-- note option 's' on 'ts' saves tally args in search args 1 for subsequent reset to BOF (by goto record #1) ss - and 'ss' to review selected records (w/o re-entering arguments)
Goto: Begin this document , End this document , UVSI Home-Page
>>>Verify - verify Packed, Numeric,& Character data fields (until EOF)
| v |
|
| vv |
|
| v100 |
|
| va50 |
|
va10b50c80d90 - may use options a,b,c,d to inhibit verify on 4 fields max vv - continue verify (options saved from prior 'v' command
>>>Exit - exit to uvhd, to display data record without COBOL fieldnames
- to see all occurrences of occurs (uvhdcob displays only 1st)
- to see fields longer than 36 bytes
| e |
|
| eu |
|
| q |
|
Goto: Begin this document , End this document , UVSI Home-Page
cobmap may specify record types on *TYPE comment lines, for example:
*TYPE=0(1),='P','PAY-RECORD' <-- 'P' in 1st byte displays pay-record fields *TYPE=0(1),='T','TIME-RECORD' <-- 'T' in 1st byte displays time-record fields *TYPE=0(1),='H','HDR-RECORD' <-- 'H' in 1st byte displays hdr-record fields *TYPE=0(1),!'H','HDR-RECORD' <-- last entry !not= for EOF display short rec
*TYPE - starts display with 1st cobmap fieldname matching fieldname
- insert *TYPE control records at begin copybook with redefined records
- then rerun cobmap1 to convert copybooks to cobmap record layouts
- do not insert in cobmaps (would be lost when cobmap1 rerun)
- see details at http://www.uvsoftware.ca/uvhdcob.htm#G1
*TYPE=0:45,'VEN-NAME' <-- Alt format for variable length (RDW,IDXf3/8,text)
- identify type by record size range
*TYPE=46:99,'VEN-PAY' <-- ven-pay layout if size 46:99, ven-name if 0:45
uvhdcob version 20100605 - Copyright (C) UV Software Inc. 1993-2010
Goto: Begin this document , End this document , UVSI Home-Page
The exit command of uvhdcob allows you to easily switch from uvhdcob to uvhd. You will sometimes need to uvhd to display the entire record because:
uvhdcob dat1/custmas1 cobol/maps/custmas1 <-- start uvhdcob, then exit to uvhd =========================================
uvhdcob datafile=dat1/custmas1 20090222:0844 copybook=cobol/maps/custmas1 options= record#=1 totalrecs=32 recsize=256 filesize=8192 fileptr=0 rec# 1 fieldname occurs bgn end typ<------ data (hex if typ=p/b) -----> 001 cm-num 0 5 n 130140 002 cm-delete 6 9 003 cm-name 10 34 EVERGREEN MOTORS LTD. 004 cm-adrs 35 59 1815 BOWEN ROAD 005 cm-city 60 75 NANAIMO 006 filler001 76 76 007 cm-prov 77 78 BC 008 filler002 79 79 009 cm-postal 80 89 V9S1H1 010 cm-phone 90 101 250-754-5531 011 cm-contact 102 119 LARRY WRENCH 012 cm-thisyr-sales 012 120 124pns 001234567C 013 cm-lastyr-sales 012 180 184pns 001234567D 014 filler003 240 255 C 19950531 rec#=1 rcount=32 rsize=256 fsize=8192 dat1/custmas1 null=next,r#=rec,s=search,u=update,x=undo,p=print,i=iprint,w=write,t=tally ,v=verify,c=chkseq#,e=exit to uvhd,q=quit,?=help --> e <-- Exit to uvhd
10 20 30 40 50 60
r# 1 0123456789012345678901234567890123456789012345678901234567890123
0 130140 EVERGREEN MOTORS LTD. 1815 BOWEN ROAD NANA
3333332222454545444244545524542222233332445442544422222222224444
130140000056527255E0DF4F230C44E0000181502F75E02F140000000000E1E1
64 IMO BC V9S1H1 250-754-5531 LARRY WRENCH ..4V|...
4442222222222442535343222233323332333324455525544442222201357000
9DF00000000002306931810000250D754D55310C12290725E38000000246C000
128 .........W0....`........)X}..f3.....\.................4V}...f...
0000000005300016000000002570063100095000000000000000013570016000
0C0000C0270D0540C0000C0098D0263C0444C0000C0000C0000C0246D0056C00
192 .E|...V}.......................f.....<........f.C 19950531
0470005700000000880000000018000680001300000000694233333333222222
35C0046D0000C0023C0000C0083C0056D0012C0000C0016D3019950531000000
rec#=1 rcount=32 rsize=256 fsize=8192 tmp1/cm1
null=next,r#=rec,s=search,u=update,x=rollback,p=print,i=iprint,w=write,e=count
,g=genseq#,c=chkseq#,t=translate(ta=Asc,te=Ebc,tu=Upr,tl=Lwr,tc=Chars,tp=Pers)
,R#=Recsize,h1=char,h2=hex,q=quit,?=help --> q <-- quit uvhd, return to uvhdcob
Goto: Begin this document , End this document , UVSI Home-Page
We will demo uvhdcob for various filetypes (Fixed, Text, RDW, IDXFORMAT3/8) using the following data files & copybooks. We will list the copybooks first since they are common to the 4 different filetypes.
| dat1/vendormas |
|
| dat1/vendorpay |
|
| dat1/vendorpaymas |
|
| dat1/vendorpaymasa |
|
cobmap1 start-end bytes for cobol record fields 201006071317 pg# 0001 cobol/cpys/vendormas.cpy vendormas RCSZ=00064 bgn end lth typ
* vendormas - cobol copybook for vendormas1/2/3/4 data files
* - demo uvhdcob on 1=fixed, 2=text, 3=rdw, 4=idx3
* - by owen townsend, uv software, june 7/2010
01 vendormas.
10 venmas-num pic x(6). 0000 0005 006
10 venmas-type pic x(4). 0006 0009 004
10 venmas-name pic x(54). 0010 0063 054
*RCSZ=00064
cobmap1 start-end bytes for cobol record fields 201006071317 pg# 0001 cobol/cpys/vendorpay.cpy vendorpay RCSZ=00064 bgn end lth typ
* vendorpay - cobol copybook for vendorpay1/2/3/4 data file
* - demo uvhdcob on 1=fixed, 2=text, 3=rdw, 4=idx3
* - by owen townsend, uv software, june 7/2010
01 vendorpay.
10 venpay-num pic x(6). 0000 0005 006
10 venpay-type pic x(4). 0006 0009 004
10 venpay-date pic x(10). 0010 0019 010
10 venpay-inv pic x(10). 0020 0029 010
10 venpay-amt pic 9(9). 0030 0038 009 n 9
10 filler001 pic x(1). 0039 0039 001
10 venpay-item pic x(24). 0040 0063 024
*RCSZ=00064
Goto: Begin this document , End this document , UVSI Home-Page
cobmap1 start-end bytes for cobol record fields 201006071317 pg# 0001 cobol/cpys/vendorpaymas.cpy vendormas RCSZ=00064 bgn end lth typ
* vendorpaymas - cobol copybook for vendorpaymas1/2/3/4 data
* - demo uvhdcob on 1=fixed, 2=text, 3=rdw, 4=idx3
* - by owen townsend, uv software, june 7/2010
* - copybook stored at /home/uvadm/cobol/cpys/vendorpaymas.c
* to demo uvhdcob on multi-record-type files
* - identified by record-type m/p in col8 dat1/vendorpaymas1
* (also see alternate 'vendorpaymasa' identifies by record
*type=7(1),='M','vendormas'
*type=7(1),='P','vendorpay'
01 vendormas.
10 venmas-num pic x(6). 0000 0005 006
10 venmas-type pic x(4). 0006 0009 004
10 venmas-name pic x(54). 0010 0063 054
*RCSZ=00064
cobmap1 start-end bytes for cobol record fields 201006071317 pg# 0002
cobol/cpys/vendorpaymas.cpy vendorpay RCSZ=00064 bgn end lth typ
01 vendorpay.
10 venpay-num pic x(6). 0000 0005 006
10 recpay-type pic x(4). 0006 0009 004
10 venpay-date pic x(10). 0010 0019 010
10 venpay-inv pic x(10). 0020 0029 010
10 venpay-amt pic 9(9). 0030 0038 009 n 9
10 filler001 pic x(1). 0039 0039 001
10 venpay-item pic x(24). 0040 0063 024
*RCSZ=00064
*type=7(1),='M','vendormas'
*type=7(1),='P','vendorpay'
*type=00:45,'vendormas'
*type=46:99,'vendorpay'
Goto: Begin this document , End this document , UVSI Home-Page
| Note |
|
cobmap1 start-end bytes for cobol record fields 201006071317 pg# 0001 cobol/cpys/vendorpaymasa.cpy vendormas RCSZ=00064 bgn end lth typ
* vendorpaymasa - cobol copybook for vendorpaymas1/2/3/4 dat
* - demo uvhdcob on 1=fixed, 2=text, 3=rdw, 4=idx3
* - by owen townsend, uv software, june 7/2010
* - copybook stored at /home/uvadm/cobol/cpys/vendorpaymas.c
* to demo uvhdcob on multi-record-type files
* - this 'vendorpaymasa' is alternate copybook to 'vendorpay
* with *type controls by record-size vs record-type-data
*type=00:45,'vendormas'
*type=46:99,'vendorpay'
01 vendormas.
10 venmas-num pic x(6). 0000 0005 006
10 venmas-type pic x(4). 0006 0009 004
10 venmas-name pic x(54). 0010 0063 054
*RCSZ=00064
cobmap1 start-end bytes for cobol record fields 201006071317 pg# 0002
cobol/cpys/vendorpaymasa.cpy vendorpay RCSZ=00064 bgn end lth typ
01 vendorpay.
10 venpay-num pic x(6). 0000 0005 006
10 recpay-type pic x(4). 0006 0009 004
10 venpay-date pic x(10). 0010 0019 010
10 venpay-inv pic x(10). 0020 0029 010
10 venpay-amt pic 9(9). 0030 0038 009 n 9
10 filler001 pic x(1). 0039 0039 001
10 venpay-item pic x(24). 0040 0063 024
*RCSZ=00064
Goto: Begin this document , End this document , UVSI Home-Page
There are 4 data-files for each copybook (listed above) to demo the 4 different types of data files. The data files are the same names as the copybooks with a digit appended to indicate the file-type (1=Fixed, 2=Text, 3=RDW, 4=IDX).
We will descibe the 4 types of files using vendormas1/2/3/4 as an example. I have added another type '0' for the Fixed-length file from a mainframe, which would be EBCDIC, with no LineFeeds.
| dat1/vendormas0 |
|
| dat1/vendormas1 |
|
| dat1/vendormas2 |
|
| dat1/vendormas3 |
|
| dat1/vendormas4 |
|
We will list only the Text files (suffix '2'), since only the text file could be listed with normal unix/linux utilities (require LineFeeds & no binary data). See copybook/maps (record layouts) listed on page 'G1'
Goto: Begin this document , End this document , UVSI Home-Page
vendor# type vendor-name ========================================= DELL10 M Dell Inc. HP0010 M Hewlett Packard IBM010 M International Business Machines MFC010 M Micro Focus COBOL MS0010 M Microsoft Corp. REDH10 M Red Hat Linux SUN010 M Sun Microsystems Ltd UVSI10 M UV Software Inc.
vendor# RT date invoice amount item-description ============================================================ DELL10 P 20100131 INV00010 000195000 Dell server 2900 HP0010 P 20100215 INV00020 000350000 HP XW9400 Workstation HP0010 P 20100215 INV00020 000042500 HP LCD Monitor IBM010 P 20100321 INV00030 000750000 AIX server IBM010 P 20100322 INV00030 000750000 DB2 database software MFC010 P 20100420 INV00040 000320000 Micro Focus Developer MS0010 P 20100501 INV00050 000011600 Microsoft Windows 7 REDH10 P 20100620 INV00060 000034900 Red Hat Enterprise 5.4
Goto: Begin this document , End this document , UVSI Home-Page
vendor# RT name/date invoice amount item-description ============================================================ DELL10 M Dell Inc. DELL10 P 20100131 INV00010 000195000 Dell server 2900 HP0010 M Hewlett Packard HP0010 P 20100215 INV00020 000042500 HP LCD Monitor HP0010 P 20100215 INV00020 000350000 HP XW9400 Workstation IBM010 M International Business Machines IBM010 P 20100321 INV00030 000750000 AIX server IBM010 P 20100322 INV00030 000750000 DB2 database software MFC010 M Micro Focus COBOL MFC010 P 20100420 INV00040 000320000 Micro Focus Developer MS0010 M Microsoft Corp. MS0010 P 20100501 INV00050 000011600 Microsoft Windows 7 REDH10 M Red Hat Linux REDH10 P 20100620 INV00060 000034900 Red Hat Enterprise 5.4 SUN010 M Sun Microsystems Ltd UVSI10 M UV Software Inc.
Goto: Begin this document , End this document , UVSI Home-Page
We will demo uvhdcob using the data files listed on pages 'G3' & 'G4', & using the copybook/maps listed on pages 'G1' & 'G2'. You can do these demos using the 'uvadm' login, or in your home directory if you copy the demo files.
#1. login uvadm --> /home/uvadm <-- can demo in uvadm homedir
===========================
#1. login yourself --> /home/yourhomedir <-- to copy demo files to your homedir
====================================
#2a. mkdir dat1 <-- make subdir for data files
==========
#2b. mkdir cobol <-- so instrns below same for uvadm or your login
===========
#2c. mkdir cobol/cpys <-- subdir for copybooks
================
#2d. mkdir cobol/maps <-- subdir for copybook/maps (record layouts)
================
#2e. mkdir tmp <-- subdir for output files from Print & Write commands
=========
#3a. cp /home/uvadm/dat1/vendor* dat1 <-- copy all vendor* files (15)
================================
(vendormas0,1,2,3,4, vendorpay0,1,2,3,4, vendorpaymas0,1,2,3,4)
#3b. cp /home/uvadm/cobol/cpys/vendor* cpys <-- copy all vendor* copybooks (3)
======================================
(vendormas, vendorpay, vendorpaymas)
#4. uvcopyx cobmap1 cobol/cpys cobol/maps uop=q0i7
==============================================
- convert COBOL copybooks to maps (record layouts) for uvhdcob
Goto: Begin this document , End this document , UVSI Home-Page
#0. uvhdcob dat1/vendormas0 cobol/maps/vendormas a <-- note option 'a'
======================*=======================
- option 'a' translates EBCDIC to ASCII for display only
uvhdcob datafile=dat1/vendormas0 20100607:1405 copybook=cobol/maps/vendormas options=a rec#=1 rcount=8 rsize=64 fsize=512 fptr=0 rec# 1 occurs bgn end typ<------ data (hex if typ=p/b) -----> 001 venmas-num 0 5 DELL10 002 venmas-type 6 9 M 003 venmas-name 10 63 Dell Inc. rec#=1 rcount=8 rsize=64 fsize=512 fptr=0 ,k1=HelpPrompts,?=HelpScreens -->
Goto: Begin this document , End this document , UVSI Home-Page
#1. uvhdcob dat1/vendormas1 cobol/maps/vendormas
======================*=====================
- no options are required for ASCII fixed length
- since record size is coded in the copybook/map
uvhdcob datafile=dat1/vendormas1 20100607:1432 copybook=cobol/maps/vendormas options= rec#=1 rcount=8 rsize=64 fsize=512 fptr=0 rec# 1 occurs bgn end typ<------ data (hex if typ=p/b) -----> 001 venmas-num 0 5 DELL10 002 venmas-type 6 9 M 003 venmas-name 10 63 Dell Inc. rec#=1 rcount=8 rsize=64 fsize=512 fptr=0 ,k1=HelpPrompts,?=HelpScreens -->
#2. uvhdcob dat1/vendormas2 cobol/maps/vendormas t <-- note option 't'
======================*=======================
- option 't' for Text files (variable length termianted by LineFeed)
uvhdcob datafile=dat1/vendormas2 20100607:1518 copybook=cobol/maps/vendormas options=t rec#=1 rcount=11 rsize=20 fsize=225 fptr=0 rec# 1 occurs bgn end typ<------ data (hex if typ=p/b) -----> 001 venmas-num 0 5 DELL10 002 venmas-type 6 9 M 003 venmas-name 10 63 Dell Inc. rec#=1 rcount=11 rsize=20 fsize=225 fptr=0 ,k1=HelpPrompts,?=HelpScreens -->
| Note |
|
Goto: Begin this document , End this document , UVSI Home-Page
#3. uvhdcob dat1/vendormas3 cobol/maps/vendormas z4 <-- note option 'z4'
======================*========================
- option 'z4' for RDW files with 4 byte record prefix
uvhdcob datafile=dat1/vendormas3 20100607:1523 copybook=cobol/maps/vendormas options=z4 rec#=1 rcount=10 rsize=23 fsize=249 fptr=0 rec# 1 occurs bgn end typ<------ data (hex if typ=p/b) -----> 001 venmas-num 0 5 DELL10 002 venmas-type 6 9 M 003 venmas-name 10 63 Dell Inc. rec#=1 rcount=10 rsize=23 fsize=249 fptr=0 ,k1=HelpPrompts,?=HelpScreens -->
rec#=2 rcount=8 rsize=30 fsize=249 fptr=23 rec# 2 occurs bgn end typ<------ data (hex if typ=p/b) -----> 001 venmas-num 0 5 HP0010 002 venmas-type 6 9 M 003 venmas-name 10 63 Hewlett Packard rec#=2 rcount=8 rsize=30 fsize=249 fptr=23 ,k1=HelpPrompts,?=HelpScreens -->
rec#=3 rcount=5 rsize=45 fsize=249 fptr=53 rec# 3 occurs bgn end typ<------ data (hex if typ=p/b) -----> 001 venmas-num 0 5 IBM010 002 venmas-type 6 9 M 003 venmas-name 10 63 International Business Machines rec#=3 rcount=5 rsize=45 fsize=249 fptr=53 ,k1=HelpPrompts,?=HelpScreens -->
rec#=4 rcount=8 rsize=31 fsize=249 fptr=98 rec# 4 occurs bgn end typ<------ data (hex if typ=p/b) -----> 001 venmas-num 0 5 MFC010 002 venmas-type 6 9 M 003 venmas-name 10 63 Micro Focus COBOL rec#=4 rcount=8 rsize=31 fsize=249 fptr=98 ,k1=HelpPrompts,?=HelpScreens -->
rec#=5 rcount=8 rsize=29 fsize=249 fptr=129 rec# 5 occurs bgn end typ<------ data (hex if typ=p/b) -----> 001 venmas-num 0 5 MS0010 002 venmas-type 6 9 M 003 venmas-name 10 63 Microsoft Corp. rec#=5 rcount=8 rsize=29 fsize=249 fptr=129 ,k1=HelpPrompts,?=HelpScreens -->
Goto: Begin this document , End this document , UVSI Home-Page
rec#=6 rcount=9 rsize=27 fsize=249 fptr=158 rec# 6 occurs bgn end typ<------ data (hex if typ=p/b) -----> 001 venmas-num 0 5 REDH10 002 venmas-type 6 9 M 003 venmas-name 10 63 Red Hat Linux rec#=6 rcount=9 rsize=27 fsize=249 fptr=158 ,k1=HelpPrompts,?=HelpScreens -->
rec#=7 rcount=7 rsize=34 fsize=249 fptr=185 rec# 7 occurs bgn end typ<------ data (hex if typ=p/b) -----> 001 venmas-num 0 5 SUN010 002 venmas-type 6 9 M 003 venmas-name 10 63 Sun Microsystems Ltd rec#=7 rcount=7 rsize=34 fsize=249 fptr=185 ,k1=HelpPrompts,?=HelpScreens -->
rec#=8 rcount=8 rsize=30 fsize=249 fptr=219 rec# 8 occurs bgn end typ<------ data (hex if typ=p/b) -----> 001 venmas-num 0 5 UVSI10 002 venmas-type 6 9 M 003 venmas-name 10 63 UV Software Inc. rec#=8 rcount=8 rsize=30 fsize=249 fptr=219 ,k1=HelpPrompts,?=HelpScreens --> EOF, -1 Last Record, or 1 return Begin File
Goto: Begin this document , End this document , UVSI Home-Page
uvhd dat1/vendormas3 z4 <-- note 'uvhd' (vs uvhdcob) ======================= - option 'z4' for recsize in 4 byte binary prefix
--> p8 <-- print 8 records to tmp/vendormas1_yymmdd_hhmmssP
uvlp12 tmp/vendormas3_100607_160344P <-- list Print command output ====================================
uvhd filename=/home/uvadm/dat1/vendormas3
options=z4 lastmod=2010060708 today=20100607160344 print=p8
records=10 rsize=23 fsize=249 fsize%rsize(rmndr)=19
10 20 30 40 50 60
r# 1 0123456789012345678901234567890123456789012345678901234567890123
0 ....DELL10 M Dell Inc.
01004444332422466624662
070045CC100D0045CC09E3E
10 20 30 40 50 60
r# 2 0123456789012345678901234567890123456789012345678901234567890123
0 ....HP0010 M Hewlett Packard
010045333324224676677256666762
0E008000100D00857C5440013B1240
10 20 30 40 50 60
r# 3 0123456789012345678901234567890123456789012345678901234567890123
0 .-..IBM010 M International Business Machines
020044433324224676766766666247766677246666667
0D0092D0100D009E452E149FE1C02539E5330D1389E53
10 20 30 40 50 60
r# 4 0123456789012345678901234567890123456789012345678901234567890123
0 ....MFC010 M Micro Focus COBOL
0100444333242246676246677244444
0F00D630100D00D932F06F35303F2FC
10 20 30 40 50 60
r# 5 0123456789012345678901234567890123456789012345678901234567890123
0 ....MS0010 M Microsoft Corp.
01004533332422466767667246772
0D00D300100D00D932F3F6403F20E
10 20 30 40 50 60
r# 6 0123456789012345678901234567890123456789012345678901234567890123
0 ....REDH10 M Red Hat Linux
010054443324225662467246677
0B002548100D0025408140C9E58
10 20 30 40 50 60
r# 7 0123456789012345678901234567890123456789012345678901234567890123
0 ."..SUN010 M Sun Microsystems Ltd
0200554333242257624667677776672476
020035E0100D0035E0D932F39345D30C44
10 20 30 40 50 60
r# 8 0123456789012345678901234567890123456789012345678901234567890123
0 ....UVSI10 M UV Software Inc.
010055543324225525667767624662
0E005639100D005603F64712509E3E
Goto: Begin this document , End this document , UVSI Home-Page
When you want to list an RDW file, an alternative to 'uvhd' could be 'uvcopy listRDW1', which will provide a more compact listing & it shows the record-size converted to decimal (vs hexadecimal by uvhd/uvhdcob).
#1. uvcopy listRDW1,fili1=dat1/vendormas3 <-- list in vertical hexadecimal
=====================================
- by default writes output file to tmp/... (with same name as input)
#2. uvlp12 tmp/vendormas3 <-- list report file created by listRDW1
=====================
1 2 3 4 5 6 7
01234567890123456789012345678901234567890123456789012345678901234567890123456789
rec# rcsz <---------------- record data (1st 64 bytes) ------------------>
0001 0019 DELL10 M Dell Inc.
4444332422466624662
45CC100D0045CC09E3E
0002 0026 HP0010 M Hewlett Packard
4533332422467667725666676
8000100D00857C5440013B124
0003 0041 IBM010 M International Business Machines
44433324224676766766666247766677246666667
92D0100D009E452E149FE1C02539E5330D1389E53
0004 0027 MFC010 M Micro Focus COBOL
444333242246676246677244444
D630100D00D932F06F35303F2FC
0005 0025 MS0010 M Microsoft Corp.
4533332422466767667246772
D300100D00D932F3F6403F20E
0006 0023 REDH10 M Red Hat Linux
54443324225662467246677
2548100D0025408140C9E58
0007 0030 SUN010 M Sun Microsystems Ltd
554333242257624667677776672476
35E0100D0035E0D932F39345D30C44
0008 0026 UVSI10 M UV Software Inc.
55543324225525667767624662
5639100D005603F64712509E3E
Goto: Begin this document , End this document , UVSI Home-Page
Goto: Begin this document , End this document , UVSI Home-Page
The pages above demonstrated uvhdcob using dat1/vendormas0,1,2,3,4. These files had only 1 record type. Now we will demo uvhdcob for files with multiple record types.
Please see 'dat1/vendorpaymas2' listed on page 'H3' with 2 record types (vendor names & vendor payments). Here are the 1st 4 records:
vendor# RT name/date invoice amount item-description ============================================================ DELL10 M Dell Inc. DELL10 P 20100131 INV00010 000195000 Dell server 2900 HP0010 M Hewlett Packard HP0010 P 20100215 INV00020 000042500 HP LCD Monitor
Also see the copybook/map listed on page 'G2' which defines both record types and has '*type' control records inserted at the begining (listed below).
*type=7(1),='M','vendormas'
*type=7(1),='P','vendorpay'
uvhdcob uses the 'type' control records to determine which copybook is to be used for the various record types. 'vendormas' records are identified by 'M' in byte 7 vs 'vendorpay' records which have 'P' in byte 7.
Also see the Alternate copybook/map 'vendorpaymasa' listed on page 'G3' which contains the following 'type' control recors:
*type=00:45,'vendormas'
*type=46:99,'vendorpay'
This Alternate format identifies record types by record length. From the vendorpaymas file listed above, you can see that the payment records are considerably longer than the vendor name records. We decided to use 45 as the boundary between the 2 types.
Goto: Begin this document , End this document , UVSI Home-Page
uvhdcob dat1/vendorpaymas3 cobol/maps/vendorpaymas z4 =====================================================
*type=7(1),='M','vendormas': bgn=7,lth=1,typ=M,fnm=vendormas *type=7(1),='P','vendorpay': bgn=7,lth=1,typ=P,fnm=vendorpay uvhdcob datafile=dat1/vendorpaymas3 20100608:2330 copybook=cobol/maps/vendorpaymas options=z4 rec#=1 rcount=32 rsize=23 fsize=745 fptr=0 rec# 1 occurs bgn end typ<------ data (hex if typ=p/b) -----> 001 venmas-num 0 5 DELL10 002 venmas-type 6 9 M 003 venmas-name 10 63 Dell Inc. rec#=1 rcount=32 rsize=23 fsize=745 fptr=0 ,k1=HelpPrompts,?=HelpScreens -->
rec#=2 rcount=12 rsize=60 fsize=745 fptr=23 rec# 2 occurs bgn end typ<------ data (hex if typ=p/b) -----> 001 venpay-num 0 5 DELL10 002 recpay-type 6 9 P 003 venpay-date 10 19 20100131 004 venpay-inv 20 29 INV00010 005 venpay-amt 30 38 n 000195000 006 filler001 39 39 007 venpay-item 40 63 Dell server 2900 rec#=2 rcount=12 rsize=60 fsize=745 fptr=23 ,k1=HelpPrompts,?=HelpScreens -->
rec#=3 rcount=24 rsize=30 fsize=745 fptr=83 rec# 3 occurs bgn end typ<------ data (hex if typ=p/b) -----> 001 venmas-num 0 5 HP0010 002 venmas-type 6 9 M 003 venmas-name 10 63 Hewlett Packard rec#=3 rcount=24 rsize=30 fsize=745 fptr=83 ,k1=HelpPrompts,?=HelpScreens -->
rec#=4 rcount=12 rsize=58 fsize=745 fptr=113 rec# 4 occurs bgn end typ<------ data (hex if typ=p/b) -----> 001 venpay-num 0 5 HP0010 002 recpay-type 6 9 P 003 venpay-date 10 19 20100215 004 venpay-inv 20 29 INV00020 005 venpay-amt 30 38 n 000042500 006 filler001 39 39 007 venpay-item 40 63 HP LCD Monitor rec#=4 rcount=12 rsize=58 fsize=745 fptr=113 ,k1=HelpPrompts,?=HelpScreens --> q <-- quit request - program ended **
Goto: Begin this document , End this document , UVSI Home-Page
Scripts such as 'uvhdc1' & 'uvhdc2' make it easier to use the 'uvhdcob' program because:
This system depends on the following components (listed on following pages)
1a. uvhdc1 demo script - supplied in /home/uvadm/sf/demo/uvhdc1
1b. uvhdc2 alternative script - supplied in /home/uvadm/sf/util/uvhdc2
- embedded comments more relevant to mainframe conversion sites
2a. ctlfile_uvhdc1 control file demo for copybooks/datafiles described above:
- copybooks: vendormas, vendorpay, vendorpaymas
- datafiles: vendormas0/1/2/3/4, vendorpay0/1/2/3/4, vendorpaymas0/1/2/3/4
2b. ctlfile_uvhdc2 control file demo for conversion mainframe sites
- copybooks: custmas, salesdtl, acntmas
- datafiles: ar/customer.master, ar/sales.items, gl/account.master_ (GDG)
The script uses environmental variables CTLMAPDIR,CNVDATA,RUNLIBS,RUNDATA (the 1st 1 defined) to define the superdir for subdirs ctl/... & maps/... You can define your desired superdir in your profile:
export CTLMAPDIR=/home/mvstest/testlibs ======================================= - to be sure you get the desired superdir
export RUNLIBS=/home/mvstest/testlibs ===================================== - could omit CTLMAPDIR if you already have & want this
export CTLMAPDIR=$RUNLIBS ========================= - need to define CTLMAPDIR if you have both CNVDATA & RUNLIBS defined - since the script picks 1st of CTLMAPDIR,CNVDATA,RUNLIBS,RUNDATA
Goto: Begin this document , End this document , UVSI Home-Page
We will 1st demo the script using the copybooks & datafiles already listed above starting at 'G1' & 'H1'. You can run these demos in /home/uvadm/... or you can run in your homedir is you copy the demo files as shown on page 'I1'. Here are the directories relevant to demonstrating the uvhdc1 script.
/home/uvadm :----cobol <-- test/demo libraries : :----cpys/ - copybooks : : :----vendormas.cpy : : :----vendorpay.cpy : : :----vendorpaymas.cpy : : : : :----ctl/ - control files : : :----ctlfile_uvhdc1 <-- sequential ctlfile for editing : : :----ctlfile_uvhdc1I.dat <-- Indexed control for lookup by uvhdget2 : : :----ctlfile_uvhdc1.Iidx : : : : :----maps/ - maps (record layouts) generated from copybooks : : :----vendormas : : :----vendorpay : : :----vendorpaymas
:----dat1 <-- test/demo data files
: :----vendormas0 - Fixed length EBCDIC
: :----vendormas1 - Fixed length ASCII
: :----vendormas2 - text file (LineFeed after last nonblank)
: :----vendormas3 - RDW (4 byte prefix, binary recsize in 1st 2)
: :----vendormas4 - IDXFORMAT3 (Micro Focus variable lth)
: :
: :----vendorpay0/1/2/3/4 - payment records (same 5 formats as above)
: :
: :----vendorpaymas0/1/2/3/4 - multi-record-type file (payments + names)
- same 5 formats as above
Goto: Begin this document , End this document , UVSI Home-Page
I have already performed these pre-requisites for the demos in /home/uvadm using script 'uvhdc1' & control file 'ctlfile_uvhdc1'. You can repeat them if you wish & you would have to do similar commands to setup uvhdc1/2 for your own files (which might be closer to the uvhdc2 conventions).
#1. Login uvadm --> /home/uvadm
#2. uvcopyx cobmap1 cobol/cpys cobol/maps uop=q0i7
==============================================
- convert the 'copybooks' to 'cobmaps'
(record layouts with field start/end/length/type on right side)
#3. vi cobol/ctl/ctlfile_uvhdc1
===========================
- create the control file to relate datafiles to copybooks & filetypes
- here are a few sample records
- see complete control file listed on page 'K6'
dat1/custmas0 cpy=custmas1 rcs=00256
dat1/custmas1 cpy=custmas1 rcs=00256
dat1/vendormas0 cpy=vendormas rcs=00064
dat1/vendormas1 cpy=vendormas rcs=00064
dat1/vendormas2 cpy=vendormas rcs=00064
dat1/vendormas3 cpy=vendormas rcs=00064
dat1/vendorpay3 cpy=vendorpay rcs=00064
dat1/vendorpaymas3 cpy=vendorpaymas rcs=00064
#4. uvcopy loadctlI,fili1=ctl/ctlfile_uvhdc1,filo1=ctl/ctlfile_uvhdc1I
==================================================================
- load the control file into an indexed file for random access by uvhdget2
Goto: Begin this document , End this document , UVSI Home-Page
We will 1st demo the script using the copybooks & datafiles already listed above starting at 'G1' & 'H1'. You can run demos in /home/uvadm/... as follows:
#1. Login uvadm --> /home/uvadm
#2a. ls -l dat1/vendor* <-- list demo data datafiles available
================== - listed above starting on page 'G1'
#2b. ls -l cobol/maps/vendor* <-- list demo copybook/maps available
======================== - listed above starting on page 'G1'
#2c. ls -l cobol/ctl/ctlfile* <-- list demo control files available
======================== - listed below starting on page 'K6'
#3. export CTLMAPDIR=/home/uvadm/cobol <-- define superdir for uvhdc1 to look
================================== for subdirs of maps/... & ctl/...
#4. uvhdc1 dat1/vendormas0 <-- run script to display EBCDIC version of file
======================
uvhdcob datafile=dat1/vendormas0
20100607:1405 copybook=cobol/maps/vendormas options=a
rec#=1 rcount=8 rsize=64 fsize=512 fptr=0
rec# 1 occurs bgn end typ<---- data (hex if typ=p/b) ---->
001 venmas-num 0 5 DELL10
002 venmas-type 6 9 M
003 venmas-name 10 63 Dell Inc.
rec#=1 rcount=8 rsize=64 fsize=512 fptr=0
,k1=HelpPrompts,?=HelpScreens -->
| Note |
|
#5a. uvhdcob dat1/vendormas0 $CTLMAPDIR/maps/vendormas fr64a
=======================================================
#5a. uvhdcob dat1/vendormas0 /home/uvadm/cobol/maps/vendormas fr64a
==============================================================
| Note |
|
Goto: Begin this document , End this document , UVSI Home-Page
#!/bin/ksh
# uvhdc1 - Korn shell script from UVSI stored in: /home/uvadm/sf/demo/
# uvhdc1 - script to run uvhdcob without specifying copybookname
# - see doc at www.uvsoftware.ca/uvhdcob.htm#K1
# - using uvhdcob directly requires copybookname
# (awkward when datafile & copybook in different filesystems)
#
# uvhdc1 - datafiles in /home/uvadm/dat1/...
# - copybook/maps in /home/uvadm/cobol/maps/...
# - ctlfile_uvhdc2I in /home/uvadm/cobol/ctl/...
#
# export CTLMAPDIR=/home/uvadm/cobol
# ==================================
# - for demo documented at www.uvsoftware.ca/uvhdcob.htm#K1
#
# uvhdc1 dat1.custmas1 <-- sample command for this script
# ====================
# - above script 'uvhdc1' generates following 'uvhdcob' command:
# (using control file entry matching datafilename spcfd)
#
# uvhdcob dat1/custmas1 $CTLMAPDIR/maps/custmas1 r256
# ===================================================
#
# - uvhdc1 looks for control-file & copybookmap in $CTLMAPDIR
# ($CTLMAPDIR/ctl/ctlfile_uvhdc1 & $CTLMAPDIR/maps/...)
# - if $CTLMAPDIR undefined, default to $CNVDATA, $RUNLIBS, or $RUNDATA
#
# ** sample control file **
#
# dat1/custmas0 cpy=custmas1 rcs=00256
# dat1/custmas1 cpy=custmas1 rcs=00256
# dat1/vendormas0 cpy=vendormas rcs=00064
# dat1/vendormas1 cpy=vendormas rcs=00064
# dat1/vendormas2 cpy=vendormas rcs=00064
# dat1/vendormas3 cpy=vendormas rcs=00064
# dat1/vendorpay3 cpy=vendorpay rcs=00064
# dat1/vendorpaymas3 cpy=vendorpaymas rcs=00064
#
#
# This script (uvhdc1) calls uvcopy job 'uvhdget2' to lookup the control file
# to get the copybookname & options (record-size & file-type), for example:
#
# uvhdc1 d2asc/custmas1 <-- script minimizes keystrokes required
# =====================
#
# uvcopy uvhdget2,filr1=$CTLMAPDIR/ctl/ctlfile_uvhdc1I,filo1=/tmp/$LOGNAME.cpy\
# =============================================================================
# ,arg1=custmas1
# ==============
#
# uvhdcob d2asc/custmas1 $CTLMAPDIR/maps/custmast
# ===============================================
# - long 'uvhdcob' command generated from short 'uvhdc1' script
#
# ** Pre-Requisites for uvhdc1 **
#
# 1. cd $CTLMAPDIR, or $CNVDATA, or $RUNLIBS, or $RUNDATA"
# =====================================================
# 2. uvcopyx cobmap1 cpys maps uop=q0i7p0 <-- create cobmaps
# =======================================
# 3. vi ctl/ctlfile_uvhdc1 <-- create control file
# =====================
# 4. uvcopy loadctlI,fili1=ctl/ctlfile_uvhdc1,filo1=ctl/ctlfile_uvhdc1I
# ==================================================================
# - load control file to Indexed file for use by uvhdget2
# keyed by datafilename to lookup copybook/map, recsize,& filetype options
#
file1="$1"; clops="$2" # give names to arg1(datafilename) & arg2(options)
file2="$1" # will append .dat if Indexed
file3=$(basename "$1") # basename (with subdir removed)
if [[ -z "$clops" ]]; then clops=m24; fi
#
# if CTLMAPDIR undefined, default to $CNVDATA or $RUNLIBS
if [[ -d "$CTLMAPDIR" ]]; then :
elif [[ -d "$CNVDATA" ]]; then export CTLMAPDIR=$CNVDATA;
elif [[ -d "$TESTLIBS" ]]; then export CTLMAPDIR=$TESTLIBS;
elif [[ -d "$TESTDATA" ]]; then export CTLMAPDIR=$TESTDATA;
else echo "none of $CTLMAPDIR,$CNVDATA,$RUNLIBS,$RUNDATA defined"
exit 99; fi
#
# filenames ending with '_' indicate generation files
# - get latest generation using exportgen0 function
if [[ "$file1" == *_ ]]; then exportgen0 file1 $file1; fi
#
# verify user filename is a valid file
# - check for Indexed file & set file2 = $file1.dat if indexed
if [[ -f "$file1.dat" ]]; then file2=$file1.dat; fi
if [[ ! -f "$file2" ]]
then echo "usage: uvhdc1 datafile [options]"
echo " ========================="
echo "example: uvhdc1 dat1/custmas1"
echo " ===================="
echo "arg1 - data file in $CTLMAPDIR/ctl/ctlfile_uvhdc1I"
echo " - ctlfile_uvhdc1I specifies cpy=copybookmap & rcs=recsize"
exit 1; fi
#
# use uvcopy job to get copybookname from datafilename
# - will write copybookname to: /tmp/${LOGNAME}.cpy
uvcopy uvhdget2,filr1=${CTLMAPDIR}/ctl/ctlfile_uvhdc1I\
,filo1=/tmp/${LOGNAME}.cpy,arg1=$file1
if (( $? != 0))
then echo "datafilename not in control file"; exit 2;fi
#
# open the file written by uvcopy & retrieve copyname & options into $variables
exec 3< /tmp/${LOGNAME}.cpy # open file written by uvcopy
read -u3 copyname rcsz cfops keys other # read file contents into variables
exec 3<&- # close file
#
#Jan28/09/DEBUG - display $rcsz$cfops$clops
echo "DEBUG: copyname=$copyname, rcsz=$rcsz, cfops=$cfops clops=$clops"
#
uvhdcob $file2 $CTLMAPDIR/maps/$copyname $rcsz$cfops$clops
#=========================================================
exit 0
#
Goto: Begin this document , End this document , UVSI Home-Page
# ctlfile_uvhdc1 - sample control file for: 'uvhdcob' & uvhdc2/uvhdget2 # - see www.uvsoftware.ca/uvhdcob.htm#K1 # # ctlfile_uvhdc1 - stored at /home/uvadm/cobol/ctl/ctlfile_uvhdc1 for demos # - using data files in /home/uvadm/dat1/... # (custmas1, vendormas0/1/2/3/4, vendorpay0/1/2/3/4, ...) # - using copybook/maps in /home/uvadm/cobol/maps/... # (custmas1,vendormas,vendorpay,vendorpaymas) # # - saves having to specify copybook/map for uvhdcob & desired datafile # - using uvhdcob directly requires copybook/map # (awkward when datafile & copybook in different filesystems) # # uvhdcob dat1/custmas1 cobol/maps/custmas1 <-- sample uvhdcob # =============================================== # # uvhdc1 dat1/custmas1 <-- script 'uvhdc1' saves coding copybook/map # ==================== - looks-up ctlfile to get copybook # # ** Pre-Requisites for uvhdc1 ** # # 0. cd $CTLMAPDIR or $CNVDATA or $RUNLIBS or $RUNLIBS # # 1. uvcopyx cobmap1 cpys maps uop=q0i7p0 <-- create cobmaps # ==================================== # # 2. vi ctl/ctlfile_uvhdc1 <-- create ctlfile to relate datafiles to copybooks # ===================== # # 3. uvcopy loadctlI,fili1=ctl/ctlfile_uvhdc1,filo1=ctl/ctlfile_uvhdc1I # ================================================================== # - load indexed file # #--------datafile------- --copybook-- -recsize- -type- -options- dat1/custmas0 cpy=custmas1 rcs=00256 typ=RSF ops=fa dat1/custmas1 cpy=custmas1 rcs=00256 typ=RSF ops=f dat1/sales0 cpy=sales1 rcs=00064 typ=RSF ops=fa dat1/sales1 cpy=sales1 rcs=00064 typ=RSF ops=f dat1/sales2 cpy=sales1 rcs=00064 typ=RST ops=f dat1/sales4rdw cpy=sales1 rcs=00064 typ=RDW ops=z4 dat1/vendormas0 cpy=vendormas rcs=00064 typ=RSF ops=fa dat1/vendormas1 cpy=vendormas rcs=00064 typ=RSF ops=f dat1/vendormas2 cpy=vendormas rcs=00064 typ=LST ops=t dat1/vendormas3 cpy=vendormas rcs=00064 typ=RDW ops=z4 dat1/vendormas4 cpy=vendormas rcs=00064 typ=IDXf8 ops=v dat1/vendorpay0 cpy=vendorpay rcs=00064 typ=RSF ops=fa dat1/vendorpay1 cpy=vendorpay rcs=00064 typ=RSF ops=f dat1/vendorpay2 cpy=vendorpay rcs=00064 typ=LST ops=t dat1/vendorpay3 cpy=vendorpay rcs=00064 typ=RDW ops=z4 dat1/vendorpay4 cpy=vendorpay rcs=00064 typ=IDXf8 ops=v dat1/vendorpaymas0 cpy=vendorpaymas rcs=00064 typ=RSF ops=fa dat1/vendorpaymas1 cpy=vendorpaymas rcs=00064 typ=RSF ops=f dat1/vendorpaymas2 cpy=vendorpaymas rcs=00064 typ=LST ops=t dat1/vendorpaymas3 cpy=vendorpaymas rcs=00064 typ=RDW ops=z4 dat1/vendorpaymas4 cpy=vendorpaymas rcs=00064 typ=IDXf8 ops=v #
Goto: Begin this document , End this document , UVSI Home-Page
# uvhdget2 - uvcopy Parameter File from UVSI stored in: /home/uvadm/pf/util/
# uvhdget2 - get the copybookname using indexed control file
# of datafilenames & copybooknames
# - command format & examples follow below:
#Jan24/09 - ctlfile1 changed to ctlfile_uvhdc2
#
# uvcopy uvhdget2,filr1=Indexed-control-file,filo1=copyname,arg1=datafile
# =======================================================================
#
# uvcopy uvhdget2,filr1=$CTLMAPDIR/ctl/ctlfile_uvhdc2
# ,filo1=/tmp/$LOGNAME.cpy,arg1=ar/customer.master
# ===============================================================
#
# $CTLMAPDIR/ctl/ctlfile_uvhdc2 <-- datafilenames, cpy=copybookmap, rcs=recsize
# $CTLMAPDIR/maps/copybookmaps <-- record layouts created by uvcopy cobmap1
# if $CTLMAPDIR undefined, defaults to $CNVDATA, or $RUNLIBS, or $RUNDATA
#
# This uvcopy job is called by script 'uvhdc2' which allows you to run 'uvhdcob'
# without specifying the copybookname, or options for record-size
# - uses indexed control file to determine copyname from datafilename
#
# uvhdcob subdir/datafile copybook options <-- uvhdcob direct command
# ======================================== - must specify file,copybook,optns
#
# uvhdc2 subdir/datafile [r257m50a] <-- usually need no options
# ================================= - option 'r' recsize supplied by copybook
# - may override & specify other options
#
# uvhdc2 ar/customer.master
# =========================
#
# - above script 'uvhdc2' generates following 'uvhdcob' command:
# (using control file entry below matching datafilename spcfd)
#
# uvhdcob ar/customer.master $CTLMAPDIR/maps/custmas fr256
# ========================================================
#
# ** sample control file **
#
# ar/customer.master cpy=custmas rcs=00256 typ=RSF ops=f
# ar/sales.items cpy=custmas rcs=00256 typ=RSF ops=f
# gl/account.master_ cpy=custmas rcs=00256 typ=RSF ops=f
#
filr1=${CTLMAPDIR}/ctl/ctlfile_uvhdc2,typ=ISF,rcs=150
filo1=/tmp/${LOGNAME}.cpy,typ=LSTt,rcs=150
#
@run
opn all open files
mvc a0(40),$arg1 store datafilename as key
redm5 filr1,a0(150) random read by key to get copymapname
skp! err1
clr b0(300),' ' init arguments build area
#
# store copybookname as arg1
man20 scn a0(128),'cpy=' scan for copybook ID
skp! err2
mvum b0(40),ax4,'. ' store cpybknm til .ext or blank
#
# store rec-size as 1st option in arg2
# - but clear if recsize zero (for RDW files)
#Feb06/10 - allow alt rcs= ID at Everis
scn a0(128),'rcs=' scan for recsize ID
skp= man26
scn a0(128),'rcm=' scan for alternate recsize ID
skp! err3
man26 mvc b41(1),'r' prefix 'r' reqd for uvhdcob
mvn b42(5),ax4(5) store recsize & test zero ?
#
# If indexed - add 1 to record-size
man30 scn a0(128),'key=' scan for keys ID
skp! man40
mvum b200(5),ax8,') ' store key lth til ending ')'
cmn b200(5),1 any key length ?
skp< 1
add b42(5),1 add 1 to recsize in ctlfile
#
#Jun12/10 - scan for ops=...
man40 scn a0(128),'ops=' control file options ?
skp! 1
mvc b50(8),ax4
#
# squeeze arguments to 1 blank between
# - 1st squeeze options to no blanks (all options arg2)
man80 sqz b40(60),' ' squeeze all options into arg2
sqzc1 b0(100),' ' squeeze to 1 blank btwn words
put filo1,b0(128) write to output file
eoj
#
#--------------------------------------------------------------------
#
err1 msgv1 'datafilename NOT FOUND in ctlfile: $filr1'
mvfv3 c0(80),'datafile = $arg1 '
can c0(80)
#
err2 msgv1 'copybookmapname NOT FOUND in ctlfile: $filr1'
mvfv3 c0(80),'for datafile = $arg1 '
can c0(80)
#
err3 msgv1 'record-size not found in ctlfile: $filr1'
mvfv3 c0(80),'datafile = $arg1 '
can c0(80)
Goto: Begin this document , End this document , UVSI Home-Page
We will demo the script using the 'vsetest' files supplied to demo the JCL conversions. See the setup procedures at VSEJCL.htm#1P1 thru 1P4. All directories are shown at VSEJCL.htm#1A1 but here are the directories relevant to demonstrating the uvhdc2 script.
Rather than setting up /home/vsetest/..., you could run these demos directly in /home/uvadm/vsetest/... since the VSEJCL demos instruct you to copy /home/uvadm/vsetest/* to /home/vsetest/...
These demo files might be more relevant to mainframe covnersions than the 'vendor' files used in the demos above 'K1' - 'K7'.
/home/vsetest :----testlibs <-- test/demo libraries : :----cpys/ - copybooks : : :----acntmas.cpy : : :----custmas.cpy : : :----saledtl.cpy : :----ctl/ - control files : : :----ctlfile_uvhdc2 <-- sequential ctlfile for editing : : :----ctlfile_uvhdc2.dat <-- Indexed control for lookup by uvhdget2 : : :----ctlfile_uvhdc2.idx : :----maps/ - record layouts generated from copybooks : : :----acntmas : : :----custmas : : :----saledtl
:----testdata <-- test/demo data files : :----ar/ - Accounts Receivable : : :----customer.master : : :----sales.items : :----gl/ - General Ledger : : :----account.master_
Goto: Begin this document , End this document , UVSI Home-Page
#1. Login vsetest --> /home/vsetest
=============
`
Rather than setting up /home/vsetest/..., you could run these demos directly
in /home/uvadm/vsetest/... since the VSEJCL demos instruct you to copy
/home/uvadm/vsetest/* to /home/vsetest/...
#1a. Login uvadm --> /home/uvadm
===========
#2. cd vsetest/testlibs <-- change to /home/uvadm/vsetest/testlibs
===================
#3. uvcopyx cobmap1 cpys maps uop=q0i7
==================================
- convert the 'copybooks' to 'cobmaps'
(record layouts with field start/end/length/type on right side)
#4. vi ctl/ctlfile_uvhdc2
=====================
- create the control file to relate datafiles to copybooks & filetypes
- here are a few sample records
- see complete control file listed on page 'K6'
#5. uvcopy loadctlI,fili1=ctl/ctlfile_uvhdc2,filo1=ctl/ctlfile_uvhdc2I
==================================================================
- load the control file into an indexed file for random access by uvhdget2
Goto: Begin this document , End this document , UVSI Home-Page
We will 1st demo the script using the copybooks & datafiles already listed above starting at 'G1' & 'H1'. You can run demos in /home/uvadm/... as follows:
#1. Login uvadm --> /home/uvadm
#2. cd vsetest/testdata <-- change to /home/uvadm/vsetest/testdata
===================
#3a. l ar <-- list A/R data files (customer.master & sales.items) #3b. l gl <-- list G/L data files (account.master)
#4. export CTLMAPDIR=/home/uvadm/vsetest/testlibs
==================================
- define superdir for uvhdc2 to look for subdirs maps/... & ctl/...
#5. uvhdc2 ar/customer.master
=========================
| Note |
|
#5a. uvhdcob ar/customer.master $CTLMAPDIR/maps/custmas fr256
========================================================
#5b. uvhdcob ar/customer.master /home/mvstest/testlibs/maps/custmas fr256
====================================================================
uvhdcob datafile=ar/customer.master 20090222:0844 copybook=/home/mvstest/testlibs/maps/custmas options= record#=1 totalrecs=32 recsize=256 filesize=8192 fileptr=0 rec# 1 fieldname occurs bgn end typ<------ data (hex if typ=p/b) -----> 001 cm-num 0 5 n 130140 002 cm-delete 6 9 003 cm-name 10 34 EVERGREEN MOTORS LTD. 004 cm-adrs 35 59 1815 BOWEN ROAD 005 cm-city 60 75 NANAIMO 006 filler001 76 76 007 cm-prov 77 78 BC 008 filler002 79 79 009 cm-postal 80 89 V9S1H1 010 cm-phone 90 101 250-754-5531 011 cm-contact 102 119 LARRY WRENCH 012 cm-thisyr-sales 012 120 124pns 001234567C 013 cm-lastyr-sales 012 180 184pns 001234567D 014 filler003 240 255 C 19950531 rec#=1 rcount=32 rsize=256 fsize=8192 dat1/custmas1 null=next,r#=rec,s=search,u=update,x=undo,p=print,i=iprint,w=write,t=tally ,v=verify,c=chkseq#,e=exit to uvhd,q=quit,?=help -->
Goto: Begin this document , End this document , UVSI Home-Page
# ctlfile4_uvhdc2 - sample control file for: 'uvhdcob' & uvhdc2/uvhdget2 # - see www.uvsoftware.ca/uvhdcob.htm#K1 # # ctlfile_uvhdc2 - stored at /home/uvadm/vsetest/ctl/ctlfile_uvhdc2 for demos # - intended for demos after setting up /home/vsetest/... # - after copying files from /home/uvadm/vsetest/* to /home/vsetest/... # - using data files in /home/vsetest/testdata/ar/... # (ar/customer.master, etc) # - using copybook/maps in /home/vsetest/testlibs/maps/... # (ar/custmas1,etc) # # - uvhdc2 saves having to specify copybook/map for uvhdcob & desired datafile # - using uvhdcob directly requires copybook/map # (awkward when datafile & copybook in different filesystems) # # uvhdcob ar/customer.master custmas <-- sample uvhdcob # ================================== # # uvhdc2 ar/customer.master <-- script 'uvhdc2' saves coding copybook/map # =========================== - looks-up ctlfile to get copybook # # ** Pre-Requisites for uvhdc2 ** # # 0. cd $CTLMAPDIR or $CNVDATA or $RUNLIBS or $RUNLIBS # # 1. uvcopyx cobmap1 cpys maps uop=q0i7p0 <-- create cobmaps # ==================================== # # 2. vi ctl/ctlfile_uvhdc2 <-- create ctlfile # ===================== # # 3. uvcopy loadctlI,fili1=ctl/ctlfile_uvhdc2,filo1=ctl/ctlfile_uvhdc2I # ================================================================== # - load control file # #--------datafile------- --copybook-- -recsize- -type- -options- # ar/customer.master cpy=custmas rcs=00256 typ=RSF ops=f ar/sales.items cpy=saledtl rcs=00256 typ=RSF ops=f gl/account.master_ cpy=acntmas rcs=00256 typ=RSF ops=f #
Goto: Begin this document , End this document , UVSI Home-Page
The 'v' command will verify character, numeric,& packed data fields. Verify searches the file for unprintable characters in pic x fields & invalid digits or signs in unpacked or packed numeric fields.
We have provided a doctored version of dat1/custmas1 (dat1/custmas1x) to test/demo uvhdcob. dat1/custmas1x has been updated (using uvhdcob) to create errors in record#s 10 & 20.
Here are the 'update' commands we used to create the BAD data for the 'verify' command test/demo. We will omit the displays & list only the commands.
#1. login uvadm or cd /home/uvadm <-- change to uvadm
=============================
#2. cp dat1/custmas1 dat1/custmas1x <-- copy to alt file to make bad data
===============================
#3. uvhdcob dat1/custmas1x cobol/maps/custmas1 u <-- option 'u' for update
============================================
#4. --> 10 <-- goto record# 10
#5a. --> u 5(1),'X' <-- create non-numeric data in numeric field (cust#) #5b. --> u 78(1),x'EE' <-- create unprintable data in character field (prov) #5b. --> u 120(1),x'EE' <-- create invalid digits in packed field (thisyr sales)
#6. --> 20 <-- goto record# 20
#7a. --> u 5(2),'XX' <-- create non-num data in numeric field (cust#) #7b. --> u 83(3),x'EEEEEE' <-- create unprintables in char field (province) #7b. --> u 180(5),x'1E2E3E4E5E' <-- create BAD data in packed field (lastyr sls)
#1. cd /home/uvadm <-- change to uvadm
==============
#2. uvhdcob dat1/custmas1x cobol/maps/custmas1 <-- run on demo file
==========================================
- uvhdcob displays 1st record & prompts for command
- we are omitting 1st record display, see verify displays next page
--> v <-- search & Verify character,numeric,& packed fields
Goto: Begin this document , End this document , UVSI Home-Page
The 'v' verify command searches from the current record until it finds a record with at least 1 bad data field & displays that record. For our demo file (dat1/custmas1x) record# 10 is the 1st record with bad data fields.
--> v <-- Verify
rec# 10 fieldname occurs bgn end typ<------ data (hex if typ=p/b) -----> 001 cm-num 0 5 n 15468X 313534363858 <-BadN 002 cm-delete 6 9 003 cm-name 10 34 TAURUS RESOURCES 004 cm-adrs 35 59 1110 - 625 HOWE STREET 005 cm-city 60 75 VANCOUVER 006 filler001 76 76 007 cm-prov 77 78 B. 42EE <-BadC 008 filler002 79 79 009 cm-postal 80 89 V6C2T6 010 cm-phone 90 101 604 685 8565 011 cm-contact 102 119 MEL RAHAL 012 cm-thisyr-sales 012 120 124pns EE0123456C <-- Bad Packed 013 cm-lastyr-sales 012 180 184pns 000000000C 014 filler003 240 255 C 19980331
v --> 10 recs verified, 4 ERRs found in rec# 10, 1st at byte# 0
2 packed & 1 numeric bad signs/digits, 1 unprintables in char fields
--> vv <-- continue Verify
rec# 20 fieldname occurs bgn end typ<------ data (hex if typ=p/b) -----> 001 cm-num 0 5 n 2343XX 323334335858 <-BadN 002 cm-delete 6 9 003 cm-name 10 34 TERRITORIAL REWIND 004 cm-adrs 35 59 BOX 1648 005 cm-city 60 75 WHITEHORSE 006 filler001 76 76 007 cm-prov 77 78 YK 008 filler002 79 79 009 cm-postal 80 89 Y1A... 593141EEEEEE <-BadC 010 cm-phone 90 101 403-512-3948 011 cm-contact 102 119 012 cm-thisyr-sales 012 120 124pns 000000000C 013 cm-lastyr-sales 012 180 184pns 1E2E3E4E5E <-- Bad Packed 014 filler003 240 255 20021130
vv --> 10 recs verified, 10 ERRs found in rec# 20, 1st at byte# 0
5 packed & 2 numeric bad signs/digits, 3 unprintables in char fields
You may use optins a,b,c,d to inhibit verify on some fields (by start byte#) to allow you to search the file for bad data on other fields. For example, to inhbit verify on cm-prov (start byte 77), you could use following command:
--> 1 <-- reset to begining of file --> va77 <-- verify, inhibiting field cm-prov (start byte 77)
Goto: Begin this document , End this document , UVSI Home-Page
Goto: Begin this document , End this document , UVSI Home-Page
uvhd/uvhdcob can handle various filetypes - Text, RDW,& IDXFORMAT1/3/8 (Micro Focus COBOL compatible). It is easier to handle 'Fixed Length' records than the 'Variable Length' records.
For fixed length records, we can calculate the number of records in the file by diividing the file-size by the record-size. We can jump instantly to any record# in the file, because we can calculate & fileseek to its byte offset (record# * record-size).
For variable length records, you can jump to a record#, but it will not be correct, because the offset would be calculated using the current record-size. After the fileseek, it is unlikely we would be positioned at the begining of a record, but uvhd/uvhdcob will automatically scan to the begining of the next record depending on the filetype (using LineFeeds for text files & the unique binary record-prefixes in RDW & IDX files).
In May 2010, we added the 'f' find command to find records by their record#. This is slower than the 'b' (jump to byte#) or 'r' (jump to record#), because we have to read all records up to the desired record#.
For large variable length files, your first find command should be 'fi' which creates an Index of record#s & file pointers, so that subsequent finds can quickly find any desired record by its record#. 'fi' also locks in the correct total record count for display in the headings of all subsequent screens.
The 'fi' command takes 10 seconds on my HP xw9400 workstation to create the Index for a 2.2 gigabyte file (avg recsize about 1000). I can then quickly find any record by its record#.
uvhd dat1/vendormas <-- start uvhdc (or uvhdcob) =================== - displays record#1
--> fi <-- 1st command 'fi' to create Find Index for 'f#' commands --> f12345678 <-- find any desired record# (quickly using index)
--> 1 <-- return to BOF --> fm500 <-- find next record of an exact record-size (option 'm') --> fm500n600 <-- find next record in a size-range (options 'm' & 'n') --> ff <-- repeat prior find (saves recoding m & n options)
Goto: Begin this document , End this document , UVSI Home-Page
You may export variable UVHDCOBROP in the profile to specify the preferred options for each user. For example, users who prefer 50 lines per screen & space between headings could add the following to their profile:
50 lines per screen is possible for the Windows command screens using terminal emulators such as 'putty'.
export UVHDCOBROP=m50s2 <-- user options for 50 lines/screen ======================= & space after hdgs
| Note |
|
Goto: Begin this document , End this document , UVSI Home-Page
The 'print' command 'p' does not print immediately, but writes the screen displays to a tmp/file, which can subsequently be printed manually after you quit the uvhdcob utility.
The immediate print 'i' uses the command stored in the variable 'iprtcmd' in the uvhdcob 'C' program. You could modify this command in the C program, & recompile the program.
char iprtcmd[30] = "uvlp12"; (original command)
'uvlp12' is a script, 1 of several supplied scripts using the 'uvlist' utility, which supplies page headings & page numbering. See uvlist.doc for instructions to modify the destination printer used by these scripts.
You could modify the script called by the 'i' command. For example to print at 14 chars per inch (vs default 10 cpi):
char iprtcmd[30] = "uvlp14"; (modified command)
A more convenient method of modifying Immediate printing is to use the environmental variables 'UVLPDEST' & 'UVHDCOBPRINT'. You could export them at your shell prompt before running uvhd or even better setup your normal choices in your .profile. Here are some examples:
export UVLPDEST=-dlaser2 <-- setup printer dest for all 'uvlp' scripts
export UVHDCOBPRINT=uvlp12 <-- the default script uvlp12 for 80 chars Portrait
export UVHDCOBPRINT=uvlp14 <-- uvlp14 would leave more space on right
The default scripts for printing on Windows are uvlpr12 & uvlpr12L. These are defined within the uvhd.c program & are used if no environmental variables are defined. These are equivalent to the following:
set UVHDCOBPRINT=uvlpr12 <-- specify DOS script for 64 chars Portrait
For windows 2000 you could define on the following screen:
ControlPanel --> System --> Advanced --> Environmental Variables
Goto: Begin this document , End this document , UVSI Home-Page
The 'uvhdcob' utility & 'uvhddif2' script can be used to compare 2 datafiles & show the differences with the corresponding COBOL copybook names.
We will demo uvhddif2, using the /home/uvadm/cobol/maps directory of cobmaps, already generated from the copybooks (/home/uvadm/cpys), as previously described on page 'B1'.
1a. cd $HOME - change to your homedir (or uvadm) 1b. mkdir tstdif - make subdir for test 1c. cd tstdir - change into subdir 1d. mkdir dat1 dat2 tmp - make sub-subdirs
2a. cp /home/uvadm/dat1/warmas1 dat1 - copy testfile to dat1 2b. cp /home/uvadm/dat1/warmas1 dat2 - copy testfile to dat2
4a. export UVDATA1=dat1 UVDATA2=dat2 - export dat1/dat2 for script 4b. export RUNLIBS=/home/uvadm/cobol - point to test/demo cobmaps
#5. uvhddif2 warmas1 warmas1 - run script to create diff report
========================
** sample output report **
1c1
< dat1/warmas1 fsz=576 rsz=64 totrecs=9 current=1
---
> dat2/warmas1 fsz=576 rsz=64 totrecs=9 current=1
34c34
< wm-descrip 12 29 dish washer
---
> wm-descrip 12 29 dish CRASHER
76c76
< wm-descrip 12 29 clothes dryer
---
> wm-descrip 12 29 clothes SHRINKER
Note that this method of comparing data-files is not as exact as the uvcmp1/2/3 jobs documented in CMPjobs.doc because:
Goto: Begin this document , End this document , UVSI Home-Page
# uvhddif2 - run uvhdcob & diff for 1 pair of data files
#
#usage: uvhddif2 datafile cobmapname
# ============================
#
# assumptions:
#
# export UVDATA1=directory of original data-files
# export UVDATA2=directory of aged data-files
# - datafiles are named the same in both directories
# cd xxx - you are in a working directory with following subdirs
# maps - directory of cobmaps (created by cobmap1 from copybooks)
# tmp - directory for interim work files & diff report
# - filename will be: datafilename.dif
#
# export RUNLIBS=cobmaps - you must define subdir for cobmaps
# or specify path-name to cobmap as arg2
#
f="$1"; f1=$UVDATA1/"$1"; f2=$UVDATA2/"$1"; cmf=$RUNLIBS/"$2"
if [[ "$2" = */* ]]
then cmf = $2
fi
#
echo "debug: f1=$f1 f2=$f2 cmf=$cmf"
#
if [[ -f $f1 && -f $f2 && -f $cmf ]]; then :
else echo "usage: uvhddif2 datafile cobmap"
echo " must: export UVDATA1=dir1 UVDATA2=dir2"
echo " output will be: tmp/datafilename.dif"
exit 9; fi
#
uvhdcob $f1 $cmf d1x=p99999999 >/dev/null
mv -f tmp/$f tmp/$f.1
#
uvhdcob $f2 $cmf d1x=p99999999 >/dev/null
mv -f tmp/$f tmp/$f.2
#
diff -b tmp/$f.1 tmp/$f.2 >tmp/$f.dif
status=$?
#
if (($status == 0))
then echo "No Difference: $f1 & $f2"
else echo "diff report in: tmp/$f.dif, enter vi,uvlp12,etc"
read reply
if [[ -n "$reply" ]]; then
$reply tmp/$f.dif
fi
fi
exit 0
Goto: Begin this document , End this document , UVSI Home-Page