uvhd CONTENTS

A1. Overview & Free Software notice (GNU FSF GPLv3)
B1. Download uvhd.c source from www.uvsoftware.ca & Compile for Unix/Linux
B2.  Download uvhd.exe from www.uvsoftware.ca for Windows/DOS
B3.  Customizing the DOS Command Prompt window for Windows 2000
- changing small, ugly, black & white default to big, blue,& beautiful
B4.  Compiling uvhd.c to uvhd.exe on Windows/DOS (using lcc-win32)
- not required, since you can download uvhd.exe from www.uvsoftware.ca
C1. Customization re printing
D1. uvhd Display format
D2.  Warning for Fixed record lengths not evenly divisible into filesize
- uvhd calculates the next lower/higher record sizes evenly divisible
E1. Help screens
F1. uvhd option summary
F4.  uvhd command summary
G1. uvhd Function summary
H1. uvhd Tutorial Preparation
I1. Browsing - demo for ASCII file with packed fields
- display records consecutively
- jump to & display any record in the file by record#
I2. Browsing - demo for EBCDIC file with packed fields
J1. 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'
J2.  Search Indexed files for deleted records
- applies to D-ISAM, C-ISAM,& MF COBOL IDXFORMAT1
- a useful application for uvhd
- also illustrates how to count (enumerate) deleted records
K1. 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
L1. Scan/Replace - searches the specified record field, searching for a pattern
  - if found, replace with a replacement pattern.
- will truncate or blank fill if search & replace lengths different
- for fixed length records, use with fields such as Name & Address
- most effective with variable length text records.

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

uvhd CONTENTS (continued)

M1. 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
N1. 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.
O1. Iprint - write formatted records to a file for immediate printing
  via the 'uvlp' command (see uvlist.doc).
- may specify a number of records &/or records matching
  1 or 2 specified patterns within specified columns.
P1. Generate Sequence Numbers
- may specify starting number & increment (default 1)
- may specify constants before & after sequence#
Q1. Check - check sequence of specified field
- options for ascending, descending, duplicates
R1. Enumerate - count records from current position matching 1 or 2
  specified patterns until EOF or within a max record count
S1. Translate - to Ascii, Ebcdic, Upper, Lower, Characters, Periods
  - unprintable characters can be translated to blanks or Periods
T1. Drop - copy to tmp file, dropping records matching 1 or 2 patterns
- you would copy back to original file if you like the results
- also drop any deleted records (x'00' last byte)
  in Indexed files (if the 'i' option is specified).
U1. Modify filesize - truncate or extend with x'00's
V1. Option 'v' - Micro Focus IDXFORMAT3 VARIABLE length Indexed records
V5.  IDXf3/IDXf8 file header & data header layouts
X1. Option 'z' - variable length records in RDW format
z4 - 4 byte prefix with binary total recsize in 1st 2 (3&4 null)
z2 - 2 byte prefix with binary data recsize (+2 for total recsize)
Y0. Miscellaneous tips using uvhd
Y1.  finding Record-Size in a fixed length file
Y2.  using the NOT= (!) condition
Z1. When your problem is too complex for 'uvhd'
- use 'uvcopy' which can do anything you can imagine.

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

A1. uvhd: Overview & Free Software policy FSF GPLv3

uvhd - Program Description

'uvhd' is a binary file investigation utility. It displays any file in vertical hexadecimal and prompts for commands to browse, search, select, update, scan/replace, print, translate, etc. uvhd is an interactive utility with a command line interface and 18 help screens.

Copyright(C) 1993-2009, UV Software Inc, distributed under GPLv3

You may download uvhd from: http://www.uvsoftware.ca/libuvhd.htm

Licensed under GPLv3

This program is free software: you may redistribute it and/or modify it under the terms of GPLv3 (GNU General Public License version 3), as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

See the full description of the GNU General Public License at: http://www.gnu.org/licenses.

uvhd & Vancouver Utilities

'uvhd' is offered as a Free sample of the Vancouver Utilties which are often used to convert mainframe JCL, COBOL,& DATA to Unix/Linux/Windows Mainframe JCL is converted to Korn shell scripts, and Mainframe COBOL is converted to Micro Focus COBOL to run under Unix/Linux.

uvhd is especially valuable to investigate mainframe type files with packed fields and no linefeeds (required by most unix/linux utilities) uvhd can investigate all converted file types: sequential, fixed, variable, indexed, text, binary, C-ISAM, D-ISAM, Micro Focus COBOL IDXFORMAT1,3,8)

uvhd displays any file in vertical hexadecimal, 64 byte segments, in 3 line groups (characters on 1st line, zones on 2nd line,& digits on 3rd line).

When you find a data problem, use the print function to capture the evidence and send it to your associates via email or hardcopy printout. Hardcopy or softcopy printouts of binary/packed files with byte position scales are not possible with most other unix utilties.

 ============================================================================
 Owen Townsend, UV Software, 4667 Hoskins Rd., North Vancouver BC, V7K2R3
         Tel:   604-980-5434          Fax: 604-980-5404
         Email: owen@uvsoftware.ca    Web: http://www.uvsoftware.ca
 Copyright(C) 1993-2009, UV Software Inc, All rights reserved
 ============================================================================

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

B1. uvhd: investigation utility for files with packed/binary fields

Download uvhd.c & Compile for Unix/Linux

Assuming
  • your current directory is /home/userxx (for examples below)
  • you have downloaded the program from www.uvsoftware.ca
  • you have copied to subdir 'src' & ensured filename is 'uvhd.c'
  • subdirectory 'bin' exists to receive the compiled output
  • your UNIX system has an ANSI C compiler

 #1. cp ??/uvhd.c src/uvhd.c  - copy/rename downloaded program
     =======================  - ensure the filename is 'uvhd.c'

 #2. cc -DH64 src/uvhd.c -obin/uvhd  <-- compile the program
     ==============================    - option '-DH64' for 64 bits (-DH32 dflt)
                                       - also add '-q64' for AIX

 #3. bin/uvhd bin/uvhd      - test uvhd (using uvhd itself as sample file)
     =================      - will display 1st 256 bytes & prompts for command
     --> s 'uvhd version' <-- suggested command to search for uvhd version
     --> ss               <-- repeat the search for other occurrences

 #4. Add bin to your PATH so you can execute it from anywhere.

     PATH=$PATH:/home/users/bin; export PATH
     =======================================

Customizing uvhd for each user via UVHDROP

You may export variable UVHDROP in the .profile to specify the preferred options for each user. For example, users who prefer 1 relative scales and space 2 for displays, may wish to add the following to their .profile:


 export UVHDROP=g1s2    <-- user options for 1 relative & space 2
 ===================

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

B2. uvhd: investigation utility for files with packed/binary fields

Download uvhd.exe & Execute under Windows/DOS

uvhd runs in the DOS Command Prompt window under Windows 95,98,NT,2000,XP,etc.

The simplest plan is to download uvhd.exe & store it in the 'Program Files' directory so windows will find it when you type 'uvhd'.

Here is an alternative plan if you prefer to store uvhd in a separate directory. This is consistent with the documentation tutorials & Help screen examples. It is also compatible with the installation of the entire package of Vancouver Utilities for Windows/DOS (in case you later decide to purchase them).

Setup separate Directories for uvhd & test files

C:\uvwin
  • super directory for Vancouver Utilities
C:\uvwin\binDOS
  • store downloaded uvhd.exe here
C:\uvwin\dat1
  • store downloaded test file 'custmas1' here
C:\uvwin\tmp
  • tmp subdir used by uvhd for write selections, etc

Setup PATH - for Windows 2000


 #1. ControlPanel -> System -> Advanced -> Environmental Variables

 #2. New or Edit (depending on whether PATH is already defined or not)

 #3. PATH   C:\uvwin\binDOS
     ======================

Setup PATH - for Windows 95


 #1. EDIT C:\AUTOEXEC.BAT

 #2. SET PATH=%PATH%;C:\uvwin\binDOS

uvhdcob - alternate version for COBOL shops

'uvhdcob' displays COBOL copybook fieldnames with the corresponding data. See complete details in section uvhdcob.doc.

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

B3. uvhd: investigation utility for files with packed/binary fields

Customize Windows 2000 DOS Command Window

This is optional, but it is highly recommended, since it converts the default small & ugly black & white DOS window to a beautiful blue experience. The following was tested on a 17 inch monitor.

  1. Create a shortcut to the DOS command prompt on your desktop.

  2. Right click on the shortcut & click on properties. You will get a 'Command Prompt Properties' window with several menu choices (General, Shortcut, Options, Font, Colors).

  3. On the Shortcut menu, update Startin & Run as follows:


 #3a. Startin --> C:\uvwin
 #3b. Run --> Maximized    (choices: Normal, Minimized, Maximized)
  1. On the Layout menu, update Screen buffer size & Window size:


 #4a. Screen buffer size Width  --> 120
 #4b. Screen buffer size Height --> 300
 #4c. Window size Width  --> 112
 #4d. Window size Height --> 56
  1. On the Color menu:


 #5a. Screen background --> dark blue
Note
  • Setting Window size width to 112 allows use of option 'l100' on 'uvhd'
  • line width of 100 characters is preferred by most users

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

B4. uvhd: investigation utility for files with packed/binary fields

compiling uvhd for WINDOWS & MSDOS

uvhd has been compiled on Windows2000 using the MSDOS command line screen. I used the lcc-win32 compiler which may be downloaded from www.cs.virginia.edu. lcc-win32 works great (thanks to Jacob Navia).

You do not need to download lcc-win32 & compile uvhd for Windows/Dos since I have already compiled it and you may download uvhd.exe from the UV Software website www.uvsoftware.ca. In case you are interested, here are procedures that could be used to compile uvhd for Windows/DOS. Please see WindowsDOS.htm#E3 for the exact procedures used at UV Software.

Directories used to compile on WinDos

D:\lcc\bin
  • holds the lcc-win32 compiler
  • PATH must include this directory
D:\uvwin\src
  • directory of UV programs on Windows/DOS
D:\uvwin\cctmp
  • temporary directory for compiles
D:\uvwin\bin
  • directory of UV executables on Windows/DOS
  • PATH must include this directory
D:\uvwin\dat1
  • directory of test files
  • custmas1 test file with packed decimal fields

Compiling uvhd on Windows/DOS


 #1. cd D:\uvwin

 #2. copy src\uvhd.c cctmp - copy master source to cctmp for compile

 #3. cd cctmp

 #4. lcc -DDWIN uvhd.c     - compile uvhd source to object
     =================

 #5. lcclnk uvhd.obj       - link uvhd object to executable
     ===============

 #6. cd ..

 #7. copy cctmp\uvhd.exe binDOS  - copy uvhd.exe to the binDOS subdir on WinDos

 #8. uvhd dat1\custmas1 r256     - execute/test uvhd on custmas1 demo file

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

C1. uvhd: investigation utility for files with packed/binary fields

uvhd Printing - Customizing

Note that the print command 'p' does not print immediately, but collects output (from possible multiple print commands in a uvhd session) into a tmp/file, which is subsequently printed manually after you quit uvhd.

The immediate print command 'i' uses the command stored in the variable 'prtcmd' in the uvhd.c source code.


 char prtcmd[30] = "uvlp12";       /* default iprint command */
 ===========================

The 'uvlp12' script is part of the Vancouver Utilities package that calls the 'uvlist' utility (has many options for cpi, landscape, etc).

If you specify option 'l' on print/iprint commands then prtcmdW is used. You would probably do this when you wish to print 100 chars per line but view the 64 chars per line on then screen.


 char prtcmdW[30] = "uvlp12L";     /* default when option l on p/i cmds */
 =============================

If desired, you could change these commands to use the 'lp' command directly (vs the uvlp12/uvlp12L script defaults).


 char prtcmd[30] = "lp -onobanner -dlaser1";  /* specify lp vs uvlp scripts */
 ===========================================

iprint command defaults for Windows

If you are running uvhd in the DOS command window of a Windows system (95,98,NT,2000,XP,etc), then the print commands default to the following:


 char prtcmd[30] = "uvlpr12";     /* default iprint for Windows */
 ===========================

 char prtcmdW[30] = "uvlpr12L";   /* default iprint if option l on Windows */
 =============================

'uvlpr12/uvlpr12L' are Windows/DOS scripts & the full names are uvlpr12.bat & uvlpr12L.bat. They are stored in subdir C:\uvwin\batDOS. These DOS batch scripts redirect output to LPT1.

'uvlp12/uvlp12L' are Unix/Linux Korn shell scripts & are stored in subdir /home/uvadm/sf/util/. These Korn shell scripts pipe output to 'lp'.

Note that uvlpr12/uvlpr12L are used when compiled for native Windows with compile variable 'DWIN'. See install guide WindowsDOS.htm for Windows (vs install.htm for Unix/Linux).

When uvhd.c is compiled for Unix/Linux emulators (SFU/UWIN/CYGWIN) that run under Windows, then uvlp12/uvlp12L unix scripts will still apply.

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

C2. uvhd: investigation utility for files with packed/binary fields

environmental variables for 'i' printing

A more convenient method of modifying Immediate printing is to use the environmental variables 'UVLPDEST' & 'UVHDPRINT'. 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 UVHDPRINT=uvlp12      <-- the default script uvlp12 for 64 chars Portrait
 export UVHDPRINT=uvlp18      <-- could specify uvlp18 to get 128 chars Portrait
 export UVHDPWIDE=uvlp12L     <-- UVHDPWIDE script used when option 'l'
                                  specified on print/iprint commands
                                - uvlp12L gets 100 chars on Landscape
                                - uvlp14L gets 128 chars on Landscape

prtcmdW or UVHDPWIDE is used if you specify the 'l' option on print/iprint commands, for example:

 --> i5l100             <-- prints next 5 records, 100 chars per line
                            Landscape at 14 cpi to fit 11" across
 --> i5l128             <-- can get up to 128 chars Landscape at 14 cpi
 --> i5                 <-- would default to 64 chars per line Portrait
                            (possibly modified by 'l' command line option)

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 UVHDPRINT=uvlpr12     <-- specify DOS script for 64 chars Portrait
 set UVHDPWIDE=uvlpr12L    <-- UVHDPWIDE script used when option 'l'
                               specified on print/iprint commands

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

