uvhdcob Documentation CONTENTS

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

A1. uvhdcob - display data files with COBOL field names

What is the difference between 'uvhd' & 'uvhdcob' ?

uvhd

uvhdcob

uvhdcob - sample display

 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 -->
  1. we show only the 1st field of occurs, such as cm-thisyr-sales - 12 x 5 byte packed fields

  2. packed fields shown in horizontal hex x'001234567C' - sign x'_C' in last byte positive, x'_D' negative

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

A2. uvhdcob functions

  1. Browse - display records consecutively - jump to & display any record in the file by record# - find records by record# (for variable length files) - reads forward until specified rec# reached

  2. Search - search by pattern, anywhere in the record (by default) or within specified column locations - may search on 1 or 2 fields with AND/OR relationships - match data =,>,< equal(default), greater than, less than - repeat previous search via 'ss' vs 's' + search args - search backward via 'sb' or 'ssb'

  3. Update - update the current record on display - specified columns replaced with specified data (char/hex) - option to rollback current record updates - option for multi-record updates with 1 qualifier field

  4. Print - write formatted records to tmp file for later lp,uvlp,etc - output file will be: tmp/filename.yymmddhhmmP - may specify a number of records from current position - may specify records matching 1 or 2 patterns & a max count - To actually print, you must quit uvhd & select the desired filename from the tmp directory.

  5. Iprint - write formatted records to a file for immediate printing via the 'uvlp12' command (see uvlist.doc). - may specify a number of records &/or records matching 1 or 2 specified patterns within specified columns.

  6. Write - write Unformatted records to a file: tmp/fname.yymmddhhmmW for subsequent use as test files, etc. - may specify number of records from current position or records matching 1 or 2 patterns within specified columns - select specified records from big files for small test files

  7. Check - check sequence of specified field - options for ascending, descending, duplicates

  8. Tally - count records from current position matching 1 or 2 specified patterns until EOF or within a max record count

  9. Exit - to uvhd, to display current record (without copybook names) - displays entire record (uvhdcob displays only 1st of occurs) - Quit on uvhd brings you back to uvhdcob

  10. Verify - will verify character, numeric,& packed data fields. - searches the file for unprintable characters in pic x fields & invalid digits or signs in unpacked or packed numeric fields.

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

B1. uvhdcob Pre-Requisites (Preparation)

preparation to use uvhdcob

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
  • in this example $RUNLIBS default saves only 'cobol/'
  • but this would be a big help when the datafiles are not in the
    same superdir as the COBOL copybook maps
Note
  • also see the 'uvhdc1' on page 'K1' script which allows you to specify
    only the data file (the copybook map is looked up via an Indexed file)

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

C1. cobmaps - COBOL record layouts created from copybooks

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

sample cobmap report

 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

C2. cobmaps - COBOL record layouts created from copybooks

uvhd vs uvhdcob

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 -->

uvhd & uvhdcob complements

  1. uvhdcob has an Exit command to show the current record in uvhd, which is a vertical hexdump (without the COBOL copybook fieldnames).

  2. Exit to uvhd when you need to see the entire record.

  3. uvhdcob shows only the 1st 36 bytes of fields

  4. uvhdcob shows only the 1st occurrence of an occurs group.

  5. when you quit uvhd, you are returned to the same record on uvhdcob.

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

D1. uvhdcob: Operating Instructions & Command Line Options

uvhdcob command line & options


 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'
  • Record size override (discussed above)
option 'a'
  • translate to Ascii (dat1/custmas0 file is EBCDIC)
option 'm50'
  • display 50 lines per screen (if your teminal allows)
  • or max fields in copybook/record
Note
  • options must be a contiguous string of alpha options & numeric values
  • numeric values optional ('a' for ASCII translate does not need)
  • may use comma separators

*TYPE control record

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

E1. uvhdcob: commands (HELP screens)

help01 - Help Screen Summary

