| A1. | Introduction & Overview |
| A2. | Directories relevant to test/demo |
| B1. | 'vi' tutorial, Brief review of most useful commands |
| C1. | Test/Demo Setup & Operating Procedures |
| D1. | Test files used to demonstrate the Vancouver Utilities |
| D1. | sales3 - test file to demo following uvcp, uvsort, uvcopy, uvqrpg |
| D2. | test100a - test file for 'U1' multicol1,2,3 |
| D3. | custmas1 - test file with packed decimal fields to demo uvhd |
| D3. | cutsmast - Indexed file version of custmas1 (to test listISF) |
| E1. | uvhd - binary file investigation & display in vertical hexadecimal |
| F1. | uvcp - file copy with record selection & reformatting |
| G1. | uvsort - file sort utility with record selection & much more |
| H1. | uvlist - list text files, inserting laser printer control codes |
| I1. | uvcopy - the most powerful Vancouver Utility (data manipulation, etc) |
| J1. | table2 - pre-programmed table analysis of any field by any argument |
| J4. | table3d - summarize target-words following key-words (all files in subdir) |
| K1. | cobmap1 - create record layouts from COBOL copybooks |
| L1. | uvqrpg - Quick Report Generator |
| M1. | D-ISAM - test uvcp/uvsort processing Indexed Sequential Fixed length records |
| - compatible with Micro Focus COBOL IDXFORMAT1 files | |
| M4. | listISF - Pre-Programmed uvcopy job to list any C-ISAM/D-ISAM Indexed file |
| - options to extract 1st portion of each record & records in file | |
| N1. | scan1d - scan all files in a directory for matches to qualified patterns |
| O1. | rep2 - copy files replacing patterns, qualified by other patterns |
| P1. | prodfix1 - uvcopy equivalent of the rep2 pre-programmed job above |
| Q1. | testint2 - uvcopy job to test 64 bit accumulators (vs 32 bit) |
| Q4. | test64c.c - C program to test 64 bit integers (independent of uvcopy) |
| R1. | testIDXL - test uxcp processing Indexed Sequential Variable length records |
| - compatible with Micro Focus COBOL IDXFORMAT3 files | |
| S1. | tabfix1 - converting tabs to blanks |
| T1. | More pre-programmed jobs for various useful file conversions |
| - UPPER/lower case, EBCDIC/ASCII, etc |
| U1. | multicol1,2,3 - rearrange files for multi-column printing (tickets,labels) |
| - options for number of columns, width of each column,& spacing between | |
| - multicol1 prints records in horizontal sequence | |
| - multicol2 prints records in vertical column sequence | |
| - multicol3 rearranges the file in vertical sequence for users | |
| who already have a program to print in horizontal sequence |
============================================================================
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
Goto: Begin this document , End this document , UVSI Home-Page
| bin |
|
| pf/ |
|
| pf/demo |
|
| pf/util |
|
| pf/IBM |
|
| sf/ |
|
| tf |
|
| dat1 |
|
| doc |
|
| dochtml |
|
| tmp |
|
Goto: Begin this document , End this document , UVSI Home-Page
It is most important to understand that vi has TWO modes of operation. Switch to INSERT mode using commands such as the following:
i=insert, a=append, R=replace, o=open new line, cw=change word.
Switch back to command mode using 'ESCAPE'. Make it a habit to hit ESCAPE as soon as you finish text entry. If in doubt (COMMAND or INSERT mode) - hit ESCAPE, it will do no harm if already in command mode (will beep).
vi filename - starts vi, reads the file,& displays 1st screen =========== (or blank screen if creating a new file)
k
|
h <-- . --> l
|
j
'h' - move cursor left 'j' - move cursor down 'k' - move cursor up 'l' - move cursor right
^d - down 1/2 screen ^u - up 1/2 screen
:1 - goto line# 1 :500 - goto line# 500 G - goto end-of-file
0 - move cursor to begining of current line $ - move cursor to end of current line
Goto: Begin this document , End this document , UVSI Home-Page
| i |
|
| a |
|
| A |
|
| r |
|
| R |
|
| cw |
|
| o |
|
| O |
|
| x |
|
| dd |
|
| D |
|
5dd - delete 5 lines (current & next 4 lines below cursor)
| yy |
|
| p |
|
5yy - yank 5 lines into current buffer
- move cursor to line above intended insert point
p - put (insert) buffer (5 lines) below cursor
| dd |
|
| p |
|
5dd - delete 5 lines (& store in current buffer)
- move cursor to line above intended insert point
p - put (insert) buffer (5 lines) below cursor
Goto: Begin this document , End this document , UVSI Home-Page
/xxx - search for xxx anywhere in the file
- search will wrap around EOF back to cursor location
| n |
|
:1,$ s/xxx/yyy - substitute 'xxx' with 'yyy'
- from 1st line to last line (1,$)
:%s/xxx/yyy - substitute 'xxx' with 'yyy'
- on ALL lines, '%' same as '1,$'
:%s/xxx/yyy/g - substitute 'xxx' with 'yyy'
- ALL lines ('%') & ALL occurrences on each line (/g)
:g/xxx/d - on ALL lines (g=global), Delete lines with 'xxx'
:g/xxx/p - on ALL lines (g=global), Print lines with 'xxx'
| u |
|
| U |
|
. - repeat the previous change command
| J |
|
:r file2 - read a file into the workspace
(following the line with the cursor)
Goto: Begin this document , End this document , UVSI Home-Page
| m[a-z] |
|
| ma |
|
| mb |
|
'a - address mark 'a' (via prefix of single quote)
'a,'b - address a range of lines from previously marked a & b
'a,'b m . - move lines from mark 'a' thru mark 'b' to follow current line
- deletes original lines
'a,'b co . - copy lines from mark 'a' thru mark 'b' to follow current line
- preserves original lines
:w - write workspace back to the file named on the vi entry command
:w filename - write workspace to a different file
:q - quit vi (warning if changes made without writing)
:wq - write & quit
| ZZ |
|
:q! - quit without writing
:10,20 w filex - write lines 10-20 to filex
http://linuxgazette.net/152/srinivasan.html =============================================
This is an excellent tutorial on 'vim', which is an enhanced version of 'vi', used on most Linux systems.
Goto: Begin this document , End this document , UVSI Home-Page
If you are the only user of the Vancouver Utilities, you could run these test/demos in the /home/uvadm directory while logged in as uvadm. See install.htm re setting up uvadm (Vancouver Utility site Administrator)
For multi-user sites it is obviously better for each user to run these test/demos in his or her own home directory. The user/programmer must have setup his/her .profile as described on page A3 of install.doc. This is easy since you can simply copy a supplied file (/home/uvadm/env/profile1) onto the end of your existing .profile.
For multi-user sites, each user/programmer should copy the required test files from /home/uvadm to his/her own home directory. We will setup subdirs with the same names as in /home/uvadm so the operating procedures will be correct whether you run from /home /uvadm or your own home directory.
#1. cd $HOME - change to your home directory
#2. mkdir dat1 tf - setup subdirs to receive test files
#3a. cp /home/uvadm/dat1/custmas1 dat1 #3b. cp /home/uvadm/dat1/sales3 dat1 <-- used for most test/demos #3c. cp /home/uvadm/dat1/sales2 dat1 #3d. cp /home/uvadm/dat1/testIDXL dat1
#4a. cp /home/uvadm/tf/sales3.cpy tf #4b. cp /home/uvadm/tf/rep2demo.tbl tf #4c. cp /home/uvadm/tf/intdata1 tf #4d. cp /home/uvadm/tf/test100 tf
#5. mkdir tmp - setup a 'tmp' subdir if not already present
========= to receive the outputs of the various test/demos
When you run these tests, please stay at your home directory level (or uvadm). Don't change in & out of the sub-directories to check I/O files. Most test/demos copy files from 'dat1' or 'tf' subdirs to the 'tmp' subdir and you need to be back at the home directory level for the next test. Note that the use of a 'tmp' subdir keeps your home directory clean & short. (subdirs only, no files in your home/working directory). You can remove all temporary files easily anytime (\rm tmp/*).
Goto: Begin this document , End this document , UVSI Home-Page
Here is the test data file that we will use for most of our demos. 'dat1/sales3' is a sales detail file, typical of COBOL applications that may have been transferred from a mainframe to Windows/DOS. These files were originally EBCDIC fixed length records without LineFeeds. We have of course translated to ASCII and we have also inserted LineFeeds (x'0A' in last byte). to make it easy for you to display & print with the usual Windows/DOS tools.
00-05 - CUST#
10-11 - SLSMN#
13-18 - DATE
20-27 - INVOICE#
30-35 - PRODUCT#
38-43 - QTY (separate trailing sign +/-)
45-51 - PRICE
53-61 - $AMOUNT (separate trailing sign +/-)
63-63 - line-feed
Note that the record field positions & record scale above are all zero relative since all field addressing in the Vancouver Utilities is zero relative.
1 2 3 4 5 6
0123456789012345678901234567890123456789012345678901234567890123
CUST# SLM DATE INV# PROD# QTY PRICE AMOUNT
================================================================
130140 21 940802 IN111001 HAM001 00020+ 0000001 00000020+
130140 21 940802 IN111001 SCR012 00021+ 0001001 00021021+
139923 35 950802 IN111002 HAM001 00022+ 0002001 00044022+
139923 35 950802 IN111002 TAB013 00023+ 0003001 00069023+
139923 35 950807 CR5421 TAB013 00024+ 0004001 00096024+
150825 44 960804 IN1122 HAM001 00025+ 0005001 00125025+
150825 44 960804 IN1122 PLN012 00026+ 0006001 00156026+
201120 44 970807 CR5234 WHIP75 00027+ 0007001 00189027+
223240 65 980816 CR955 HAM001 00028+ 0008001 00224028+
223240 65 980816 IN441 BIT001 00029+ 0009001 00261029+
308685 75 990812 IN6605 SAW001 00010- 0000001 00000010-
308685 75 990812 IN6605 WID115 00011- 0001001 00011011-
308685 75 990812 CR8835 TAB013 00012- 0002001 00024012-
315512 33 000805 IN2251 HAM001 00013- 0003001 00039013-
315512 33 000805 IN2251 SAW051 00014- 0004001 00056014-
315512 33 000805 IN2255 WID115 00015- 0005001 00075015-
400002 85 010812 CR245 HAX129 00016- 0006001 00096016-
406082 55 020815 IN33001 BBQ001 00017- 0007001 00119017-
406082 55 020815 IN33001 TAB013 00018- 0008001 00144018-
406082 65 020816 IN441 HAM001 00019- 0009001 00171019-
Please contrast this sales3 file to the custmas1 file on the next page. 'sales3' is all character with LineFeeds & no packed decimal fields, which makes it easy to display/print with the usual Windows/DOS tools. 'custmas1' has no LineFeeds & does have packed decimal fields, which makes it impossible to display/print with the usual Windows/DOS tools.
Goto: Begin this document , End this document , UVSI Home-Page
0001 one 0002 two 0003 three 0004 four 0005 five 0006 six 0007 seven 0008 eight 0009 nine 0010 ten 0011 eleven 0012 twelve 0013 thirteen 0014 fourteen 0015 fifteen 0016 sixteen 0017 seventeen 0018 eightteen 0019 nineteen 0020 twenty -------- etc -------- 0090 ninety 0091 ninety one 0092 ninety two 0093 ninety three 0094 ninety four 0095 ninety five 0096 ninety six 0097 ninety seven 0098 ninety eight 0099 ninety nine 0100 one hundred
These records are 20 bytes each, with a LineFeed x'0A' in column 20 (byte 19). See usage on page 'U1' for uvcopy demo jobs multicol1,2,3.
Goto: Begin this document , End this document , UVSI Home-Page
000-005 - customer# 008-008 - delete flag (D) 010-034 - customer name 035-059 - address 060-076 - city 077-078 - province 080-089 - postal code 090-101 - phone# 102-119 - contact name 120-179 - this year sales 12 x 5 byte packed fields 180-239 - last year sales 12 x 5 byte packed fields 240-243 - credit codes 244-249 - date of last change 250-255 - unused blanks (x'20's), Note - No LineFeed (x'0A') in last byte
'custmas1' is a typical file used in COBOL applications that have been transferred from a mainframe to Unix/Linux/Windows/DOS. These are Fixed length records, may be Indexed, may have packed decimal fields,& might not have terminating linefeeds. The packed fields & no linefeeds make it impossible to display or print these files with the usual Windows/DOS tools, so we will use Vancouver Utilities 'uvhd' (see below & see more details on the next page).
uvhd dat1/custmas1 r256 - execute uvhd to display dat1/custmas1 ======================= (1st record shown below)
1 2 3 4 5 6
0123456789012345678901234567890123456789012345678901234567890123
0 130140 EVERGREEN MOTORS LTD. 1815 BOWEN ROAD NANA
3333332222454545444244545524542222233332445442544422222222224444
130140000056527255E0DF4F230C44E0000181502F75E02F140000000000E1E1
64 IMO BC V9S1H1 604-754-5531 ........
4442222222222442535343222233323332333322222222222222222200000000
9DF00000000002306931810000604D754D55310000000000000000000000C000
128 .........W0....`........)X|..f3.....\.......................f...
0000000005300016000000002570063100095000000000000000000000016000
0C0000C0270C0540C0000C0098C0263C0444C0000C0000C0000C0000C0056C00
192 ...............................f.....<........f.C
0000008900000000880000000018000680001300000000694222222222222222
00C0026C0000C0023C0000C0083C0056D0012C0000C0016D3000000000000000
'uvhd' will be invaluable if you have files like this in your shop. If Indexed, 'listISF' will be handy to extract the front-end character portion (omitting the packed decimal fields) outputting to a text file which we can display/print with the usual Windows/DOS tools. Here are the 1st 80 bytes from the 1st 3 records extracted by listISF, and please see the full listISF demo on page 'M4'.
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
Goto: Begin this document , End this document , UVSI Home-Page
'uvhd' is especially useful for displaying fixed length record files that contain packed or binary fields or do not have line feeds & therefor are not easily displayed by the usual editors or word processors. Records are displayed 256 bytes at a time by default (if record size not specified) in 4 groups of 3 vertical hex lines as follows:
......record in character format '.' for non-display characters......
...........hex representation of character zones...................
...........hex representation of character digits..................
uvhd dat1/custmas1 r256s2 <-- try this 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,p=print,i=iprint,w=write,t=tally,c=checkseq ,R#=Recsize,h1=char,h2=hex,q=quit,?=help --> q
Any non-display characters are represented by periods on the character line (1st line of 3 vertical hex lines). The above example has a lot due to the multiple packed decimal fields.
In this example we entered 'q' to quit after the 1st 256 bytes of the file was displayed, but we could have used any of the various commands to browse, search, select, update, tally, etc. Enter '?' at the prompt for the 'help' screens which show you the command formats.
| See | 'uvhd.doc' for the more details, examples,& tutorials. |
Goto: Begin this document , End this document , UVSI Home-Page
Suppose we wanted to select all sales record for hammers 'HAM001' in bytes 30-35 of our test data file (listed on the previous page). Run the following uvcp command & confirm that your output matches the output shown below.
#1. uvcp "fili1=dat1/sales3,typ=RST,rcs=64,filo1=tmp/s3,sel1=30(6):HAM001"
======================================================================
#2. cat tmp/s3 <-- display output file (should match following)
==========
130140 21 940802 IN111001 HAM001 00020+ 0000001 00000020+ 150825 44 960804 IN1122 HAM001 00025+ 0005001 00125025+ 223240 65 980816 CR955 HAM001 00028+ 0008001 00224028+ 315512 44 000805 IN2251 HAM001 00013- 0003001 00039013- 406082 65 020816 IN441 HAM001 00019- 0009001 00171019-
You can play with different record selections, for example we could add another criteria - select hammers, but only for salesman '44'. For brevity, I will omit most of the original command above & repeat only the 'sel' commands.
#1. uvcp "fili1=...as above...,sel1=30(6):HAM001,sel2=10(2):44"
===========================================================
#2. cat tmp/s3 <-- display output file (should match following)
==========
150825 44 960804 IN1122 HAM001 00025+ 0005001 00125025+ 315512 44 000805 IN2251 HAM001 00013- 0003001 00039013-
Please see the complete documentation in uvcp.htm and several other test/demos in uvtrain.htm
Note that we have described our test file as 'typ=RST' with record size 64. This means the records are all exactly 64 bytes long with a Terminator (LineFeed x'0A') in the last byte. The output file typ is assumed to be the same. The LineFeeds are a convenience for vi, cat, more, lp, uvlp12, etc. Many COBOL applications have no LineFeeds & would use typ=RSF for faster processing.
Please see the various file types & options in uvcp.htm, or briefly on page 'M1' in this document.
Goto: Begin this document , End this document , UVSI Home-Page
'uvsort' is a powerful utility which has most of the functionality of the well known & expensive 'SyncSort' utility often used to replace the mainframe sort when mainframes are converted to Unix, Linux, or Windows.
As an example we will sort our test file dat1/sales3 by product# bytes 30-35. Please see the original file in customer# sequence listed on page 'D1'.
We will also demonstrate 'data reduction' (dropping duplicate records for the specified sort keys). For example we might wish to determine only which products are selling by retaining only 1 record for each product#.
Run the following uvsort & confirm that your output matches the output shown.
#1. uvsort "fili1=dat1/sales3,typ=LSTt,rcs=64,filo1=tmp/s3,key1u1=30(6)"
====================================================================
#2. cat tmp/s3 <-- display output file (should match following)
==========
406082 35 020815 IN33001 BBQ001 00017- 0007001 00119017- 223240 65 980816 IN441 BIT001 00029+ 0009001 00261029+ 139923 35 950802 IN111002 CHR001 00022+ 0002001 00044022+ 406082 65 020816 IN441 HAM001 00019- 0009001 00171019- 400002 85 010812 CR245 HAX129 00016- 0006001 00096016- 150825 44 960804 IN1122 PLN012 00026+ 0006001 00156026+ 308685 21 990812 IN6605 SAW001 00010- 0000001 00000010- 315512 44 000805 IN2251 SAW051 00014- 0004001 00056014- 130140 21 940802 IN111001 SCR012 00021+ 0001001 00021021+ 406082 35 020815 IN33001 TAB013 00018- 0008001 00144018- 201120 44 970807 CR5234 WHIP75 00027+ 0007001 00189027+ 315512 44 000805 IN2255 WID115 00015- 0005001 00075015-
Compare this to the original on page 'D1' & note that the output records are in product# sequence & that duplicates have been dropped.
Data reduction is requested by option 'u1' of the sort key 'key1u1=30(6)'.
You combine data reduction with record selections, for example wish to select sales after 1999, then our uvsort command might be as shown below. (I will omit most of the original above & repeat only the 'key' & the 'sel' commands).
#1. uvsort "fili1=...as above...,key1u1=30(6),sel1=13(2)<10"
========================================================
#2. cat tmp/s3 <-- display output file, should be as above
========== without any records for years 1999 & older.
Please see many other powerful features in the complete documentation in uvsort.htm and several other test/demos in uvtrain.htm
Goto: Begin this document , End this document , UVSI Home-Page
uvlist will list ascii text files (on stdout by default) but with the main intention of piping to a printer. Several scripts are provided (such as uvlp12) which includes pipe to the printer, so you can list your text files with a minimum of keystrokes.
Many options are provided for laser printers, for example you can list 132 column reports on 8 1/2 width paper using the 'uvlp18' script which includes the option to print at 18 characters per inch.
uvlist will help you get organized & stay organized by allowing you to file your important listings in standard 8 1/2 x 11 3 ring binders & by ensuring that all listings have page headings that identify the file name & the last modification date.
Here are a few sample commands for uvlist, but uvlist is not usually run directly, but rather by using 1 of the many supplied scripts with convenient pre-defined options, such as 'uvlp12' (see below).
uvlist file [format-options] [HP laser-options] <-- command format ===============================================
uvlist filename <-- display file contents on the screen =============== - standard output is the default
uvlist file | lp <-- redirect output to the printer ================
uvlist file p60 c12m300 | lp <-- format options for 60 lines/page (dflt) ============================ laser options 12 cpi, margin 300/720"
uvlp12 file <-- same as above, uvlp12 script includes =========== these options & redirects to the printer
uvlp12 file b91e95 <-- same as above, with options to ================== begin on page 91 & end on page 95
Here is just the 1 essential line extracted from the 'uvlp12' script.
uvlist $1 p60z2$2 a2t1c12$3 | lp $UVLPDEST $UVLPOPTN #===================================================
You can see that $1 is the filename & $2/$3 are optional addons to the default options for the uvlp12 script. Note the 2 sets of options (format & laser). Your .profile should include 'export UVLPDEST="-dlp0"' to set the destination & 'export UVLPOPTN="-onobanner"' to set other desired options.
Please see many more options & examples documented in uvlist.htm.
Goto: Begin this document , End this document , UVSI Home-Page
The following scripts (based on the uvlist utility) are very useful for printing programs, scripts, or miscellaneous text files when you would like to have page headings & page numbering, with various other pre-defined options.
| uvlp |
|
| uvlp12 |
|
| uvlp14 |
|
| uvlp16 |
|
| uvlp18 |
|
| uvlp18v7 |
|
uvLp - print Landscape at 10 cpi (106 chars on 11" wide)
uvlp12L - print Landscape at 12 cpi (128 chars on 11" wide)
uvlp14L - print Landscape at 14 cpi (150 chars on 11" wide)
uvlp16L - print Landscape at 16 cpi (170 chars on 11" wide)
uvlp14Lv8 - print Landscape at 14 cpi horizontal & 8 lpi vertical
(for 150 chars across, 60 lines down, NO uvlist pg headings)
| uvlpLS13 |
|
| uvlpLD13 |
|
Please see more uvlist scripts documented in uvlist.htm.
Goto: Begin this document , End this document , UVSI Home-Page
uvcopy is the most powerful of the Vancouver Utility programs. uvcopy is the basis for many of the conversion tools & for hundreds of pre-programmed jobs that do various useful things, such as table analysis. Here is an example based on the dat1/sales2 file previously listed in full on page 'D1'.
1 2 3 4 5 6
0123456789012345678901234567890123456789012345678901234567890123
cust# slsm# date invoice# product# qty price amount
130140 21 940802 IN111001 HAM001 000020 0000001 000000020
130140 21 940802 IN111001 SCR012 000021 0001001 000021021
139923 35 950802 IN111002 CHR001 000022 0002001 000044022
Our test/demo uvcopy job=sltbl1 will read thru the file, building a table in memory of sales quantity & $amount by product code. At end of file the table will be printed with line item % calculated of the 100% total lines.
#1. cd ~uvadm - change to UV superdir with subdirs dat1, tmp, & pf/demo
#2. uvcopy sltbl1,fili1=dat1/sales2,filo1=tmp/sales2.rpt <-- the hard way
====================================================
#2a. uvcopy sltbl1 <-- the easy way (the I/O filenames default as above)
=============
#3. cat <-- enter 'cat' when prompted for report disposition
=== - will display report (from tmp/sltbl1.rpt)
sltbl1 2002/05/20_08:46:40 sales analysis by product# of quantity & amount
tbl#001 pg#001 -argument- -acum#1- % -acum#2- %
line# count % product# sales qty sales amt
1 2 10 BBQ001 30 11 2,729.30 21
2 1 5 CHR001 22 8 440.22 3
3 5 25 HAM001 75 29 3,700.75 29
4 2 10 HAX129 27 10 1,656.27 13
5 2 10 SAW051 2 56.02
6 1 5 SCR012 21 8 210.21 1
7 4 20 TAB013 49 19 1,818.49 14
8 3 15 WHIP75 29 11 1,976.29 15
20*100 *TOTAL* 2.55 *100 12,587.55 *100
See the uvcopy job=sltbl1 code listed on next the next page --->
Before you look, guess how many instructions were required to create the report shown above. This job demonstrates the power & conciseness of uvcopy. It would take thousands of lines of COBOL code to create similar table analysis summary reports.
Goto: Begin this document , End this document , UVSI Home-Page
rop=r1x2 #run option prompt report disposition
fili1=?dat1/sales3,typ=RSF,rcs=64
filo1=?tmp/sltbl1.rpt,typ=LSTt,rcs=80
@run
opn all
# begin loop to get & table until EOF
man20 get fili1,a0 get next record
skp> eof (cc set > at EOF)
tblt1f3 a30(6),'product#; sales qty; sales amt',a38(6),a53(9)
skp man20 return to get next record
# EOF - dump table to report file & display report
eof tbpt1s2 filo1,'sales analysis by product# of quantity & amount'
cls all
eoj
Only 12 uvcopy instructions were required to create the report. All uvcopy instructions are documented in uvcopy3.htm (vol 3 of UVdoc). All instructions are 3 characters & may be followed by options.
The options used on 'tbl' & 'tbp' (2 most pertinent instructions in this job) are described below:
tbl - build table in memory
___t1 - option t1 for table#1 (t2 for table #2, etc)
_____f2 - option f2 for format 2 (acum1=quantity, acum2=dollars/cents)
tbp - print table (write memory table to output file for later use)
___t1s2 - options to identify table#1 & space 2 after table written
Here is the good news - you don't have to learn the uvcopy code before you can use it - there are hundreds of pre-programmed jobs that do many useful things (such as the table analysis demonstrated above). You can use the pre- programmed jobs on your own files since they solicit filenames, record-sizes, etc (vs the demo job above designed for 1 specific test file).
The next page will demonstrate using 'table2' (a uvcopy pre-programed job) to generate a report similar to that shown on the previous page. Sometimes, you may still want to write your own uvcopy job (as above) to use some of the more powerful features, for example:
Goto: Begin this document , End this document , UVSI Home-Page
'table2' is a 'pre-programmed' uvcopy job that you can run on any fixed-length record file to create a table summary of record counts & 2 other qty/amt fields by a specified argument field. No programming required, just run 'uvcopy table2'.
'table2' solicits the filename & options which define displacement & length of the table argument,& 1 or 2 fields to be accumulated. table2 then reads through the file & displays or prints the accumulated totals sorted & summarized to one line per unique key field value.
1 2 3 4 5 6
0123456789012345678901234567890123456789012345678901234567890123
cust# slsm# date invoice# product# qty price amount
130140 21 940802 IN111001 HAM001 00020+ 0000001 00000020+
130140 21 940803 IN111001 SCR012 00021+ 0001001 00021021+
130140 21 940804 IN111001 CHR001 00022+ 0002001 00044022+
139923 35 950802 IN111002 TAB013 00023+ 0003001 00069023+
139923 35 950807 IN111002 TAB013 00024+ 0004001 00096024+
150825 44 960804 IN1122 HAM001 00025+ 0005001 00125025+
150825 44 960805 IN1122 HAX129 00026+ 0006001 00156026+
201120 44 970807 CR5234 WHIP75 00027+ 0007001 00189027+
223240 65 980816 CR955 HAM001 00028+ 0008001 00224028+
223240 65 980817 IN441 BBQ001 00029+ 0009001 00261029+
308685 21 990812 IN6605 SAW051 00010- 0000001 00000010-
308685 21 990813 IN6605 WHIP75 00011- 0001001 00011011-
308685 21 990814 CR8835 TAB013 00012- 0002001 00024012-
315512 44 000805 IN2251 HAM001 00013- 0003001 00039013-
315512 44 000806 IN2251 SAW051 00014- 0004001 00056014-
315512 44 000807 IN2255 WHIP75 00015- 0005001 00075015-
400002 85 010812 CR245 HAX129 00016- 0006001 00096016-
406082 35 020815 IN33001 BBQ001 00017- 0007001 00119017-
406082 35 020816 IN33001 TAB013 00018- 0008001 00144018-
406082 65 020816 IN441 HAM001 00019- 0009001 00171019-
uvcopy table2,fili1=dat1/sales3,uop=a30b6c38d6e53f9g3r64,filo1=tmp/sales3.tbl =============================================================================
uvcopy table2 <-- Try this Now
============= - You only need to enter/remember this much
- you will be prompted for filename & options
- filenames default as shown above (for this demo)
--> see options & prompts illustrated on the next page -->
Goto: Begin this document , End this document , UVSI Home-Page
uvcopy table2 <-- enter this command ============= - will display options & prompt as follows:
uop=a0b0c0d0e0f0g1p0r0 - option defaults
uop=a0 - argument displacement (0 rel)
uop= b0 - argument length
uop= note - may omit options c,d,e,f,p for record counts only
uop= c0 - acum#1 displacement (0 rel)
uop= d0 - acum#1 length
uop= e0 - acum#2 displacement (0 rel)
uop= f0 - acum#2 length
uop= g1 - edit all acums as qty (commas, no decimal)
uop= g2 - edit all acums as $ (commas & decimal point)
uop= g3 - edit acum#1 qty, acums#2-#6 $amount
uop= g__ - table formats g1-g12 see uvcopy.doc tbf f1-f12
uop= p0 - acum-fields unpacked, "p1" packed, "p2" binary
uop= r8192 - input record size (max 8192)
uop= note - if file type LST specify r > largest possible
uop=a30b6c38d6e53f9g3r64 <-- ENTER this for demo with dat1/sales3 file
====================
product#;quantity;amount <-- ENTER this for demo Field Headings
========================
Summary of Qty & Amt by Product# <-- ENTER this for demo Report Heading
================================
<-- ENTER null at filename prompt to accept demo input
Notes re: input File TYPE prompts
RSF (default) <-- Record Seqntl Fixed (recsize option r must be correct)
LST <-- Line Seqntl Terminated (specify r > largest possible)
User OPtion (uop) defaults = q1a0b0c0d0e0f0g1p0r0
null to accept or re-specify (1 or more)
--> a30b6c38d6e53f9g3r64 <-- suggested options
====================
enter table header fieldnames separated by semicolons (argument;acum1;acum2)
--> product;qty;amt <-- suggested field headings
===============
enter table heading (optional, prints above fieldnames)
--> summary of qty & amt by product# <-- suggested report headings
================================
dat1/sales3 = default fili01 - null accept or reenter ? --> <-- null to accept default input file
RSF = typ default fili01 - null accept or enter new typ ? --> <-- null to accept default file type (fixed)
EOJ, Output File written to: tmp/sales3_tblproduct
enter command: vi,cat,more,lp,uvlp12,null --> cat
--> cat <-- enter 'cat' to display report on screen
- see report on the next page ----->
Goto: Begin this document , End this document , UVSI Home-Page
table2 2003/04/26_20:15:34 Sales Summary by Product# tbl#001 pg#001 -argument- -acum#1- % -acum#2- % line# count % product quantity
1 2 10 BBQ001 12 12 1,420.12 31
2 1 5 CHR001 22 22 440.22 9
3 5 25 HAM001 41 41 1,390.41 30
4 2 10 HAX129 10 10 600.10 13
5 2 10 SAW051 24- 24- 560.24- 12-
6 1 5 SCR012 21 21 210.21 4
7 4 20 TAB013 17 17 29.83-
8 3 15 WHIP75 1 1 1,030.01 22
20*100 *TOTAL* 100 *100 4,501.00 *100
Please see more examples in TABLEjobs.htm and alternate job 'table1' for variable length delimited text files.
Goto: Begin this document , End this document , UVSI Home-Page
'table3d' is a more useful than 'table2' for JCL/script & COBOL conversions because it is designed to process entire directories of files (vs 'table2' which processes only fixed length data files & only 1 at a time).
'table3d' allows you to specify a 'key-word', preceding a 'target-word'. The job searches all lines of all files in the directory & the report shows one line for each target-word with the counts & percentages of the total line. Some examples of possible reports might be:
Note that the 'cross-reference' reports (see '2Q1') provide for the 1st 2 above, so we use #3 as our example. The TOP-NODE in DSN filenames becomes the sub-directory in the converted scripts. A few samples of 'DSN's from our test files might be:
//CUSTMAS DD DSN=AR.CUSTOMER.MASTER.INDEXED,DISP=SHR
//SORTIN DD DSN=GL.ACCOUNT.TRANS,DISP=SHR
//SORTOUT DD DSN=&&TEMPSLS,DISP=(NEW,PASS),...
uvcopy table3d,fild1=jcl0,arg1=DSN,arg2=.,arg4==. ================================================= fild1 = directory containing the JCL arg1 = search pattern arg2 = qualifier (at least 1 '.' present to identify a valid DSN) arg4 = characters to be blanked '=' & '.' for word separation
Job: table3d Dir: jcl0 Keyword(s): DSN
Qual1: . Qual2: Blanked: =.'" Userops: q1c0f0l0k0m0p1w1
table3d 2007/09/10_09:59:46 Counts by Targetword following specified Keyword
tbl#001 pg#001 -argument-
line# count % target-word
1 27 28 AR
2 1 1 ARTEST
3 1 1 FTP
4 52 54 GL
5 1 1 GLTEST
6 1 1 MXP
7 4 4 PY
8 4 4 PYTEST
9 2 2 RPTS
10 2 2 WORK
95*100 *TOTAL*
Goto: Begin this document , End this document , UVSI Home-Page
You can enter just 'uvcopy table3d' & you will be prompted for all required info as shown below:
uvcopy table3d <-- run table3d & reply to prompts (see below) ==============
table3d - scan for Keyword(s) & table counts of following Targetword
- use : delimiter for multiple keywords (keyword1:keyword2:keyword3:etc)
uop=q1c0f0l0k0m0p1w1 - option defaults
c1 - bypass comments in COBOL programs (* column 7)
c2 - bypass comments in shell scripts (# column 1)
f0 - do not prepend/append table entry with filename
f1 - prepend table argument with filename
f2 - append table argument with filename
k1 - no blank before keyword (k0 ensures word sep)
k2 - no blank after keyword (allow keyword prefix)
l0 - translate lower case before matching patterns
m2 - look for multiple keywords on 1 line
p1 - qualifier#1 present & qualifier#2 absent
p2 - qualifier#1 present & qualifier#2 present
p4 - qualifier#1 absent & qualifier#2 absent
w1 - target word is 1st word following keyword
w2 - target word is 2nd word following keyword
-------- examples - options, keywords,& spcl chars to be blanked ------
COBOL--> c1f2 <-- options copybook cross-ref
-------> copy <-- keyword copybook xref
JCL/ksh> c2w2 <-- options Korn shell script top-node summary
-------> exportfile:exportgen0:exportgen1 <-- multiple keywords
-------> exportfile DDNAME node1/node2.node3.node4
-------> &\,$=/-(.`);*|" <--- on arg4/prompt, enter spcl chars to blank
-------> abcdefhlpqrsAPQ <--- OR enter these alphas to represent above
User OPtion (uop) defaults = q1c0f0l0k0m0p1w1 ** responses **
null to accept or re-specify (1 or more) --> <-- options default OK
indir fild01 null accept or reenter --------> jcl0 <-- subdir with JCL
enter search word(s), (":" sep multiple) ---> DSN <-- search pattern
enter qualifier#1 (null=disable) -----------> . <-- DSNs must have 1 '.'
enter qualifier#2 (null=disable) -----------> <-- not required
chars to blank before word sep (1 min) -----> =. <-- for word sep
strings to be removed (":" sep multiple) ---> <-- not required
EOJ, Output File written to: tmp/jcl0_DSN
enter command: vi,cat,more,lp,uvlp12,null --> more <-- to see report
Goto: Begin this document , End this document , UVSI Home-Page
We could also create a top-node/subdir report after conversion to scripts. Here are some examples of the 'export's created from the mainframe DSN's.
exportfile CUSTMAS ar/customer.master.indexed
exportgen0 GLMSOLD gl/account.master_
exportgen1 SORTOUT $JTMP/gl/account.trans_
uvcopy table3d,fild1=jcl3,arg1=exportfile:exportgen0:exportgen1
===============================================================
,arg2=.,arg4=efp,uop=w2
=======================
Job: table3d Dir: jcl3 Keyword(s): exportfile:exportgen0:exportgen1
Qual1: . Qual2: PARM Blanked: =/.'"- Userops: q1c0f0l0k0m0p1w1w2
table3d 2007/09/10_09:33:28 Counts by Targetword following specified Keyword
tbl#001 pg#001 -argument-
line# count % target-word
1 28 28 ar
2 49 50 gl
3 11 11 misc
4 7 7 py
5 2 2 rpts
97*100 *TOTAL*
Comparing this report to the TOP-NODE report on page 'J4', you can see that we have consolidated the ARTEST,GLTEST,PYTEST subdirs into the 'misc' subdir. The JCL converter uses the TOPNODES table to do this as explained at MVSJCL.htm#4D1
Do you see how you can run table3d to summarize other components of JCL or COBOL by choosing appropriate keywords, targetwords,& options. See more explanations at: TABLEjobs.htm#E1
Goto: Begin this document , End this document , UVSI Home-Page
There are over 300 pre=programmed jobs provided with the Vancouver utilities to do various things found useful at customer sites. For example COBOL shops have found the 'cobmap1' job most useful. cobmap1 reads a COBOL copybook & creates a report showing the field start, end, length,& type on the right side.
As an example, we will generate the 'cobmap' for the dat1/sales3 file that we have been using for some of our demo jobs (see listing on page 'D2').
uvcopy cobmap1,fili1=tf/sales3.cpy,filo1=tmp/sales3.map =======================================================
uvcopy cobmap1 <-- just this will prompt you for filenames
==============
--> tf/sales3.cpy <-- enter desired input filename (default if null entry)
--> <-- output filename will default tmp/cobmap if null entry)
cat tmp/sales3.map <-- display record layout created by cobmap1 ==================
cobmap1 start-end bytes for cobol record fields 200303291315 pg# 0001
cpy1/sales3.cpy RCSZ=00064 bgn end lth typ
* sales3 - cobol copy book for sales3 test/demo file
10 sl-cust pic 9(6). 0000 0005 006 n 6
10 filler001 pic x(4). 0006 0009 004
10 sl-slsmn pic 9(2). 0010 0011 002 n 2
10 filler002 pic x. 0012 0012 001
10 sl-date pic 9(6). 0013 0018 006 n 6
10 filler003 pic x. 0019 0019 001
10 sl-inv pic x(8). 0020 0027 008
10 filler004 pic x(2). 0028 0029 002
10 sl-prod pic x(6). 0030 0035 006
10 filler005 pic x(2). 0036 0037 002
10 sl-qty pic s9(6). 0038 0043 006 ns 6
10 filler006 pic x. 0044 0044 001
10 sl-price pic 9(4)v99 sign trailing separate. 0045 0051 007 n 7
10 filler007 pic x. 0052 0052 001
10 sl-amount pic 9(6)v99 sign trailing separate. 0053 0061 009 n 9
10 filler008 pic x(2). 0062 0063 002
*RCSZ=00064 0064
The mainframe to unix conversions also use cobmap1 as the 1st step in generating jobs to automatically convert mainframe EBCDIC files to ASCII preserving packed decimal fields. See details in DATAcnv1.htm.
Goto: Begin this document , End this document , UVSI Home-Page
01-02 - salesman# <-- control level #2 (major) 04-09 - customer# <-- control level #1 (minor) 14-19 - date 21-28 - invoice# 31-36 - product code 39-44 - quantity <-- to be accumulated in acum1 46-52 - price 54-62 - amount <-- to be accumulated in acum2
sl# cust# date invoice product qty price amount
1 2 3 4 5 6
0123456789012345678901234567890123456789012345678901234567890123
================================================================
21 130140 960802 IN111001 HAM001 000010 0001000 000010000
21 130140 960802 IN111001 SAW012 000020 0002000 000040000
21 139923 970802 IN111002 CHR001 000030 0003000 000080000
21 139923 970802 IN111002 TAB013 000042 0004000 000160000
21 139923 970807 CR5421 TAB013 000050 0005000 000250000
44 250825 980804 IN1122 HAM001 000060 0006000 000360000
44 250825 980804 IN1122 SAW012 000070 0007000 000490000
uvqrpg qrpgEX1 <-- execute uvqrpg demo ============== - see uvqrpg job listed on next page -->
Sales Analysis by customer within salesman 1999/10/26_09:43:19 page0001 sl# cust# date invoice product quantity price amount =========================================================================
21 130140 960802 IN111001 HAM001 10 10.00 100.00
960802 IN111001 SAW012 20 20.00 400.00
30 * 500.00 *
139923 970802 IN111002 CHR001 30 30.00 800.00
970802 IN111002 TAB013 42 40.00 1,600.00
970807 CR5421 TAB013 50 50.00 2,500.00
122 * 4,900.00 *
152 ** 5,400.00 **
44 250825 980804 IN1122 HAM001 60 60.00 3,600.00
980804 IN1122 SAW012 70 70.00 4,900.00
130 * 8,500.00 *
130 ** 8,500.00 **
282 *** 13,900.00 ***
Goto: Begin this document , End this document , UVSI Home-Page
# qrpgEX1 - uvqrpg example - sales analysis by customer within salesman # - see uvqrpg.doc for input file layout & sample report expected # # uvqrpg qrpgEX1,fili1=dat1/sales4,filo1=tmp/qrpgEX1.rpt <-- run job (hard way) # ====================================================== # # uvqrpg qrpgEX1 <-- run job (easy way, filenames default as shown above) # ============== # fili1=?dat1/sales4,rcs=64,typ=LST filo1=?tmp/$jobname.rpt,rcs=80,typ=LSTt head2=h2000(45),'Sales Analysis by customer within salesman ' head2=h2045(25),'$datetime $page####' head1s2p55u4=h1000(50),'sl# cust# date invoice product quantity' head1=h1050(30),'price amount' ctll2=a0(2),'sl#' ctll1=a3(6),'cust#' ref=a13(6),'date' ref=a20(8),'invoice' ref=a30(6),'product' acum1=a38(6),'quantity',,'zz,zz9-' ref=a45(7),'price',,'zz,zzz.99-' acum2=a53(9),'amount',,'zzzzz,zzz.99-'
<-- Please relate the report on the previous page to the uvqrpg code above.
Please see more examples in uvqrpg.htm.
Goto: Begin this document , End this document , UVSI Home-Page
The Vancouver Utilities will be especially useful to Micro Focus COBOL users, since the D-ISAM indexed file handler is compatible with Micro Focus COBOL. uvcp, uvsort,& uvcopy make it easy to perform various maintenacne & utility functions (load, unload, sort, list, extract, reorganize, clear fields, etc).
D-ISAM files have 2 parts. The data & index are separate files, for example:
cusmaster.dat <-- data partition of customer master file cusmaster.idx <--index partition of customer master file
Actually Micro Focus COBOL does not expect the '.dat' extension, and D-ISAM was modified for Vancouver Utilities to default to no extension. But this is optional & controlled by the following export/set. I suggest you activate this now, so it is easier to distinguish between sequential & indexed files on the following test/demos.
export DISAMEXT=dat <-- causes .dat extension when DISAM files created ===================
| typ=RSF |
|
| typ=RST |
|
| typ=LST |
|
| typ=ISF |
|
| typ=IDXf3 |
|
| typ=IDXf8 |
|
These are the most common file types & relevant to the following exercises (please see uvcp.htm#F1 page F1 for the complete list). To load an indexed file the input file type would usually be typ=RSF or typ=LST & the output type would usually be typ=ISF. We will not cover typ=IDXf3/IDXf8 here (see uvcp.htm#F3).
Goto: Begin this document , End this document , UVSI Home-Page
#1. del tmp/* - delete any old files from the tmp subdir
#2. uvcp "fili1=dat1/sales3,typ=RSF,rcs=64,filo1=tmp/s3,typ=ISF,isk1=0(6d)"
=======================================================================
#3. dir tmp - list output files created
--> s3.dat - data partition
--> s3.idx - index partition
#4. uvhd tmp/s3.dat r65h2 - inspect data partition with uvhd
===================== (1st record shown below)
10 20 30 40 50 60
0123456789012345678901234567890123456789012345678901234567890123
0 130140 21 940802 IN111001 HAM001 00020+ 0000001 00000020+ .
3333332222332333333244333333224443332233333223333333233333333220
130140000021094080209E1110010081D0010000020B00000001000000020B0A
64 .
0
A
rec#=1 rcount=20 rsize=65 fsize=1300 tmp/s3
null=next,r#=rec,s=search,u=update,p=print,i=iprint,w=write,t=tally,c=checkseq
,R#=Recsize,h1=char,h2=hex,q=quit,?=help -->
Note that the output records are 65 bytes. D-ISAM adds an extra byte at the end of the record x'0A', which is changed to a x'00' for a deleted record. Our input records already had a x'0A' (LineFeed) in the the 64th byte (0 relative 63) since this was a test/demo file & we wanted you to be able to inspect the records with the editor.
Note that the Indexed Sequential Key is specified by 'isk1=0(6d)'. This is the customer# in the 1st 6 bytes, 0 displacement (6 long). The 'd' means duplicates allowed. Please see more details on page uvcp.htm#D1.
#5. uvhd tmp/s3.idx - inspect index partition with uvhd
===============
There is no point in looking at the index partition, we cannot understand it without the technical D-ISAM documentation. If it becomes corrupted, you can recreate it from the data partition using uvcp (as above) or uvsort to create a more efficient indexed file (see uvsort.htm).
Goto: Begin this document , End this document , UVSI Home-Page
#1. uvcp "fili1=tmp/s3,typ=ISF,rcs=64,filo1=tmp/s3a,typ=LSTt"
=========================================================
#2. uvhd tmp/s3a t1h2 - inspect output file (confirm just 1 LF)
=================
#1. uvsort "fili1=tmp/s3,typ=ISF,rcs=64,filo1=tmp/s3,isk1=0(6d),key1=0(6)"
======================================================================
Goto: Begin this document , End this document , UVSI Home-Page
'listISF' is a pre-programmed job to list any C-ISAM/D-ISAM IDXFORMAT1 indexed file without having to specify record size or keys. By default it will output the 1st 80 bytes of each record into a text file (with options to change output records size, & record counts to bypass, copy,& stop). This job is quite useful to extract the front end character portion from long records with trailing packed fields that cannot be displayed or printed with out special tools such as uvhd. For example we could extract the name & address portion (1st 80) from our custmast demo Indexed file (of 256 byte records with many trailing packed fields). Here is the 1st record (illustrating the packed fields) from the uvhd demo on page 'E1'. Note that we will use 'dat1\custmast', the indexed version of 'dat1\custmas1'.
1 2 3 4 5 6
0123456789012345678901234567890123456789012345678901234567890123
0 130140 EVERGREEN MOTORS LTD. 1815 BOWEN ROAD NANA
3333332222454545444244545524542222233332445442544422222222224444
130140000056527255E0DF4F230C44E0000181502F75E02F140000000000E1E1
64 IMO BC V9S1H1 604-754-5531 ........
4442222222222442535343222233323332333322222222222222222200000000
9DF00000000002306931810000604D754D55310000000000000000000000C000
128 .........W0....`........)X|..f3.....\.......................f...
0000000005300016000000002570063100095000000000000000000000016000
0C0000C0270C0540C0000C0098C0263C0444C0000C0000C0000C0000C0056C00
192 ...............................f.....<........f.C
0000008900000000880000000018000680001300000000694222222222222222
00C0026C0000C0023C0000C0083C0056D0012C0000C0016D3000000000000000
uvcopy listISF,fili1=dat1/custmast,rop=c10,uop=r80 <-- may enter cmd line args ================================================== uvcopy listISF <-- easy demo (files & options default as above) ==============
rop - run options for bypass & list counts (may enter on command line)
ex: uvcopy listISF,fili1=xx,filo1=yy,rop=b20c10
Run OPtion (rop) defaults = q1b0c10
null to accept or re-specify (1 or more) ---> c10 <-- may modify copy option
uop=r80 - output rec-size option (default=80)
r80 - rcsz will be 1st 80 (default)
r0 - indicates full size will be listed
null to accept or re-specify (1 or more) ---> r80 <-- may modify extract rcsz
display/edit/print ? (more/edit/type/null)---> type <-- display output file
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 142175 LILLY ELECTRIC (1973) LTD16809 - 24TH AVENUE SURREY BC 145264 D MAGRATH SUPPLIES LTD. 1939 KIRSCHNER ROAD KELOWNA BC 147615 O'CONNER R.V. CENTRE 44430 YALE ROAD WEST CHILLIWACK BC 149304 POINT GREY GOLF & COUNTRY3350 S.W. MARINE DRIVE VANCOUVER BC 150825 RIGGERS INDUSTRIAL 960 - 6TH AVENUE HOPE BC 152355 SHAW, JOHN 477 CARIBOO CRES. PORT COQUITLAM BC 154688 TAURUS RESOURCES 1110 - 625 HOWE STREET VANCOUVER BC
Goto: Begin this document , End this document , UVSI Home-Page
'scan1d' is a pre-programmed job that will scan any directory of text files for matches on any pattern, qualified by any 2 other patterns that must be or must not be present (default 1 present, 1 absent).
For example, I wanted to update my 'doc' directory to add more references to 'LINUX' where ever I was discussing 'conversion' to 'UNIX'. Please try this procedure & see if your results include the sample results shown below.
uvcopy scan1d,fild1=/home/uvadm/doc <-- start job,specifying input dir#1=doc =================================== - answers prompts as shown below:
uop=q1a1b99999c0d256e0p1 - option defaults
a1 - begin scan at line #1 (default) of input file
a0 - causes prompt for search pattern to BEGIN scan
b99999 - end scan at line #99999 (dflt) of input file
c0 - begin scan at col #1 (zero rel) of input lines
d256 - length of scan area default 256 bytes
p1 - 1 present qual(31-60) & 1 absent qual(61-80)
p2 - 2 present quals(31-60+61-80) & NO absent quals
p4 - 2 absent quals(31-60+61-80) & NO present quals
User OPtion (uop) defaults = q1a1b99999c0d256e0p1
null to accept or re-specify (1 or more) ---------> <-- null OK
enter your search pattern (max 64 bytes) ---------> conversion <-- enter
1st qual, dflt present, absent(p4), null=disable --> unix <-- enter
2nd qual, dflt absent, present(p2), null=disable --> linux <-- enter
match options: i=case-insens,p=patterns(@,#,etc)
enter match options: i,p,q1/q2/q3,n,or null --> i <-- case-insen
display/edit/print ? (enter: more/vi/lp/null) --> more <-- display
JOB: scan1d DIR: doc SEARCH: conversion QUAL1: unix QUAL2: linux SEARCHBGN: ====================================================== 2003/03/30_16:26:40 00096 pf/IBM - Mainframe to Unix conversion jobs 00097 - supplied only with the Unix mainframe conversion package 00744 The mainframe to unix conversions also use cobmap1 as the 1st step in 01172 3 hits @EOF: doc/WindowsDOS.doc
00264 02. Loading data from mainframe for conversion on UNIX 00358 ** #02 Loading data from mainframe for conversion on UNIX ** 02192 2 hits @EOF: doc/SQLjobs.doc ====================================================== 2003/03/30_16:26:48 EOD: 00209 hits in 0025 files of 0085 total (30353 lines)
I have only shown a few of the results, your results should be as shown above (209 hits in 25 files of 85 total). I could have used the 'rep2d' job to actually change 'Unix' to 'Unix and Linux' but in this case, it is obviously better to use the scan report to selectively modify depending on syntax. The report tells me the line#s, making it easy locate them in the editor.
Goto: Begin this document , End this document , UVSI Home-Page
'rep2' is a pre-programmed job to copy any text file searching & replacing depending on a table of patterns (search, replace, qualify present & absent).
For our test/demo we will use the table shown below. The table patterns must be '~' tilde filled to indicate pattern length & the table is ended by a line of all tildes.
| cols 001-030 |
|
| cols 031-060 |
|
| cols 061-080 |
|
| cols 031-060 |
|
#1. cat tf/rep2demo.tbl <-- inspect search/replace table
===================
| Note |
|
#2. uvcopy rep2,fili1=dat1/sales3,filo1=tmp/s3,fili2=tf/rep2demo.tbl <--run demo
================================================================
JOB: rep2 INFILE: dat1/sales3 OUTFILE: tmp/s3 TABLE: new/rep2demo.tbl searchbgn: ====================================================== 2003/03/30_16:52:28 HAM001~~~~~~~~~~~~~~~~~~~~~~~~HAM201~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ TAB013~~~~~~~~~~~~~~~~~~~~~~~~TAB213~~~~~~~~~~~~~~~~~~~~~~~~ 21 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ TAB013~~~~~~~~~~~~~~~~~~~~~~~~TAB313~~~~~~~~~~~~~~~~~~~~~~~~ 35 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ====================================================== 2003/03/30_16:52:28 00001 130140 21 940802 IN111001 HAM201 00020+ 0000001 00000020+ 00004 139923 35 950802 IN111002 TAB313 00023+ 0003001 00069023+ 00005 139923 35 950807 CR5421 TAB313 00024+ 0004001 00096024+ 00006 150825 44 960804 IN1122 HAM201 00025+ 0005001 00125025+ 00009 223240 65 980816 CR955 HAM201 00028+ 0008001 00224028+ 00013 308685 21 990812 CR8835 TAB213 00012- 0002001 00024012- 00014 315512 44 000805 IN2251 HAM201 00013- 0003001 00039013- 00019 406082 35 020815 IN33001 TAB313 00018- 0008001 00144018- 00020 406082 65 020816 IN441 HAM201 00019- 0009001 00171019- ====================================================== 2003/03/30_16:52:28 EOF: 00009 reps on 00000 lines of 00020 total line
Only the audit report (rep2.aud) is shown, you can also inspect the output file (tmp/s3) & confirm that only 9 lines have been changed. This job 'rep2' modifies only 1 file at a time, also see 'rep2d' in REPjobs.htm to search/ replace all files in a directory while copying to a 2nd directory.
Goto: Begin this document , End this document , UVSI Home-Page
This is a follow-on to the preceding demo of pre-programmed job 'rep2' to make mass changes to data files based on a search/replace table. Note that rep2 is intended for text files, for data files it is usually better to write a special purpose uvcopy job to be certain to preserve the exact record layout.
Please run the supplied uvcopy job (pf/demo/prodfix1) as follows:
#1. uvcopy prodfix1,fili1=dat1/sales3,filo1=tmp/sales3a <-- run the demo job
===================================================
#2. cat tmp/sales3a <-- display outfile & confirm prod# changes
=============== (via lookup table coded in job below)
# prodfix1 - modify product#s via a lookup table
# - sample uvcopy demo for TestDemo.doc
#
#usage: uvcopy prodfix1,fili1=dat1/sales3,filo1=tmp/sales3a
# ===================================================
#
fili1=?dat1/sales3,rcs=64,typ=RSF
filo1=?tmp/sales3a,rcs=64,typ=RST
lod=c0(20) # load table of 20 byte entries
HAM001 HAM201 # lookup prod# 0(6), replacement 7(6)
SAW001 SAW201
TAB013 TAB213
~~~~~~~~~~~~~~~~~~~~ # table ended by all tildes entry
@run
opn all
# begin loop to get,process,put records until EOF
loop get fili1,a0 get record into area 'a'
skp> eof (cc set > at EOF)
mvc b0(64),a0 copy inrec to outarea 'b'
lokz1 cc0(20),c0(6),a30(6) lookup table by 6 char prod#
skp! put1 if nofind - go output as is
rep1 mvc b30(6),cc7 replace outrec prod# with table prod#
put1 put filo1,b0 write the output record
skp loop return to next record
eof cls all
eoj
For brevity, this job does not qualify the prod# replacement by salesman#. Please see pf/demo/prodfix2 if you wish to see the qualified replacement that was illustrated in the previous 'rep2' demo (5 more instructions).
Please see uvcopy3.htm for details of the instructions used above. This document is not intended to explain the details, but rather to illustrate that you can do anything required with the uvcopy utility. You will not find yourself wishing for more powerful data manipulation capability as is often the case with other utilties.
Goto: Begin this document , End this document , UVSI Home-Page
Here is uvcopy job to test uvcopy processing of 32 & 64 bit integers. This processing depends on how you compiled uvcopy. '#1' below compiles on an Intel LINUX system in 32 bit mode. You should change 'LNX' to the proper code for your system (SUN,HP,AIX,SFU,etc). See install.htm#C1. On the next page we will recompile in 32 bit mode & rerun the test.
#1. ccc uvcopy LNX H32 disamLNX NOLF - compile on Linux in 32 bit mode
================================ - with DISAM indexed files, NO LargeFiles
#2. uvcopy testint2 - execute uvcopy job 'testint2'
=============== - displays output via 'more'
#3. uvlp12 tmp/testint2_H32 - OR print output from file created
=======================
# Date=20040621, Machine=LNX, Bits=H32 cycle decimal-value hex native hex swapped 01 00000000000000000001 0100000000000000 0100000000000000 02 00000000000000000002 0200000000000000 0200000000000000 03 00000000000000000004 0400000000000000 0400000000000000 04 00000000000000000008 0800000000000000 0800000000000000 05 00000000000000000016 1000000000000000 1000000000000000 06 00000000000000000032 2000000000000000 2000000000000000 07 00000000000000000064 4000000000000000 4000000000000000 08 00000000000000000128 8000000000000000 8000000000000000 09 00000000000000000256 0001000000000000 0001000000000000 10 00000000000000000512 0002000000000000 0002000000000000 11 00000000000000001024 0004000000000000 0004000000000000 12 00000000000000002048 0008000000000000 0008000000000000 13 00000000000000004096 0010000000000000 0010000000000000 14 00000000000000008192 0020000000000000 0020000000000000 15 00000000000000016384 0040000000000000 0040000000000000 16 00000000000000032768 0080000000000000 0080000000000000 17 00000000000000065536 0000010000000000 0000010000000000 18 00000000000000131072 0000020000000000 0000020000000000 19 00000000000000262144 0000040000000000 0000040000000000 20 00000000000000524288 0000080000000000 0000080000000000 21 00000000000001048576 0000100000000000 0000100000000000 22 00000000000002097152 0000200000000000 0000200000000000 23 00000000000004194304 0000400000000000 0000400000000000 24 00000000000008388608 0000800000000000 0000800000000000 25 00000000000016777216 0000000100000000 0000000100000000 26 00000000000033554432 0000000200000000 0000000200000000 27 00000000000067108864 0000000400000000 0000000400000000 28 00000000000134217728 0000000800000000 0000000800000000 29 00000000000268435456 0000001000000000 0000001000000000 30 00000000000536870912 0000002000000000 0000002000000000 31 00000000001073741824 0000004000000000 0000004000000000 32 000000000=214748364x 0000008000000000 0000008000000000 <-- 32 bit limit 33 00000000000000000000 0000000000000000 0000000000000000
Goto: Begin this document , End this document , UVSI Home-Page
#1. ccc uvcopy LNX S64 disamLNX LF64 - re-compile on Linux in 64 bit mode
================================ - S64 for machines w 64 bit integers
but still able to use 32 bit pointers
- H64 for machines w 64 bit Hardware ptrs
#2. uvcopy testint2 - re-execute uvcopy job 'testint2'
=============== - displays output via 'more'
#3. uvlp12 tmp/testint2_S64 - OR print output from file created
=======================
# Date=20040621, Machine=LNX, Bits=S64 cycle decimal-value hex native hex swapped 01 00000000000000000001 0100000000000000 0000000000000001 .. ----- 30 lines omitted, same as previous page ----- 31 00000000001073741824 0000004000000000 0000000040000000 32 00000000002147483648 0000008000000000 0000000080000000 33 00000000004294967296 0000000001000000 0000000100000000 34 00000000008589934592 0000000002000000 0000000200000000 35 00000000017179869184 0000000004000000 0000000400000000 36 00000000034359738368 0000000008000000 0000000800000000 37 00000000068719476736 0000000010000000 0000001000000000 38 00000000137438953472 0000000020000000 0000002000000000 39 00000000274877906944 0000000040000000 0000004000000000 40 00000000549755813888 0000000080000000 0000008000000000 41 00000001099511627776 0000000000010000 0000010000000000 42 00000002199023255552 0000000000020000 0000020000000000 43 00000004398046511104 0000000000040000 0000040000000000 44 00000008796093022208 0000000000080000 0000080000000000 45 00000017592186044416 0000000000100000 0000100000000000 46 00000035184372088832 0000000000200000 0000200000000000 47 00000070368744177664 0000000000400000 0000400000000000 48 00000140737488355328 0000000000800000 0000800000000000 49 00000281474976710656 0000000000000100 0001000000000000 50 00000562949953421312 0000000000000200 0002000000000000 51 00001125899906842624 0000000000000400 0004000000000000 52 00002251799813685248 0000000000000800 0008000000000000 53 00004503599627370496 0000000000001000 0010000000000000 54 00009007199254740992 0000000000002000 0020000000000000 55 00018014398509481984 0000000000004000 0040000000000000 56 00036028797018963968 0000000000008000 0080000000000000 57 00072057594037927936 0000000000000001 0100000000000000 58 00144115188075855872 0000000000000002 0200000000000000 59 00288230376151711744 0000000000000004 0400000000000000 60 00576460752303423488 0000000000000008 0800000000000000 61 01152921504606846976 0000000000000010 1000000000000000 62 02305843009213693952 0000000000000020 2000000000000000 63 04611686018427387904 0000000000000040 4000000000000000 64 =922337203685477580x 0000000000000080 8000000000000000 <-- 64 bit limit 65 00000000000000000000 0000000000000000 0000000000000000
See the uvcopy job (testint2) listed on the next page --->
Goto: Begin this document , End this document , UVSI Home-Page
# testint2 - uvcopy Parameter File from UVSI stored in: /home/uvadm/pf/adm
# testint2 - test conversion from decimal to binary & back
# - uvcopy compiled with options H64, S64, or H32
# - 2,147,483,648 limit for 32 bits
#
#usage: uvcopy testint2,filo1=tmp/testint2_H64/S64/H32
# ==============================================
# 1. uvcopy testint2 <-- easier command, outfile defaults as above
# ===============
# 2. uvlp16 tmp/testint2_S64 <-- print output at 16cpi to fit 8" paper
# =======================
#
# Note - output display will be different depending on machine architecture
# BigEndMachines = HP, SUN, AIX
# LittleEndMachines = INTEL, LINUX, DEC-ALPHA, DWIN, CWIN, UWIN, SFU
opr='uop=c66 - default option for calc cycles'
uop=q1c66 # default options
filo1=?tmp/testint2_,rcs=128,typ=LSTt
@run
cata8 $filo1,$longbits append H64/S64/H32 to outfilename
opn all
mvfv3 b0(80),'# Date=$date, Machine=$machine, Bits=$longbits'
putb filo1,b0(80) write info to 1st line of report
mvfv3 b0(80),'cycle decimal-value hex native hex swapped'
putb filo1,b0(80) write info to 1st line of report
mvn $ca1,1 init accumulator
mvn $ca3,1 init counter for cycles option limit test
#
# begin loop to convert, print, double,& repeat
man20 mvn b0(2),$ca3 cycle#
mvn b4(20),$ca1 decimal value in 20 bytes
hxc b26(16),$ca1 convert to hex display
mvn c0(8bs),$ca1 swap BigEnd/LittleEnd
hxc b44(16),c0(8) convert to hex display
put filo1,b0 write output
mpy $ca1,2 double for next cycle
add $ca3,1 count cycles
cmn $ca3,$uopbc test cycles limit ?
skp< man20
#
eof cls all
sysv1 'more $filo1'
eoj
| Note |
|
Goto: Begin this document , End this document , UVSI Home-Page
Here is a C program to test 64 bit integers. This would prove that your system software can process 64 bit integers (independently from uvcopy). Compile & test as shown below as /* comments */ within the program & you should get the results listed below.
/* test64c.c - test long long for unix/linux, lcc-win32, etc */ /* - convert numstring to long long, multiply by 4, convert back*/ /* - see alternate program test64d.c for Windows SFU */ /* - also see testll1.c & testll2.c which allow you to specify */ /* initial value, multiplier,& no of cycles */ /* - also see uvcopy job 'testint2' similar to this C program */ /* (uvcopy job testint2 stored at /home/uvadm/pf/adm/testint2*/ /* */ /* - defines a long long 64 bit field */ /* - uses 'strtoll' to convert numeric strings to initial value */ /* - multiply by 4, repeat 15 cycles, print result to see limits */ /* - uses printf '%016lld' to convert 64 bit integers to numstrings*/ /* */ /*June2004 - problem with 'strtoll' when compiled by lcc-win32 */ /* - workaround is to code base 10 (vs 0 defaulting to base 10) */ /* */ /*compile: cc src/test64c.c -obin/test64c */ /* ============================== */ /* */ /*usage: bin/test64c <-- execute */ /* =========== - expected result below */ /* */ /* 00. 0000000000004096 * 04 = 0000000000016384 = 00 40 00 00 00 00 00 00 */ /* 01. 0000000000016384 * 04 = 0000000000065536 = 00 00 01 00 00 00 00 00 */ /* 02. 0000000000065536 * 04 = 0000000000262144 = 00 00 04 00 00 00 00 00 */ /* 03. 0000000000262144 * 04 = 0000000001048576 = 00 00 10 00 00 00 00 00 */ /* 04. 0000000001048576 * 04 = 0000000004194304 = 00 00 40 00 00 00 00 00 */ /* 05. 0000000004194304 * 04 = 0000000016777216 = 00 00 00 01 00 00 00 00 */ /* 06. 0000000016777216 * 04 = 0000000067108864 = 00 00 00 04 00 00 00 00 */ /* 07. 0000000067108864 * 04 = 0000000268435456 = 00 00 00 10 00 00 00 00 */ /* 08. 0000000268435456 * 04 = 0000001073741824 = 00 00 00 40 00 00 00 00 */ /* 09. 0000001073741824 * 04 = 0000004294967296 = 00 00 00 00 01 00 00 00 */ /* 10. 0000004294967296 * 04 = 0000017179869184 = 00 00 00 00 04 00 00 00 */ /* 11. 0000017179869184 * 04 = 0000068719476736 = 00 00 00 00 10 00 00 00 */ /* 12. 0000068719476736 * 04 = 0000274877906944 = 00 00 00 00 40 00 00 00 */ /* 13. 0000274877906944 * 04 = 0001099511627776 = 00 00 00 00 00 01 00 00 */ /* 14. 0001099511627776 * 04 = 0004398046511104 = 00 00 00 00 00 04 00 00 */ /* 15. 0004398046511104 * 04 = 0017592186044416 = 00 00 00 00 00 10 00 00 */ /* */ /*Note - the 32 bit limit is at #09 above 1,073,741,824 is OK in 32 bits */ /* - following entries zeros or garbage if 64 bit software not working*/
Goto: Begin this document , End this document , UVSI Home-Page
#include <stdio.h> #include <stdlib.h>
/*Note - this test64c codes initial value1s as numeric string */ /* - then converts to value1 via 'strtoll' <-- problem in June2004 */ /* - strtoll problem fixed by coding base 10 explicitly (vs 0 default)*/
char value1s[16] = "4096"; /* initial value as num string for strtoll */ long long value1 = 0; /* initial value */ int mult = 4; /* multiplier */ int cycles = 15; /* no of calc cycles */ long long value2; /* save current for printing */ int ii; /* loop index */
/* union to hold long long & 8 byte char array in same memory positions*/
/* - 8 byte character array (for hex representation conversion) */
union LLCH
{ long long ll;
unsigned char ch[8];
} llch;
/* test conversions, numstring to long long, multiply,& convert back */ int main(int argc, char *argv[]) { /* convert initial value num string to long long for mult by 4, 15 cycles*/ value1 = strtoll(value1s,(char**)0,10); /* <-- MUST code base 10 for lcc-win32*/
/* begin loop to calc & print results */
for (ii=0; ii < cycles; ii++)
{ value2 = value1; /* save current value for printing */
value1 *= mult; /* multiply value by multiplier */
llch.ll = value1; /* store value in union for hex cnvrt*/
printf(
"%02d. %016lld * %02d = %016lld = %02X %02X %02X %02X %02X %02X %02X %02X\n"
,ii,value2,mult,value1
,llch.ch[0],llch.ch[1],llch.ch[2],llch.ch[3]
,llch.ch[4],llch.ch[5],llch.ch[6],llch.ch[7]);
}
return(0);
}
Goto: Begin this document , End this document , UVSI Home-Page
'uxcp' supports Indexed Sequential Variable length record files & must be compiled with the Micro Focus COBOL 'cob' command as shown in install.htm#D1. You can test uxcp using test files provided as shown below:
0010.0080 testIDXL - test file to create ISAM Variable length file 0020.0080 - input to 'cblIDX31.bat' which writes variable file 0030.0080 - this file is Line Sequential, layout as follows: 0040.0080 01-04=ISAM key, 05=.separator,06-09=recsize,10-400 text 0050.0080 - output record varies from 60 to 256 depending on recsize 06-09 0060.0060 - here is an 60 byte record--------------------------> 0070.0080 - here is an 80 byte record------------------------------------------> 0080.0160 - here is a 160 byte record...........................................----------------------------------------------- 0090.0240 - here is a 240 byte record (last record in file).....................-----------------------------------------------
#1. uxcp "fili1=dat1/testIDXL,rcs=256,typ=LST\
============================================
,filo1=tmp/testIDXI,rcs=254,typ=IDXf3v60,isk1=0(4)"
===================================================
#1a. uvhd tmp/testIDXI v <-- examine output data partition with 'uvhd'
===================
| Note |
|
#2. uxcp "fili1=tmp/testIDXI,rcs=256,typ=IDXf3,filo1=tmp/testx,typ=LSTt"
====================================================================
#2a. vi tmp/testx <-- examine output file with 'vi'
============
This converts the typ=IDXf3 file back to a text file (typ=LSTt) which should be the same as the original file used in step #1.
Goto: Begin this document , End this document , UVSI Home-Page
| Note |
|
#1. uxcp "fili1=dat1/testIDXL,rcs=256,typ=LST\
==========================================
,filo1=tmp/testIDXI,rcs=254,typ=IDXf3v60,isk1=0(4)"
===================================================
#1a. uvhd tmp/testIDXI v <-- examine output data partition with 'uvhd'
===================
1 2 3 4 5 6
r# 1 0123456789012345678901234567890123456789012345678901234567890123
0 0~......0302201201162403022012011624.>.......................<..
370000003333333333333333333333333333030000000000000000000F000300
0E00000003022012011624030220120116240E0200000000100000000E000C00
64 ............................................X.6.................
00000000000000000000000000000000000000000000503E0000000000000000
0000000000002010000000000000000000000000000080600000000000000000
| Note |
|
1 2 3 4 5 6
r# 7 0123456789012345678901234567890123456789012345678901234567890123
740 @<0060.0060 - here is an 60 byte record---------------------->..
4333332333322266762672662332677627666762222222222222222222222300
0C0060E00600D0852509301E060029450253F24DDDDDDDDDDDDDDDDDDDDDDE00
1 2 3 4 5 6
r# 8 0123456789012345678901234567890123456789012345678901234567890123
804 @P0070.0080 - here is an 80 byte record-------------------------
4533332333322266762672662332677627666762222222222222222222222222
000070E00800D0852509301E080029450253F24DDDDDDDDDDDDDDDDDDDDDDDDD
64 ----------------->..
22222222222222222300
DDDDDDDDDDDDDDDDDE00
1 2 3 4 5 6
r# 9 0123456789012345678901234567890123456789012345678901234567890123
888 @.0080.0160 - here is a 160 byte record.........................
4A33332333322266762672623332677627666762222222222222222222222222
000080E01600D08525093010160029450253F24EEEEEEEEEEEEEEEEEEEEEEEEE
64 ..................----------------------------------------------
2222222222222222222222222222222222222222222222222222222222222222
EEEEEEEEEEEEEEEEEEDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
128 --------------------------------->..
222222222222222222222222222222222300
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDE00
Goto: Begin this document , End this document , UVSI Home-Page
Have you ever wished you had an easy way to convert tabs to blanks ? The Vancouver Utilities includes 3 pre-programmed jobs to do this.
| tabfix1 |
|
| tabfix2 |
|
| tabfix3 |
|
All of these are documented in UVjobs1.htm. Here we will demonstrate a simple version of tabfix1 to replace each tab with 4 blanks.
#1. cat tf/tabtest - display test file (note tab expansion when displayed)
==============
- the line below between === has 1 tab between words & without expansion
would appear as follows (using periods to represent the tabs):
a.bb.ccc.dddd.eeeee.ffffff.ggggggg.hhhhhh <-- periods
================================================================
a bb ccc dddd eeeee ffffff ggggggg hhhhhh <-- tabs
================================================================
#2. uvhd tf/tabtest t1h2 - use uvhd hexdump utility to see the tabs (x'09')
==================== - option t1 text file (records ended by LF x'0A')
- option 'h2' forces hexadecimal display
--> enter null 9 times to advance to line #10 (with x'09' tabs)
10 20 30 40 50 60
r# 10 0123456789012345678901234567890123456789012345678901234567890123
530 a.bb.ccc.dddd.eeeee.ffffff.ggggggg.hhhhhh.
60660666066660666660666666066666660666666660
1922933394444955555966666697777777988888888A
#3. uvcopy tabfix1,fili1=tf/tabtest,filo1=tmp/tabfix1.tmp,uop=t4 <-- hard way
=============================================================
#3a. uvcopy tabfix1 - easy way (I/O files & options default as shown above)
==============
#4. cat tmp/tabfix1.tmp - display output (note tabs converted to blanks)
=================== - but better to use uvhd (as shown in #5 below)
#5. uvhd tmp/tabfix1.tmp t1h2 - verify tabs x'09' to blanks x'20'
========================= - same options as #2 above & advance to line #10
10 20 30 40 50 60
r# 10 0123456789012345678901234567890123456789012345678901234567890123
526 a bb ccc dddd eeeee ffffff ggggggg hhhhhh.
622226622226662222666622226666622226666662222666666622226666660
10000220000333000044440000555550000666666000077777770000888888A
You can see that each tab x'09' (uvhd #2 above) has been converted to 4 blanks x'20's here in uvhd #5.
Goto: Begin this document , End this document , UVSI Home-Page
# tabfix1 - convert tabs to 4 blanks (simplified version of pre-programmed job)
# - actual pf/util/tabfix1 allows option for 1 to 8 blanks
#
fili1=?tf/tabtest,typ=LST,rcs=a256
filo1=?$jobname.tmp,typ=LSTt,rcs=b256
@run
opn all
# begin loop to copy records until EOF
loop get fili1,a0(256) get current record
skp> eof
mvc b0(256),a0 move input record to output area
#---------------------------------
rep b0(256),x'09',c' ' replace tabs with 4 blanks
#---------------------------------
put filo1,b0(256) write record to output file
skp loop
# end of file - close files & end job
eof cls all
eoj
These uvcopy jobs are easily changed (or copied & renamed) if you have other conversions that you would like to perform. For example, if you wanted to also convert formfeeds to linefeeds, (replacing page skips with blank lines), you could add a 2nd 'rep'lace instruction following that shown above:
#---------------------------------------------------------------
rep b0(256),x'09',c' ' replace tabs with 4 blanks
rep b0(256),x'0C',x'0A' replace FormFeed with LineFeed <-- add
#---------------------------------------------------------------
Here is an easier way to modify text files, similar to the above, but with many more options that can be selected at will. You can use the 'uvlist' utility as a filter with various combinations of the following options:
| t1-t9 |
|
| u1-u9 |
|
| c1 |
|
| d1 |
|
| d2 |
|
| f1 |
|
| w1 |
|
Here is the uvlist version of the demo shown above:
uvlist tf/tabtest t4i1h0p0 >tmp/tabtest =======================================
The other options shown (i1h0p0) are required to prevent uvlist from inserting Laser printer PCL5 codes & page headings.
Goto: Begin this document , End this document , UVSI Home-Page
Here are a few more of the many Pre-programmed jobs provided. These examples will use our 'sales3' test file, but please try substituting some of your own filenames.
#1a. uvcopy tolower - execute uvcopy with the 'tolower' prmfile
============== - filenames will be solicited from operator
or you can enter on command line as shown below:
#1b. uvcopy tolower,fili1=dat1/sales3,filo1=tmp/sales3L
==================================================
- demo test file provided (sales3 in UPPER case)
#1c. cat tmp/sales3L - inspect output
=============== - output can go in tmp subdir (cleaned periodically)
#2a. uvcopy toupper,fili1=tmp/sales3L,filo1=tmp/sales3U
==================================================
- convert lower case to UPPER case
#2b. cat tmp/sales3U - inspect output
===============
#3a. uvcopy toebcdic,fili1=dat1/sales3,filo1=tmp/sales3E
===================================================
- convert ASCII file to EBCDIC
#3a. uvhd tmp/sales3E a - display with uvhd editor in vertical hexadecimal
================== (option 'a' shows character line in ASCII)
#4a. uvcopy toascii,fili1=tmp/sales3E,filo1=tmp/sales3A
==================================================
- convert EBCDIC file to ASCII
#4b. cat tmp/sales3A - inspect output
===============
Goto: Begin this document , End this document , UVSI Home-Page
Use this job when you want to print multi column tickets, labels, etc. This assumes the input records contain some sequential# or alpha sequence that we wish to appear in sequence horizontally or vertically. Three versions of the program are provided:
| multicol1 |
|
| multicol2 |
|
| multicol3 |
|
These jobs read the entire file into memory to allow the vertical sequencing. By default 10 megabytes are reserved for the input area 'a', but you could increase to 100 meg or more if required depending on your memory available. Since 200 bytes are allowed for each record, 10 meg allows 50,000 records,& 100 meg would allow 500,000 records. You may modify 'was=a10000000' which appears about line #45 in the job (see listing 2 pages ahead).
0001 one 0002 two 0003 three 0004 four ------- etc ------ 0097 ninety seven 0098 ninety eight 0099 ninety nine 0100 one hundred
0001 one 0002 two 0003 three 0004 four
0005 five 0006 six 0007 seven 0008 eight
0009 nine 0010 ten 0011 eleven 0012 twelve
----------------- etc ------------------
0097 ninety seven 0098 ninety eight 0099 ninety nine 0100 one hundred
0001 one 0026 twenty-six 0051 fifty-one 0076 seventy-six
0002 two 0027 twenty-seven 0052 fifty-two 0077 seventy-seven
0003 three 0028 twenty-eight 0053 fifty-three 0078 seventy-eight
----------------- etc ------------------
0025 twenty-five 0050 fifty 0075 seventy-five 0100 one hundred
Goto: Begin this document , End this document , UVSI Home-Page
These jobs were suggested by Mike Fey of Datex Services Vancouver. The most important job to him was multicol3, since he already had an application to print horizontally, and he needed a way to rearrange the file to achieve the vertical column effect.
0001 one 0026 twenty six 0051 fifty one 0076 seventy six 0002 two 0027 twenty seven 0052 fifty two 0077 seventy seven ----- etc ----- 0025 twenty five 0050 fifty 0075 seventy five 0100 one hundred
# 0001 one 0026 twenty six 0051 fifty one 0076 seventy six # 0002 two 0027 twenty seven 0052 fifty two 0077 seventy seven # 0003 three 0028 twenty eight 0053 fifty three 0078 seventy eight # --------------------------- etc ---------------------------- # 0025 twenty five 0050 fifty 0075 seventy five 0100 one hundred
Note that if we feed the output of multicol3 into multicol1, we will get the same output as we did from multicol2 (as shown above & on the previous page).
Run the following & ensure that your outputs match those shown above. Option 'c' controls the number of columns per output line (default 4). Option 'w' controls width allowed for each record on output line (default 19). Option 's' controls the space between records on the output line (default 1). The number of columns is controlled by user option 'c' You may specify options on the command line (via uop=...) or at the prompt.
#1. uvcopy multicol1,fili1=?tf/test100a,filo1=tmp/testmc1,uop=c4w19s1
=================================================================
#2. uvcopy multicol2,fili1=?tf/test100a,filo1=tmp/testmc2,uop=c4w19s1
=================================================================
#3. uvcopy multicol3,fili1=?tf/test100a,filo1=tmp/testmc3,uop=c4
============================================================
#4. uvcopy multicol1 <-- you may omit filenames & options from command line
================ - you will be prompted to accept or override defaults
'multicol2' is listed on the next 2 pages & you may inspect any of these jobs in /home/uvadm/pf/util/...
Goto: Begin this document , End this document , UVSI Home-Page
# multicol2 - rearrange a file for multi-column printing (2up,3up,etc,20up) # - for printing multi column tickets, labels, etc # - 3 versions of this job: # multicol1 - creates multi-column output in horizontal sequence #*multicol2 (this job) - creates multi-column output in VERTICAL sequence # multicol3 - creates single-column output in vertical sequence for # user program that will print in horizontal sequence # # ** example - 4up ** # # demo input records have sequential#s: 0001 one, 0002 two...0100 one hundred # - the 1st 3 & last lines would be as follows: # # 0001 one 0026 twenty six 0051 fifty one 0076 seventy six # 0002 two 0027 twenty seven 0052 fifty two 0077 seventy seven # 0003 three 0028 twenty eight 0053 fifty three 0078 seventy eight # --------------------------- etc ---------------------------- # 0025 twenty five 0050 fifty 0075 seventy five 0100 one hundred # # This solution requires enough memory to hold the entire file in memory # - 200 bytes are allowed for each record (table entry in memory) # - 10 meg (default) allows 50,000 records of 200 bytes # - may increase by changing 'was=a10000000' (see below) # - number of columns is controlled by user option 'c' (default 4) # - output data width per column is specified by option 'w' (default 19) # - spacing between output data columns specified by option 's' (default 1) # - may change on the command line (via uop=c##) or at the prompt # - sample/demo command line for 4up tickets follows: # # uvcopy multicol2,fili1=?tf/test100a,filo1=tmp/testmc2,uop=c4w19s1 # ================================================================= # # ** counters & registers etc ** # # $uopbc - user option for number of columns desired (2up,3up,4up,etc) # $ca1 - total records read (from $ci1 after rtb) # $ca2 - records per column (total recs / no of columns) # $ca3 - bytes per column (recs/col * 200) (incrmnt to next vertical record) # $ca4 - column ctr for loop control (0,1,2,3,...$uopbc) # $ra - index register for records tabled in memory (200 bytes each max) # $rb - index register for next record slot in output line # $rc - index register for table record for next vertical column # $rw - index register for width of each data column (from $uopbw) # $rs - index register for space between data columns (from $uopbs) # opr='uop=q1c4w19s1 - option defaults' opr=' c4 - no of columns' opr=' w19 - width allowed for data in each column' opr=' s1 - space between data columns' uop=q1c4w19s1 # defaults was=a10000000b2000 # assign memory for area 'a' (entire file read into area a) fili1=?tf/test100a,typ=LST,rcs=200 filo1=?tmp/testmc2,typ=LSTt,rcs=200
Goto: Begin this document , End this document , UVSI Home-Page
@run
opn all open files
rtb fili1,a0(200),a0(200) read entire file into area a
mvn $ca1,$ci1 save no of lines read by rtb
mvn $rw,$uopbw load rgstr w with data width per col
mvn $rs,$uopbs load rgstr s with space between columns
mvn $ra,0 init rgstr a to 1st record in table
#
# if no of records not evenly divisible by no of columns, add extra to make even
mvn $cb1,$ca1 total records read
div $cb1,$uopbc / columns (remndr in $rem)
cmn $rem,0 zero remainder ?
skp= man10
mvn $cb2,$uopbc columns
sub $cb2,$rem - remndr of (ttlrecs/columns)
add $ca1,$cb2 add diff to make evenly divisible
#
# calculate 'records per column' & 'bytes per column'
man10 mvn $ca2,$ca1 total records
div $ca2,$uopbc / columns = recs per col
mvn $ca3,$ca2 records per column
mpy $ca3,200 * 200 = bytes per column
#
# inits for loop to write multi records to multi columns per line
man20 mvn $ca4,0 init column counter
mvn $rb,0 init rgstr for multi cols per line
clr b0(2000),' ' clear output line
mvn $rc,$ra init vert col table index from col1
#
# begin loop to insert multi records in current output line
# - selecting records from the table to appear in vertical column sequence
# - incrementing to next column record by precalculated bytes per column
# - bytes per output slot determined by option 'w' & 's' (now in rgstrs w & s)
man30 mvc bb0($rw200),ac0 insert from $rc at dsplcmt $rb for lth $rw
add $rc,$ca3 up to next input record for next column
add $rb,$rw up output rgstr by col width
add $rb,$rs up output rgstr by space between cols
add $ca4,1 up output columns ctr
cmn $ca4,$uopbc reached max cols per line ?
skp=> man40
cmn $rb,2000 reached max bytes per line ?
skp> man40
skp man30 return to insert next column current line
#
# reached max cols/line, or max bytes/line
# - write current line to output file & return to build next line (unless EOT)
# - up table control register & test end of column 1 (& end of table)
man40 put filo1,b0 write current line
add $ra,200 up to next record in col 1
cmn $ra,$ca3 end of col 1 (& end table) ?
skp< man20
#
# End of Table - close files & end job
man50 cls all
eoj
#
Goto: Begin this document , End this document , UVSI Home-Page