D1. uvhd: investigation utility for files with packed/binary fields

uvhd Display format illustrated

Records are displayed 256 bytes at a time by default (if rcsz not spcfd) in 4 groups of 3 vertical hex lines as follows:

         ...........record in character format (. for non-dspl chars)....
         ...........hex representation of record zones...................
         ...........hex representation of record digits..................

sample display - 1st record from dat1/custmas1 file


 uvhd dat1/custmas1 r256s2   - command to display the testfile
 =========================     options: r256=record-size, s2=double space
 filename=/home/uvadm/dat1/custmas1 options=r256s2
 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                  ..4V|...
             4442222222222442535343222233323332333322222222222222222201357000
             9DF00000000002306931810000250D754D55310000000000000000000246C000
         128 .........W0....`........)X}..f3.....\.................4V}...f...
             0000000005300016000000002570063100095000000000000000013570016000
             0C0000C0270D0540C0000C0098D0263C0444C0000C0000C0000C0246D0056C00
         192 ...............................f.....<........f.C
             0000008900000000880000000018000680001300000000694222222222222222
             00C0026C0000C0023C0000C0083C0056D0012C0000C0016D3000000000000000
 rec#=1 rcount=32 rsize=256 fsize=8192 dat1/custmas1
 null=next,r#=rec,s=search,u=update,x=rollback,p=print,i=iprint,w=write,e=count
 ,g=genseq#,c=checkseq#,t=translate(ta=Asc,te=Ebc,tu=Upr,tl=Lwr,tc=Chars,tp=Pers)
 ,R#=Recsize,h1=char,h2=hex,q=quit,?=help --> q

In this example we entered 'q' to quit after the 1st 256 bytes of the file was displayed, but we could have entered a record# or byte# to explore other areas of the file. Note that the current record# & byte# are displayed at the left of the two top lines (the 0-64 byte scale).

The uvhd display is especially useful for displaying data files that do not have line feeds & therefor are not easily displayed by an editor & for files with packed decimal fields.

Any non displayable characters is represented by periods on the character line (1st line of 3 vertical hex lines). The above sample has a lot due to the multiple packed fields.

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

D2. uvhd: investigation utility for files with packed/binary fields

Fixed record lengths not evenly divisible into filesize

uvhd issues a warning for Fixed record lengths that are not evenly divisible into the filesize. As of March 2003, uvhd also calculates the next lower & next higher record sizes that are evenly divisible into the filesize. It is then easy to correct the Record size via the 'R' command (which is equivalent to the 'r' option on the command line).

For example if you specified r300 for the dat1/custmas1 test file (vs the correct r256), you would get the following display:


 uvhd dat1/custmas1 r300s2    <-- intentional incorrect 'r'ecord size option
 =========================
 filename=/home/uvadm/dat1/custmas1 options=r300s2
 records=27 filesize=8192 recsize=300 fsize%rsize(remainder)=92
                      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                  ..4V|...
             4442222222222442535343222233323332333322222222222222222201357000
             9DF00000000002306931810000250D754D55310000000000000000000246C000
         128 .........W0....`........)X}..f3.....\.................4V}...f...
             0000000005300016000000002570063100095000000000000000013570016000
             0C0000C0270D0540C0000C0098D0263C0444C0000C0000C0000C0246D0056C00
         192 ...............................f.....<........f.C
             0000008900000000880000000018000680001300000000694222222222222222
             00C0026C0000C0023C0000C0083C0056D0012C0000C0016D3000000000000000
         256 132588    GEECOE GENERATOR SERVICESUNIT 170
             33333322224444442444454545254554445544523332
             13258800007553F5075E5214F20352693535E9401700
 --> R256  <-- enter correct record-size at prompt while on 1st record
             - see tip 'Y1' for more explanations

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

E1. uvhd: investigation utility for files with packed/binary fields