help01
  • help menu summary (enter # to goto desired help screen)
help02
  • uvhdob command format (datafile, copybook,& options)
help03
  • command line options a - z
help04
  • Browsing, jump to rec# or byte# (fixed-lth), find by rec# (var-lth)
help05
  • Searching by data strings with optional qualifiers
help06
  • Update 1 or multiple records, with optional qualifiers
help07
  • print to a file & iprint (immediate print, if configured)
help08
  • write records to subdir tmp/... (selected by qualifier patterns)
help09
  • Write options (recsize, fixlth, text, RDW, etc)
help10
  • sequence check & tally (count records)
help11
  • Verify data: digits/signs in numeric/packed, unprintables chars
help12
  • Exit to uvhd (hexdump of record, quit uvhd returns to uvhdcob)
help13
  • Multi Record *TYPE files (type control record in copybook maps)
 uvhdcob version 20100605 - Copyright (C) UV Software Inc. 1993-2010

help02 - command format & options


 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

help03 - command line options

a
  • assume EBCDIC input, translate char fields to ASCII display
d1
  • display debug msgs for cobmaps with multi *TYPE defs
c1
  • do not stop on verify errors on non-numeric fields
e1
  • inhibit date/time extensions on tmp filenames
f#
  • first record# to be displayed (default #1)
i1
  • inhibit switch ends, switch i2 is the default if i1 not specified
i2
  • switch ends on binary 2 & 4 byte fields (INTEL vs RISC)
m#
  • max lines/screen (default 16) allow for hex/char, sp1/sp2
n1
  • inhibit sequence# fields on left of screen
r#
  • record size overrides RCSZ= in cobmap file default 256
s2
  • space 2 between headings & field names/data lines
t
  • text records ended by LF=x'0A' - standard unix/windows
    also specify option r recsize if max records > 256
u
  • required for update capability, else read only
v
  • variable length records in Micro Focus Indexed file
    show recs: v1=active, v2=deleted, v4=system, v8=system1 (default=v7)
w1
  • combine all Write cmd outputs into 1 file (vs 1 file per Write cmd)
  • output files written to: tmp/inputfilename_yymmdd_hhmmssW
z#
  • input RDW format (2,4,8 byte prefixes with recsize in binary)
z2
  • RDW prefix 2 bytes only, recsize EXCLUDES prefix size
z4
  • RDW prefix 4 bytes, recsize 1st 2, 3&4 nulls, recsize INCLUDES prefix
z8
  • BDW/RDW 4+4, BDW bypasswd, else like z4
z1
  • (+ 1 bit) = z3/z5/z9 Little-end binary, z2/z4/z8 default BIG-end

help04 - Browsing, Jumping, Finding

null
  • next record (or next segment if rcsz > 384)
b#
  • goto a specific byte# within the file (zero relative)
r#
  • goto a specific record# within the file (one relative)
  • may omit 'r', a number assumed to be a rec#
  • advance a specified # of records (from current position)
  • backup a specified # of records (from current position)
f#
  • find records by record# in LARGE variable length files (RDW,text,IDX)
r#
  • jump to rec# (calc based on current rec-lth) wrong for variable-lth
f#
  • slower than r# (fixed-length files), use f# if you need exact record#
fi
  • for large files, 1st find cmd should use option 'i' (of 'fi')
  • reads sequentially to EOF creating Index for subsequent finds by rec#
f#
  • then quick to find any record# desired
r1
  • might return to record #1 before using options m & n
f999999m123
  • option 'm' to find record with specified record-size
f999999m50n90
  • option 'm' & 'n' to find records from minimum to maximum size
  • 'f999999' used to search to EOF (more 9's for big files)
ff
  • repeat prior find command, to find next rec with m & n size
ff
  • 'ff' saves retyping big numbers & options m & n
R#
  • change Rec-size (Fixed-lth) vs option 'r' on command line
  • display help screens

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

help05 - Search

s 'ABC'
  • search (until EOF) for 'ABC' anywhere in the record
s 40(40),'ABC'
  • search for 'ABC' anywhere in columns 41-80
s 20(3),!'000'
  • search for records with cols 21-23 NOT 000
s 0(80),=x'0C'
  • search for a FormFeed x'0C' anywhere in 1st 80 bytes
s 0(80),>x'7F'
    - search for any byte > x'7F' in 1st 80 bytes of records
s 'ABC',,'XYZ'
  • search for 'ABC' AND 'XYZ' anywhere in record
s 'ABC',|,'XYZ'
  • search for 'ABC' OR 'XYZ' anywhere in record
 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
  • repeat last search (from current record)
sss
  • repeat search (in same record incrementing column)

help06 - Update

 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
  • rollback last update to current rec (repeat toggles last update)
X
  • rollback all updates to current rec (repeat toggles all updts)
  • rollback ability is lost if you move off current updated record
  • no rollback is possible for multi-record updates
  • could 'w'rite (backup) entire file to tmpdir before updts
 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

help07 - print & iprint

 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)

help08 - write records to tmp/...

 >>> 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
  • write entire file, dropping ISAM deleted records
    (option 'i' drops records with x'00' in last byte)
we10
  • write every 10th record (to make smaller test file ?)
w100e5
  • write 100 records, select every 5th (file must have 500+)
we10 77(2),'VA'
  • write every 10th rec with state = 'VA' (from here to EOF)

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

help09 - Write options

w100r64t2
  • sample Write command to Write next 100 records with options
  • r64=fixedsize 64 byte recs, t2=terminate with LF in last byte
w99z2a1c1
  • write next 99 recs in RDWz2 format (recsize in 2 byte prefix)
  • translate to ASCII, translate any unprintable chars to periods
a1
  • translate to ASCII, write command output records
c1
  • convert unprintable chars in write output records to periods
n1
  • insert variable recsize as 4 numerics at BEGIN write output
n2
  • insert variable recsize as 4 numerics at END write output
r#
  • record size for fixed-length output, omit for RDWz2/z4
t1
  • insert Carriage-Return at end write records (for MAC)
t2
  • insert Line-Feed at end of write records (for Unix/Linux)
t3
  • insert both CR & LF at end write records (for some Windows programs)
t4
  • insert after Last-Non-Blank, else at end recsize (t6 for LF)
z#
  • write RDW format (2 or 4 byte prefixes with recsize in binary)
z2
  • prefix 2 bytes only, recsize EXCLUDES prefix size
z4
  • prefix 4 bytes, recsize 1st 2, 3&4 nulls, recsize INCLUDES prefix
z1
  • (add 1 bit) = z3/z5 Little-end binary, z2/z4 default BIG-end binary

help10 - sequence check & tally (count records)

 >>> 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

help11 - Verify data

>>>Verify - verify Packed, Numeric,& Character data fields (until EOF)

v
  • will display 1st record found with bad data
  • shows packed fields in hexadecimal, with <--Bad Packed note
  • replaces unprintable chars with '.'s & flags <--BadC or <--BadN
  • might print record for further investigation
vv
  • enter 'vv' to advance to next record & continue search/verify
    (easier than entering '+' for next record & reissuing 'v' command)
v100
  • verify next 100 records (vs until EOF default)
  • takes long time to verify all fields all records in gigabyte files
va50
  • inhibit verify on field if start byte 50 (specified by option a)
  • use when you know 50 always bad (to search for other bad fields)
 va10b50c80d90 - may use options a,b,c,d to inhibit verify on 4 fields max
 vv     - continue verify (options saved from prior 'v' command

help12 - Exit to uvhd

 >>>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
  • exit to uvhd (to display entire record w/o fieldnames)
  • will display same record
eu
  • may specify options (eg: u=update)
q
  • quit (in uvhd) returns you to uvhdcob

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

help13 - Multi Record *TYPE files

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

Alternate TYPE format for variable length records

 *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

F1. inter-operation of uvhdcob & uvhd

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:

  1. uvhdcob displays only the 1st 36 bytes of long data fields
  2. uvhdcob displays only the 1st occurrence of occurs field sets.
  3. uvhdcob might display the wrong fieldnames for redefined records (if you have not inserted *TYPE control records in copybook/cobmaps)

 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

G1. uvhdcob - display data-files with COBOL copybook field-names

copybooks for the demo datafiles

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
  • copybook for Vendor Master file
  • vendor#, Record Type, vendor name
  • see copybook/map listed below
dat1/vendorpay
  • copybook for Vendor Payment file
  • vendor#, Record Type, date, invoice, amount, item dscrptn
  • see copybook/map listed below
dat1/vendorpaymas
  • copybook for Vendor Payments sorted with Vendor Masters
  • Multi-Record-Type file to demo uvhdcob *TYPE control
  • see copybook/map with redefined records listed below
dat1/vendorpaymasa
  • Alternate copybook for Vendor Payments & Vendor Masters
  • Multi-Record-Type control by record-size vs record-codes
  • see copybook/map with redefined records listed below

cobol/maps/vendormas

 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

cobol/maps/vendorpay

 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

G2. copybooks for the demo datafiles

cobol/maps/vendorpaymas

 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

Notes re *TYPE

      *type=7(1),='M','vendormas'
      *type=7(1),='P','vendorpay'
  1. Note the '*type' controls inserted at begining of copybook to identify the different Record Types & display the corresponding field-names and data-field-contents.

  2. Also note that '*type' can be coded to identify records by record-length vs record-data. See an example of this (cobol/cpys/vendormapmasa) listed on the next page. Its '*type' controls are:

      *type=00:45,'vendormas'
      *type=46:99,'vendorpay'

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

G3. copybooks for the demo datafiles

cobol/maps/vendorpaymasa

Note
  • this is the Alternate method of record *TYPE control
  • by 'record-size' vs 'record-type-codes' (see above vendorpaymasa)
 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

H1. uvhdcob - display data files with COBOL field names

demo Data-Files - Fixed,Text,RDW,IDX

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
  • Fixed length file from a mainframe (64 byte records)
  • EBCDIC with no LineFeeds
  • cannot be listed with normal Unix/Linux utilties
dat1/vendormas1
  • Fixed length file (64 bytes)
  • translated to ASCII
  • period inserted in 63rd byte to indicate End of Record
  • LineFeed inserted in 64th byte for convenience
    so you can use Unix/Linux utilities (vi,lp,cat,more,etc)
dat1/vendormas2
  • Text file with LineFeed after the last non-blank
  • can use Unix/Linux utilities (vi,lp,cat,more,etc)
  • Micro Focus COBOL 'ORGANIZATION LINE SEQUENTIAL'
dat1/vendormas3
  • RDW (Record Descriptor Word) file with 4 byte record prefixes
  • record-size binary in 1st 2 bytes, nulls in 3rd & 4th byte
  • file type option 'z4' for uvhd, uvhdcob, uvcp, uvcopy, etc
  • RDW must be used when variable lth files FTP'd from mainframe
dat1/vendormas4
  • variable length files for Micro Focus COBOL (IDXFORMAT3/8)
  • file header record 128 for IDXFORMAT3, 1024 IDXFORMAT8
  • record-size binary in 1st 2 bytes
  • various record types coded in 1st 2 bits
  • x'40' = data record, x'03' = system, x'02' = deleted
  • file type option 'v' for uvhd & uvhdcob
  • option 'typ=IDXf3/IDXf8' for uvcp, uvsort,& uvcopy
  • see details re IDXf3/f8 at uvhd.htm#V1

notes re data-file listings (below)

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

H2. demo data filetypes - Fixed,Text,RDW,IDX

dat1/vendormas2


 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.

dat1/vendorpay2


 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

H3. demo data filetypes - Fixed,Text,RDW,IDX

dat1/vendorpaymas2


 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

I1. uvhdcob - display data-files with COBOL copybook field-names

demo uvhdcob for various filetypes

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
     ===========================

OR login to your homedir & copy demo files


 #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

I2. demo uvhdcob for various filetypes

uvhdcob demo for EBCDIC files


 #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 -->

uvhdcob demo for various filetypes

  1. We showed the 1st 2 records for the EBCDIC file above, but we will show only the 1st record for most types (to save space) since the displays are similar.

  2. We will show all 8 records for file type RDW (option z4) - see page 'I4' & 'I5'

  3. uvhdcob shows the record lengths for variable length filetypes, which is why we thought it more interesting to show all records for the RDW file.

  4. When files are FTP'd from a mainframe, any variable length files must be FTP'd with the RDW option.

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

I3. demo uvhdcob for various filetypes

uvhdcob demo for ASCII Fixed Length


 #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 -->

uvhdcob demo for Text files


 #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
  • the length of the 1st record is 20 bytes (rsize=20)
  • see all records below (displayed for RDW file dat1/vendormas3)

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

I4. demo uvhdcob for various filetypes

uvhdcob demo for RDW files


 #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

I5. demo uvhdcob for various filetypes

demo for RDW (continued)

 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

Variable Length files (text,RDW,IDX)

  1. Note the record sizes displayed on each of the 8 records above. Record-Sizes: #1=23, #2=30, #3=45, #4=31, #5=29, #6=27, #7=39, #8=30.

  2. For RDW files the recsize is stored in a 4 byte record-prefix (binary in 1st 2 bytes, 3&4 null). You can use 'uvhd' to display the binary prefixes, see the next page

  3. For variable lth files, the record count shown is often wrong, because it is calculated at each record by dividing the file-size by the record-size. Record-Counts: #1=10, #2=8, #3=5, #4=8, #5=8, #6=9, #7=7, #8=8.

  4. For variable length files, we recommend your first command should be: fi - create Find Index, to speedup subsequent finds by record# - reads to EOF storing file-pointers & record#s at 1% filesize intervals - also locks in correct record count on all future screens headings

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

I6. demo uvhdcob for various filetypes

use uvhd to show RDW record-sizes


 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

I7. demo uvhdcob for various filetypes

listRDW1 alternative to uvhd above

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

I8. demo uvhdcob for various filetypes

uvhdcob demo for IDXf3/IDXf8 files

  1. These are variable length files for Micro Focus COBOL.

  2. The Vancouver Utilities (uxcopy,uxsort,uxcp) can handle these files and refers to them as IDXf3 and IDXf8.

  3. Samples of IDXf3/IDXf8 are not yet provided here in uvhdcob.doc

  4. See information about IDXf3/IDXf8 at uvhd.htm#V1 or uvcp.htm#??

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

J1. uvhdcob - display data-files with COBOL copybook field-names

demo uvhdcob for Multi-File-Types

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

J2. demo uvhdcob for Multi-File-Types

sample display for vendorpaymas


 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

K1. scripts 'uvhdc1/2' make it easier to use 'uvhdcob'

Scripts such as 'uvhdc1' & 'uvhdc2' make it easier to use the 'uvhdcob' program because:

  1. You do not need to specify the copybook, just the datafile,

  2. You do not need to specify file type options, since they can be picked up from the control file.

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
  1. ctlfile_uvhdc1/2 control files - supplied in /home/uvadm/ctl/... - must be customized & loaded into Indexed files ctl/ctlfile_uvhdc1I/2I

 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)
  1. uvhdget2, uvcopy job to lookup indexed control file to get copybook name - uvcopy job supplied in /home/uvadm/pf/util/uvhdget2

  2. $CTLMAPDIR is set to 1st defined of: $CTLMAPDIR,$CNVDATA,$RUNLIBS,$RUNDATA

    CTLMAPDIR, CNVDATA, RUNLIBS, RUNDATA

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

K2. 'uvhdc1/2' scripts make it easier to use 'uvhdcob'

uvhdc1 demo in /home/uvadm/...

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

K3. 'uvhdc1/2' scripts make it easier to use 'uvhdcob'

Pre-Requisites for uvhdc1/uvhdc2

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

K4. 'uvhdc1' script make it easier to use 'uvhdcob'

test/demo uvhdc1

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
     ======================

sample display dat1/vendormas0

     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
  • uvhdc1 allows you to specify only the datafilename
    & omit the copybookname (as shown above)
  • the uvhdc1 script will call the uvhdcob program as in #5a below
  • with $CTLMAPDIR expanded it will be as in #5b below

 #5a. uvhdcob dat1/vendormas0 $CTLMAPDIR/maps/vendormas fr64a
      =======================================================

 #5a. uvhdcob dat1/vendormas0 /home/uvadm/cobol/maps/vendormas fr64a
      ==============================================================
Note
  • the convenience of not having to remember the copybook-name & filetype
  • in this case filetype is f=Fixedlth, r=recsize 64,& a=translate to ASCII

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

K5. 'uvhdc1' script make it easier to use 'uvhdcob'

script uvhdc1 - listing

 #!/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

K6. 'uvhdc1' script make it easier to use 'uvhdcob'

sample control file ctlfile_uvhdc1

 # 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

K7. 'uvhdc1/2' scripts make it easier to use 'uvhdcob'

uvcopy job 'uvhdget2' called by 'uvhdc1/2'

 # 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

L1. 'uvhdc2' script makes it easier to use the 'uvhdcob' program

uvhdc2 demo in /home/vsetest/...

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

L2. 'uvhdc2' script makes it easier to use the 'uvhdcob' program

Pre-Requisites for uvhdc2


 #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

L3. 'uvhdc2' script make it easier to use 'uvhdcob'

test/demo uvhdc2

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
  • the uvhdc2 script will call the uvhdcob program as in #5a below
  • with $CTLMAPDIR expanded it will be as in #5b below
  • note convenience of not having to remember the copybook-name & filetype
  • in this case filetype is f=Fixed-length, r=recsize 256

 #5a. uvhdcob ar/customer.master $CTLMAPDIR/maps/custmas fr256
      ========================================================

 #5b. uvhdcob ar/customer.master /home/mvstest/testlibs/maps/custmas fr256
      ====================================================================

sample display dat1/vendormas0

 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

L4. 'uvhdc1/2' scripts make it easier to use 'uvhdcob'

ctlfile_uvhdc2 for script uvhdc2

 # 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

M1. uvhdcob - display data files with COBOL field names

'v' verify data command

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.

creating BAD data

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)

test/demo verify command


 #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

M2. uvhdcob 'verify' test/demo

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

options to inhibit verify specified 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

M3. uvhdcob 'verify' test/demo

Notes re uvhdcob Verify

  1. We created intentional errors in records #10 & #20 of dat1/custmas1x.

  2. Note flags on right hand side '<-BadN', '<-BadC', '<-- Bad Packed'

  3. cm-num '15468X' flagged because 'X' is non-numeric. Hex representation x'313534363858' is shown in case of unprintables.

  4. cm-prov 'B.' is shown in hex as x'42EE' (the '.' is actually x'EE').

  5. cm-thisyr-sales is shown as x'EE0123456C' (1st 2 digits x'EE' invalid).

  6. packed fields are always shown in hex (valid of invalid).

  7. uvhdcob shows only the 1st field of occurs. You could verify all occurs fields using 'genverify1' which generates a uvcoy job to verify all numeric & packed fields using the 'vnf' instruction.

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

N1. uvhdcob find command

find command for Variable Length, N/R for Fixed-Lth

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#.

option 'i' create Index for find by 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#.

find command examples


 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

U1. setting Options via Environmental Variables

Customizing uvhd for each user via UVHDCOBROP

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
  • the 'ROP' stands for Run OPtions
  • most Vancouver Utilities have similar Run OPtions
  • utility program name + ROP
  • UVCOPYROP, UVSORTROP, UVHDROP, UVHDCOBROP, etc

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

U2. Customizing printing via Environmental Variables

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)

environmental variables for 'i' printing

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

env-vars for printing on Windows

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

V1. uvhdcob/diff script to compare 2 datafiles

The 'uvhdcob' utility & 'uvhddif2' script can be used to compare 2 datafiles & show the differences with the corresponding COBOL copybook names.

test/demo uvhddif2

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

  1. vi dat2/warmas1 - make some changes

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
      ========================
  1. vi tmp/warmas1.dif - investigate difference 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:

  1. uvhdcob only displays the 1st 36 bytes of longer data-fields
  2. uvhdcob only displays the 1st field of occurs

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

V2. uvhdcob/diff script to compare 2 datafiles

 # 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

Visitor Counters for ThisYear and LastYear

ThisYear=000524   (J=76,F=67,M=79,A=64,M=76,J=90,J=72,A=0,S=0,O=0,N=0,D=0)
LastYear=001049   (J=40,F=96,M=91,A=85,M=83,J=86,J=85,A=78,S=92,O=128,N=89,D=96)