uvhd HELP MENU (screen #1 of 19)

 uvhd filename [options]    <-- enter filename & options on command line
 uvhd dat1/custmas1 r256us2 <-- Example (r256=recsize,u=updates,s2=space2)
 ==========================   - options lower case, optional numeric values

HELP MENU - select by entering 1-19, or null for next

help01
  • (this screen) uvhd command line & Help screen menu
help02
  • command line options a-l
help03
  • command line options m-z
help04
  • Browsing commands (r#, b#, +, -, R#, ?)
help05
  • Search commands
help06
  • Search commands continued
help07
  • Update (u) & Rollback (x/X)
help08
  • Update - more examples
help09
  • Scan/Replace (v)
help10
  • Write selected records to date/time stamped filename in tmp subdir
help11
  • Write options (a=ASCII,c=chars,r=recsize to write,t=terminator,etc)
help12
  • Print & Iprint (Immediate print)
help13
  • Translate to Ascii,Ebcdic,Upper,Lower,Characters,Periods
help14
  • sequence number checking & generating
help15
  • Enumerate/count (e)
help16
  • Drop records(d), Truncate file(z)
help17
  • uvhd Tips & Techniques (saving keystrokes)
help18
  • Customizing uvhd for User Preferences re Options & Printing
help19
  • Free Software Notice - Licensed under GNU FSF GPLv3

help02 of 19 - command line options (a-l)


 uvhd dat1/custmas1 r256us2  <-- Example (r256=recsize,u=updates,s2=space2)
 ==========================
 a1   - translate to ASCII, character line (prior to zone & digit lines)
 b1   - inhibit BOLD search patterns, b2=no BOLD errmsgs, b3=both(DOS dflt)
 c1   - display extended ASCII chars values 128-255 (vs showing as periods)
 d2   - show file dsplcmnts on all segments vs only 1st segment of record
 e1   - no errmsg filesize/recsize not divisible, e2=no recsize calc, e3=both
 f#   - first record# to be displayed (default #1)
 g0   - zero relative column scale (default), use g1 for 1 relative
 g1   - also use 1 relative dsplcmnts on commands (search,update,etc)
 h0   - auto determine display: chars only or hexadecimal (depending on data)
 h1/h2- h1=force characters only, h2=force hexadecimal (chars/zones/digits)
 l#   - line display width, default 64, max 1024

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

help03 of 19 - command line options continued (m-z)

m#
  • max lines/screen (default 16) allow for hex/char, sp1/sp2
n#
  • number of records per screen (between prompts, for short records)
o#
  • inhibit column scale to every #records, use with n# records/screen
r#
  • record size, default 256, max 32768
s#
  • space before: s1=scale, s2=data, s4=prompt, s8=after scale, s15=all
t1
  • text records ended by CR=x'0D' - unusual, old Macs, obsolete ?
t2
  • text records ended by LF=x'0A' - standard unix/windows
u
  • required when uvhd invoked, to allow update command (else read only)
v
  • variable length records Micro Focus Seqntl/Indexed IDXFORMAT3/8
    show recs: v1=filehdr, v2=deleted, v4=active data, v8=all (dflt=v5)
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
  • prefix 2 bytes only, recsize EXCLUDES prefix size
z4
  • prefix 4 bytes, recsize 1st 2, 3&4 nulls, recsize INCLUDES prefix
z8
  • prefix 8 bytes, recsize 1st 2, 3&4 null, 5-8 ignored
z1
  • (+ 1 bit) = z3/z5/z9 Little-end binary, z2/z4/z8 default BIG-end

help04 of 19 - file Browsing commands

null
  • next record (or next segment if rcsz > 384)
r#
  • goto specific record# in the file (one relative)
  • can omit the 'r' (numeric value considered a record#)
  • advance specified # of records (from current position)
    (default 1 if no value specified)
  • backup specified # of records (from current position)
b#
  • goto specific byte# in the file (zero relative)
R#
  • change Record size (vs option 'r' on command line)
  • display help (19 screens)

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

help05 of 19 - Search (1st of 2)


 uvhd dat1/custmas1 r256u  - examples for demo file 'custmas1' (may download)
 ========================  - r256=recsize,u=update allowed
 s 'LTD'           - search for 'LTD' anywhere in record
 ss                - repeat last search (starting from next record)
 s 0(60),'LTD'     - search for 'LTD' anywhere in 1st 60 bytes
 s 77(2),='BC'     - search for 'BC' in bytes 77-78 (match = assumed)
 s 77(2),!'BC'     - search for Not 'BC' in bytes 77-78
 s 77(2),>'BC'     - search for greater than 'BC' in bytes 77-78
 s 120(5),x'000000000C'  - search for packed decimal zero field in 120-124
 s 120(5),!x'000000000C' - search for non-zero packed field in 120-124
 s 'ROAD',|,'STREET'     - search for ROAD or STREET anywhere in record (|=OR)
 s 'ROAD',|,'STREET',|,'DRIVE' - search for 3 patterns anywhere in record
 s 0(1),'1',77(2),'BC'               - '1' in byte 0 And 'BC' in 77-78
 s 0(1),'1',|77(2),'BC'              - '1' in byte 0 Or 'BC' in 77-78
 s 0(1),'1',77(2),'BC',90(3),'604'   - '1' in 0 And BC(77-78) And 604(90-92)
 s 0(1),'1',|77(2),'BC',|90(3),'604' - '1' in 0 Or BC(77-78) Or 604(90-92)
 s adrs1,value1,adrs2,value2,adrs3,value3 - 3 pairs of address & value
  - 'And' is the default when 2 or 3 conditions are specified
  - 'Or' is signalled by the '|' (pipe symbol)

help06 of 19 - Search (continued)


 uvhd dat1/custmas1 r256u - demo file shown at www.uvsoftware.ca/uvhd.htm#I1
 ======================== - must specify option 'u' if updates intended
s 'LTD'
  • search (forward by default) for LTD anywhere in record
sb 'LTD'
  • search backward for LTD anywhere in record
ss
  • repeat last search (starting from next record)
sss
  • repeat search (in same record incrementing byte#)

 s 77(2),'BC',242(4),>'1989',242(4),<'2000' - search for BC updated in 1990's
 ========================================== - search date range
 s 77(2),'BC',242(4),>'1989',<'2000' - same (3rd adrs defaults to 2nd)
 s 77(2),'AB',|77(2),'AL'   - search for 'AB' or 'AL in 77-78
 s 77(2),'AB',|,'AL'        - same as above (2nd field defaults to 1st)
 s 77(2),'AB',|,'AL',|,'YK' - search for 'AB' Or 'AL' Or 'YK' in 77-78
 s 'LTD','ROAD','BC'        - searches entire record, all 3 must be found
 s 'LTD',|,'ROAD',|,'BC'    - searches entire record, any 1 found is a match
sn5 77(2),'BC'
  • search for 5th occurrence (option 'n') of 'BC'

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

help07 of 19 - Update (u) & Rollback (x/X)


 uvhd dat1/custmas1 r256u - demo file shown at www.uvsoftware.ca/uvhd.htm#I1
 ======================== - must specify option 'u' when updates intended
u 77(2),'AB'
  • update current record 77-78 with 'AB' (fixing some 'AL's)
x
  • rollback last update (repeat 'x' toggles last update)
uu
  • repeat last update (after moving to different record)
u9999 77(2),'AB'
  • update next 9999 records, or until EOF (no rollback)
  • no x/X rollback for multi-record updates (backup file 1st)
 u99 77(2),'AB',77(2),'AL' - update next 99 recs with AB 77-78 if currently AL
 u99 77(2),'AB',,'AL'   - same as above, 2nd adrs defaults to 1st
 u99 9(1),'*',8(1),'D',77(2),'BC' - update byte 9 '*', if 8 is 'D' & prov BC
 >>> x/X - rollback last update or all updates to current rec
 x       - rollback last update to current rec (repeat x toggles last update)
 X       - rollback ALL updates to current rec (repeat X toggles ALL updts)
 x/X only for record on display & applies to both u(update) & v(scan/replace)

help08 of 19 - Update - more examples


 uvhd dat1/custmas1 r256u - demo file shown at www.uvsoftware.ca/uvhd.htm#I1
 ======================== - must specify option 'u' if updates intended
 u 75(1),'*',77(2),'BC'  - test conditional update on 1 (current) record
 uu9999                  - then re-execute update on ALL records via uu9999
                  - OR for interactive updates, use 'ss' & 'uu' interleaved
 s 77(2),'BC'     - 1st search to qualifying record
 u 75(1),'*'      - 1st update to record on display
 ss               - repeat last search (s 77(2),'BC')
 uu               - repeat last update (u 75(1),'*')
                  - can also use this for interleaved 'ss' & 'vv' (scan/rep)
x
  • rollback last replace on current record (repeat 'x' toggles last rep)
X
  • rollback all replacements on current record ('X' toggles)
  • rollback applies only to 1 current record & ability lost if you move off

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

help09 of 19 - Scan/Replace (v)

 >>> v=scan/replace - scan a record field for a search pattern
       - if found replace with a specified replacement pattern
       - may truncate or blank fill if search/replace pattern lengths unequal

 uvhd dat1/custmas1 r256u - demo file layout at www.uvsoftware.ca/uvhd.htm#I1
 ======================== - must specify option 'u' if 'v' updates intended

v 10(25),'LTD','LIMITED' - replace 'LTD' with 'LIMITED' anywhere in 10-34

 v999 10(25),'LTD','LIMITED' - 'LTD' to 'LIMITED' on next 999 records (or EOF)
 v999 35(25),'AVE.','AVENUE',77(2),'BC' - replace only if BC in 77-78
 v999 'ST.','STREET'         - a big mistake for fixed length record layouts
 v999 0(256),'ST.','STREET'  - same as this, entire record would be shifted
 v999w 10(25),'LTD','LIMITED' - option 'w' to write separate file to tmp/...
       - writes tmp/filename_yymmdd_hhmmssV (Text records, this field only)

 uvhd tf/tabtest1 t <-- demo TEXT file with tabs (unix expands to 8 spaces)
 ==================   - option 't' Text file, 'u' not req'd to write sep file
 v999w x'09','    ' <-- replace tabs (x'09') with 4 spaces (tf/tabtest1 file)

help10 of 19 - Write selected records to tmp subdir

 >>> w=write - write data records only for later use (test files,etc)
             - writes start at current position & end at EOF (or max count)
             - write outputs written/appended to tmp/filename_yymmdd_hhmmssW
w5
  • write (unformatted) 5 records from current position
ww
  • repeat last write command (from current position)
w 'VANCOUVER'
  • write all records with 'VANCOUVER' anywhere in record
w25 77(2),'BC'
  • write (25 max) records with 'BC' in bytes 77-78
 w 8(1),'D',77(2),'AB',|,'AL' - write recs with 'D' in 8 & AB or AL in 77-78
we10
  • write every 10th record (to make smaller test file ?)
w100e5
  • write 100 records, select every 5th (file must have 500+)
we10 77(2),'BC'
  • write every 10th rec with province 'BC' (from here to EOF)
wi
  • write entire file (if at 1st rec), except ISAM deleted
wi 77(2),'BC'
  • select BC bytes 77-78, 'i' option drops ISAM deleted

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

help11 of 19 - 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 CR/LF after Last-Non-Blank, else at end specified record-size
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

help12 of 19 - Print selected records to tmp subdir

 >>> p=print - write formatted records to a file for subsequent lp,uvlp,vi,etc
             - writes tmp/filename_yymmdd_hhmmssP (concat for uvhd session)
             - export UVLPDEST="lp -dlaserxx" for unix lp (see help17 below)
 p5                - print 5 recs from current position
 p25 'VANCOUVER'   - search & print (25 max) records with 'VANCOUVER' anywhere
 p 77(2),'BC'      - search & print (til EOF) records with BC in bytes 77-78
 p 77(2),'BC',90(3),!'604' - print recs with BC in 77-78 & Not 604 in 90-92
 p9s2f3            - print 9 records, space 2, formfeed every 3rd record
 pp                - repeat last print command (from current position)
 >>> i=iprint - write formatted records to tmp file for immediate uvlp12/lp
              - writes tmp/filename_yymmdd_hhmmssI & uvlp12 issued immediately
 i5              - iprint 5 recs 64 char lines (dflt: export UVHDPRINT=uvlp12)
 ii              - repeat last iprint command (from current position)
 i 'VANCOUVER'       - iprint records with 'VANCOUVER' anywhere in record
 i 77(2),'AB',|,'AL' - print records with AB or AL in 77-78
 i 0(120),<x'20'     - iprint records with any bytes < space in 1st 120 bytes
 i6s2f4      - iprint 6 records, space 2, formfeed every 4th record
 i3s2l128    - iprint 3 recs, 128 bytes/line, using export UVHDPWIDE=uvlp14L

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

help13 of 19 - Translate to Ascii,Ebcdic,Upper,Lower,Characters

>>> t=translate - to ASCII,EBCDIC,UPPER,lower,characters,periods ta=Ascii, te=Ebcdic, tu=Upper, tl=lower, tc=characters, tp=periods

 ta         - translate to Ascii, entire current record, (t1a is same)
 ta 0(120)  - translate to ASCII, 1st 120 bytes of current record
 ta 240(16) - translate bytes 240-255 (zero relative, 241-256 one relative)
 t999999a   - translate to Ascii, all records in file (from current to EOF)
 te         - translate to Ebcdic, entire current record
 tu         - translate to Upper, entire current record
 tl         - translate to Lower, entire current record
 tc         - translate to Characters, any unprintables translated to blanks
            - unprintables are x'00'- x'1F' & x'7F'-x'FF'
 tc1        - translate unprintable Chars to blanks, except LineFeeds x'0A'
 tc2        - translate to Characters, except for Carriage-Returns x'0D'
 tc4        - translate to Characters, except for FormFeeds x'0C'
 tc8        - translate to Characters, except for Tabs x'09'
 tc15       - translate to Chars, except LFs,CRs,FFs,Tabs (1+2+4+8=15)
 tc3        - translate to Chars, except for LFs & Crs
 tp         - translate any unprintable Characters to carats
 tp15       - translate unprintables to carats, except LFs,CRs,FFs,Tabs
 t999999p1 0(120) translate all recs, unprintables to carats, except LF

help14 of 19 - sequence number checking & generating

>>> c=check - check sequence in specified field - until EOF or SEQUENCE ERR

c 0(6)
  • check sequence in key field 0-5 (cols 1-6), show 1st out of seq
cd 0(6)
  • option 'd' to check sequence descending (vs ascending default)
ce 74(6)
  • option 'e' to consider EQUAL keys out-of-sequence
ci 74(6)
  • option 'i' to check sequence number increment by 1
ci10 74(6)
  • option 'i10' to check sequence number increment by 10, etc
cc
  • repeat last sequence check (from current position to EOF)
g9999 75(5),'00001'
  • generate seqnums in cols 76-80 incrmnt by 1 from 00001
  • specify count (9999) greater than no of recs in file
  • else seqnum inserted only in current record
  • must specify 'u' option on command line (like update)
 gi10 72(8),'#00010.' - seqnum cols 74-79 from 000010 incrmnt by 10
        - any non-numeric data is inserted before & after the seqnum digits
        - might omit count 9999 to observe results in current record
 gg9999 - then repeat command (gg) with count to seqnum entire file
 g9999 74(6),'A00001',0(1),'A' - conditional seqnum, if col 1 = 'A'
 r1                            - return to record #1 before next command
 g9999 74(6),'B00001',0(1),'B' - conditional seqnum, if col 1 = 'B'

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

help15 of 19 - Enumerate (e)

 >>> e=enumerate - count records from current point to EOF
 e                - count records from current position to EOF

 uvhd dat1/custmas1 r256 - demo file shown at www.uvsoftware.ca/uvhd.htm#I1
 =======================
e 'LTD'
  • count records with 'LTD' anywhere in current record
e25 77(2),'BC'
  • count (within next 25 recs) recs with BC in bytes 77-78
 e99 77(2),'AB',|77(2),'AL'  - count records with AB or AL in bytes 77-78
 e99 77(2),'AB',|,'AL'       - same as above (2nd adrs defaults to 1st)
 e99 77(2),'BC',90(3),!'604' - count recs with BC in 77-78 & Not 604 in 90-92
                             - powerful technique to verify record data

help16 of 19 - Drop records, Truncate file

 >>>drop - copies file to tmp/fname_yyyymmdd_hhmmssD, drop matching records
           a pattern & optionally with D-ISAM flag x'00' in last byte
         - file overwritten if command repeated (no collection as on write)
         - copy starts at current position & ends at EOF (or max count)
d 8(1),'D'
  • copy to tmp file dropping records with 'D' in column 9
d500i
  • copy 500 recs max to tmp file dropping D-ISAM flagged recs
di
  • copy entire file to tmp dropping D-ISAM flagged records

>>> z=truncate (modify) filesize (truncate or extend with x'00's)

z100000
  • truncate file to 100,000 bytes
  • works on Unix,Linux,Windows/SFU, but not on Windows/DOS

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

help17 of 19 - uvhd Tips & Techniques (save keystrokes)

  tip#1 - use command repeats to save keystrokes
        - use 'double letter commands' to repeat prior cmd w/o rekeying args
     ss - repeat last search, uu - repeat last update, ii - repeat last print
        - 1st re-position to desired rec before executing repeat command
        - or 'r1' to return to begin file to include all recs
    ww5 - may specify count on repeat commands, if original was 'w5 0(1),'A''
          ww5 would write next 5 recs with A in 1st byte (bypassing non 'A's)
tip#2
  • Transfer Search arguments to other commands (w,e,p,i)
  • allows you to verify correct arguments before other commands:
  • then transfer verified args to desired command w/o having to re-key
    for example, we could specify args on search & transfer to write:
   s 77(2),'BC',242(4),>'1997'  - search for BC records newer than 1997
   w=s                          - transfer Search args to Write command
   ww99999                      - Write out selected records until EOF
       - transfer also applies to Enumerate(e=s), Print(p=s),& Iprint(i=s)
 tip#3 - using NOT '!' condition, can use to find exceptions to most records
       - for example to find any provice codes that are NOT 'BC'
   s 77(2),!'BC'       <-- display records with province codes NOT = 'BC'
   w9999 77(2),!'BC'   <-- write NON 'BC' records to tmp/filename_date_time

help18 of 19 - Customizing uvhd - User Preference Options

 export UVHDROP=s2z1  <-- user preference options example
                          s2=space2, g1=one relative byte#s (vs 0 rel default)
 export UVLPDEST=-dlaserxx <-- specify printer destination for 'i' command
 export UVHDPRINT=uvlp12   <-- specify iprint script for 64 char lines
                             - uvlp12 is UV script for laser Portrait printing
 export UVHDPWIDE=uvlp12L  <-- recommended script for Landscape 100+ chars
                             - UVHDPWIDE used if you specify 'il100'
 export UVHDPRINT="lp -dlaserxx" <-- may specify standard unix lp command
 export UVHDPWIDE="lp -dlaserxx -onobanner" - for 64 chars or 100 chars

uvhd version 20090207 - Copyright UV Software Inc. 1993-2009 - see full documentation at: www.uvsoftware.ca/libuvhd.htm

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

help19 of 19 - Program Licensed under GPLv3

'uvhd' is a binary file investigation utility. It displays any file in vertical hexadecimal and prompts for commands to browse, search, select, update, scan/replace, print, translate, etc. uvhd is an interactive utility with a command line interface and 17 help screens.

Copyright(C) 1993-2009, Owen Townsend, UV Software, owen@uvsoftware.ca

Licensed under GPLv3

This program is free software: you may redistribute it and/or modify it under the terms of GPLv3 (GNU General Public License version 3), as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

See the full description of the GNU General Public License at: http://www.gnu.org/licenses.

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

F1. uvhd: investigation utility for files with packed/binary fields

Command Line Options


 uvhd filename [options] - display the named file on the screen
 =======================   in 64 byte lines (see display format above)

Options must follow the filename as 1 string of alpha & numeric values. If omitted, option 'r' record size defaults to 256


 uvhd dat1/custmas0 r256a1s3  <-- example showing multiple options
 ===========================    - recsize, Ascii translate, space lines
a
  • translate to ASCII, character line (prior to zone & digit lines)
    zone & digit lines will still reflect the EBCDIC values
  • also causes any constants entered on commands (search,update,etc)
    to be translated from ASCII entry to EBCDIC (to match datafile)
  • also causes fill chars to be EBCDIC blanks on write commands
  • Always specify option 'a' for EBCDIC files
b1
  • inhibit BOLD highlighted search patterns (for dumb terminals)
b
  • inhibit BOLD errmsgs (b3=both - DOS default)
c1
  • display extended ASCII chars values 128-255 (vs showing as periods)
d2
  • show file dsplcmnts on all segments vs only 1st segment of record
e1
  • no errmsg filesize/recsize not divisible, e2=no recsize calc, e3=both
f#
  • first record# to be displayed (default #1)
g0
  • zero relative column scale (must enter zero relative displacements)
g1
  • one relative column scale
  • also allows you to enter 1 relative displacements on commands
    --> s 1(80),'XX' <--vs--> s 0(80),'XX' <-- search 1st 80 for XX
h0
  • auto determine display: chars only or hexadecimal (depending on data)
h1
  • force characters only (inhibit hex zone/digit lines)
h2
  • force vertical hexadecimal display
l99
  • declare the line size (how much to display on each screen line)
  • default 64 bytes, max 64 bytes
  • might specify 50 if your rcsz was 50, 100, 150, 200, etc

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

F2. uvhd: command line OPTIONS (continued)

m#
  • max lines/screen (default 20) allow for hex/char, sp1/sp2
n#
  • number of records per screen (between prompts, for short records)
o#
  • inhibit column scale to every #records, use with n# records/screen
r9999
  • declare a record size other than the default 256 bytes
  • max 32768, max display segment is 384 per screen
s#
  • space options for record display & printing
s1
  • space before the scale
s2
  • space before the data segments (3 line groups of chars/zones/digits)
s4
  • space before the prompts at the end of each record display
  • you may binary combine these options, for example
s3
  • space before scale & before data segments (s1+s2=s3)
s7
  • maximum spacing (s1+s2+s4=s7)
t
  • End Record Markers for variable length TEXT records (vs fixed records)
t1
  • records ended by CR=x'0D' - unusual, old Macs, obsolete ?
t2
  • records ended by LF=x'0A' - standard unix/windows
t3
  • records ended by LF+CR (x'0D0A'), redundant on input (y3 for output)
u
  • required for update capability, else read only
  • must enter on command line if you intend to use instructions:
    u=update, v=scan/replace,or t=translate
v#
  • Micro Focus Variable length Indexed/sequential files IDXFORMAT3
  • the numeric value indicates records to be displayed or printed
    v1=filehdr, v2=deleted, v4=data, v8=all/system
    (default is v5 = file header & data records)
w1
  • combine all Write command outputs into 1 file (vs separate files)
v
  • IDXFORMAT8 MicroFocus Indexed fixed records allowing files > 2 gig
    show recs: v1=filehdr, v2=deleted, v4=active data, v8=all (dflt=v5)
z4
  • RDW, variable lth, recsize 1st 2 bytes binary, bytes 3&4 x'0000'
    recsize includes prefix-size + data-size (z/z0 default z4)
z2
  • RDW, prefix 2 bytes only, recsize excludes prefix size
  • z2/z4 default Big-end binary, specify z3 or z5 for little-end binary

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

F3. uvhd: investigation utility for files with packed/binary fields

OPTION EXAMPLES

uvhd dat1/custmas1 r256 - display the file as 256 byte records (default)

 uvhd file r128aus2g1     - may concatenate all options
 uvhd file r128,a,u,s2,g1 - or may separate with commas if desired
           r128           - recsize=128
                a         - translate character line to ASCII (for EBCDIC files)
                          - constants on commands will be translated to EBCDIC
                  u       - allow update commands to be used
                    s2    - space between 3 line segments (chars/zones/digits)
                       g1 - use 1 relative column scale (vs zero relative)
                          - also expects you to enter 1 relative displacements
                            on the commands (search, update, etc)
uvhd file r100l50
  • display 100 byte records on 2 lines of 50 bytes each
    (note 'l50' is the 'l' ell option)
uvhd file t2
  • determine rec size via linefeeds (vs fixed 256 bytes)

OPTION RULES

  1. Options may be entered on the program command line following the command name & the filename.

  2. The program design allows for 26 option codes (26 letters of alphabet).

  3. An option letter may be followed by a value pertaining to that option.

  4. Options must be contiguous (no spaces between the option codes). but you may separate with commas if desired

  5. You may setup your preferred options via an environmental variable in your .profile (so you don't have to enter on command line every time). You might use this for the 'g1' option (one relative scale vs zero rel).

    export UVHDROP=g1     <-- force 'g1' on all subsequent uvhd commands

Note that you could still override this on the command line

    uvhd file r256g0      <-- 'g0' on command line overrides UVHDROP=g1

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

F4. uvhd: investigation utility for files with packed/binary fields

uvhd commands - Browsing

null
  • defaults to continuing display from current position
r#
  • goto specified record# within the file (one relative)
  • may omit 'r' (goto record# assumed if numeric only)
b#
  • goto specified byte# within the file (zero relative)
 +#   - go specified # of records ahead from current position
 -#   - go specified # of records back  from current position
R#
  • change record size & re-display current record

uvhd commands - Searching

s
  • search records for a data pattern

uvhd commands - Updating

u
  • update records in specified columns with new data,
    which must be the same length as the data field defined.
v
  • scan/replace, search data fields replacing a specified pattern,
    with an alternate (which may be of different length).

uvhd commands - Printing

p
  • print, write formatted records to a temporary file,
    for later print/display via: lp, uvlp, vi, etc
  • assigns filename as tmp/filename.yyyymmddHHMMP
i
  • immediate print, write formatted records to a temporary file,
    which is immediately printed via 'uvlp' (lp for download version)

uvhd commands - Writing

w
  • write, write unformatted records to the 'tmp' subdirectory
  • assigns filename as tmp/filename.yyyymmddHHMMW
    (example: tmp/custmas1_971130_154500W)
Note
  • the write command is a very handy way to create test files
  • you can select specified number of records by patterns
  • change file location & repeat previous search/selection criteria.

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

F5. uvhd: investigation utility for files with packed/binary fields

uvhd commands - Deleting

d
  • delete records, copies file to the 'tmp' subdirectory
    for inspection before copying/moving back over original file.

uvhd commands - Check Sequence

c
  • check sequence on specified field
  • displays 1st record not in sequence (or EOF all OK)

uvhd commands - Counting records

e
  • enumerate (count) records from current position matching 1 or 2
    specified patterns until EOF or within a max record count

uvhd commands - Translating

t
  • translate to Ascii, Ebcdic, Upper, Lower, Characters, Periods
  • unprintable Characters can be translated to blanks or Periods

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

G1. uvhd: Function Summary

I1. Browse - display records consecutively
- jump to & display any record in the file by record#
J1. 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)
J2.  Search Indexed files for deleted records
K1. 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
L1. Scan/Replace - searches the specified record field, searching for a pattern
  - if found, replace with a replacement pattern.
- will truncate or blank fill if search & replace lengths different
M1. 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
N1. 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.
O1. Iprint - write formatted records to a file for immediate printing
  via the 'uvlp' command (see uvlist.doc).
- may specify number of records &/or records matching patterns
P1. Generate Sequence Numbers
- may specify starting number & increment (default 1)
- may specify constants before & after sequence#
Q1. Check - check sequence of specified field
- options for ascending, descending, duplicates
R1. Enumerate - count records from current position matching 1 or 2
  specified patterns until EOF or within a max record count
S1. Translate - to Ascii, Ebcdic, Upper, Lower, Characters, Periods
  - unprintable characters can be translated to blanks or Periods
T1. Drop - copy to tmp file, dropping records matching 1 or 2 patterns
- you would copy back to original file if you like the results
- also drop any deleted records (x'00' last byte)
  in Indexed files (if the 'i' option is specified).
U1. Modify filesize - truncate or extend with x'00's

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

H1. uvhd: investigation utility for files with packed/binary fields

uvhd Tutorial - Preparation

If you have installed the full Vancouver Utilities package, you will have the testfile in the /home/uvadm/dat1 subdirectory.


 #1. cd /home/?????           - change to your home directory

 #2. mkdir dat1 tmp           - make directories for testfile & print outputs

 #3. cp /home/uvadm/dat1/custmas1 dat1  - copy supplied file to your sub dir

 #4. uvhd dat1/custmas1 r256    - execute uvhd (interactive utility)
     =======================

alternative download testfile from internet

Note
  • the uvhd.c source program download & compile instructions have
    already been presented on page 3 of this documentation.

 #1. http://www.uvsoftware.ca  - goto UV Software web site
     ========================

 #2. custmas1.dat              - click on testfile name to download
     ============              - save to disc

 #3. mv custmas1.dat /home/userx/dat1/custmas1
     =========================================
                    - move testfile to your home dir & drop suffix (.dat)
                      to match tutorial (shorter & easier to key)
                    - '.dat' on web site necessary to download as binary
                      & preserve the packed fields

 #4. uvhd dat1/custmas1 r256    - execute uvhd (interactive utility)
     =======================

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

I1. uvhd: investigation utility for files with packed/binary fields

Browsing the ASCII demo file


 uvhd dat1/custmas1 r256s2  <-- initiate uvhd on test file with options
 =========================      'r256' (record-size) & 's2' (double space)
                                (between 3 line groups of chars,zones,digits)
 filename=/home/uvadm/dat1/custmas1 options=r256s2
 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 dat1/custmas1
 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 displays the 1st record & waits for you to enter a command. Null entries cause uvhd to display records consecutively. You can jump to & display any record in the file by entering the desired record#.


 #1. null entry          - display next consecutive record
     ==========

 #2. r10                 - display record #10
     ===

 #3. r99999              - go to End Of File
     ======

 #4. -1                  - backup to & display last record in file
     ==

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

I2. uvhd: investigation utility for files with packed/binary fields

Browsing EBCDIC files


 uvhd dat1/custmas0 r256    <-- investigate EBCDIC demo file (dat1/custmas0)
 =======================
                      10        20        30        40        50        60
 r#        1 0123456789012345678901234567890123456789012345678901234567890123
           0 ......@@@@.........@......@...K@@@@....@.....@....@@@@@@@@@@....
             FFFFFF4444CECDCDCCD4DDEDDE4DEC44444FFFF4CDECD4DDCC4444444444DCDC
             130140000055597955504636920334B000018150266550961400000000005151
          64 ...@@@@@@@@@@..@......@@@@...`...`....@@@@@@@@@@@@@@@@@@........
             CDD4444444444CC4EFEFCF4444FFF6FFF6FFFF44444444444444444400000000
             946000000000023059218100006040754055310000000000000000000000C000
         128 .........W0....`........)X|..f3.....\.......................f...
             0000000005300016000000002570063100095000000000000000000000016000
             0C0000C0270C0540C0000C0098C0263C0444C0000C0000C0000C0000C0056C00
         192 .E|...V}.......................f.....<........f..@@@@@@@@@@@@@@@
             047000570000000088000000001800068000130000000069C444444444444444
             35C0046D0000C0023C0000C0083C0056D0012C0000C0016D3000000000000000

BUT, of course we can NOT read the data on unix/linux ASCII systems. 'uvhd' provides option 'a' to perform EBCDIC to ASCII translation on the character line of the 64 byte 3 line groups (characters, zones, digits). You can then 'read' the EBCDIC data. Note that the zones & digit lines will reflect the actual data values (see an EBCDIC code card).

re-display with option 'a'


 uvhd dat1/custmas0 r256a  <-- investigate EBCDIC demo file, using option 'a'
 ========================      to translate the character lines to ASCII
                      10        20        30        40        50        60
 r#        1 0123456789012345678901234567890123456789012345678901234567890123
           0 130140    EVERGREEN MOTORS LTD.    1815 BOWEN ROAD          NANA
             FFFFFF4444CECDCDCCD4DDEDDE4DEC44444FFFF4CDECD4DDCC4444444444DCDC
             130140000055597955504636920334B000018150266550961400000000005151
          64 IMO          BC V9S1H1    604-754-5531                  ........
             CDD4444444444CC4EFEFCF4444FFF6FFF6FFFF44444444444444444400000000
             946000000000023059218100006040754055310000000000000000000000C000
         128 .........W.....-.........X@..f.....m*.......................f...
             0000000005300016000000002570063100095000000000000000000000016000
             0C0000C0270C0540C0000C0098C0263C0444C0000C0000C0000C0000C0056C00
         192 .E@...V'........c..............f..............f.C
             047000570000000088000000001800068000130000000069C444444444444444
             35C0046D0000C0023C0000C0083C0056D0012C0000C0016D3000000000000000

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

I3. uvhd: investigation utility for files with packed/binary fields

Packed Decimal fields

Note that there are 24 * 5 byte packed fields in 120-240. You can identify the end of each packed field by the sign, x'_C' or x'_D'in the last byte. For example here is the 1st 8 bytes of last segment:

         192 .E@...V'   <-- character line
             04700057   <-- zones line
             35C0046D   <-- digits line
               ^    ^   <-- '^' marks sign/end of each packed field

Translation would destroy packed fields, so we will use our options to specify translation only for 0-119 & 241-255 (see options c0d120e240f16 on the command line below).

Relevancy of option 'a'

Option 'a' is relevant to sites that are converting from an IBM mainframe to Unix, Linux, or Windows/SFU. The data files are transferred to the new machine where they are converted from EBCDIC to ASCII (see DATAcnv1.htm).

The conversion jobs are generated automatically from the COBOL copybooks. All character type & unpacked numeric fields are translated from EBCDIC to ASCII, while preserving any packed or binary fields unchanged (since they would be destroyed by the translation).

'uvhd' with option 'a' is a vital asset to verify the data conversions, you can spot check the conversion by examining both the input EBCDIC data & the output ASCII file.

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

J1. uvhd tutorial - SEARCHING

You can search for & display records containing a specified pattern. The pattern may be anywhere in the record (by default) or within specified column locations.

Searching is performed from the current record on display until EOF, so you may need to return to the begining of file (command 'r0') to ensure you find all records.


 uvhd dat1/custmas1 r256     - initiate uvhd
 =======================     - display 1st record & wait for oprtr command

 #1. s 0(120),'CALGARY'     - search for 1st record concatenating 'CALGARY'
 #   ==================       (within 1st 120 bytes of each record)

***found CALGARY at byte# 60

 r#      23           1         2         3         4         5         6
 b#    5632 0123456789012345678901234567890123456789012345678901234567890123
          0 306959    356582 ALBERTA LTD.      DEVITT NURSERY           CALG
            3333332222333333244445542454222222244545524555455222222222224444
            306959000035658201C252410C44E0000004569440E5235290000000000031C7
         64 ARY          AL T2T5N1       -   -                      ........
            4552222222222442535343222222222222222222222222222222222200000000
            12900000000001C04245E10000000D000D00000000000000000000000000C000
        128 ..........)....`................................................
            0000000001280006000000000000000000000000000000000000000000000000
            0C0000C0009C0030C0000C0000C0000C0000C0000C0000C0000C0000C0000C00
        192 ..........&Rl..................'l...I\..........C   870807
            0000000000256000000000000000001260004500000000004222333333222222
            00C0000C0062C0000C0000C0000C0027C0029C0000C0000C3000870807000000

 #2. ss                      - repeat search for next record with 'CALGARY'
     ==                        (using last specified search criteria)
                            - repeat the 'CALGARY' search until EOF reached

 #3. r0                      - return to 1st record in the file

 #4. s <x'20'                - search for any byte < x'20' (space character)
     ========                - could specify as:  s <' '

 #5. s 'LTD','ROAD'          - search for records with 'LTD' AND 'ROAD' anywhere

 #6. sb 'LTD',|,'ROAD'       - search BACKWARD for records with 'LTD' OR 'ROAD'

 #7. ssb                     - repeat last search BACKWARD (vs default forward)

 #8. s 77(2),>'AA',,<'AZ'    - search for recs with cols 78-79 from AB to AY

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

J2. uvhd: Searching for Deleted records in Indexed files

This applies to D-ISAM Indexed files which are compatible with C-ISAM and Micro Focus COBOL IDXFORMAT1 files. First we need an Indexed file for our test/demo. If you have the Vancouver Utility package you can use the supplied D-ISAM file in subdir dat1/. Note that D-ISAM files are in 2 parts: data & indexed, with extensions '.dat' & '.idx'.


 dat1/custmast.dat     <-- data partition of indexed file
 =================
 dat1/custmast.idx     <-- index partition of indexed file
 =================

We will only be interested in data partition (where our data records are) since the .idx partition is unintelligible to most of us. The data partition is quite simple. All that happens when we load an indexed file from a sequential file is that 1 extra bye is added to each record. The extra byte will initially be x'0A' (LineFeed), but programs may delete records which change the x'0A' to a x'00' (null).


 uvhd dat1/custmast.dat r257     <-- examine D-ISAM file with uvhd
 ===========================         (recsize 1 extra for ISAM files)
                      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
         256 .
             0    <-- note x'0A' in byte 256, zero relative, 257 one relative
             A      - x'0A' IDs a good record, x'00' IDs a deleted record

 s 256(1),x'00'    <-- search for 1st deleted record
 ==============
 ss                <-- repeat search for next deleted record
 ==
 1                 <-- return to begining of file
 =

 t 256(1),x'00'    <-- enumerate (count) no of deleted records in the file
 ==============

If you have a lot of indexed records, you can use 'uvsort' to sort the data partition (making it more efficient) & drop the deleted records. See uvsort.htm#L2 & uvsort.htm#M1 (to recover corrupted files).

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

K1. uvhd tutorial - UPDATING

The 'u' command will update the current record on display. You can replace specified columns with specified data (character or hexadecimal).

This is a safe method of updating Micro Focus Indexed files, because uvhd will never change the record size. Micro Focus Indexed files can be updated with 'vi' but this is very dangerous, because it is easy (with vi) to add a byte or drop a byte, which would destroy the integrity of the remainder of the file (fixed record slots, not variable text).


 cp dat1/custmas1 tmp/cm1    - copy test file to tmp, since update will modify
 ========================

 uvhd tmp/cm1 r256u          - initiate uvhd
 ==================          - 'u' option require when update intended

 #1. u 14(5),'red  '          - change 'EVERGREEN MOTORS'
     ===============            to 'EVERred   MOTORS'

 #2. x                         - undo (rollback) the last update
     =                         - repeat to re-apply last update (toggle)

 #3. u 192(3),=x'12345C'       - update 1 of the packed fields
     ===================         (using hexadecimal notation)
 r#       1           1         2         3         4         5         6
 b#       0 0123456789012345678901234567890123456789012345678901234567890123
          0 130140    EVERred   MOTORS LTD.    1815 BOWEN ROAD          NANA
            3333332222454554422244545524542222233332445442544422222222224444
            13014000005652254000DF4F230C44E0000181502F75E02F140000000000E1E1
         64 IMO          BC V9S1H1    604-754-5531                  ........
            4442222222222442535343222233323332333322222222222222222200000000
            9DF00000000002306931810000604D754D55310000000000000000000000C000
        128 .........W0....`........)X|..f3.....\.......................f...
            0000000005300016000000002570063100095000000000000000000000016000
            0C0000C0270C0540C0000C0098C0263C0444C0000C0000C0000C0000C0056C00
        192 .4\...V}.......................f.....<........f.C
            1350005700000000880000000018000680001300000000694222222222222222
            24C0046D0000C0023C0000C0083C0056D0012C0000C0016D3000000000000000
            ^^^ - note results of:  u 192(3),x'12345C'
                             & of:  u 14(5),'red  '
 4a. r0                        - reset file pointer to rec #0 (1st in file)
 4b. u99 77(2),'AB',77(2),'AL' - update cols 78-79 to 'AB' if currently 'AL'
                                 (no rollback for multi-record updates)
 Note - To ensure multi-record updates to EOF, specify 'u' + a number,
        that is higher than the number of records in the file.
       - OK to use 9 '9's (u999999999), but do not use more (32 bit limit).

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

L1. uvhd tutorial 'v' - scan/replace

'v' (scan/replace) searches the specified record field, searching for a specified pattern & if found, replacing with a specified replacement pattern.


 cp dat1/custmas1 tmp/cm1   - copy test file to tmp (since scan/rep modifies)
 ========================

 #1. uvhd dat1/custmas1 r256u   - initiate uvhd
     ========================   - option u required for update or scan/replace
                      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

 #2. v 10(25),'LTD.','LIMITED' - replace 'LTD' with 'LIMITED' anywhere in 10-34
     =========================
                      10        20        30        40        50        60
 r#        1 0123456789012345678901234567890123456789012345678901234567890123
           0 130140    EVERGREEN MOTORS LIMITED 1815 BOWEN ROAD          NANA
             3333332222454545444244545524444544233332445442544422222222224444
             130140000056527255E0DF4F230C9D94540181502F75E02F140000000000E1E1
Note
  • will lose any data pushed beyond byte 34 (fixed length record fields)

 #3a. 5            - goto record #5 (also known to contain 'LTD.')

 #3b. vv           - repeat last 'v' scan/replace command
      ===

 #4a. 1                        - return to rec#1

 #4b. v99 10(25),'LTD.','LIMITED' <-- same change on 99 (all) records (or EOF)
      ===========================

 #5a. 1                            - return to rec#1

 #5b. v999 'LTD.','LIMITED'        - big mistake for fixed length record layouts
                                   - defaults to entire record

 #5c. v999 0(256),'LTD.','LIMITED' - same as this, entire record would be shifted

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

L2. uvhd tutorial 'v' - scan/replace

scan/replace vs update

  1. 'u' updates a fixed field (op1) with constant data (op2) which must be the same length as the op1 field defined.

  2. 'v' scans the op1 record field for the op2 constant data & if found, replaces the op2 data with the op3 replacement data.

  3. Both 'u' & 'v' allow extra fields & constants to qualify the update. 'u' allows 2 qualifiers, but 'v' allows only 1 since there are 3 max constants allowed & 'v' requires 2 for scan/replace.

  4. 'v' allows the search & replacement data to be of different lengths, which causes the remainder of the op1 data field to be truncated or blank filled.

  5. 'v' can be dangerous for fixed length fields. You must be sure that op1 defines a field such as Name & Address where it is OK to shift data. Be sure you define only 1 field since you don't want to shift data outside of the intended field.

  6. 'v' can be most effective for delimited variable length text files, since it is OK to shift multiple fields in these file types. But note that uvhd will never change record lengths. Any attempt to shift data past the original record length will be truncated.

  7. If your 'scan/rep's require increasing the record length, you can NOT do it with 'uvhd'. Use the uvcopy utility which can do anything. See the 'uvcopy vs uvhd' comparison on page 'Z1'.

    option 'w' to write separate file for scan/replace

  8. In May 2008, option 'w' was added to the scan/replace 'v' command, to allow you to write out a separate (TEXT) file for a scan/replace.

  9. The text file is written to the tmp/... subdir & date/time stamped as shown below.


    tmp/filename_yymmdd_hhmmssV
    ===========================
  1. Writing a separate text file allows you to replace shorter patterns with longer patterns & not lose any data as would be the case with the normal option 'u' update in place.

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

L3. uvhd tutorial 'v' - scan/replace

writing text file with 1 field from fixed lth records

Scan/Replace with different pattern lengths is a very powerful & useful feature for 'TEXT files', which we will demonstrate on the next page.

But 1st we will illustrate that it could be used for 1 selected field from a 'Fixed Length Record file' (vs scan/replace on multi-fields or entire record which would corrupt the records by pushing data into following fields).

On page 'L1' we could lose data by replacing 'LTD.' with 'LIMITED' in 10(25). Option 'w' will extract the specified field to a separate TEXT file, which allows records longer than the 25 byte original name field.


 #1. uvhd dat1/custmas1 r256   - initiate 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

 #2. v999w 10(25),'LTD.','LIMITED' - option 'w' to write separate file to tmp/...
     ============================
     - writes tmp/filename_yymmdd_hhmmssV (Text records, this field only)
     - text records have LineFeed inserted after last non-blank

 #3. q   <-- quit uvhd

 #4. cat tmp/custmas1_yymmdd_hhmmssV   <-- display extracted field
     ===============================
      EVERGREEN MOTORS LIMITED
      GEECOE GENERATOR SERVICES
      E&L TRUCKING
      NICHOLSON CHEVROLET LIMITED
      OTTO MOBILES WESTERN LIMITED

We are showing only 5 of the 32 text files written, And you can see that replacing 'LTD.' with 'LIMITED' has exceeded the 25 byte original field length in some cases.

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

L4. uvhd tutorial 'v' - scan/replace

demo option 'w' scan/replace on TEXT file

Scan/Replace with option 'w' can be very useful for TEXT files (vs fixed record fixed field demo above). For example we can use scan/replace with option 'w' to convert all tabs (x'09') in a text file to 4 spaces (vs 8 default).

The following 11 line file is supplied in /home/uvadm/tf/tabtest1 to demo uvhd scan/replace option 'w' to write a separate file, allowing longer replacements to expand the record lengths (not possible with fixed record updates in place).

 # tabtest1 - test file for uvcopy job tabfix1 (replace tabs with 4 blanks)
 #          - 'vi' or 'lp' will expand the tabs when you examine this file
 # - the 2nd last line below has 1 tab between words & without expansion would
 #   appear as follows (using commas to represent the tabs):
 a,bb,ccc,dddd,eeeee,ffffff,ggggggg <-- see below 'commas' replaced by 'tabs'
           1         2         3         4         5
 0123456789012345678901234567890123456789012345678901234
 =======================================================
 a	bb	ccc	dddd	eeeee	ffffff	ggggggg	<-- tab x'09' delimited
 =======================================================

 #1. uvhd tf/tabtest1 t <-- demo TEXT file with tabs (unix expands to 8 spaces)
     ==================   - option 't' Text file, 'u' not req'd to write sep file
                          - just rec#11 shown (with tabs x'09')
                      10        20        30        40        50        60
 r#       10 0123456789012345678901234567890123456789012345678901234567890123
         534 a.bb.ccc.dddd.eeeee.ffffff.ggggggg.<-- tab x'09' delimited.
             60660666066660666660666666066666660322276627233226666667660
             19229333944449555559666666977777779CDD0412087097045C9D9454A

 #2. v999w x'09','    ' <-- replace tabs (x'09') with 4 spaces
     ==================

 #3. uvhd tmp/tabtest1_080517_195200V t  <-- examine output file
     ==================================    - note tabs expanded to 4 blanks
                      10        20        30        40        50        60
 r#       10 0123456789012345678901234567890123456789012345678901234567890123
         529 a    bb    ccc    dddd    eeeee    ffffff    ggggggg    <-- tab
             6222266222266622226666222266666222266666622226666666222232227662
             10000220000333000044440000555550000666666000077777770000CDD04120
          64 x'09' delimited.
             7233226666667660
             87097045C9D9454A

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

M1. uvhd tutorial - WRITING (selecting)

The 'w' command writes Unformatted records to a file for test files, etc. You may specify a number of records from the current position or records matching a specified pattern. This is an easy way to select specified records from a file & insert LineFeeds to allow printing (of mainframe type files).


 uvhd dat1/custmas1 r256   <-- initiate uvhd
 =======================

 #1. w5r80t2      <-- write 2 records from current position
     =======        - option 'r80' Record-size for output records
                    - option 't2' insert lineFeed in last byte
                      (so we can use vi,uvlp12,etc on output file)
     >>> 5 recs written to tmp/custmas1_961116_104901W

 #2. w 77(2),'AB',|,'AL'     - write(select) recs with 'AB' or 'AL' cols 78-79
     ===================       (from current position until EOF)
     >>> 3 recs written to tmp/custmas1_961116_104901W

 #3. q                       - quit uvhd

 #4. ls -l tmp               - investigate the output filename assigned
 -rw-rw-r--   1 uvu      group       8192 Nov 16 10:40 custmas1
 -rw-rw-r--   1 uvu      group       5331 Nov 16 10:47 custmas1_961116_104600P
 -rw-rw-r--   1 uvu      group        400 Nov 16 10:49 custmas1_961116_104901W

 #5. vi tmp/custmas1*P       - use vi to inspect the file contents
 130140    EVERGREEN MOTORS LTD.    1815 BOWEN ROAD          NANAIMO          BC
 132588    GEECOE GENERATOR SERVICESUNIT 170 - 2851 SIMPSON  RICHMOND         BC
 208060    E&L TRUCKING             LAND & CATTLE LTD        WARBURG          AB
 211140  D FORD NEW HOLLAND         BOX 1, 440 ELLIS ROAD    WINTERBURN       AL

 #6a. we10                   - write every 10th record
      ====

 #6b. we4 77(2),'BC'         - write every 4th record with 'BC' in cols 78-79
      ==============

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

M2. uvhd tutorial - WRITING (selecting)

Options for Write command

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 in last byte of write output records (for MAC)
t2
  • insert Line-Feed in last byte of write records (Unix/Linux)
t3
  • insert both CR & LF in last 2 bytes of write records (Windows/DOS)
t4
  • insert terminators after Last-Non-Blank, else at end specified rec-size
Note
  • may use multi-bit combinations, for example 't7' = t1+t2+t4
    (to insert CR+LF after last non-blank)
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

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

N1. uvhd tutorial - PRINTING

The 'p' command writes formatted records to a file for subsequent printing via lp, uvlp, etc. You may specify a number of records from the current position, or records matching a specified pattern (up to a maximum number). The 'p' command creates a file in the 'tmp' subdir of the current directory (the 'tmp' subdir will be created if it does not already exist).

      filename assigned: tmp/inputfilename.yymmddhhmmP
            for example: tmp/custmas1_961116_095502P

 uvhd dat1/custmas1 r256   - initiate uvhd
 =======================

 #1. p2                   - print 2 records from the current position
     ==
                 >>> 2 recs printed to tmp/custmas1_961116_104604P

 #2. p 77(2),'AB'         - print records with 'AB' in columns 78-79
     ============           ('AB' is the province code for 'ALBERTA')
                 >>> 3 recs printed to tmp/custmas1_961116_104604P

 #3. p3 0(6),>'200000'    - print 1st 3 records with 1st 6 bytes > 200000

 #4. q                    - quit uvhd
     =

 #5. ls -l tmp            - investigate the output filename assigned
     =========
 -rw-rw-r--   1 uvu      group       8192 Nov 16 10:40 custmas1
 -rw-rw-r--   1 uvu      group       5331 Nov 16 10:47 custmas1_961116_104604P

 #6. lp tmp/custmas1*P         - print the output file
     =================           (same display as original uvhd)
Note
  • Print (& Iprint,Write) commands create a separate file for each command
  • prior to Feb 2009, they did not, outputs were combined in 1 file
  • there is a command line option (w1) to combine Writes into 1 file

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

O1. uvhd tutorial - IMMEDIATE PRINTING

The 'i' command writes formatted records to a file for Immediate printing via the 'uvlp12' script (issued by uvhd using the 'system' shell command). This script is documented in uvlist.doc & is stored at /home/uvadm/sf/uvlp12. If desired you may modify the uvhd program to replace the 'uvlp12' script with the UNIX 'lp' or whatever print command you desire.

The 'i' command creates a file in the 'tmp' subdirectory & the executes the uvlp12 (or lp) for example:

format: uvlp12 tmp/inputfilename.yymmddhhmmI

 example: uvlp12 tmp/custmas1_970110_154905I

You may specify a number of records from the current position, or records matching a specified pattern (optionally within specified columns).


 uvhd dat1/custmas1 r256    - initiate uvhd
 =======================

 #1. i2                    - Iprint 2 records from the current position
     ==
     >>> 2 recs printed to tmp/custmas1_970110_160006I

 #2. i5 77(2),!'BC'        - print (5 recs max) searching from current position
     ==============          for records with province codes NOT= 'BC'
     >>> 5 recs printed to tmp/custmas1_970110_160006I

 #3. q                     - quit uvhd
    =

notes

The uvhd program uses the 'system' command to execute the 'uvlp' shell script (see uvlp documented in uvlist.doc). If required you could change the command by editing the program & recompiling, or via environmental variables. This was discussed early in this documentation but briefly:

 export UVLPDEST=-dlaser2     <-- setup printer dest for all 'uvlp' scripts
 export UVHDPRINT=uvlp        <-- the default uvlp script
 export UVHDPRINT=uvlp12L      <-- use this to print 100 char lines Landscape

'uvlp12L' is recommended if you use the 'l100' option on your iprint commands, for example:

 --> i5l100             <-- prints next 5 records, 100 chars per line
                            Landscape at 12 cpi to fit 11" across
 --> i5                 <-- would default to 64 chars per line
                            (possibly modified by 'l' command line option)

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

P1. uvhd tutorial - Generate Sequence Numbers

command 'g' generates sequence numbers. You can specify a starting value and an increment (other than the default 1). You can also specify constants to be inserted before & after the initial value (for the 1st record).

Note
  • must specify 'u' option on command line (like update)

 #1. cp dat1/test100 tmp      <-- copy a test file to tmp subdir
     ===================        - test100 has 100 * 40 byte records

 #2. uvhd tmp/test100 r40u    <-- start uvhd specifying filename,
     =====================        record size & update option

 a. --> g10 30(4),'0001'      <-- sequence# 1st 10 records
        ================        - insert seq# in bytes 30-33
                                - initial value 0001, increment by 1 (default)
     0001 tf/test100 one           0001
     0002 tf/test100 two           0002
                     - - - etc - - -
     0009 tf/test100 nine          0009
     0010 tf/test100 ten           0010
 b. --> r1                    <-- return to rec #1 (begin file)

 c. --> g10i10 30(6),'#0010.' <-- sequence# 1st 10 records
        ====================    - inserts seq# in bytes 31-34
                                - inserts '#' prior & '.' after seq#
                                - increments by 10 (option 'i10')
     0001 tf/test100 one           #0010.
     0002 tf/test100 two           #0011.
                     - - - etc - - -
     0009 tf/test100 nine          #0018.
     0010 tf/test100 ten           #0019.
 d. --> r1                    <-- return to rec #1 (begin file)

 e. --> g100 30(4),'0020',0(3),'002' <-- sequence# up to 100 records max
        ============================   - insert seq# in bytes 30-33
        - qualified, only records that have '002' in 1st 3 bytes (twenties)
        - initial value 0020, increment by 1 (default)
     0001 tf/test100 one
                     - - - etc - - -
     0019 tf/test100 nineteen
     0020 tf/test100 twenty        0020
     0021 tf/test100 twenty one    0021
                     - - - etc - - -
     0028 tf/test100 twenty eight  0028
     0029 tf/test100 twenty nine   0029
     0030 tf/test100 thirty
                     - - - etc - - -
     0100 tf/test100 one hundred

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

Q1. uvhd tutorial - CHECK SEQUENCE

The 'c' command checks the sequence on a specified field & displays the first record not in sequence (or EOF all OK). You may specify option 'd' for descending (vs default ascending), option 'e' to consider equal fields to be out of sequence, or option 'i' to check the increment (i1,i10,etc).

For this tutorial, we will use 'g' (generate seq#s) to create a test file, then 'u' to create an intentional error, then 'c' to check the sequence.


 #1. cp dat1/test100 tmp      <-- copy a test file to a tmp subdir
     ===================

 #2. uvhd tmp/test100 r40uh2  <-- start uvhd, specifying the filename,
     =======================      record size 'r40', update option 'u',
                                  & option 'h2' to force hex display

 a. --> g100i10 30(4),'0010'  <-- insert seq#s in cols 31-34, incrmnt 10
        ====================

 b. --> r51                   <-- goto record #51
        ===

 c. --> u 30(4),'0515'        <-- change seq# to '0515' (from '0510')
        ==============
 d. --> r1                    <-- reposition to rec#1 (begin file)
        ==

 e. --> c 30(4)               <-- check sequence --> will be OK
        =======

 f. --> ci10 30(4)            <-- check sequence increment 10
        ==========              - will get error as follows:
                      10        20        30        40        50        60
    r#    51 0123456789012345678901234567890123456789012345678901234567890123
        2000 0051 tf/test100 fifty one     0515     .
             3333276276773332666772666222223333222220
             0051046F45341000696490FE500000051500000A

ci10 30(4) ERROR, 1st out of sequence record above

 g. --> cc                    <-- continue sequence checking
        ==                      - will get a 2nd error (not shown)
 h. --> cc                    <-- continue sequence checking
        ==                      - will now get to EOF (rec#100) OK

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

R1. uvhd tutorial - Enumerate (count records)

The 'e' command counts (enumerates) records from current position, matching 1 or 2 specified patterns, until EOF or within a specified maximum record count.


 uvhd dat1/custmas1 r256        - initiate uvhd
 =======================

 #1.  e 77(2),'AB'             - count records with 'AB' in cols 78-79
      ============

 #2a. r0                       - return to begining of file

 #2b. e 77(2),'AB',|,'AL'      - count records with 'AB' OR 'AL' in cols 78-79
      ==================

 #3a. r0

 #3b. e 77(2),'BC','LTD'       - count records with 'BC' in 78-79
      ==================         & 'LTD' anywhere in record

 #4.  e 77(2),'BC',0(256),'LTD'  - same as above
      =========================

 #5.  e 77(2),'BC',,'LTD'        - WRONG (would be interpreted same as below)
      ===================

      e 77(2),'BC',77(2),'LTD'   - op3 omitted would be same as this (WRONG)
      ========================
 --> q  <-- quit dat1/custmas1

 uvhd dat1/custmast.dat r257    - investigate a D-ISAM demo file
 ===========================      (recsize 257 bytes)

 #6.  e 256(1),x'00'            - count records with x'00' in byte 256
      ==============

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

S1. uvhd tutorial - Translate

The 't' command will translate to Ascii,Ebcdic,Upper,Lower,Characters,or Periods (depending on options a,e,u,l,c,p).

ta
  • translate entire current record to Ascii
t999999e
  • translate all records (from current to EOF) to Ebcdic
tl 0(120)
  • translate 1st 120 bytes of current record to Lower case
tc1
  • translate unprintable Characters to blanks EXCEPT LineFeeds x'0A'
    (c2=except CR x'0D', c4=except FF x'0C', c8=except tab x'09')
tc15
  • translate to Chars, except LFs,CRs,FFs,Tabs (1+2+4+8=15)

Translate Tutorial


 cp dat1/custmas1 tmp/cm1   - copy test file to tmp subdir
 ========================     (since we will modify)

 uvhd tmp/cm1 r256u         - initiate uvhd
 ==================         - option 'u' required to modify records

 #1a. te 0(120)        - translate 1st 120 bytes of 1st record to Ebcdic
      =========

 #1b. ta 0(120)        - translate 1st 120 bytes of 1st record back to Ascii
      =========

 #2a. t99l 10(25)      - translate bytes 10-34 of all(32) records to Lower case
      ===========
Note
  • see this demo on next page (using 80 byte custmas6 vs 256 byte custmas1)

 #2b. 1                - reset file pointer back to record #1

 #2c. t99u 0(120)      - translate 1st 120 of all(32) records to Upper case
      ===========

 #2d. 1                - reset file pointer back to record #1

 #3a. tc               - translate any unprintable Chars to blanks
      ===                (entire current record)

 #3b. x                - rollback current record (undo translate above)
      ===

 #4a. tc4              - translate any unprintable Chars to blanks
      ===                (except for FormFeeds x'0C')

 #3b. x                - rollback current record (undo translate above)
      ===

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

S2. uvhd tutorial - Translate

translate example - to lower case

We will show you how you can use uvhd to translate 1 field (or all fields) in all (or some) records of a data file. We will use test/demo file /home/uvadm/dat1/custmas6, which has 32 records, but we will show only the 1st 3 & last 3, before & after the translate.

demo data file dat1/custmas6 - BEFORE translate

 130140    EVERGREEN MOTORS LTD.    1815 BOWEN ROAD          NANAIMO          BC
 132588    GEECOE GENERATOR SERVICESUNIT 170 - 2851 SIMPSON  RICHMOND         BC
 139923    JOHNSTONE BOILER & TANKS 1250 EAST PENDER STREET  VANCOUVER        BC
                 - - - 1st 3 & last 3 of 32 records - - -
 402875    HULL, DON & SONS LTD.    BOX 1297                 PRINCE GEORGE    BC
 403887  D MILNER, LARRY            BOX 28 RAU ROAD R.R.8    QUESNEL          BC
 406082    PRECAM RENTALS LTD:      10116-94TH AVE           FORT ST. JOHN    BC

Op. Instrns. to translate to lower


 #1. cp dat1/custmas6 tmp/cm6   <-- copy/rename test file to tmp subdir
     ========================     - do NOT update any files in dat1/... dir

 #2. uvhd tmp/cm6 r80u  <-- run uvhd on N&A 80 byte records with Update intent
     =================    - need option 'u' for any update command
                          - shows 1st record (usual uvhd behavior)
                       10        20        30        40        50        60
     r#     1 0123456789012345678901234567890123456789012345678901234567890123
            0 130140    EVERGREEN MOTORS LTD.    1815 BOWEN ROAD          NANA
           64 IMO          BC.

 #3. --> t99l 10(25)    <-- translate to Lower case bytes 10-34 of all/32 records
         ===========      - '99' or any high number to process all records
                          - option 'l' specifies 'l'ower case translate
                          - could omit 10(25) to translate entire record

 #4. more tmp/cm6       <-- display records after translate to lower case
     ============

demo data file tmp/cm6 - AFTER translate

 130140    evergreen motors ltd.    1815 BOWEN ROAD          NANAIMO          BC
 132588    geecoe generator servicesUNIT 170 - 2851 SIMPSON  RICHMOND         BC
 139923    johnstone boiler & tanks 1250 EAST PENDER STREET  VANCOUVER        BC
                 - - - 1st 3 & last 3 of 32 records - - -
 402875    hull, don & sons ltd.    BOX 1297                 PRINCE GEORGE    BC
 403887  D milner, larry            BOX 28 RAU ROAD R.R.8    QUESNEL          BC
 406082    precam rentals ltd:      10116-94TH AVE           FORT ST. JOHN    BC

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

T1. uvhd tutorial - DROPPING records

The 'd' command copies to a temporary file, dropping records via a specified pattern. The output file is written to 'tmp/filename_yymmdd_hhmmssD' in the current working directory.

If you like the results, you would copy back & rename to original file (dropping the date/time & 'D' ID automatically appended by uvhd).

If option 'i' (for IDXFORMAT1/C-ISAM files) is specified, any deleted records will be dropped. The ISAM delete flag is a x'00' in the last byte of the record. You could perform this drop on the '.dat' partition of a Micro Focus Indexed file, but you would then have to rebuild the '.idx' using Micro Focus 'fhrebuild' or D-ISAM 'dcheck'.

You can run the following demo, using dat1/custmast.dat & dat1/custmast.idx. The rcsz is 256, but you must specify 257 to uvhd using the '.dat' file.

cp /home/uvadm/dat1/custmast.dat dat1 - copy supplied files to your sub dir cp /home/uvadm/dat1/custmast.idx dat1


 uvhd dat1/custmast.dat r257       - invoke uvhd on .dat file, with rcsz=257
 ===========================

 di 8(1),'D'                     - copy to tmp/custmast.dat.yymmddhhmmD
 ===========                     - dropping records with 'D' in column 9
                                 - dropping records with x'00' in column 257
                                   (since option 'i' is specified)

23 copied,4 dropped(pattern),5 dropped(ISAMdel),tmp/custmast.dat_970724_111407D

uvhd displays a status line (such as shown above), reporting the number of records copied & the number dropped by the pattern test & by the ISAM delete flag test. The tmp file will be overwritten if another 'd' command is executed (records are not appended as they are for the 'write' command).

Copy starts at current position & ends at EOF (or max rec count). To copy the entire file, you must be positioned at the 1st record.

other sample drop commands

r0
  • reposition to 1st record in file before each 'd' command
di
  • copy entire file to tmp file dropping D-ISAM flagged recs
d15i
  • copy 15 records max, dropping any D-ISAM flagged records
d 77(2),'BC'
  • copy to tmp dropping recs with province 'BC' in cols 78-79
  • 'i' option not specified (for non-Indexed files)

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

U1. uvhd tutorial - TRUNCATE file-size

command 'z'
  • truncate (modify) filesize (truncate or extend with x'00's)
  • truncate works only for Unix, Linux,& Windows/SFU
  • NOT for Windows/DOS versions (uvhd.exe)
z100000
  • truncate file to 100,000 bytes
Note
  • you must have specified the 'u' update option on the command line.
  • try the following test/demo

 #1. cp dat1/custmas1 tmp/cm1       - copy test file to tmp subdir
     ========================

 #2. uvhd tmp/cm1 r256u           - enter uvhd with update option 'u'
     ==================
 tmp/cm1 bytes=8192 recs=32 mdate=2000071412 today=200007141244
 r#       1           1         2         3         4         5         6
 b#       0 0123456789012345678901234567890123456789012345678901234567890123
          0 130140    EVERGREEN MOTORS LTD.    1815 BOWEN ROAD          NANA
            3333332222454545444244545524542222233332445442544422222222224444
            130140000056527255E0DF4F230C44E0000181502F75E02F140000000000E1E1
         64 IMO          BC V9S1H1    604-754-5531                  ..4V|...
            4442222222222442535343222233323332333322222222222222222201357000
            9DF00000000002306931810000604D754D55310000000000000000000246C000
        128 .........W0....`........)X}..f3.....\.................4V}...f...
            0000000005300016000000002570063100095000000000000000013570016000
            0C0000C0270D0540C0000C0098D0263C0444C0000C0000C0000C0246D0056C00
        192 ...............................f.....<........f.C
            0000008900000000880000000018000680001300000000694222222222222222
            00C0026C0000C0023C0000C0083C0056D0012C0000C0016D3000000000000000
 tmp/cm1 rsz=256 totrecs=32 current=1 fsiz=8192 fptr=0
 null=next,r#=rec,s=search,u=update,x=rollback,p=print,i=iprint,w=write,e=count
 ,g=genseq#,c=checkseq#,t=translate(ta=Asc,te=Ebc,tu=Upr,tl=Lwr,tc=Chars,tp=Pers)
 ,h1=char,h2=hex,q=quit,?=help -->

 #3. --> z4096         <-- truncate file to 4096 bytes
         =====             ===========================
 tmp/cm1 bytes=4096 recs=16 mdate=2000071412 today=200007141245
 r#       1           1         2         3         4         5         6
 b#       0 0123456789012345678901234567890123456789012345678901234567890123
          0 130140    EVERGREEN MOTORS LTD.    1815 BOWEN ROAD          NANA
            3333332222454545444244545524542222233332445442544422222222224444
            130140000056527255E0DF4F230C44E0000181502F75E02F140000000000E1E1
                  - - - - - - - etc, same as above - - - - - - -
 Note the filesize is now displayed as 4096 (vs 8192) & recs count 16 (vs 32).

This command is very handy for dropping the MS-DOS EOF x'1A' from the end of large files, saving a file copy operation, before submitting to apps.

But Be Careful, you can destroy a lot of data if you make a mistake.

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

V1. uvhd: option 'v' - for Micro Focus COBOL Variable length files

Micro Focus COBOL Variable Length Indexed files IDXFORMAT3

'uvhd' can be used to investigate any kind of file & is especially valuable for files with binary & packed data & that might not have LineFeeds.

'uvhd' works will for fixed record length data files. When you specify the correct record size, the data fields will be consistently displayed from record to record. For fixed length Indexed records (created by Micro Focus COBOL), you simply add 1 byte to the record size.

However, the default options (FIXED length) do not work well for VARIABLE length Indexed/Sequential records, because data records will not be consistent.

A test/demo file is provided & I suggest you try it first with the fixed length default option (rcsz=256 bytes), as shown below. We will then try it on the next page with the 'v' option & note the improvement.


 uvhd dat1/testIDXf3 r256 <-- examine Variable length file (W/O option v)
 ========================
 r#       1           1         2         3         4         5         6
 b#       0 0123456789012345678901234567890123456789012345678901234567890123
          0 0~......9911230948416799112309484167.>.......................P..
            3700000033333333333333333333333333330300000000000000000009000500
            0E00000099112309484167991123094841670E02000000001000000010000000
note
  • Variable files have system control records at begining of file.
  • 128 byte header + a mostly null record as long as max record size.
  • 1st data record in this example starts at byte #532, see next page -->
 r#       3           1         2         3         4         5         6
 b#     512 0123456789012345678901234567890123456789012345678901234567890123
          0 ....................@P0010.0080 testIDXL- test file to create IS
            0000000000000000000045333323333276774553227677266662762676676245
            00000000000000000000000010E0080045349361D04534069C504F0325145093
         64 AM Variable length file               ..@P0020.0080         - in
            4425676666626666762666622222222222222200453333233332222222222266
            1D0612912C50C5E748069C500000000000000000000020E0080000000000D09E
        128 put to 'cblIDX1.bat' which write variable file            ..@P00
            7772762266645532667227666627767627676666626666222222222222004533
            05404F073F29361E21470789380729450612912C5069C5000000000000000000

The begining of each record is marked with '@', which indicates user data (vs deleted or system records). The 'P' is x'50', which is decimal 80, which is the record length, which of course may vary from record to record.

If desired you can recreate the variable length indexed test file as follows, if you have Micro Focus COBOL & have compiled the 'ux' utility versions (as shown in the install guide).


 uxcp "fili1=dat1/testIDXL,typ=LST,rcs=254,filo1=dat1/testIDXf8,typ=IDXf3v60,isk1=0(4)"
 ================================================================================

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

V2. uvhd: option 'v' - for Micro Focus COBOL Variable length files

redisplay test file with option 'v'


 uvhd dat1/testIDXf3 v  <-- examine Variable length file (WITH option v)
 =====================
 r#       1           1         2         3         4         5         6
 b#     532 0123456789012345678901234567890123456789012345678901234567890123
          0 @P0010.0080 testIDXF3 test file to create ISAM Variable length f
            4533332333327677455322767726666276267667624544256766666266667626
            000010E0080045349361D04534069C504F03251450931D0612912C50C5E74806
         64 ile               ..
            66622222222222222200
            9C500000000000000000
 r#      10           1         2         3         4         5         6
 b#    1292 0123456789012345678901234567890123456789012345678901234567890123
          0 @T0100.0084 - here is an 84 byte record
            4533332333322266762672662332677627666762222222222222222222222222
            040100E00840D0852509301E084029450253F240000000000000000000000000
         64
            222222222222222222222222
            000000000000000000000000
 r#      12           1         2         3         4         5         6
 b#    1468 0123456789012345678901234567890123456789012345678901234567890123
          0 @x0120.0120 - here is a 120 byte record.........................
            4733332333322266762672623332677627666762222222222222222222222222
            080120E01200D08525093010120029450253F24EEEEEEEEEEEEEEEEEEEEEEEEE
         64 ..................--------------------------------------->..
            222222222222222222222222222222222222222222222222222222222300
            EEEEEEEEEEEEEEEEEEDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDE00

With option 'v', the data record contents will be displayed consistently, as long as you read sequentially thru the file (enter for next record).

However you might not be able to use several of the uvhd commands such as jump to a specified record by keying the record# or '+' or '-' a number of records, because we don't know intervening record sizes & we get off track.

You can in fact get back on track by setting the current byte# to the nearest '@' symbol you see. The easiest way to get back on track is simply enter '0' to return to the begining of the file.

Note that searching for data works fine as long as you are on track.


 s 2(4),'0090'     <-- sample search to find last record shown above.
 =============

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

V3. uvhd: option 'v' - for Micro Focus COBOL Variable length files

Tips using uvhd option 'v'

Uvhd with option v, reads only the data partition of Micro Focus variable length Indexed or Sequential record files. Command line option 'v' causes uvhd to look for & interpret the system control records & variable length record sizes, in order to display user data records in a consistent manner.

Browsing & searching sequentially will keep the record display on-track, but using the random access commands (jump to any specified record#), might cause the display to get off-track (display not starting at begin record). The following tips should help you to use option 'v' with success.

In November 2002, uvhd was enhanced to minimize the 'off the rails' problem. If variable record display option v4 (data records) & an invalid record header is encountered, uvhd will now scan for the next data record type x'40'.

  1. If the file does have variable length records & you do get off track, you can use the 'b#' byte# command to get back on track, for example:

    r#    12           1         2         3         4         5         6
    b#  1448 0123456789012345678901234567890123456789012345678901234567890123
           0                     @x0120.0120 - here is a 120 byte record.....
             2222222222222222222247333323333222667626726233326776276667622222
             00000000000000000000080120E01200D08525093010120029450253F24EEEEE

If you get this display after a record# jump, you can get back on track by entering 'b1468' = display starting from byte# 1468. You can see that the next record (identified by the '@' sign) is 20 bytes higher than the current setting, so just add 1448+20 = 1468.

  1. The easiest way to get back on track is simply return to the begining of the file, by entering 'r1' or just '1'. You might then search for the desired record (see example on previous page: s 2(4),'0120'

  2. Option 'v' defaults to 'v5' which is v1+v4 (bit addition).


    uvhd dat1/testIDXF3 v5      <-- option 'v' defaults to 'v5'
    ======================
    v1 - display file header (1st record)
    v2 - display deleted data records
    v4 - display active data records
    v8 - display all records (including system records)
  1. You could specify 'v2' to see only the deleted records in the file.

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

V4. uvhd: option 'v' - Micro Focus Variable length Indexed files

Option 'v' also works for IDXFORMAT8 (for files that may exceed 2 gigs).

A test/demo file is provided (dat1/testIDXf8). You can recreate as follows, if you have Micro Focus COBOL & have compiled the 'ux' utility versions (as shown in the install guide).


 uxcp "fili1=dat1/testIDXL,typ=LST,rcs=40,filo1=dat1/testIDXf8,typ=IDXf8,isk1=0(6)"
 ================================================================================

 uvhd dat1/testIDXf8 v
 =====================
                      10        20        30        40        50        60
 r#        1 0123456789012345678901234567890123456789012345678901234567890123
           0 3.......0412300950506704123009505067.>...................(...(..
             3F00000033333333333333333333333333330300000000000000000002000200
             3E00000004123009505067041230095050670E02001800001060000008000800
          64 ............................................X.7.X.7.............
             00000000000000000000000000000000000000000000503A503A00000000000E
             0000000900002210000000000000000000000000000A807480740000000000D0
         128 ................................................................
             0000000E000000000000000000000000000000000000000F0000000000000000
             000000D04244010400000040000000C0000000000000003E0000000000000000
                       ------ 192-960 not shown (all x'00's) ------
         960 ................................................................
             0000000000000000000000000000000000000000000000000000000000000000
             0000000000000000000000000000000000000000000000000000000000000000
               ----- other system records bypassed to 1st data at 3120 -----
                      10        20        30        40        50        60
 r#        2 0123456789012345678901234567890123456789012345678901234567890123
        3120 @(BBQ010   BAR-B-Q              0019500   ......
             424453332224452425222222222222223333333222000000
             08221010000212D2D1000000000000000019500000000000
                      10        20        30        40        50        60
 r#        3 0123456789012345678901234567890123456789012345678901234567890123
        3168 @(CHR015   LAWN CHAIR           0004500   ......
             424453332224454244445222222222223333333222000000
             08382015000C17E038192000000000000004500000000000
                      10        20        30        40        50        60
 r#        4 0123456789012345678901234567890123456789012345678901234567890123
        3216 @(HAM010   CLAW HAMMER          0000950   ......
             424443332224445244444522222222223333333222000000
             0881D0100003C17081DD5200000000000000950000000000

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

V5. uvhd: option 'v' - Micro Focus Variable length Indexed files

IDXORMAT3/IDXFORMAT8 file header layout

The Vancouver Utilities (uxcopy,uxsort,uxqrpg,uxcp,uvhd) are compatible with Micro Focus COBOL variable length sequential & Indexed files (IDXFORMAT3 & 8).

We will document the most important fields in the file header for IDXf3/IDXf8. If desired, you can find all fields defined on the Micro Focus website.

Note that you can investigate the file headers using 'uvhd' with option 'v' See sample on the previous page.

 000-003 - file header record length
         - 1st 4 bits x'30' identifies a system record
         - next 12 bits is header length if max record length is < 4095
         - next 28 bits is header length if max record length is => 4095

008-014 - creation date/time yymmddhhmmsscc (indexed files only)

 039-039 - organization (1=seqntl, 2=indexed, 3=relative)
 043-043 - file type (3=IDXFORMAT3, 8=IDXFORMAT8)

048-048 - recording mode (0=fixed, 1=variable)

 054-057 - maximum record length (big end format)
         - example recsize 80 = x'00000050'

058-061 - minimum record length

128-135 - offset to End-of-File (8 bytes binary big end format)

 140-141  - number of keys in Indexed file

record header layout

 000-000 - 1st 4 bits identifies the record type
 x'1_'   - system record - duplicate occurrence record
 x'2_'   - deleted record
 x'3_'   - system record
 x'4_'   - user data record
 x'5_'   - reduced user data record
 x'6_'   - pointer record
 x'7_'   - user data record referenced by a pointer record
 x'8_'   - reduced user data record referenced by a pointer record
 000-001 - next 12 bits is the record length if max recsize < 4095
 000-003 - next 28 bits is the record length if max recsize =? 4095

002-... - record data if max recsize < 4095 004-... - record data if max recsize => 4095

Note
  • all records are padded with x'00's to a multiple of 4 bytes

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

X1. uvhd: option 'z' - Variable Length files in RDW format

Option 'z' is provided to read BDW/RDW mainframe variable length files.

z4
  • RDW prefix 4 bytes, recsize INCLUDES prefix size
  • recsize binary in 1st 2 bytes (bytes 3&4 unused x'0000')
  • z4 is the default ('z' or 'z0' same as z4)
z2
  • RDW prefix 2 bytes, recsize EXCLUDES prefix size
z8
  • RDW prefix 8 bytes, recsize INCLUDES prefix size
z1
  • add 1 bit for little-end binary = z3/z5/z9 (vs BIG-END z2/z4/z8)

The following test/demo files are supplied in /home/uvadm/dat1:

dat1/testBDW
  • BDW/RDW, 2 blocks of 8 records each (in ASCII)
dat1/testBDWe
  • BDW/RDW, same as above but data in EBCDIC
dat1/testLST
  • text file used to create testRDW with uvcopy job LST2RDW1
dat1/testRDW
  • RDW file created from testLST, used to create testBDW
dat1/testRDWe
  • RDW file, same as above in EBCDIC, used to create testBDWe

We will 1st illustrate stripping the RDW prefixes from dat1/testRDWe. First examine the testRDWe file using option 'a1' (since we know the test file is EBCDIC & we want to be able to read the char line display). We also use option 's3' to space apart the 3 line groups of chars,zones,digits.


 uvhd dat1/testRDWe a1s3   <-- examine the RDW test file
 =======================
                      10        20        30        40        50        60
 r#        1 0123456789012345678901234567890123456789012345678901234567890123
           0 ....DELL00 - Dell Inc.  ....HP0000 - Hewlett Packard....IBM000 -
             0100CCDDFF464C8994C984440100CDFFFF464C8A98AA4D8898980200CCDFFF46
             080045330000045330953B000C008700000008563533071321940C0092400000
          64  International Business Machines....MFC000 - Micro Focus COBOL
             4C9A8998A899894CAA898AA4D888898A0200DCCFFF464D88994C98AA4CDCDD44
             0953595139651302429552204138955200004630000004939606634203626300
         128 ....MS0000 - Microsoft Corp.....REDHAT - Red Hat Linux  ....SUN0
             0100DEFFFF464D8899A98A4C99940100DCCCCE464D884C8A4D89AA440200EEDF
             0C0042000000049396266303697B0C0095481300095408130395470004002450
         192 00 - Sun Microsystems Ltd   ....UVSI00 - UV Software Inc.
             FF464EA94D8899AAAA89A4DA84440200EEECFF464EE4E98AA8984C984444
             00000245049396282354203340000000452900000450266361950953B000

The entire file is only 252 bytes & contains 8 short variable length records:

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

X2. uvhd: option 'z' - Variable Length files in RDW format

This page will illustrate options 'z4' & 'z2' for 4 byte or 2 byte prefixes. Note that the binary record length INCLUDES the prefix size for option 'z4', BUT excludes the prefix size for option 'z2'.

We will show the 1st 3 records for 'testRDWe' (EBCDIC file with 4 byte prefixes) & for 'testRDWz2e (EBCDIC file with 2 byte record prefixes).

RDW option z4 - 4 byte hdrs


 uvhd dat1/testRDWe z4a
 ======================
                      10        20        30        40        50        60
 r#        1 0123456789012345678901234567890123456789012345678901234567890123
           0 ....DELL10 - Dell Inc.
             0100CCDDFF464C8994C98444
             080045331000045330953B00
                      10        20        30        40        50        60
 r#        2 0123456789012345678901234567890123456789012345678901234567890123
          24 ....HP0010 - Hewlett Packard
             0100CDFFFF464C8A98AA4D889898
             0C00870010000856353307132194
                      10        20        30        40        50        60
 r#        3 0123456789012345678901234567890123456789012345678901234567890123
          52 ....IBM010 - International Business Machines
             0200CCDFFF464C9A8998A899894CAA898AA4D888898A
             0C009240100009535951396513024295522041389552
Note
  • 1st recsize = x'0018' = 1*16+8=24 = total record length on the scale
  • the prefix size (4 bytes) is INCLUDED in the record size

RDW option z2 - 2 byte hdrs


 uvhd dat1/testRDWez2 z2a
 ========================
                      10        20        30        40        50        60
 r#        1 0123456789012345678901234567890123456789012345678901234567890123
           0 ..DELL10 - Dell Inc.
             01CCDDFF464C8994C98444
             0445331000045330953B00
                      10        20        30        40        50        60
 r#        2 0123456789012345678901234567890123456789012345678901234567890123
          22 ..HP0010 - Hewlett Packard
             01CDFFFF464C8A98AA4D889898
             08870010000856353307132194
                      10        20        30        40        50        60
 r#        3 0123456789012345678901234567890123456789012345678901234567890123
          48 ..IBM010 - International Business Machines
             02CCDFFF464C9A8998A899894CAA898AA4D888898A
             089240100009535951396513024295522041389552
Note
  • 1st recsize = x'0014' = 1*16+4=20 (but scale shows 22 bytes)
  • the prefix size (2 bytes) is EXCLUDED from record size (add 2 bytes)

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

X3. uvhd: option 'z' - Variable Length files in RDW format

writing out text records from RDW files

Now, we will demonstrate how you could extract text records & drop the binary record size prefixes. For this we will need some additional options. You can see all options earlier in this doc or using the ?help screens, but here are the options most relevant to RDW files & writing out text records.

options on command line - for INPUT file

a1
  • translate to ASCII, character line (prior to zone & digit lines)
z#
  • input RDW format (2,4,8 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
z8
  • prefix 8 bytes, recsize 1st 2, 3&4 null, 5-8 ignored
z1
  • (+ 1 bit) = z3/z5/z9 Little-end binary, z2/z4/z8 default BIG-end

options on Write command - for OUTPUT file

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 CR/LF after Last-Non-Blank, else at end specified record-size
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

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

X4. uvhd: option 'z' - Variable Length files in RDW format


 uvhd dat1/testRDWe z4a1
 =======================
                      10        20        30        40        50        60
 r#        1 0123456789012345678901234567890123456789012345678901234567890123
           0 ....DELL00 - Dell Inc.
             0100CCDDFF464C8994C98444
             080045330000045330953B00

uvhd displays the 1st record & waits for your command.

 ---> w999a1t2  <-- write all records (8) to tmp/testRDWe_yymmdd_hhmmssW

text records extracted from RDW file

     DELL00 - Dell Inc.
     HP0000 - Hewlett Packard
     IBM000 - International Business Machines
     MFC000 - Micro Focus COBOL
     MS0000 - Microsoft Corp.
     REDHAT - Red Hat Linux
     SUN000 - Sun Microsystems Ltd
     UVSI00 - UV Software Inc.
w999
  • Write command (999 records, but we know only 8)
  • do not need the 999, default is write all)
a1
  • translate output record data to ASCII
  • command line option 'a1' translates only for display
t2
  • Terminate output recors with LineFeeds

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

X5. uvhd: option 'z' - Variable Length files in RDW format

writing fixed size text records with original size at end


 uvhd dat1/testRDWe z4a1  <-- rerun uvhd with option z4 for RDW
 =======================      and option a1 to translate char display to ASCII
                      10        20        30        40        50        60
 r#        1 0123456789012345678901234567890123456789012345678901234567890123
           0 ....DELL00 - Dell Inc.
             0100CCDDFF464C8994C98444
             080045330000045330953B00
 ---> wn2r50t3  <-- writes all records (8) to tmp/testRDWe_yymmdd_hhmmssW
                  - 'n2' append data-size as 4 numeric characters
                  - 'r50' to write all records fixed 50 bytes
                  - 't3' insert CR/LF at end record.

text records written with original recsize appended

     DELL00 - Dell Inc.                            0024
     HP0000 - Hewlett Packard                      0028
     IBM000 - International Business Machines      0044
     MFC000 - Micro Focus COBOL                    0032
     MS0000 - Microsoft Corp.                      0028
     REDHAT - Red Hat Linux                        0028
     SUN000 - Sun Microsystems Ltd                 0036
     UVSI00 - UV Software Inc.                     0032

use uvhd to show 'CR/LF's


 uvhd tmp/testRDWe_yymmdd_hhmmssW t1h2
 =====================================
                      10        20        30        40        50        60
 r#        1 0123456789012345678901234567890123456789012345678901234567890123
           0 DELL00 - Dell Inc.                            0024..
             4444332224666246622222222222222222222222222222333300
             45CC000D045CC09E3E00000000000000000000000000000024DA
  1. The output of the prior uvhd above was written to the 'tmp' subdir, with a _date_time stamp & 'W' as last char to identify output from Write.

  2. If you have several uvhd outputs in tmp/... you can save typing the long filename_date_time files by using '*' & last 2 digits of time (seconds).


    uvhd tmp/testRDWe_071109_125325W t1h2  <-- do NOT type all this
    =====================================
    uvhd tmp/*25W t1h2  <-- enter this if ls shows file suffix '25W' unique
    ==================
  1. Use option 't1' to display text records (ended by LF x'0A') & option 'h2' to force hex display (so you can see hex codes for CR & LF).

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

X6. uvhd: option 'z' - Variable Length files in RDW format

testBDWe - EBCDIC file of BDW/RDW records

Here is the 1st 64 bytes of a test/demo file dat1/testBDWe. This is the Ebcdic with both BDW & RDW variable length prefixes. You can examine dat1/testBDWe with uvhd as follows:


 uvhd dat1/testBDWe a1  <-- option 'a1' translates char line to ASCII
 =====================
             10        20        30        40        50        60
    0123456789012345678901234567890123456789012345678901234567890123
    ........DELL00 - Dell Inc.  ....HP0000 - Hewlett Packard....IBM0
    00000100CCDDFF464C8994C984440100CDFFFF464C8A98AA4D8898980200CCDF
    1000080045330000045330953B000C008700000008563533071321940C009240

The 1st 64 bytes shows the 4 byte BDW, followed by RDW for 1st record (DELL), followed by 2nd record RDW+data (HP), followed by 3rd record RDW+data (IBM). uvhd displays data 'vertical hex', converting to horizontal hex we have:

at byte 00
  • x'0100' - BDW length for 1st block (256 decimal)
at byte 04
  • x'0018' - RDW length for 1st record (DELL) = 1*16+8*1 = 24 bytes
at byte 28
  • x'001C' - RDW length for 2nd record (HP) = 1*16+12*1 = 28 bytes
at byte 56
  • x'002C' - RDW length for 3rd record (IBM) = 2*16+12*1 = 44 bytes

Run uvhd twice, the 1st time to strip BDW hdrs,& a 2nd time to strip RDW hdrs:

uvhd run#1 - to strip BDW prefixes


 uvhd dat1/testBDWe z4a1  <-- options z4=read BDW, a1=display ASCII
 =======================
 ---> w999 <-- write out, stripping BDW headers (from 2 blocks)
           --> result is RDW only file (16 records)

uvhd run#2 - to strip RDW prefixes


 uvhd tmp/testBDWe_yymmdd_hhmmssW z4a1 <-- z4=RDW, a1=ASCII display
 =====================================
 ---> w999a1t2 <-- write out, stripping RDW headers
                 - 'a1' translates data to ASCII
                 - 't2' inserts LineFeed Terminators
                 - result is text only file (16 records)

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

X7. uvhd: option 'z' - Variable Length files in RDW format

using uvcp to process uvhd outputs

After using uvhd to write out records (text or otherwise) from your data files, you may sometimes wish to reformat that output for your desired purposes.

For example, prior to November 2007, there was only option 'a1' to translate the records displayed to ASCII, bit no option 'a2' to also translate the 'write' command output to ASCII ('a3' for both).

Without option 'a2' I would have used 'uvcp' as follows:


 uvcp "fili1=tmp/testBDWe_yymmdd_hhmmssWe_yymmdd_hhmmssW,rcs=64,typ=LSTt\
 =======================================================================
 ,filo1=tmp/testBDWe.txt,tra=0(64)"
 ==================================

Instruction 'tra=0(64)' translates the records to ASCII. See uvcp.htm to see many other instructions you can use to reformat your data as desired (mvc, clr, rep, tre, tru, trl, sel, del, etc).

see DATAcnv1 for more BDW/RDW examples

Note
  • also see DATAcnv1.htm for more examples of data conversions
  • stripping BDW/RDW record prefixes
  • converting variable length files to fixed length
  • translating from EBCDIC to ASCII, allowing for packed & signed fields

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

Y1. uvhd: Miscellaneous Tips

finding Record-Size in a fixed length file


 uvhd tf/test100    <-- test100 to demo finding correct recsize
 ===============      - recsize defaults to 256 when not spcfd on cmd line

WARNING: rcsz does not divide evenly into filesize

 filename=/home/uvadm/tf/test100 options=
 records=15 filesize=4000 recsize=256 fsize%rsize(remainder)=160
                      10        20        30        40        50        60
 r#        1 0123456789012345678901234567890123456789012345678901234567890123
           0 0001 tf/test100 one                    .0002 tf/test100 two
             3333276276773332666222222222222222222220333327627677333277622222
             0001046F45341000FE500000000000000000000A0002046F4534100047F00000
          64                .0003 tf/test100 three                  .0004 tf/
             2222222222222220333327627677333276766222222222222222222033332762
             000000000000000A0003046F4534100048255000000000000000000A0004046F
         128 test100 four                   .0005 tf/test100 five
             7677333266772222222222222222222033332762767733326676222222222222
             453410006F520000000000000000000A0005046F453410006965000000000000
         192        .0006 tf/test100 six                    .0007 tf/test100
             2222222033332762767733327672222222222222222222203333276276773332
             0000000A0006046F4534100039800000000000000000000A0007046F45341000

filesize NOT multiple of recsize, 160 bytes remain rec#=1 rcount=15 rsize=256 fsize=4000 tf/test100 If Text file (with LineFeeds), quit/restart with option 't' If Variable (IDXFORMAT3,8,RDW), quit/restart w option v,x,or z If Fixed length records, change recsize now via command 'R' (R256 current) next evenly divisible record sizes lower/higher are --> R250/R400 OR you may continue (ignoring these warnings) -->

finding record-size in fixed length files

  1. Display the 1st block of 256 bytes (default when option 'r' not spcfd)

  2. Use the 'R' command to test your perception of the correct record-size, based on repeating patterns (in 1st 256 bytes ?)

  1. If no repeating patterns in 1st 256, then recsize is probably > 256

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

Y2. uvhd: Miscellaneous Tips

using the NOT= (!) condition

The NOT EQUAL '!' condition can be quite useful. You could use it to verify field contents. For example if all records should have 'BC' in cols 78-79, you could use the following search to verify:

s 77(2),!'BC'
  • verify all records have 'BC' in cols 78-79
  • should reach EOF with nomatch (if match use ss for next)

Also note that when you use the <!> conditions, the field length must match the pattern length, if the pattern length is greater than 1. If the pattern length is 1 you can search any field length.

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

Z1. uvhd: When to use 'uvcopy' (vs uvhd)

uvcopy vs uvhd

  1. uvhd is very convenient since it is interactive & easy to learn with 15 help screens containing many examples.

  2. But when your problem is too complex for 'uvhd', use 'uvcopy' which can do anything you can imagine.

  3. uvcopy is the solution to any problem you can not solve with uvhd. uvcopy is an incredibly powerful utility that can do anything you might require re data manipulation in raw data files.

  4. Of course uvcopy is harder to learn, but there is lots of documentation and many examples. All of the instructions are documented in uvcopy3.htm. Please see HTML documentation on the website http://www.uvsoftware.ca or in the dochtml subdir on the distribution CD.

  5. Also note that uvcopy (or uvcp or uvsort) are more appropriate for batch jobs (repetitive work) because you can code them in scripts which might also execute COBOL programs or be scheduled by 'cron'.

    Things uvcopy can do that uvhd cant

  6. Record layout changes. uvhd can replace data with alternates, but can not move fields to different locations.

  7. Multi-File I/O. Uvcopy allows 8 input files & 40 output files.

  8. Indexed file access in key sequence.

  9. Creating Indexed files.

  10. Unpacking packed fields, converting Binary to Numeric, etc

  11. Translating EBCDIC to ASCII, ASCII to EBCDIC, UPPER case to lower case, lower case to UPPER. You may even create your own translate table from a supplied neutral translate table.

  12. uvcopy (or uvcp or uvsort) can be used in shell scripts.

  13. Sorting files, uvsort is the easiest to use, but uvcopy can also sort.

  14. Reporting & Accumulating. The 'enumerate' command of uvhd is limited. uvcopy can be used for reporting & accumulating, but 'uvqrpg' is the best. Also note the 'tbl' feature of both uvcopy & uvqrpg which builds tables based on any specified argument (up to 48 bytes) with up to 6 accumulators & dumps the tables in sorted sequence at end of job. See TABLEjobs.htm.

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

    Visitor Counters for ThisYear and LastYear

    ThisYear=000266   (J=119,F=118,M=29,A=0,M=0,J=0,J=0,A=0,S=0,O=0,N=0,D=0)
    LastYear=000205   (J=0,F=0,M=0,A=0,M=0,J=0,J=0,A=0,S=0,O=0,N=55,D=150)