Part_0 | - Overview of Vancouver Utilities |
- for mainframe conversions & general purpose Unix/Linux utilities | |
- uvhd,uvhdcob,uvlist,uvcp,uvsort,uvcopy,uvqrpg,pre-programmed jobs | |
- cross-references, file comparisions, table summaries, etc | |
- converting fixed-field files to delimited format to load RDBMS tables | |
- generating scripts to create & load tables from COBOL copybooks |
Part_1 | - Preparations for Vancouver Utilities training |
- setup profiles to use Vancouver Utilities | |
- copy supplied demo files from /home/uvadm/dat1/ to your homedir dat1/ | |
- Unix/Linux tips | |
- vi editor tutorial |
Part_2 | - Test/Demo data files provided |
- customer master & sales history files | |
- sales detail files | |
- record layouts for reference when doing exercises |
Part_3 | - Basic Vancouver Utilities |
- uvhd, uvhdcob, uvlist, uvcp, uvsort | |
- examples & exercises |
Part_4 | - uvcopy, the most powerful of the Vancouver utilities |
- general purpose file maintenance & data manipulation utility | |
- user written or supplied (over 500 pre-programmed jobs supplied) | |
- easy to copy demo jobs & modify for your purposes | |
- examples & exercises, such as: | |
- create a telephone list from supplied customer master file | |
- create table summaries such as product sales by city & province | |
- write 'addup0' to accumulate $amount in sales file & display at EOF | |
- similar to 'addup1' in Part 6, pre-programmed job for any field any file |
Part_5 | - uvfix scripts make it easy to apply powerful uvcopy instructions |
without having to write the file I/O framework | |
- uvfix1 - copy 1 Text file to tmp/... applying uvcopy instructions | |
- may then inspect (with vi tmp/...) & copy back if desired | |
uvfixA - copy ALL Text files from 1 subdir to a 2nd subdir | |
while applying uvcopy instructions | |
uvfix2 - copy 1 Fixed-Length file to tmp/... applying uvcopy instructions | |
- may then inspect (with uvhd tmp/...) & copy back if desired | |
uvfixB - copy ALL Fixed-Length files from 1 subdir to a 2nd subdir | |
while applying uvcopy instructions | |
uvcpfix1 - copy 1 Text file to tmp/... applying 'uvcp' instructions | |
- may then inspect (with vi tmp/...) & copy back if desired | |
- simpler than uvfix1/uvcopy when changing file types only | |
uvcpfix2 - copy 1 Fixed-Length file to tmp/... applying 'uvcp' instructions | |
- may then inspect (with vi tmp/...) & copy back if desired | |
- option to output text (typ=LSTt) vs default typ=RSF (Fixed Length) |
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Part_6 | - Pre-programmed jobs (based on uvcopy) |
- addup1/2 - accumulate any field in any file by options for dsplcmnt(length) | |
- cobmap1,cleanup,cobfil51,uvcmp1,listISF,scan1d,rep1d,rep2d,datedemo1, | |
calendar1,tabfix1/2/3,escape1/2,table2,genacum2,genverify1 | |
- cross-references (COBOL copybooks, JCL/scripts using each program, etc) | |
- examples using mass change jobs rep1d & rep2d to change all uvlp | |
scripts for A4 paper (vs letter size) or to Xi-Text spooler (vs lp). |
Part_7 | - uvqrpg (Quick Report Program Generator) |
- makes it easy to create control level reports (up to 8 levels) | |
- up to 100 accumulators per level | |
- up to 255 summary tables | |
- examples & exercises |
Part_8 | - scripts (Korn shell, Bourne shell, Bash shell) |
- a few examples of over 500 supplied | |
- rename scripts make it easy to mass change all filenames in directory | |
- alldiff script compares all files in 2 directories | |
- dtree script illustrates directory trees |
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
This 'utilities' training plan is applicable to both mainframe conversion sites and to sites that do not need mainframe conversion tools, but do need general purpose utilities, to replace mainframe data utilities that are missing on Unix/Linux systems.
Applicable sites for 'utilities only' training may have already migrated using tools from other vendors, who do not provide the extensive utilities offered by UV Software to replace mainframe utility functions that are otherwise not available on Unix/Linux systems.
The Vancouver Utilities can replace mainframe utilities such as SORT, IDCAMS, IEBGENER, DITTO, EASYTRIEVE, etc with uvsort, uvsort, uvcp, uvhd, etc.
We recommend 2 weeks for this training, versus the 4 or 5 weeks recommended for the mainframe conversion training.
We will not give a day by day outline, since the course will be customized to the needs of each customer, but here is a list of suggested activities & topics.
The first day on-site, UV Software will install the software, and print documentation for each student (two three ring binders with tabs). The customers sysadmin should be involved in the installation.
We will need to be modify the profiles to provide access to the Vancouver Utility programs & scripts. UV Software recommends the 'stub' & 'common' profile system, that allows sysadmins to update the 'common profile' that is invoked by the 'stub profile' in each user's home directory. Please see the profiles described at https://www.uvsoftware.ca/admjobs.htm#Part_1.
To learn the basic Vancouver Utilities (uvhd,uvsort,uvlist,uvcp,uvcopy,etc) we will follow this training guide, referring to the program references as required ('uvhd.doc', uvsort.htm, etc).
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
0B1. | |
basic Vancouver Utilities |
'uvhd' is a file investigation utility, for files with packed/binary fields. uvhd is every customers favorite utility, an interactive utility that displays records in vertical hexadecimal, and prompts for commands to browse, search, select, update, search/replace, etc. See uvhd documentation at https://www.uvsoftware.ca/uvhd.htm.
'uvhdcob' is similar to uvhd, but also shows the COBOL copybook fieldnames beside the data contents. Excellent for verifying data conversions. You can see at a glance any mismatches between the data field contents & the COBOL field definitions. The 'v' Verify command will search the file for invalid digits or signs in unpacked or packed numeric fields, and for unprintable characters in pic x fields. See https://www.uvsoftware.ca/uvhdcob.htm.
'uvlist' is a utility for listing text files on laser printers. uvlist scripts are provided to print files at various cpi,lpi,margins,etc. For example, 'uvlp13LD' will print mainframe reports (132 cols x 66 lines) on 8 1/2 by 11 at 13 cpi, 8 lpi, Landscape, Duplex with margins for 3 hole punched paper. 'uvlp12D' is used to print the UV Software documentation. uvlist is great for listing scripts, programs, etc, because the page headings tell you vital info such as: filename, date, userid, filesize, page#, etc. See uvlist documentation at https://www.uvsoftware.ca/uvlist.htm.
'uvcp' is a command line data utility that can copy files, converting record formats between: fixed, variable, sequential, indexed, text, RDW, etc). uvcp (& uvsort,uvcopy,etc) are compatible with Micro Focus COBOL file formats IDXFORMAT1,3,& 8 (fixed indexed, variable sequential or indexed). uvcp also provides record select, reformat, translate, etc. See uvcp documentation at https://www.uvsoftware.ca/uvcp.htm.
'uvsort' is a sort utility for Unix/Linux with mainframe capabilities. The Unix system sort will NOT sort mainframe type files that do not have Linefeeds, may be indexed, and may have packed decimal sort fields. uvsort has the functionality of mainframe SORT - record select, reformat, etc. Also note that uvsort has all the commonly used functions of SyncSort and the entire Vancouver Utility package is a fraction of the SYNCSORT price. See uvsort documentation at https://www.uvsoftware.ca/uvsort.htm.
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
'uvcopy' is the most powerful of the Vancouver Utilities. It is ideal for processing data files migrated from the mainframe, because it can handle packed decimal fields, Indexed files, addressing fields by column#, etc. The usual Unix/Linux system utilities can not handle these features, which are common in mainframe utilities (SORT,IDCAMS,FILEAID,EASYTRIEVE,QUIKJOB,etc).
uvcopy is an interpreter for its 'parameter files' stored in the 'pf' library. Over 500 pre-programmed 'uvcopy jobs' are supplied in /home/uvadm/pf/... These jobs are used for many of the UV Software conversions, but many are useful for ongoing operations. For example to create a record layout from a COBOL copybook, you could use the 'cobmap1' job as follows:
uvcopy cobmap1,fili1=cpys/armaster,filo1=maps/armaster ======================================================
Some sites use uvcopy to perform tasks that they might have previously performed with Easytrieve or other mainframe utilities. For example some sites receive input from their customers on Excel spread sheets. uvcopy provides instructions to convert the ',' or '|' delimited export file from Excel into whatever fixed field record layout the site's COBOL programs require. See the Excel uvcopy demo at https://www.uvsoftware.ca/uvcopy5.htm#A1.
Note the uvcopy documentation is split into 7 books (uvcopy1 - uvcopy7). begining at https://www.uvsoftware.ca/uvcopy1.htm.
'uvqrpg' makes it easy to create control level reports, ie: reports with multiple total levels depending on specified control fields, such as customer#, salesman#, division, etc.
Page heading #1 (head1) specifies field positions simply by coding the field-names within the print line where ever you want them to print.
uvqrpg includes table/tbl/tbp table build/print instructions. This powerful feature allows you to build summary tables accumulating quantities & amounts by desired arguments (slsmn#, cust#, product#,etc). You can have up to 255 tables in 1 job & thousands of entries in each table.
See complete documentation at https://www.uvsoftware.ca/uvqrpg.htm
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
There are over 500 pre-programmed jobs supplied with the Vancouver Utilities, to perform various useful tasks at Unix/Linux sites. They are documented in functional groups (AIDjobs,CMPjobs,COPYjobs,LISTjobs,REPjobs,SCANjobs,etc). Here is a brief description of a few of the most useful pre-programmed jobs.
There are several pre-programmed jobs to create cross references for COBOL programs, copybooks, MVS JCL, VSE JCL, and the Korn shell scripts converted from MVS/VSE JCL. See documentation at https://www.uvsoftware.ca/xrefjobs.htm
xcobcall1 - list of all CALLED-PROGRAMs in each PROGRAM xcobcall2 - crossref all PROGRAMS calling any 1 CALLED-PROGRAM xcobcopy1 - list all COPYBOOKS in any 1 PROGRAM xcobcopy2 - crossref all PROGRAMS copying any 1 COPYBOOK xcobfile2 - crossref all PROGRAMS using each external-file xkshfile1 - list all DATAFILES used in any 1 ksh SCRIPT xkshfile2 - crossref show all ksh SCRIPTs using any 1 DATAFILE xkshprog1 - list all PROGRAMs executed in any 1 ksh SCRIPT xkshprog2 - crossref show all ksh SCRIPTS executing any 1 PROGRAM xkshproc1 - list all PROCs executed in each JCL/ksh/script xkshproc2 - shows all JCL/ksh/scripts executing each PROC xkshparm1 - list all SYSIN/PARM modules in each JCL/ksh/script xkshparm2 - shows all JCL/ksh/scripts referencing each SYSIN/PARM
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
The mainframe had extensive data file compare utilities that are absent on Unix/Linux systems. Vancouver Utilities fill this void. Please see https://www.uvsoftware.ca/cmpjobs.htm.
The 'CMPjobs' are designed for mainframe type files that may have packed/binary fields & do not have the LineFeeds required by the Unix/Linux 'diff' utility.
The pre-programmed job 'uvcmp1' prints mismatched record pairs in vertical hexadecimal with '*'s highlighting the differences. For example here is just 1 record pair from the demo shown at https://www.uvsoftware.ca/cmpjobs.htm#1D2.
uvcmp1 - compare 2 files, print mismatched records, '*' flag diffs 2008/05/24_16:35:30 uop=q1p30r256s8t500000v2x0y0z1r64 recsize reccount file-size typ Report=rpts/warmas1.cmp 1: 64 8 0 RSF File1=dat1/warmas1 2: 64 8 0 RSF File2=dat1/warmas1a 1 2 3 4 5 6 f#rec#byte# 0123456789012345678901234567890123456789012345678901234567890123 ============================================================================ 1 1 0 33333 11111 refrigerator 961231 3-year 991231 000006733 . 3333323333327667666767672222223333332327667233333323333333332220 3333301111102562975214F200000096123103D951209912310000006733000A ** * ** ** **** 2 1 33333 11111 refrigerator 961215 4-year 001215 000005500 . 3333323333327667666767672222223333332327667233333323333333332220 3333301111102562975214F200000096121504D951200012150000005500000A ** * ** ** ****
CMPjobs provide for various file types (fixed, variable, sequential, indexed, ASCII, EBCDIC) and there are options for up to 4 exclude fields (date/time,etc).
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
You can use a pre-programmed 'TABLEjob' to read thru your data file, building a table in memory, based on a specified argument field, accumulating 1 or 2 amount/quantity fields. At EOF, the table is dumped to a report file sorted in sequence by the argument field.
For example, here is the command to create the product summary table shown at: https://www.uvsoftware.ca/tablejobs.htm#C1
uvcopy table2,fili1=dat1/sales3,uop=a30b6c38d6e53f9r64 ====================================================== - create a summary table of sales by product# a30b6 - defines the product# (start byte 30, length 6) c38d6 - defines the quantity (start byte 38, length 6) e53f9 - defines the $ amount (start byte 53, length 9) r64 - defines the record size
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
'table2' is a pre-programmed job to create table summary reports without having to write uvcopy instructions. 'table2' requires 120 uvcopy instructions, since it needs to interpret the user's options (a30b6,etc) into the actual uvcopy instructions.
If you wrote a custom uvcopy job to create the above table summary, it would require only 12 uvcopy instructions. This is because it requires only 1 instruction (tbl) to build the table & 1 instruction (tbp) to output at EOF. See uvcopy job 'sltbl1' listed at https://www.uvsoftware.ca/tablejobs.htm#G2 Or see the similar 'cmtbl1' uvcopy job listed at the bottom of page '0E1'.
I think you will agree that a COBOL program to create the above summary table would probably take hundreds of lines of code. COBOL would require a lot of code to create new entries for new arguments, add to existing entries on matching arguments, calculate percentages based on the 100% total line, and dump the table in argument sequence.
Note that there is a table2 'script' (that calls 'uvcopy table2'), which makes it easier to key the command. The script equivalent of the above is:
table2 dat1/salles3 a30b6c38d6e53f9r64 ======================================
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
There are several sub-systems that customers might choose to implelement. We call these sub-systems because they require some setup (vs pre-programmed jobs), but they can be extremely useful. Here are a few suggestions.
'genacum2' is a Vancouver Utility to generate uvcopy jobs to accumulate all numeric fields (packed/zoned/binary) in 1 or all data files. The jobs are generated automatically from the 'cobmap' record layout (which is generated from the COBOL copybook).
You might use these reports to verify data file conversions, OR to get a 2nd opinion on suspicious looking totals on your COBOL reports.
We can use your copybooks to generate jobs to accumulate All numeric fields for All your data files. Then you can run them whenever the need arises. Here is the sample from the documentation at https://www.uvsoftware.ca/datacnv1.htm#8G1
uvcopy pfa1/customer.master <-- execute job to accumulate all numeric fields ===========================
genacum2 RCSZ=00256 DataFile=d2asc/custmas1 2009/02/26_09:22:03 copybook=cpys/custmas1.cpy line# Field-Name occurs start lth type field-total
1 cm-num 0005 006 n 7,259,353 2 cm-thisyr-sales 12 0124 005 pns 99,697.93 3 cm-lastyr-sales 12 0184 005 pns 45,440.85
Record count 32 Hash-Total 21,773,231 **
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
'uvhdcob' (already covered as item #4) is 1 of the basic Vancouver Utilties that displays data field contents beside the COBOL copybook fieldnames. 'uvhdc2' is a script that makes uvhdcob much easier to use.
Using 'uvhdcob' directly, you must specify both the data-file-name & the copybook-name, which might involve long path-names since they are usually in different file systems.
Using the 'uvhdc2' script, you need only specify the data-file-name with one level of sub-directory. This avoids long path-names & means you can run it from anywhere.
This is enabled by setting up a control file to relate the data-file-name to the copybook. See details starting at https://www.uvsoftware.ca/uvhdcob.htm#H1. Here is the sample command & display shown at uvhdcob.htm#H3.
uvhdc2 ar/customer.master <-- uvhdc2 script requires only data-file-name ========================= - omitting copy-book-name required by uvhdcob
rec# 1 fieldname occurs bgn end typ<------ data (hex if typ=p/b) -----> 001 cm-num 0 5 n 130140 002 cm-delete 6 9 003 cm-name 10 34 EVERGREEN MOTORS LTD. 004 cm-adrs 35 59 1815 BOWEN ROAD 005 cm-city 60 75 NANAIMO 006 filler001 76 76 007 cm-prov 77 78 BC 008 filler002 79 79 009 cm-postal 80 89 V9S1H1 010 cm-phone 90 101 250-754-5531 011 cm-contact 102 119 LARRY WRENCH 012 cm-thisyr-sales 012 120 124pns 001234567C 013 cm-lastyr-sales 012 180 184pns 001234567D 014 filler003 240 255 C 19950531
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
The vancouver Utilities can convert your fixed length data files to "delimited","format" for loading Relational Database tables, and also generate the scripts to create & load the RDBMS Tables.
https://www.uvsoftware.ca/sqldemo.htm shows you how to generate all these automatically from your COBOL copybooks. Here is the sample data file and "delimited","file" used to demo these procedures.
130140 EVERGREEN MOTORS LTD. 1815 BOWEN ROAD NANAIMO BC 139923 JOHNSTONE BOILER 1250 EAST PENDER ST. VANCOUVER BC 150825 RIGGERS INDUSTRIAL 960 - 6TH AVENUE HOPE BC
uvcopy delimcust1,fili1=dat1/cust1,filo1=dat1/cust1.txt ======================================================= - convert fixed-field format to "delimited","format"
130140,"EVERGREEN MOTORS LTD.","1815 BOWEN ROAD","NANAIMO","BC" 139923,"JOHNSTONE BOILER","1250 EAST PENDER ST.","VANCOUVER","BC" 150825,"RIGGERS INDUSTRIAL","960 - 6TH AVENUE","HOPE","BC"
Creating tables manually would be very laborious for files with many fields. UV Software provides uvcopy job 'sqlcreate1' to automatically generate Oracle batch-files to create tables. The job also generates the SQL*LOADER control file to load the table. These jobs are demonstrated at SQLdemo.htm, and more extensively documented at DATAcnv1.htm#4F1 - 4F5.
sqlcreateA cust1.cpy <-- generate scripts to create & load RDBMS Table ====================
/* create_cust1.sql - SQL batch file to create a table */ /* --> sqlplus user/pass @sqls/create_cust1.sql <-- */ DROP TABLE cust1; CREATE TABLE cust1 ( cm_num number (06) , --#001 9(6). cm_name char (0022) , --#002 x(22). cm_adrs char (0022) , --#003 x(22). cm_city char (0016) , --#004 x(16). cm_prov char (0002) --#005 x(2). ); exit;
-- load_cust1.ctl - SQL*LOADER control file to load Oracle table -- --> sqlldr user/pass control=sqls/load_cust1.ctl <-- load data infile 'd4pipe/cust1.dat' into table cust1 fields terminated by '|' optionally enclosed by '"'
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Up to this point we have been illustrating pre-programmed uvcopy jobs to solve various problems by specifying options &/or generating jobs from your COBOL copybooks.
Of course you will encounter many situations where you must write new code to solve unique data file problems or create customized reports.
uvcopy is ideal for these situations because it can do many things not possible with the standard unix/linux utilities (such as processing packed decimal fields & handling Indexed files compatible with Micro Focus COBOL).
Given - customer master sales file of 256 byte records ===== - this year monthly sales in 12 * 5 byte packed fields starting at 120 - last year monthly sales in 12 * 5 byte packed fields starting at 180 - province code in bytes 77-78
Required - write a job to create the table summary report shown below ======== - how may lines of code would it take in COBOL ?
cmtbl1 2009/03/18_06:49:31 sales by province (this yr & last yr) dat1/custmas1 tbl#001 pg#001 -argument- -acum#1- % -acum#2- % line# count % province thisyr sales lastyr sales 1 3 9 AB 323.13 0 1,534.06 3 2 10 31 AL 27,274.33 27 33,552.35 73 3 16 50 BC 64,877.23 65 3,494.47 7 4 3 9 YK 7,223.24 7 6,859.96 15 32*100 *TOTAL* 99,697.93 *100 45,440.84 *100
# cmtbl1 - table analysis of customer master sales history file opr='$jobname - summarize sales (thisyr&lastyr) by province' fili1=?dat1/custmas1,rcs=256,typ=RSF filo1=?tmp/$fili1,rcs=80,typ=LSTt @run opn all # begin loop to read all customer master sales history records # - crossfooting & accumulating (tabling) thisyr & lastyr totals loop get fili1,a0(256) skp> eof xft $ca1,a120(5p),12 xft $ca2,a180(5p),12 tblt1f2 a77(2),'province;thisyr sales;lastyr sales',$ca1,$ca2 skp loop # end of file - print/edit the table to a file for: lp, cat,or vi eof tbpt1s1 filo1,'sales by province (this yr & last yr)' cls all sysv1 'cat $filo1' eoj
See more table summary jobs at https://www.uvsoftware.ca/tablejobs.htm#G1
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Several UV Software customers have COBOL applications that require fixed field record inputs. These unix/linux sites may have remote clients that create data inputs using excel spread-sheets. They can export the spread-sheet data to a pipe delimited text file & email it to the unix/linux processing site.
000100|Owen Townsend|4667 Hoskins Rd|North Vancouver|BC|V5P3V8| 000200|Gordon Campbell|1234 Government St.|Victoria|BC|V1P2G3| 000300|Stephen Harper|24 Sussex Drive|Ottawa|ON|K1Y2L6| 000400|George Bush|1600 Pennsylvannia|Washingtom|DC|00001| 000500|Bill Gates|1 Microsoft Way|Redmond|WA|98052|
000100 Owen Townsend 4667 Hoskins Rd North Vancouver BC V5P3V8 000200 Gordon Campbell 1234 Government St. Victoria BC V1P2G3 000300 Stephen Harper 24 Sussex Drive Ottawa ON K1Y2L6 000400 George Bush 1600 Pennsylvannia Washingtom DC 00001 000500 Bill Gates 1 Microsoft Way Redmond WA 98052
Output: 00-09=cust# 10-29=name 30-49=adrs 50-69=city 70-71=prov 73-79=zip
uvcopy delim2fix,fili1=data/nameadrsd,filo1=tmp/nameadrsf <-- execute job =========================================================
uvcopy delim2fix <-- same as above, since file I/O defaults as shown above ================ - coded in job below with '?' which prompts to allow change
# delim2fix - demo convert pipe delimited data to fixed length records rop=r1x2 # Run OPtions to prompt user for outfile display (dflt more) fili1=?dat1/nameadrs2d,rcs=128,typ=LST filo1=?tmp/nameadrs2f,rcs=80,typ=RST @run opn all open files loop get fili1,a0(128) get next delimited record into area 'a' skp> eof fix b0(20),a0(80),6,'|' convert to fixed 20 byte fields in area 'b' mvc c0(6),b0 cust# to output cols 00-05 mvc c10(60),b20 name, adrs, city to 10-29,30-49,50-69 mvc c70(2),b80 province to 70-71 mvc c73(7),b100 zip code to 73-79 put filo1,c0(80) write out current record skp loop return to get next record eof cls all close files # sysv1 'more $filo1' run option 'rop=r1x2' prompts to display (more default) eoj end job
See more delimited file conversions at: https://www.uvsoftware.ca/uvcopy5.htm
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
https://www.uvsoftware.ca/admjobs.htm describes several subsystems that are used when UV Software converts mainframe systems to Unix/Linux. Some of these may also apply to any Unix/Linux site.
Part1 |
|
Part2 |
|
Part3 |
|
Part4 |
|
Part5 |
|
Part6 |
|
Part7 |
|
Part8 |
|
xcobcall1 - list of all CALLED-PROGRAMs in each PROGRAM xcobcall2 - crossref all PROGRAMS calling any 1 CALLED-PROGRAM xcobcopy1 - list all COPYBOOKS in any 1 PROGRAM xcobcopy2 - crossref all PROGRAMS copying any 1 COPYBOOK xcobfile2 - crossref all PROGRAMS using each external-file xcobsql1 - list all SQL Includes in any 1 PROGRAM xcobsql2 - crossref all PROGRAMS using any 1 SQL Include xkshfile1 - list all DATAFILES used in any 1 ksh SCRIPT xkshfile2 - crossref show all ksh SCRIPTs using any 1 DATAFILE xkshprog1 - list all PROGRAMs executed in any 1 ksh SCRIPT xkshprog2 - crossref show all ksh SCRIPTS executing any 1 PROGRAM xkshproc1 - list all PROCs executed in each JCL/ksh/script xkshproc2 - shows all JCL/ksh/scripts executing each PROC xkshparm1 - list all SYSIN/PARM modules in each JCL/ksh/script xkshparm2 - shows all JCL/ksh/scripts referencing each SYSIN/PARM
xcobcopy2 ** crossref all PROGRAMS using each COPYBOOK ** Keyword=copy:include Exclude=unix Include=.cpy page# 1 Directory=/home/mvstest/testlibs/cbls Options=a16b16c4e3l1q0i7 =======================================================2008/04/05_11:46:21
custmas.cpy car100.cbl car120.cbl car130.cbl car140.cbl ____________6 car150.cbl car200.cbl
*paymas.cpy cpy100.cbl
saledtl.cpy_2 car150.cbl car200.cbl
sdline.cpy car200.cbl
stline.cpy car200.cbl
Note |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
1A1. | Introduction & Suggested Procedures |
1A2. | Test/Demo training files supplied in /home/uvadm/... |
1A3. | Vancouver Utilities /home/uvadm/... subdirs |
1A4. | Preparation for Training exercises |
1A5. | copy test/demo files to your homedir |
- 1st make subdirs for various file types | |
1A6. | summary list of training files |
1B1. | Unix/Linux tips for new users |
1B2. | Stay in your working directory & address files thru subdirs |
1B4. | Setup a 'tmp/' subdir in your working directory (keep it clean) |
1B5. | script 'cleandir1' to move any files in working directory to a subdir |
1B6. | File Naming Conventions (append a digits, misspell, use a common prefix) |
1C1. | vi editor command summary (minimum essentials) |
1C1. | - operation modes (command or insert), cursor movement |
1C2. | - insert, delete, copy, move, |
1C3. | - search, substitute, miscellaneous |
1C4. | - mark begin/end lines & copy |
1C5. | - registers to yank lines & put elsewhere |
- write & quit | |
1C6. | - .vimrc file, vim backup,& vim references |
1D0. | vi editor tutorial |
- edit demo script files hello1,hello2,hello3,hello4,hello5 | |
- instructions at begining of each demo script file | |
1D1. | modify using 'R' (multi-byte Replace) |
1D2. | modify using 'x' (delete char) & 'i' (Insert chars) |
1D3. | modify using 'cw' (Change Word) |
1D4. | modify using 'yy' (yank) line & 'p' (put) line |
1D5. | modify using 'o' (open) line in insert mode & '.' repeat command |
1E1. | vi exercise, correct mistakes in nursery rhyme "Hey Diddle Diddle ..." |
1F1. | vi exercise for the 'm' 'mark' command |
- to 'mark' blocks of text for move,copy,delete,write,etc | |
- given demo file uvtrain_contents (52 lines, 7 Parts) | |
- Delete odd# Parts & Move even# Parts to reverse sequence |
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
This section will be used during training courses conducted by UV Software, and this is also intended to be used as a self-study guide. These exercises will refer you to relevant sections in the utility program references for uvhd, uvlist, uvcp, uvsort,& uvcopy.
You could become proficient in these utilities by studying the program references only, but these exercises will help you get started & give you some method of measuring your progress.
The exercises will start with the easiest to use utilities (uvhd, uvlist, uvcp, & uvsort), and then progress to the more complex/powerful uvcopy.
Part_2 will illustrate several test/demo files to be used in the following exercises. You will often be referred to these file layouts, since they are used as inputs to the various exercises.
Note that the record layouts field locations are documented as column positions which are relative to one as the first byte of the record. All Vancouver Utility program addresses must be zero relative, so always subtract 1 from the column locations given. If the documentation refers to a 'column#', it is one relative; if it refers to a 'byte#', it is zero relative.
Most users of this package will be mainframe customers who are converting to Unix/Linux systems. These test files will illustrate the differences between mainframe files and UNIX files. For more information on the methods used to transfer and translate mainframe files to UNIX, please see DATAcnv1.htm.
If you are the only user, you could stay in the 'uvadm' main directory, so you can have easy access to the input test files in 'dat1'.
I suggest you make a 'tmp' sub-directory (mkdir tmp) for the various output files generated during these exercises. This will keep the 'uvadm' main directory uncluttered & when exercises are complete you can remove all tmp files & the sub-directory itself. (rm tmp/* & rmdir tmp)
Please see the next page for multi-user procedures --->
(a BETTER alternative whether single or multi-user)
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
We recommend setting up userid 'uvadm' & installing the software in its home directory which would usually be /home/uvadm. We allow for alternate locations' by defining environmental variable '$UV' in the profile as follows:
export UV=/home/uvadm #<-- default location of Vancouver Utiltiies ===================== export UV=/opt/uvsoftware/uvadm #<-- possible alternate location ===============================
To use the Vancouver utilities, you must setup your profile as described at https://www.uvsoftware.ca/install.htm#A5. If the package is already installed and you are a new user, you can conCATenate the supplied profile onto your existing profile as follows:
cat $UV/env/stub_profile >>.profile <-- for Unix/Korn shell users =================================== cat $UV/env/stub_profile >>.bash_profile <-- for Linux/Bash shell users ========================================
Please see all installation directories summarizedat install.htm#A2. The following are rlevant to the training exercises in this document.
$UV/bin/... - contains Vancouver Utility programs (compiled from $UV/src). (uvhd, uvlist, uvcp, uvsort, uvcopy) - this directory must be in your PATH (defined in your .profile)
$UV/mf/cpys - COBOL copybooks describing record layouts for data files (custmas1.cpy, salesdtl.cpy, etc)
$UV/dat1/... - test data files for UV training exercises (custmas1, custmas2, custmas3, sales1, sales2, sales3, etc) - demo file for vi mark exercise (uvtrain_contents)
$UV/mf/maps - 'cobmap's created from COBOL copybooks (custmas1.map, salesdtl.map, etc) - shows field start/end/length/type on right side
$UV/pf/... - parameter files (pre-programmed jobs) for the uvcopy utility example: cobmap - create record layouts from COBOL copy-books - sub-directoried pf/adm, pf/demo, pf/IBM, pf/util directories defined by env-var PFPATH (see below)
$UV/sf/... - script files supplied with the Vancouver Utilities example: uvlp12 - script to execute uvlist & pipe to a printer - sub-directoried sf/adm, sf/demo, sf/IBM, sf/util - add to your PATH as shown below
$UV/sf/demo/.. - script files for 'vi' editor tutorial at '1D0' (hello1,hello2,hello3,hello4,hello5)
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
/home/uvadm <--- usual installation (homedir of VU admin) /opt/uvsw/uvadm <--- alternative installation $UV <--- could be anywhere defined by $UV (/home/uvadm default) :-----bin <-- binaries (uvcopy,uvsort,etc), distros for RedHat Linux :-----ctl - control files for various purposes :-----dat1 - test data files :-----doc - Vancouver Utilities documentation (text) :-----dochtml - documentation in HTML (same as on www.uvsoftware.ca) :-----env <-- profiles for Unix/Linux users & administrators :-----hdr - hdr files for C compiles :-----htmlcode - merged into dochtml when text converted to HTML :-----lib - libraries for C compiles (subfunctions,DISAM,etc) :-----mvstest <-- test/demos for MVS JCL/COBOL mainframe conversions : :-----... - many subdirs omitted, see JCLcnv1demo.htm#3B2 :-----pf <-- Parameter Files for uvcopy & uvqrpg : :-----adm - administrative jobs : :-----demo - demo jobs : :-----IBM - IBM mainframe conversion jobs : :-----util - utility jobs :-----sf <-- Script Files : :-----adm - administrative scripts : :-----demo - demo scripts : :-----IBM - IBM mainframe conversion scripts : :-----util - utility scripts :-----sfun - ksh functions used in converted JCL/scripts : - jobset51,jobend51,exportgen0,exportgen1,logmsg1,etc :-----src <-- Vancouver Utilities C source code :-----srcf - C source for various sub-functions :-----tf - test files for various examples in doc :-----tmp - tmp subdir (test/demo outputs) :-----vsetest <-- test/demos for VSE JCL/COBOL mainframe conversions : :-----... - many subdirs omitted, see VSEJCL.htm
/home/appsadm <-- setup user 'appsadm' (your site admin vs uvadmin) :-----env - copy profiles from /home/uvadm/env/... : :-----common_profile - common profile (called by stub_profile) : : - customize as desired for your site : :-----stub_profile - copy to homedirs & rename .profile or .bash_profile
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
export UV=/home/uvadm #<-- default (line 36 of common_profile_uv) export UV=/opt/uvsw/uvadm #<-- alternate suggested
All subsequent references in the profiles use '$UV', for rexample:
export PATH=$PATH:$UV/bin:$HOME/bin:$HOME/sf:...etc... ======================================================
cp $UV/env/common_profile_uv /home/appsadm/common_profile_ABC =============================================================
cp $UV/env/stub_profile_uv $HOME/.profile <-- for Unix ========================================= cp $UV/env/stub_profile_uv $HOME/.bash_profile <-- for Linux ==============================================
cp $UV/dat1/custmas1 data/ ==========================
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Your system administrator may already have setup your user .profile to use the Vancouver utilities (see Installation Guide for recommendations). But if not you can do the following - quick & dirty, 1 time use. - Assuming you are 'userxx' & your homedir is /home/userxx - Assuming Vancouver Utilties hame directory defined by symbol $UV
export HOME=/home/userxx ========================
export UV=/home/uvadm <-- define location of VU =====================
export UV=/opt/uvsoftware/uvadm <-- alternate location of VU ===============================
#1. export PATH=$PATH:$HOME/bin:$HOME/sf export PATH=$PATH:$UV/bin:$UV/sf/adm:$UV/sf/demo:$UV/sf/IBM:$UV/sf/util ======================================================================= search for executable programs & scripts, 1st in user dirs, 2nd in VU dirs
#2. export PFPATH=$HOME/pf:$UV/pf/adm:$UV/pf/demo:$UV/pf/IBM:$UV/pf/util ==================================================================== - search for uvcopy jobs, 1st in user subdir, 2nd in VU subdirs
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
If you were the only user, you could work directly in the uv directory, but it is better to work in your own home directory (single or multi-user).
#1. login --> your homedir
#2a. mkdir dat1 <-- make subdir for demo datafiles ========== #2b. mkdir cpys <-- make subdir for copybooks ========== #2c. mkdir maps <-- make subdir for copybook layouts (maps) ========== #2d. mkdir pf <-- make subdir for uvcopy jobs ========== #2e. mkdir sf <-- make subdir for scripts ========== #2f. mkdir tmp <-- make tmp subdir in your home directory ========= to receive output of various exercises
#3. copyUVdemodiles ==================== - execute script to copy demo files required for uvtrain.doc - script listed below
# copyUVDemoFiles - copy demo files for uvtrain exercises # - by Owen Townsend, UV Software, January 2014 echo "copyUVDemoFiles - copy demo files for uvtrain exercises" echo "You should be in your homedir & should have created subdirs" echo "- as per www.uvsoftware.ca/uvtrain.htm#1A4" mkdir dat1 cpys maps pf sf tmp # err OK if already present cp $UV/dat1/custmas[0-4] dat1 cp $UV/dat1/sales[0-4] dat1 cp $UV/dat1/diddle1 dat1 cp $UV/dat1/uvtrain_contents dat1 cp $UV/tf/test100 dat1 cp $UV/sf/demo/hello* sf cp $UV/mf/cpys/custmas cpys cp $UV/mf/maps/sales cpys exit 0
Note |
|
export UV=/home/uvadm <-- default value of 'UV' ===================== - sites may modify if desired
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
/home/useridxx :-----cpys <-- COBOL copybooks : :-----acntmas.cpy : :-----citytax1.cpy : :-----custmas1.cpy : :-----saledtl.cpy : :-----sales.cpy : :-----vendormas.cpy : :-----warmas3.cpy :-----dat1 <-- test/demo data files : :----- custmas0 : :----- custmas1 : :----- custmas2 : :----- custmast.dat : :----- custmast.idx : :----- diddle1 : :----- sales0 : :----- sales1 : :----- sales2 : :----- vendormas* :-----maps <-- record layouts (maps) from copybooks : :----- acntmas : :----- citytax1 : :----- custmas1 : :----- saledtl : :----- sales3 : :----- vendormas : :----- warmas3 :-----sf <-- script files for 'vi' training turorial : :----- hello1 : :----- hello2 : :----- hello3 : :----- hello4 : :----- hello5 :-----tmp <-- for your output files - see tip#2 on page '1B3'
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Your working directory should contain only subdirectories, and all files should reside within sub-directories. In the following example, your working directory should be 'testlibs'
/p1 :-----testlibs <-- working directory : :-----cbl0 - COBOL programs from mainframe : :-----cbl1 - cleaned up, cols 1-6 & 73-80 cleared, etc : :-----cbl2 - cnvMF5 converts mainframe COBOL to MicroFocus COBOL : :--*--cbls - copy here (standard source library) before compiling : :--*--cblst - cobol source listings from compiles : :--*--cblx - compiled COBOL programs (.int's) : :-----cpy0 - for COBOL copybooks : :-----cpy1 - cleaned up, cols 1-6 & 73-80 cleared, etc : :-----cpy2 - cnvMF5 converts mainframe COBOL to MicroFocus COBOL : :--*--cpys - copy here (standard copybook library) : :--*--ctl - conversion control files (jclunixop51,cobdirectives) : :-----jcl0 - test/demo JCLs supplied : :-----jcl1 - intermediate conversion 73-80 cleared : :-----jcl2 - PROCs expanded from procs : :-----jcl3 - JCLs converted to Korn shell scripts : :-----jcl4 - JCL/scripts with file info #cmts (I/O,recsize,P/B) : :--*--jcls - copy here to begin each job test/debug (in $PATH) : :--*--maps - 'cobmaps' record layouts generated from copybooks : :--*--pf - uvcopy jobs to replace utilities (easytrieve,etc) : :-----parm0 - control cards & includes (SORT FIELDS, etc) : :--*--parms - control cards with 73-80 cleared : :-----proc0 - test/demo PROCs supplied : :-----procs - will be merged with jcl1, output to jcl2 : :--*--sf - for misc scripts you may wish to write : :--*--tmp - tmp subdir used by uvsort & various conversions : :--*--xref - cross-references (see XREFjobs.htm)
The above shows all subdirs required for mainframe conversions, but only the subdirs marked with '*' need to be retained after conversion.
You should work 1 level above your files & address your files through a sub- directory. In the example above, you would edit your programs as follows:
cd /p1/testlibs <-- change to working directory cdl <-- alias 'cdl' changes to $RUNLIBS (defined in profile)
vi cbls/apay100.cbl <-- address program thru subdir ===================
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
mfcbl1 car100.cbl <-- compile 1 COBOL program ================= - script assumes program is in subdir 'cbls'
cnvMF51 cbl0/CAR100.cbl <-- convert program from cbl0->cbl1->cbl2->cbls ======================= - script assumes cbl1,cbl2,cbls are below you
jcl2ksh51 jcl0/JAR100.jcl <-- convert JCL from jcl0->jcl1->jcl2->jcl3->jcls ========================= - script assumes jcl1,jcl2,jcl3,jcls are below you
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Normally you will only edit 1 program at a time because you will usually then compile the program & the compile script must run above the subdirs because it needs to reference source, copybooks,& compiled libraries.
It makes no sense to change into the subdir, edit 1 program,& then change back to compile the program. That would use 4 commands vs only 2 commands when you work above the subdirs.
#1. cd cbls <-- change into subdir =======
#2. vi car100.cbl <-- edit program (specify just filename) ============= (but overall less efficient)
#3. cd .. <-- change back out (to compile program) =====
#4. mfcbl1 car100.cbl <-- compile program =================
#1. vi cbls/car100.cbl <-- edit program (specify subdir/filename) ================== (but overall more efficient)
#2. mfcbl1 car100.cbl <-- compile program =================
When you move onto the next program, your keystrokes are minimized by using your shell history & changing only the program name.
#3. vi cbls/car200.cbl <-- edit 2nd program ================== #4. mfcbl1 car200.cbl <-- compile 2nd program =================
When you have extensive editing to do on multiple files in the same subdir, of course you would change into the directory, do the edits,& change back.
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
I recommend setting up a 'tmp' subdirectory in your various working directories, and use it for any temporary files, rather than clutter up your working directory (keep your working directory clean, subdirs only).
#1a. grep 'UPSI' cbls/* >tmp/upsi <-- extract lines with UPSI
#1b. vi tmp/upsi <-- review results with editor
#1c. uvlp12 tmp/upsi <-- print results
#2a. vi cbls/apay100.cbl - edit program apay100.cbl ma - mark start of desired paragraph (mark 'a') mb - mark end of desired paragraph (mark 'b') :'a,'b w tmp/chkdigit - write paragraph out to tmp subdir (from mark 'a' to mark 'b') :q - quit edit apay100
#2b. vi cbls/apay200.cbl - edit program apay200.cbl -- - move to desired point :r tmp/chkdigit - read paragraph into apay200.cbl :wq - write/quit apay200
Don't confuse our 'tmp' subdir with /tmp which is a system wide directory.
/tmp - system temporary directory /home/joe/tmp - Joe's temporary directory /p1/testlibs/tmp - temp subdir for test libraries
You would clean out your 'tmp' subdir at least once a day, or you could setup a 'crontab' to do this automatically.
If multiple programmers working in shared directory (such as /home/testlibs) & desire their own tmp subdir, I suggest they append their initials (tmpaa, tmpbb, etc). Cron job can still clean out via 'rm tmp*/*'.
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
If you do want to cleanup an existing working directory with a lot of mixed files & subdirs, you might find the 'cleandir1' script handy.
#1. cd workdir?? ============
#2. mkdir cleanup <-- make subdir to receive files =============
#3. cleandir1 cleanup <-- move files in current dir to subdir 'cleanup' =================
#4. mv cleanup/... subdirxx <-- move desired files to desired subdirs =======================
# cleandir1 - cleanup current directory by moving files to subdir # - by Owen Townsend, UV Software, Aug 12/2009 # - we recommend no files in working directory # - all files should be stored in appropriate subdirs d=$1 if [[ ! -d "$d" ]]; then echo "usage: cleandir1 subdir <-- arg1 must be a directory" echo " ================" echo " cleandir1 cleanup <-- example" echo " =================" exit 99; fi x=0 for f in * { if [[ -f $f ]]; then echo "moving $f to $d" mv $f $d ((x=x+1)) fi } echo "$x files moved to $d" exit 0
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
It is a good idea to append a digit (1,2,3,etc) on the end of filenames. For example: 'customer1', 'sales1', etc. This provides several long lasting advantages thru out the life of our applications:
It is a good idea to intentionally misspell filenames for the same reasons as explained above (appending a digit (1,2,3) on the end of filenames). Misspelling also makes them unique & easy to find with vi,grep,find,etc. For example 'tmp' vs 'temp', 'wrk' vs 'work', etc.
Common prefixes make it easy to find related files with 1 command. For example if I wanted to find all instances where my utilities are called in the scripts directory: ('uv' is common to uvcopy,uvsort,uvlist,uvqrpg,uvhd,etc).
grep 'uv' scripts/* ===================
grep 'uv' sf/*/* (uvadm scripts are sf/adm/* sf/demo/* sf/util/* sf/IBM/*) ================
Goto: Begin this doc , End this doc , Index this doc , Contents this library , 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 up-arrow | | h <-- . --> l left-arrow <-- . --> right-arrow | | j down-arrow
^d - down 1/2 screen ^u - up 1/2 screen
Note |
|
: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 doc , End this doc , Index this doc , Contents this library , 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 doc , End this doc , Index this doc , Contents this library , 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)
^+A - increment the number under the cursor - cursor can be anywhere on a multi-digit number - '^' represents the 'control key'
ga |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
m[a-z] |
|
m a |
|
mb |
|
'a - goto mark 'a' (addressed by preceding with sungle quote) - NO preceding ':' as on following commands
:'a,'b - address a range of lines from previously marked a & b - may use with 'move' & 'copy' as follows:
:'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
vim dir/file1 <-- edit file1
ma |
|
mb |
|
:'a,'b w tmp/file1x <-- Write selected lines to tmp/... =================== :q - quit editing file1
vim dir/file2 <-- edit file2
... - move cursor to line above desired insert
:r tmp/file1x <-- read lines (selected from file1) into file2 ============= :wq - write & quit
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Registers are addressed by preceding '"' double quote vs single quote for marks. Registers are handy for capturing data lines for later insertion as desired.
"a 5yy - yank 5 lines into register "a "a5yy - no need to leave space between register ID & Yank number & command
"a p - put contents of register "a (following current line)
"A 2yy - Append 2 more lines to contents of register "a (Upper case register Appends, lower case replaces)
You can yank lines into registers (a-z) that will be preserved between files & between logon sessions (since stored in .viminfo file) (a very powerful feature that you should take advantage of).
vim dir/file1 <-- edit file1
... - move cursor to 1st line desired
"a5yy - yank 5 lines into register "a ===== :q - quit editing file1
vim dir/file2 <-- edit file2
... - move cursor to line above desired insert
"ap - put lines from register "a into file2 === :wq - write & quit
: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
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
You can create a '.vimrc' file in your home directory to store abbreviations, macros,& command maps. For example here are some 'Insert ABbreviations' I use:
:iab UVw www.uvsoftware.ca :iab UVs UV Software :iab UVu Vancouver Utilities
When I am in Insert mode & type 'UVw ' (following space required), it is automatically expanded to www.uvsoftware.ca. For my abbreviations I use a convention of 2 Upper case & 1 lower case letter to avoid any confusion with an intended word.
You can configure vim to create backup files by coding a .vimrc file in your home directory. Here is the .vimrc file I use in my homedir. I set backupdir to create the backup files in some other directory since I do not want to clutter up my homedir with the backup files.
".vimrc file - created Apr04/2010 in /home/uvadm/.vimrc" " - to create backup files at begin vi sessions" :set backup :set backupdir=/home2/uvbak/vimbackup :set backupext=.bak
Note |
|
https://guru99.com/the-vi-editor.html (nofollow) ====================================== - excellent tutorial on 'vim'
https://linuxgazette.net/152/srinivasan.html ============================================= - another excellent tutorial on 'vim'
ftp://ftp.vim.org/pub/vim/doc/vimbook-OPL.pdf =============================================== - download everything about vim 3.8 MB .pdf file
https://guru99.com/unix-linux-tutorial.html (nofollow) ============================================ - many other tutorials on unix/linux
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
On page '1A4' we setup subdirs & populated with desired test/demo files.
#1. login --> your homedir =====
#2. ls -l <-- list subdirs in your homedir ===== - should be as follows:
/home/useridxx :-----cpys - COBOL copybooks :-----dat1 - test/demo data files :-----maps - record layouts (maps) from copybooks :-----sf - script files for 'vi' training turorial :-----tmp - for your output files
#3. ls -l dat1 <-- list files in the dat1/... subdir ==========
:-----dat1 : :-----custmas0 - customer master EBCDIC : :-----custmas1 - customer master ASCII : :-----sales0 - sales detail EBCDIC : :-----sales1 - sales detail ASCII : :-----diddle1 - nursery rhyme for vi correction : :-----uvtrain_contents - for vi 'mark' exercise
#4. ls -l sf/ <-- list files in sf/... =========
:-----sf - script files for 'vi' training turorial : :----- hello1* : :----- hello2* : :----- hello3* : :----- hello4* : :----- hello5*
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
# hello1 - training exercises for vi & scripts # - by Owen Townsend, UV Software, March 27/09 # - this script copied from: $UV/sf/demo to: $HOME/sf/... # # vi ex#1 - change 'Owen' (on "echo" line below) to your name # - using 'R' (multi-byte Replace) # # 1. vi sf/hello1 <-- start 'vi' to edit sf/hello1 # 1a. --> use arrow keys to position cursor on 1st char of 'Owen' # 1b. --> R <-- 'R' to enter insert/Replace mode # 1c. --> Xxxxxxx" <-- overwrite Owen" with your name # 1d. --> escape <-- to end insert/Replace mode # 1e. --> :wq <-- Write & Quit vi # 1f. --> ksh sf/hello1 <-- use Korn shell to execute script # echo "=====================" echo "Hello Owen" echo "====================="
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
# hello2 - training exercises for vi & scripts # - by Owen Townsend, UV Software, March 27/09 # - this script copied from: $UV/sf/demo to: $HOME/sf/... # # vi ex#2 - change 'Owen' (on "echo" line below) to your name # - using 'x' (delete char) & 'i' (Insert chars) # # 2. vi sf/hello2 <-- start 'vi' to edit this file (sf/hello2) # 2a. --> /Owen <-- search for 'Owen' with '/' command # 2b. --> n <-- 'n' search Next until you reach correct 'Owen' # 2c. --> x <-- 'x' (delete) repeat 4 times to delete 'Owen' # 2d. --> i <-- 'i' to enter Insert mode # 2e. --> Xxxxxxx" <-- enter your name & closing quote # 2f. --> escape <-- end insert mode # 2g. --> center "Hello Name" within the "=====" lines # (you can determine the commands to do this) # 2h. --> :wq <-- Write & Quit vi # 2i. --> ksh sf/hello2 <-- use Korn shell to execute script # ============= # ** optional ** # 2j. --> chmod 775 sf/* <-- set execute bits on all scripts in sf/... # 2k. --> sf/hello4 <-- execute script directly (w/o ksh) # 2l. --> hello4 <-- works since $HOME/sf is in your PATH # 2m. --> echo $PATH <-- display your PATH, do you see $HOME/sf ? # echo "=====================" echo "Hello Owen" echo "=====================" exit 0
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
# hello3 - training exercises for vi & scripts # - by Owen Townsend, UV Software, March 27/09 # - this script copied from: $UV/sf/demo to: $HOME/sf/... # # vi ex#3 - change 'Owen' (on "echo" line below) to your name # - using 'cw' (Change Word) # # 3. vi sf/hello3 <-- start 'vi' to edit this file (sf/hello3) # 3a. --> /Owen - <-- search for 'Owen -' # 3b. --> n <-- find correct 'Owen' # 3c. --> cw <-- 'cw' deletes word & enters insert mode # 3d. --> Xxxxxxx <-- enter your name # 3e. --> escape <-- end insert mode # 3f. --> :wq <-- Write & Quit vi # 3g. --> sf/hello3 <-- execute script # echo "=======================================================" echo "Hello Owen - here is a random insult for your amusement" amuse echo "=======================================================" exit 0 # ** sample output from hello3 ** # ======================================================= # Hello Owen - here is a random insult for your amusement # Thou reeky, tardy-gaited, pumpion! # =======================================================
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
# hello4 - training exercises for vi & scripts # - by Owen Townsend, UV Software, March 27/09 # - this script copied from: $UV/sf/demo to: $HOME/sf/... # # vi ex#4 - change 3 'Owen's (between === lines below) to your name # - duplicate the 'amuse' line 4 times (for a total of 5) # # 4. vi sf/hello4 <-- start 'vi' to edit this file (sf/hello4) # 4a. --> /Owen <-- search for 1st 'Owen' # 4b. --> n ... <-- repeat 'n' until 1st Owen between === lines # 4b. --> cw <-- 'cw' for 1st change # --> Xxxxxx <-- enter your name # --> escape <-- end cw insert mode # 4c. --> n <-- search for 2nd owen to change # 4d. --> . <-- '.' (repeat last change) # 4e. --> n <-- search for 3rd owen to change # 4f. --> . <-- '.' (repeat last change) # Duplicate 'amuse' line 4 times # 4b. --> /amuse <-- search for amuse (use 'n' Next as required) # 4c. --> yy <-- 'yy' (yank) 'amuse' line into buffer # 4d. --> p <-- 'p' (put) buffer to line below cursor # 4e. --> p ... <-- repeat 3 times (for total of 5) # 4f. --> :wq <-- Write & Quit vi # 4g. --> sf/hello4 <-- execute script # echo "=======================================================" echo "Hello Owen - here is a random insult for your amusement" amuse -f "Owen is a: " ###<-- DUPLICATE this line 4 times echo "Goodbye Owen" echo "=======================================================" exit 0
# ** sample output from hello4 (after changes above) ** # ======================================================= # Hello Owen - here is a random insult for your amusement # Owen is a: ruttish, swag-bellied, miscreant! # Owen is a: ruttish, swag-bellied, miscreant! # Owen is a: ruttish, swag-bellied, miscreant! # Owen is a: ruttish, swag-bellied, miscreant! # Owen is a: ruttish, swag-bellied, miscreant! # Goodbye Owen # =======================================================
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
# hello5 - training exercises for vi & scripts # - by Owen Townsend, UV Software, March 27/09 # - this script copied from: $UV/sf/demo to: $HOME/sf/... # # ex#5 - FIX problem in ex#4 by inserting 'sleep 1' between 'amuse' commands # - ex#4 duplicated the 'amuse' insult generator 4 times # BUT - the insults generated were all the same # - because the random# generator is based on current time # # 5. vi sf/hello4 <-- start 'vi' to edit prior file to be corrected # 5a. --> /amuse <-- search for 1st 'amuse' cmd (next as reqd) # 5b. --> o <-- 'o' (open) a line (below cursor) in insert mode # sleep 1 <-- enter 'sleep 1' command # escape <-- escape to end insert mode # 5c. --> j <-- move down 1 line (or use down arrow) # 5d. --> . <-- '.' repeat last change (insert 'sleep 1') # 5e. --> j & . <-- repeat down 1 line & insert sleep 1 as reqd # (OR could use 'yy' yank & 'p' put if desired) # # 5f. --> :wq <-- Write & Quit vi # 5g. --> sf/hello4 <-- execute script # echo "=======================================================" echo "Hello Owen - here is a random insult for your amusement" amuse -f "Owen is a: " amuse -f "Owen is a: " amuse -f "Owen is a: " amuse -f "Owen is a: " amuse -f "Owen is a: " echo "Goodbye Owen" echo "=======================================================" exit 0
# ** sample output from hello5 (after changes above) ** # ========================================================= # Hello Owen - here is a random insult for your amusement # Owen is a: lumpish, flap-mouthed, whey-face! # Owen is a: spleeny, unchin-snouted, lewdster! # Owen is a: craven, hedge-born, bugbear! # Owen is a: jarring, clay-brained, miscreant! # Owen is a: tottering, onion-eyed, dewberry! # Goodbye Owen # =========================================================
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
We have provided a Nursery rhyme "Hey Diddle Diddle" with several spelling & formatting mistakes for yuo to correct with the vi editor.
#1. Login --> your homedir =====
#2. ls -l dat1 <-- list files in subdir dat1/... ==========
/home/userxx :-----dat1 : :-----diddle1 <-- this file copied on page '1A4'
#3. cat dat1/diddle1 <-- display the file to be corrected ================
diddle1 - demo file for 'vi' exercises Please fix the mistakes in the following verse: #---------------------------------------------- Hey diddle dIddle, the cat and the fUddle The cow FLEW over the SUN <--remove this garbage--> The BIG dog laFFed to see such sport And the dish ran away with the fork. #---------------------------------------------- --> fix various mistakes (capitalized) --> remove the <--...garbage---> --> Join last 2 lines into 1 line
#4. vi dat1/diddle1 <-- correct mistakes =============== --> ... <-- see vi commands '1C1' - '1C6'
#5. cat dat1/diddle1 <-- display file after correction ================
#---------------------------------------------- Hey diddle diddle, the cat and the fiddle The cow jumped over the moon The little dog laughed to see such sport And the dish ran away with the spoon. #----------------------------------------------
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
vi command 'm' marks blocks of text for moving, copying, deleting, writing, etc. The demo file for this exercise may already have been copied to your homedir on page '1A3', but if not it will be moved by instruction #2 below. The demo file is 52 lines long, but here is an abbreviated version for illustration. This exercise will instruct you to:
vi dat1/uvtrain_contents <-- edit file, modify as above ========================
Part_0 - Overview of Vancouver Utilities - for mainframe conversions & general purpose Unix/Linux utilities . . . lines omitted . . .
Part_1 - Preparations for Vancouver Utilities training . . . lines omitted . . .
Part_2 - Test/Demo data files provided . . . lines omitted . . .
Part_3 - Basic Vancouver Utilities - uvhd,uvhdcob,uvlist,uvcp,uvsort,uvcopy,uvqrpg
Part_4 - uvcopy, the most powerful of the Vancouver utilities - general purpose file maintenance & data manipulation utility
Part_5 - uvfix
Part_6 - Pre-programmed jobs (based on uvcopy) - cobmap1, cleanup, cobfil51, uvcmp1, xtbl1, listISF, scan1d, rep2d,
Part_7 - uvqrpg (Quick Report Program Generator) - makes it easy to create control level reports (up to 8 levels)
Part_8 - scripts (Korn shell, Bourne shell, Bash shell) - a few examples of over 500 supplied
Use the 'mark' command to Delete even-numbered parts & Reverse the order of odd-numbered parts. We will give you the detailed instructions to delete the 1st even Part_0 & move the 1st odd Part_1 to the end of file. You should have no problem taking it from there.
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
#1. Login --> your homedir =====
#2. ls -l dat1 <-- list files in subdir dat1/... ==========
/home/userxx :-----dat1 : :-----uvtrain_contents <-- this file copied on page '1A4'
#3. vi dat1/uvtrain_contents <-- begin editing dat1/uvtrain_contents ========================
#4. Mark 1st & last lines in Part_0 & Delete
#4a. --> /Part_ <-- search for Part_0 #4b. --> ma <-- mark 'a' (1st line of Part_0) #4c. --> j <-- repeat 'j' (or down arrow) to last line of Part_0 #4d. --> mb <-- mark 'b' (llast line of Part_0) #4e. --> : 'a,'b d <-- 'd' Delete from mark 'a' to make 'b'
Note |
|
#5. Mark 1st & last lines in Part_1 & Move to end-of-file
#5a. --> /Part_ <-- search for Part_1 (or down arrow) #5b. --> ma <-- mark 'a' (1st line of Part_1) #5c. --> j <-- repeat 'j' (or down arrow) to last line of Part_1 #5d. --> mb <-- mark 'b' (llast line of Part_1) #5e. --> G <-- Goto last line of file #5e. --> :'a,'b m . <-- move mark 'a' to mark 'b' to '.' Here at EOF
#7. --> :wq <-- Write 7 Quit
#8. cat dat1/uvtrain_contents <-- display results =========================
#9. uvlp12 dat1/uvtrain_contents <-- print results (optional) ============================
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
2A1. | notes re mainframe files transferred to UNIX |
2B1. | File Type codes (typ=RSF,RST,LST,LSTt,ISF,IDXf8,etc) |
2C0. | dat1/custmas0 - customer master & sales history file (EBCDIC version) |
- 256 byte fixed records | |
- containing 24 packed fields (2 years of sales history) | |
- no terminating linefeeds | |
- typical COBOL file (originally on a mainframe) |
2C1. | dat1/custmas1 - customer master & sales history file (ASCII version) |
- packed fields are the same as in the EBCDIC version | |
(compatible with Micro Focus COBOL) |
2C2. | dat1/custmas2 - customer master name & address file |
- 120 byte fixed records, LineFeed in last byte | |
- converted from custmas1 by dropping sales history | |
& inserting line-feeds (easier to access on UNIX) |
2C3. | dat1/custmas3 - customer master name & address file |
- 80 byte fixed length records, linefeed terminated | |
- converted from custmas2 by dropping postal,contact,tel# | |
- Line Sequential (vs Record Sequential) |
2D0. | dat1/sales0 - customer sales detail records (EBCDIC version) |
- 64 byte fixed records, no terminating linefeeds | |
- COBOL file originally on a mainframe | |
- signs in zone of units digits, need correction due to | |
EBCDIC to ASCII translation (+ {ABCDEFGHI, - }JKLMNOPQR) |
2D1. | dat1/sales1 - customer sales detail records (ASCII version) |
- signs corrected for Microfocus (+ 0123456789, - pqrstuvwxy) |
2D2. | dat1/sales2 - customer sales detail records |
- 64 byte fixed records, LineFeeds in last byte |
2D3. | dat1/sales3 - customer sales detail records |
- 64 byte fixed records, LineFeeds in last byte | |
- signs changed to trailing separate byte '+' or '-' |
Note |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Fixed length files on mainframes did not have line-feeds at the end of each record. When transferred to UNIX systems, these files cannot be displayed or printed by the normal UNIX utilities such as 'vi' or 'lp'.
dat1/custmas1 & dat1/sales1 are typical mainframe COBOL files without linefeeds (custmas1 has packed fields & sales1 needs sign correction) dat1/custmas2 & dat1/sales2 have had linefeeds inserted in the last byte so you may examine or print them with the usual UNIX tools.
These files will be used by several exercises below, that are intended to help you work with mainframe type files on a UNIX system.
Copy the demo files to your homedir if you have not already done so (originally documented on page '1A5').
copyUVdemodiles =============== - execute script to copy demo files required for uvtrain.doc - script listed below
# copyUVDemoFiles - copy demo files for uvtrain exercises # - by Owen Townsend, UV Software, January 2014 echo "copyUVDemoFiles - copy demo files for uvtrain exercises" echo "You should be in your homedir & should have created subdirs" echo "- as per www.uvsoftware.ca/uvtrain.htm#1A4" mkdir dat1 cpys maps pf sf tmp # err OK if already present cp $UV/dat1/custmas[0-4] dat1 cp $UV/dat1/sales[0-4] dat1 cp $UV/dat1/diddle1 dat1 cp $UV/dat1/uvtrain_contents dat1 cp $UV/tf/test100 dat1 cp $UV/sf/demo/hello* sf cp $UV/mf/cpys/custmas cpys cp $UV/mf/maps/sales cpys exit 0
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
typ=LST |
|
typ=LSTt |
|
typ=RSF |
|
typ=RST |
|
typ=RSR |
|
typ=ISF |
|
typ=IDXf1 |
|
typ=IDXf3 |
|
typ=IDXf8 |
|
typ=RDWz4 |
|
typ=RDWz2 |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Fixed length 256 byte records, no terminating linefeeds. 32 records containing many packed decimal fields (typical mainframe COBOL type file).
Note |
|
001-006 - customer# 009-009 - delete flag (D) 011-035 - customer name 036-060 - address 061-076 - city 078-079 - province 081-090 - postal code 091-102 - phone# 103-120 - contact name 121-180 - this year sales 12 x 5 byte packed fields 181-240 - last year sales 12 x 5 byte packed fields 241-244 - credit codes 245-250 - date of last change 251-256 - unused (no LineFeed at end record)
uvhd dat1/custmas0 r256as2 - execute uvhd to display dat1/custmas1 ========================== - option 'a' to translate character line to ASCII - option 's2' to space between 3 line hex groups
records=32 rsize=256 fsize=8192 rec#=1 rsize=256 fptr=0 fsize=8192 rcount=32 10 20 30 40 50 60 r# 1 0123456789012345678901234567890123456789012345678901234567890123
0 130140 EVERGREEN MOTORS LTD. 1815 BOWEN ROAD NANA FFFFFF4444CECDCDCCD4DDEDDE4DEC44444FFFF4CDECD4DDCC4444444444DCDC 130140000055597955504636920334B000018150266550961400000000005151
64 IMO BC V9S1H1 250-754-5531 LARRY WRENCH ...V@... CDD4444444444CC4EFEFCF4444FFF6FFF6FFFF4DCDDE4EDCDCC4444401357000 946000000000023059218100002500754055310319980695538000000246C000
128 .........W.....-.........X'..f.....m*..................V'...f... 0000000005300016000000002570063100095000000000000000013570016000 0C0000C0270D0540C0000C0098D0263C0444C0000C0000C0000C0246D0056C00
192 .E@...V'........c..............f..............f.C 19950531 047000570000000088000000001800068000130000000069C4FFFFFFFF444444 35C0046D0000C0023C0000C0083C0056D0012C0000C0016D3019950531000000
Note |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
uvhd dat1/custmas1 r256s2 <-- execute uvhd to display dat1/custmas1 =========================
records=32 rsize=256 fsize=8192 rec#=1 rsize=256 fptr=0 fsize=8192 rcount=32 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}....... 0000000005300016000000002570063100095000000000000000013570000000 0C0000C0270D0540C0000C0098D0263C0444C0000C0000C0000C0246D0000C00
192 .E|...V}.......................f.....<........f.C 19950531 0470005700000000880000000018000680001300000000694233333333222222 35C0046D0000C0023C0000C0083C0056D0012C0000C0016D3019950531000000
Each 64 byte segment is shown on 3 lines (characters, zones,& digits). The character line of the EBCDIC display is translated to ASCII by option 'a'.
You can see the EBCDIC/ASCII differences by examining the zones & digits lines. For example a '1' in EBCDIC is x'F1', in ASCII it is x'31'. An 'A' in EBCDIC is x'C1', in ASCII it is x'41'.
Note the 24 x 5 byte packed fields in cols 121-240. These are the same for EBCDIC & ASCII, and are compatible with both mainframe COBOL & Micro Focus COBOL on Unix/Linux/Windows. The packed fields & the lack of linefeeds mean that you cannot examine this file with 'vi' or print it with 'lp'.
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
ASCII characters only, no packed or binary fields. Fixed length 120 byte records, LineFeed terminated in col 120, to allow inspection with 'vi' & printing with 'lp'.
001-006 - customer# 009-009 - delete flag (D) 011-035 - customer name 036-060 - address 061-076 - city 078-079 - province 081-090 - postal code 091-102 - phone# 103-119 - contact name 120-120 - line-feed
130140 EVERGREEN MOTORS LTD. 1815 BOWEN ROAD NANAIMO BC V9S1H1 250-754-5531 LARRY WRENCH 132588 GEECOE GENERATOR SERVICESUNIT 170 - 2851 SIMPSON RICHMOND BC V6X2R2 604-278-4488 HARRY LIGHT 139923 JOHNSTONE BOILER & TANKS 1250 EAST PENDER STREET VANCOUVER BC V5L1W1 604-320-1845GEORGE BROWN
records=15 rsize=256 fsize=3840 rec#=1 rsize=256 fptr=0 fsize=3840 rcount=15 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 .132588 4442222222222442535343222233323332333324455525544442222033333322 9DF00000000002306931810000250D754D55310C12290725E380000A13258800
128 GEECOE GENERATOR SERVICESUNIT 170 - 2851 SIMPSON RICHMOND 2244444424444545452545544455445233322233332544554422544444442222 007553F5075E5214F20352693535E9401700D02851039D03FE002938DFE40000
192 BC V6X2R2 604-278-4488 HARRY LIGHT .139923 JOHNST 2222244253535322223332333233332445552444452222203333332222444455 000002306682220000604D278D44880812290C978400000A1399230000AF8E34
Note |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
ASCII characters only, no packed or binary fields. Variable length records, max 80, LineFeed terminated, (Line Sequential vs dat1/custmas2 which was Record Sequential).
001-006 - customer# 009-009 - delete flag (D) 011-035 - customer name 036-060 - address 061-076 - city 078-079 - province 080-080 - line-feed after last non-blank
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 HOPE BC 145264 D MAGRATH SUPPLIES LTD. 1939 KIRSCHNER ROAD KELOWNA BC 147615 X 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. COQUITLAM BC 154689 FRANKLIN RESOUCES 805 - 1199 HOWE STREET VANCOUVER BC 157352 D WHYTE, W. 1150 LODGE ROAD NORTH VANCOUVER BC 173320 X ZENITH TRANSPORT 2381 ROGERS AVE COQUITLAM BC 201120 ALLTYPE RENTAL LTD. BOX 1819 GRANDE PRAIRIE AL 204700 CASE POWER EQUIPMENT 12611-100 ST GRANDE PRAIRIE AL 208060 E&L TRUCKING LAND & CATTLE LTD THREE HILLS AB 211140 D FORD NEW HOLLAND BOX 1, 440 ELLIS ROAD FORT MCMURRAY AB 223240 X NICHOLSON CHEVROLET LTD. 7215 ARGYLL ROAD EDMONTON AL 224700 OTTO MOBILES WESTERN LTD.8441 CORONET ROAD EDMONTON AL 231550 SPARROW ELECTRIC CO. LTD.BOX 88 THREE HILLS AL 239300 TERRITORIAL REWIND BOX 1648 WHITEHORSE YK 237286 WEBER, TOM BOX 5503 FORT MCMURRAY AL 301120 D ALBERTA GAS CHEMICALS LTD3RD. FLOOR, 11456 JASPER EDMONTON AL 306959 X 356582 ALBERTA LTD. DEVITT NURSERY CALGARY AL 308685 FOOTHILLS ELECTRIC 3932 - 3A ST. N.W. CALGARY AL 313720 MONITREX ENGINEERING LTD 7-2280-39 AVE, N.E. WHITEHORSE YK 315512 PARTS PLUS BOX 510 MAIN ST THREE HILLS AB 318833 TOP NOTCH CONSTRUCTION BOX 308, STN J CALGARY AL 400002 ACKLANDS LTD 945 -2ND AVE PRINCE GEORGE BC 401210 COAST RANGE CONSTRUCTION 1103-207 W. HASTINGS ST VANCOUVER BC 402875 HULL, DON & SONS LTD. BOX 1297 PRINCE GEORGE BC 403887 D MILNER, LARRY BOX 28 RAU ROAD R.R.8 DAWSON CITY YK 406082 PRECAM RENTALS LTD: 10116-94TH AVE CHILLIWACK BC
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Fixed length 64 byte records, no packed or binary fields, no linefeeds. Original mainframe file translated from EBCDIC to ASCII. Signs in zone of units digits, need correction due to EBCDIC to ASCII translation (+ {ABCDEFGHI, - }JKLMNOPQR)
01-06 - CUST# 11-12 - SLSMN# 14-19 - DATE 21-28 - INVOICE# 31-36 - PRODUCT# 39-44 - QTY (pos digits {ABCDEFGHI, neg digits }JKLMNOPQR) 46-52 - PRICE 54-62 - $AMOUNT (pos digits {ABCDEFGHI, neg digits }JKLMNOPQR) 63-64 - blanks (no linefeed in 64)
uvhd dat1/sales0 r64a <-- display dat1/sales0 in vertical hexadecimal ===================== - option 'a' to translate character line to ASCII
rec#=1 rsize=64 fptr=0 fsize=1280 rcount=20 10 20 30 40 50 60 r# 1 0123456789012345678901234567890123456789012345678901234567890123
0 130140 21 940802 IN111001 HAM001 00002{ 0000001 00000002{ FFFFFF4444FF4FFFFFF4CDFFFFFF44CCDFFF44FFFFFC4FFFFFFF4FFFFFFFFC44 1301400000210940802095111001008140010000002000000001000000002000
rec#=2 rsize=64 fptr=64 fsize=1280 rcount=20 10 20 30 40 50 60 r# 2 0123456789012345678901234567890123456789012345678901234567890123
64 130140 21 940802 IN111001 SCR012 00002A 0001001 00002102A FFFFFF4444FF4FFFFFF4CDFFFFFF44ECDFFF44FFFFFC4FFFFFFF4FFFFFFFFC44 1301400000210940802095111001002390120000002100001001000002102100
rec#=3 rsize=64 fptr=128 fsize=1280 rcount=20 10 20 30 40 50 60 r# 3 0123456789012345678901234567890123456789012345678901234567890123
128 139923 35 950802 IN111002 CHR001 00002B 0002001 00004402B FFFFFF4444FF4FFFFFF4CDFFFFFF44CCDFFF44FFFFFC4FFFFFFF4FFFFFFFFC44 1399230000350950802095111002003890010000002200002001000004402200
Note |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
1 2 3 4 5 6 1234567890123456789012345678901234567890123456789012345678901234 CUST# SLM DATE INV# PROD# QTY PRICE AMOUNT
130140 21 940802 IN111001 HAM001 00002{ 0000001 00000002{ 130140 21 940802 IN111001 SCR012 00002A 0001001 00002102A 139923 35 950802 IN111002 CHR001 00002B 0002001 00004402B 139923 35 950802 IN111002 TAB013 00002C 0003001 00006902C 139923 35 950807 CR5421 VAR200 00002D 0004001 00009602D 150825 44 960804 IN1122 HAM001 00002E 0005001 00012502E 150825 44 960804 IN1122 PLN012 00002F 0006001 00015602F 201120 44 970807 CR5234 BBQ001 00002G 0007001 00018902G 223240 65 980816 CR955 HAM001 00002H 0008001 00022402H 223240 65 980816 IN441 BIT001 00002I 0009001 00026102I 308685 21 990812 IN6605 SAW001 00001} 0000001 00000001} 308685 21 990812 IN6605 WID115 00001J 0001001 00001101J 308685 21 990812 CR8835 TAB013 00001K 0002001 00002401K 315512 44 000805 IN2251 HAM001 00001L 0003001 00003901L 315512 44 000805 IN2251 SAW051 00001M 0004001 00005601M 315512 44 000805 IN2255 WID115 00001N 0005001 00007501N 400002 85 010812 CR245 HAX129 00001O 0006001 00009601O 406082 35 020815 IN33001 BBQ001 00001P 0007001 00011901P 406089 35 020815 IN33001 TAB013 00001Q 0008001 00014401Q 406082 65 020816 IN441 VAR200 00001R 0009001 00017101R
vi dat1/sales1 <-- try this, what does screen look like ? ==============
'vi dat1/sales1' would not show discrete records as shown above because there are NO LineFeeds (appears to vi as 1 line). You could insert LineFeeds with 'uvcp' as shown below & on page '3D3'
uvcp "fili1=dat1/sales1,rcs=64,typ=RSF,filo1=tmp/sales1,typ=RST" ================================================================ - 'typ=RST' inserts a LineFeed Terminator in last byte of each 64 byte record - could translate the EBCDIC file (sales0) to ASCII & insert LF's as follows:
uvcp "fili1=dat1/sales0,rcs=64,typ=RSF,filo1=tmp/sales1,tra=0(64),typ=RST" ==========================================================================
sales1 was translated to ASCII, but the zoned signs were given no special treatment & still reflect the mainframe conventions (vs Microfocus COBOL conventions on Unix/Linux systems).
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Fixed length 64 byte records. LineFeeds inserted in last byte for easy UNIX inspection & printing. Signs corrected for Microfocus: '+' 0123456789, & '-' pqrstuvwxy (negative zones x'70', 0-9 becomes alpha 'p'-'y').
01-06 - CUST# 11-12 - SLSMN# 14-19 - DATE 21-28 - INVOICE# 31-36 - PRODUCT# 39-44 - QTY (pos digits 0123456789, neg digits pqrstuvwxy) 46-52 - PRICE 54-62 - $AMOUNT (pos digits 0123456789, neg digits pqrstuvwxy) 64-64 - linefeed terminated
1 2 3 4 5 6 1234567890123456789012345678901234567890123456789012345678901234 CUST# SLM DATE INV# PROD# QTY PRICE AMOUNT
130140 21 990802 IN111001 HAM001 000020 0000101 000002020 130140 21 000802 IN111001 SCR012 000021 0001001 000021021 130140 21 010802 IN111001 CHR001 000022 0010001 000220022 139923 35 980802 IN111002 TAB013 000023 0000201 000004623 139923 35 990807 IN111002 VAR200 000024 0002001 000048024 150825 44 010804 IN1122 HAM001 000025 0020001 000500025 150825 44 020804 IN1122 HAX129 000026 0000301 000007826 201120 44 030807 CR5234 BBQ001 000027 0003001 000081027 223240 65 010816 CR955 HAM001 000028 0030001 000840028 223240 65 020816 IN441 BBQ001 000029 0000101 000002929 308685 21 020812 IN6605 SAW051 00001p 0000101 00000101p 308685 21 030812 IN6605 BIT075 00001q 0001001 00001101q 308685 21 040812 CR8835 TAB013 00001r 0010001 00012001r 315512 44 040805 IN2251 HAM001 00001s 0000201 00000261s 315512 44 050805 IN2251 SAW051 00001t 0002001 00002801t 315512 44 060805 IN2255 BIT075 00001u 0020001 00030001u 400002 85 990812 CR245 HAX129 00001v 0000101 00000161v 406082 35 010815 IN33001 BBQ001 00001w 0001001 00001701w 406082 35 020815 IN33001 TAB013 00001x 0010001 00018001x 406082 65 030816 IN441 VAR200 00001y 0000101 00000191y
Could correct the Mainframe zoned signs (in sales1 on prior page) to Unix zoned signs as shown below - using 'tras' (TRAanslate Signs) instruction which looks only for mainframe signs '{ABCDEFGHI' & '}JKLMNOPQR', and changes to Unix signs '0123456789' & 'pqrstuvwxy'.
uvcp "fili1=dat1/sales1,rcs=64,typ=RSF,filo1=tmp/sales1,tras=38(24),typ=RST" ===========================================================================
Note 'tras=39(24)' applies only to the numeric fields in bytes 38-61 (or columns 39-62). Cannot tras=0(64) entire record because we would change letters in pic x fields.
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
fixed length 64 byte records, LineFeeds in last byte signs changed from units zones to separate trailing '+' or '-' (often used on UNIX & MS-DOS systems)
01-06 - CUST# 11-12 - SLSMN# 14-19 - DATE 21-28 - INVOICE# 31-36 - PRODUCT# 39-44 - QTY (separate trailing sign +/-) 46-52 - PRICE 54-62 - $AMOUNT (separate trailing sign +/-) 64-64 - line-feed
1 2 3 4 5 6 1234567890123456789012345678901234567890123456789012345678901234 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-
uvcp "fili1=dat1/sales2,rcs=64,typ=RST,filo1=tmp/sales3\ ,mvn=38(6z+)38(6z),mvn=53(9z+)53(9z)" ========================================================
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
3A1. | uvhd - file investigation utility, display records in vertical hexadecimal |
- prompts for commands: browse,search,select,update,replace,print,etc | |
- interactive utility with 18 help screens. |
3A2. | uvhd Search command demo |
3A3. | uvhd Write command demo |
3A4. | uvhd Drop command demo |
3B1. | uvhdcob - similar to uvhd, but also shows the COBOL copybook fieldnames |
on the left with the corresponding data on the right. |
3B2. | uvhdcob Verify command to search for records with bad data |
- invalid digits in numeric/packed fields | |
- unprintable characters in character fields |
3C1. | uvlist - text file & documentation listing utility |
- many options available especially for laser printers |
3C2. | uvlp__ - uvlist scripts provided for commonly used options, for example: |
uvlp12 - print 12 cpi to get 88 columns on 8 x 1/2" | |
uvlp18 - print 18 cpi to get 132 columns on 8 x 1/2" | |
uvlp12D - print 12 cpi Duplex | |
uvlp13L - print 13 cpi Landscape to get mainframe reports on 8 1/2 x 11 | |
(13 cpi gets 136 cols in 11", 5.6 lpi gets 66 lines in 8") | |
uvlp13LD - print 13 cpi & 5.6 lpi Landscape & Duplex |
3C4. | uvlp12 - listing of uvlp12 script |
3C5. | UVLPDEST - environmental variable in profile defines printer for uvlp... |
- modify to a laser printer near you |
3C6. | modifying uvlp scripts for A4 paper 8 x 12 vs letter 8 1/2 x 11 |
and for Xi-Text print spooler (uses 'spr' vs 'lp) | |
- using 'rep2d' mass change all uvlp... scripts for A4 paper | |
- change code for paper size from 'a2' letter to 'a26' A4 | |
- or change 'lp' to 'spr' for Xi-Text print spooler | |
- changes about 75 scripts of 350 total in sf/util/... | |
See Operating Instructions on page '6C1' |
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
3D1. | uvcp - file copy & maintenance utility (command line driven) |
- replacement for mainframe DATA utility | |
- several examples & exercises |
3D0. | uvcp - command line Data File Utility |
- replacement for mainframe IDCAMS, IEBGENER, etc | |
3D1. | uvcp example#1 - translate to ASCII & Insert LineFeeds |
3E1. | uvcp example#2 - inserting LineFeeds to allow editing/printing |
3F1. | uvcp example#3 - translate EBCDIC to ASCII preserving packed fields |
3F2. | uvcp exercise#3a - translate to lower case |
3G1. | uvcp example#4 - Selecting or Deleting records |
3H1. | uvcp example#5 - clearing multiple contiguous packed fields |
3I1. | uvcp example#6 - Y2K conversion |
3J1. | uvcp example#7 - numeric field conversions |
- converting zoned signs to separate signs (leading or trailing) | |
3K1. | uvcp example#8 - loading Indexed files with uvcp |
3K2. | script makeISF0 - create an empty Indexed file |
3L1. | uvsort - sort utility for Unix/Linux |
- replacement for mainframe SORT utility | |
- several examples & exercises |
3M1. | uvsort example#2 - sorting with Unique key option 'u' |
3M2. | option 'u' (key#u1/2) - drop duplicate records |
3N1. | uvsort example#3 - multi-file input |
3O1. | uvsort example#4 - sort & load Indexed files |
3O2. | uvsort example#5 - rebuild files with corrupted Indexes |
3P1. | uvsort example#6 - Y2K sort options |
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
'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.
uvhd is especially valuable to investigate mainframe type files with packed fields and no linefeeds (required by most unix/linux utilities)
Note |
|
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)
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. 10 <-- display record #10 (one relative) ===
#3. 1 <-- return to 1st record ===
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Example |
|
uvhd dat1/custmas1 r256u <-- initiate uvhd (with option 'u' allow Update) ======================== - displays 1st record & wait for oprtr command (same display as shown on previous page)
#1. s 77(2),'AL' <-- search for 'AL' in 77-78 (province of ALberta ?) ============ (should be 'AB' since 'AL' is ALabama)
10 20 30 40 50 60 r# 13 0123456789012345678901234567890123456789012345678901234567890123
3072 201120 ALLTYPE RENTAL LTD. BOX 1819 DRAY 3333332222444555425445442454222222244523333222222222222222224545 20112000001CC4905025E41C0C44E0000002F801819000000000000000004219 'AL'--> ** 64 TON VALLEY AL T0E0M0 403-246-5274LARRY ZOLF ........ 5442544445222442534343222233323332333344555254442222222200000000 4FE061CC590001C04050D00000403D246D5274C12290AFC6000000000000C000
128 ..........Fl...Il......................................vl..9q... 0000000000460014600000000000000000000000000008900000000760037100 0C0000C0086C0039C0000C0000C0000C0000C0000C0003C0000C0066C0091C00
192 .4..................%.L.............I...........A 20010731 1390000000000000000020400810000000004000000000004233333333222222 24C0000C0000C0000C0054C0095C0000C0039C0000C0000C1020010731000000 found--> s 77(2),'AL' <--at byte# 77 of record# 13 rec#=13 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 -->
#2. u 77(2),'AB' <-- Update 77(2) to 'AB' (correct code for AlBerta) ============
#3. ss <-- repeat last search for next record with 'AL' in 77(2) === (using last specified search criteria)
#4. uu <-- repeat last Update (store 'AB' in 77(2)) ===
#5. ss/uu <-- could repeat ss & uu until EOF reached =====
#6. 0 <-- OR return to 1st record in the file ===
#7. u99 77(2),'AB','AL' <-- Update ALL records to 'AB' in 77(2) =================== - IF 'AL' in 77(2)
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Required - select customer records for YUKON ('YK' in bytes 77-78). ======== - Write a file of 80 byte records, dropping off the packed fields
The 'write' command automatically writes to the tmp/... subdir within the current directory, assigning the filename as 'tmp/datafile_yymmdd_hhmmssW'.
rm -f tmp/* <-- remove all files from output directory ===========
uvhd dat1/custmas1 r256 <-- start uvhd on dat1/custmas1 ======================= - displays 1st record & waits for command
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 -->
--> w99r80t2 77(2),'YK' <-- command to write records with 'YK' in 77-78 =================== - 'w99' ensures all records in file tested - 'r80' option to write 80 byte Records - 't2' Terminate with LineFeeds (text file)
--> q <-- quit uvhd
cat tmp/*W <-- display selected records ==========
234300 TERRITORIAL REWIND BOX 1648 WHITEHORSE YK 313720 MONITREX ENGINEERING LTD 7-2280-39 AVE, N.E. WHITEHORSE YK 403887 D MILNER, LARRY BOX 28 RAU ROAD R.R.8 DAWSON CITY YK
Please see uvhd.htm for other commands (browse, search, update, scan/replace, translate, print, etc).
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Suppose you have some bad records (invalid packed data) that cause your production run to fail. You desperately want to process all other good records & fix the bad records later. The bad records could later be re-submitted if transactions of sorted back in to a permanent file.
With uvhd you can flag the bad records for the drop command to bypass. You could flag the records in the 1st byte with a null x'00', or any distinct flag that could not occur in the good records. It would be better to flag in some unused byte if you later want to fix the bad records & sort back into the file.
#1. cp dat1/custmas1 tmp1/cm1 <-- copy demo file to tmp1 subcdir ========================= (dont want to change demo file)
#2. uvhd tmp1/cm1 r256u <-- run uvhd with Update option =================== #2a --> u 6(1),'*' <-- flag with '*' col 7 after cust# ========== #2b --> 10 <-- goto record #10 === #2c --> uu <-- repeat flag update === #2d --> d99 6(1),'*' <-- drop records with '*' col 7 ============ #2e --> q ===
#3. l tmp <-- list tmp subdir to see Backup/Correct/Dropped files =====
tmp/custmas1_yyyymmdd_HHMMSSB <-- Backup (entire file Before drops) tmp/custmas1_yyyymmdd_HHMMSSC <-- Corrected file (drops removed) tmp/custmas1_yyyymmdd_HHMMSSD <-- Dropped records
Note that the drop command writes 3 files (with date/time stampes) into tmp/... and then copies the Corrected file back overwriting original, re-opens the file & prompts for next command. If you detect a mistake you can restore the Backup file as follows:
#4. cp tmp/custmas1/yyyymmdd_hhmmssB dat1/custmas1 ============================================== - restore Backup file, removing date/time stamp, back to original filename
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
uvcopyx cobmap1 cpys maps uop=q0i7 ================================== - convert all copybooks in cpys/* to cobmaps (record layouts) in maps/...
uvhdcob dat1/custmas1 maps/custmas1 <-- sample 'uvhdcob' command line =================================== - arg1 is the data filename & arg2 is the record layout (created from copybook)
dat1/custmas1 rsz=256 totrecs=32 current=1 fsiz=8192 fptr=0 cobmapfile=maps/custmas1 today=199911291108 datalastmod=1999112910 rec# 1 fieldname occurs bgn end typ<------ data (hex if typ=p/b) -----> 001 cm-num 0 5 n 130140 002 cm-delete 6 9 003 cm-name 10 34 EVERGREEN MOTORS LTD. 004 cm-adrs 35 59 1815 BOWEN ROAD 005 cm-city 60 75 NANAIMO 006 filler001 76 76 007 cm-prov 77 78 BC 008 filler002 79 79 009 cm-postal 80 89 V9S1H1 010 cm-phone 90 101 604-754-5531 011 cm-contact 102 119 012 cm-thisyr-sales 012 120 124pns 001234567C 013 cm-lastyr-sales 012 180 184pns 001234567D 014 cm-thisyr-xft 240 244pns 4320202020 015 cm-lastyr-xft 245 249pns 2020202020 016 filler003 250 255 null=next,r#=rec,s=search,u=update,p=print,i=iprint,w=write,t=tally,c=checkseq ,e=exit to uvhd, q=quit, ?=help --> q
Note |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
The 'v' verify command searches from the current record until it finds a record with at least 1 bad data field & displays that record. To demo the verify command, we will 1st create some bad data in record #10 of dat1/custmas1 (see 1st record shown above).
#1. uvhdcob dat1/custmas1 maps/custmas1 u <-- start uvhdcob ===================================== - with Update option
#1a. --> 10 <-- goto record #10 #1b. --> u 5(1),'*' <-- put bad data in Numeric field #1c. --> u 78(1),x'EE' <-- put unprintable data in Character field #1d. --> u 120(1),x'EE' <-- put bad data in Packed field #1e. --> q <-- quit
#2. uvhdcob dat1/custmas1 maps/custmas1 <-- start uvhdcob ===================================== - to test verify
#2a. --> v99 <-- verify/search for any record with bad data - or until EOF if no bad data
rec# 10 fieldname occurs bgn end typ<------ data (hex if typ=p/b) -----> 001 cm-num 0 5 n 15468* 313534363858 <-BadN 002 cm-delete 6 9 003 cm-name 10 34 TAURUS RESOURCES 004 cm-adrs 35 59 1110 - 625 HOWE STREET 005 cm-city 60 75 VANCOUVER 006 filler001 76 76 007 cm-prov 77 78 B. 42EE <-BadC 008 filler002 79 79 009 cm-postal 80 89 V6C2T6 010 cm-phone 90 101 604 685 8565 011 cm-contact 102 119 MEL RAHAL 012 cm-thisyr-sales 012 120 124pns EE0123456C <-- Bad Packed 013 cm-lastyr-sales 012 180 184pns 000000000C 014 filler003 240 255 C 19980331
v99 --> 10 recs verified, 4 ERRs found in rec# 10, 1st at byte# 0 2 packed & 1 numeric bad signs/digits, 1 unprintables in char fields
#2b. --> vv <-- continue verify to next bad data record or EOF - will search to EOF & display 'no bad data found'
Goto: Begin this doc , End this doc , Index this doc , Contents this library , 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 (uvlp12,etc) which include the pipe to the printer, so you can list your text files with a minimum of keystrokes.
uvlist was originally developed to list the documentation files of the Vancouver Utility package. These files use the '*eject' pattern (anywhere in 1st 15 cols) to signal a new page.
uvlist has also proven to be of substantial assistance to customers as a general purpose text file list utility for programs, scripts, documentation, parameter files, etc.
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.
uvlist saves you the frustration that can occur when you pick up a listing without page headings to identify where it came from & when it was created.
/home/uvadm/doc/uvlist.doc now=950228:1340 uvadm ln# 78 pg# 3 ==========================================================================
The uvlist page heading is shown above. Please note that it contains the following vital pieces of information:
#1. filename - /home/uvadm/doc/uvlist.doc (or whatever) #2. file size - size=999999 (optional) #3. today's date when printed - now=yymmdd:HHMM #4. userid - 'uvadm' (or whatever) #5. line# of 1st line on page - ln#9999 #6. page number - pg#999
uvlist sf/util/uvlp18 | lp <-- try this (or any of the uvlp__ ========================== scripts on the next page)
This command will list 1 of the many scripts provided based on uvlist.
See the scripts on the next page which will save keystrokes since they include the '| lp' coding & the names reflect the various options coded.
Goto: Begin this doc , End this doc , Index this doc , Contents this library , 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.
Scripts are provided for various commonly used options such as characters per inch (saves having to key the options & the pipe to the printer).
Some of the scripts provided are itemized below & you can check for others by listing uvadm/sf directory --> ls -l sf/util/uvlp*
uvlp10 |
|
uvlp12 |
|
uvlp14 |
|
uvlp16 |
|
uvlp18 |
|
uvlp20 |
|
uvlp12v6 |
|
uvlp12D |
|
'D' <---- UPPER case 'D' indicates DUPLEX printing 'L' <---- UPPER case 'L' indicates LANDSCAPE
uvlp12L |
|
uvlp14L |
|
uvlp16L |
|
uvlp18L |
|
uvlp20L |
|
uvlp12LD |
|
uvlp14LD |
|
uvlp16LD |
|
uvlp18LD |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
The following scripts allow for 132 characters wide (Landscape at 13 cpi), and 66 lines per page (8 lines/inch if Landscape).
uvlp13L |
|
uvlp13LD |
|
uvlp13LA |
|
uvlp18 |
|
uvlp18D |
|
uvlp18A |
|
uvlpd12 |
|
uvlpd12A |
|
uvlpd18 |
|
uvlpd1p |
|
uvlpp |
|
uvlpp12 |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
#!/bin/ksh # uvlp12 - Korn shell script from UVSI stored in: /home/uvadm/sf/util/ # uvlp12 - print a file at 12 cpi (90 chars on 8 1/2 x 11) # - pg hdngs with: filename, mod-date, today-date, page#s # - for HP laserjet 4 printers & compatibles # - by Owen Townsend - UV Software Inc - Dec 1994 # #usage: uvlp12 filename [group1] [group2] <-- may override default options # ================================= # # - 1 of several: uvlp12,uvlp14,uvlp16,uvlp12L,uvlp14L,uvlp12D,uvlp14LD,etc # - these scripts invokes uvlist & pipe to the spooler # - scriptnames reflect commonly used uvlist options # group1: p60 = 60 lines per page # group2: c12 = 12 cpi = 90 chars across on 8 1/2 " paper # m280 = default margin offset by 280/720 inch (for 3 hole punches) # - see uvlist.doc for the many other HP PCL5 compatible print options # # .profile should specify environmental variables for 'lp', for example: # export UVLPDEST="-dlp0" #<-- destination 'lp0' ("-dLPT1" for SFU) # export UVLPDEST="" #<-- null to use lpadmin default # export UVLPOPTN="-onobanner" #<-- 'nobanner' option for lp # export UVLPOPTN="" #<-- null disable for Windows SFU # if [ -f "$1" ]; then : else echo "ERROR - $1 is not a file"; exit 1; fi # uvlist $1 p60$2 t1c12$3 | lp $UVLPOPTN $UVLPDEST #=============================================== #note - option 't1' for tray 1 (main paper source on my Lexmark t642) # - option 't4' for alternate tray (t2 & t3 are manual & envelope) # - OR use option 'a1' for letter size (& remove tray code) # and relate letter size to tray# via printer control panel uvln=$(basename $0) linesbf=$(wc -l $1); linesb=${linesbf% *}; lines=${linesb##* }; echo "$uvln printing $1 on $UVLPDEST, lines=$lines" exit 0
Note |
|
vi /home/sf/util/uvlp12D <-- inspect Duplex version ========================
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
The common_profile defines a default printer that may not be convenient for you. You can override the default by adding a line to your .profile (or .bash_profile) as follows:
#1. vi .profile <-- edit your .profile ===========
#1a. --> G <-- goto last line #1b. --> o <-- 'o' open a new line below cursor
#1c. --> export UVLPDEST="-dlaserjet2" <-- define printer near you =============================
#1C. --> export UVLPDEST="-Plaserjet2" <-- dest option for Xi-Text spooler ===========================
#1d. --> escape to end insert mode
#1e. --> :wq <-- Write & Quit
You can over-ride the profile definitions by redefining UVLPDEST and/or UVLPOPTN at your shell prompt (effective until you logoff or redefine).
#1. export UVLPDEST="-dlaserjet2" <-- define alternate destination =============================
#2. uvlp12D cbls/xxxxxx.cbl <-- print your files =======================
#3. export UVLPDEST="-dlaserjet1" <-- restore default ============================= (or logoff/logon)
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
You may have to modify the 'uvlp' scripts if your site uses A4 paper 8X12 (vs letter 8 1/2 x 11). Here are samples to illustrate changes required, using 'uvlp12' with most #comment lines removed to highlight changes required.
# uvlp12 - print a file at 12 cpi (90 chars on 8 1/2 x 11) # - many lines removed to highlight changes for A4 # - see original uvlp12 listed on prior page # # - modified for A4 paper option a26l2 vs a2/t1/t4 # - mass change by uvcopy rep2d & search/replace table ctl/rep2d_uvlp_A4 # # uvlist $1 p60$2 a2c12$3 | lp $UVLPOPTN $UVLPDEST <-- original #commented out # ================**============================== # a2<-- letter size, change to a26 A4 size, add l2 for CR # uvlist $1 p60$2 a26l2c12$3 | lp $UVLPOPTN $UVLPDEST #<-- 'a26l2' replaces 'a2' #===============*****============================== # a26l2<-- codes for A4 paper & LF/CR (vs LF only)
# rep2d_uvlp_A4 - table file for rep2d search/replace all files in subdir # - option a26 for A4 paper & option l2 for CR/LF # 01:30=search pattern, 31:60=replacement, 61-80=present qual,81:100=absent qual a2~~~~~~~~~~~~~~~~~~~~~~~~~~~ a26l2~~~~~~~~~~~~~~~~~~~~~~~~uvlist~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ t1~~~~~~~~~~~~~~~~~~~~~~~~~~~ a26l2~~~~~~~~~~~~~~~~~~~~~~~~uvlist~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ t4~~~~~~~~~~~~~~~~~~~~~~~~~~~ a26l2~~~~~~~~~~~~~~~~~~~~~~~~uvlist~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#1. vi ctl/rep2d_uvlp_A4 <-- create search/replace table for uvcopy rep2d ====================
#2. mv sf/util sf/util.old <-- change name of existing sf/util ======================
#3. mkdir sf/util <-- make new 'util' subdir =============
#4. uvcopy rep2d,fild1=sf/util.old,fild2=sf/util,fili3=ctl/rep2d_util_A4 ==================================================================== - execute 'rep2d' mass change job
Please see the more extensive instructions on page '6C1'
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
'uvcp' is a replacement for the mainframe 'DATA' utility. uvcp is handy for converting fixed record length files without LineFeeds to text type files with linefeeds that may be investigated with 'vi' or printed with 'lp' (or uvlp12, etc).
Example |
|
#1. vi dat1/sales0 <-- 1st try to examine with 'vi' ============== - screen display might be:
ñóðñôð@@@@òñ@ùôðøðò@ÉÕñññððñ@@ÈÁÔððñ@@ððððòÀ@ððððððñ@ðððððððòÀ@@ñóðñôð@@@@òñ@ùôð øðò@ÉÕñññððñ@@âÃÙðñò@@ððððòÁ@ðððñððñ@ððððòñðòÁ@@ñóùùòó@@@@óõ@ùõðøðò@ÉÕñññððò@@ÃÈ Ùððñ@@ððððòÂ@ðððòððñ@ððððôôðòÂ@@ñóùùòó@@@@óõ@ùõðøðò@ÉÕñññððò@@ãÁÂðñó@@ððððòÃ@ððð óððñ@ððððöùðòÃ@@ñóùùòó@@@@óõ@ùõðøð÷@ÃÙõôòñ@@@@ãÁÂðñó@@ððððòÄ@ðððôððñ@ððððùöðòÄ@@ - - - 12 screen lines omitted - - -
Note |
|
#2. uvhd dat1/sales0 <-- examine EBCDIC file with uvhd & NO options ================ - recsize option 'r' defaults to 'r256'
10 20 30 40 50 60 r# 1 0123456789012345678901234567890123456789012345678901234567890123 0 ......@@@@..@......@........@@......@@......@.......@.........@@ FFFFFF4444FF4FFFFFF4CDFFFFFF44CCDFFF44FFFFFC4FFFFFFF4FFFFFFFFC44 1301400000210940802095111001008140010000002000000001000000002000 64 ......@@@@..@......@........@@......@@......@.......@.........@@ FFFFFF4444FF4FFFFFF4CDFFFFFF44ECDFFF44FFFFFC4FFFFFFF4FFFFFFFFC44 1301400000210940802095111001002390120000002100001001000002102100 128 ......@@@@..@......@........@@......@@......@.......@.........@@ FFFFFF4444FF4FFFFFF4CDFFFFFF44CCDFFF44FFFFFC4FFFFFFF4FFFFFFFFC44 1399230000350950802095111002003890010000002200002001000004402200 192 ......@@@@..@......@........@@......@@......@.......@.........@@ FFFFFF4444FF4FFFFFF4CDFFFFFF44ECCFFF44FFFFFC4FFFFFFF4FFFFFFFFC44 1399230000350950802095111002003120130000002300003001000006902300
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
#3. uvhd dat1/sales0 a <-- examine EBCDIC file with uvhd ================== - option 'a' to translate EBCDIC to ASCII - recsize option 'r' defaults to 'r256'
10 20 30 40 50 60 r# 1 0123456789012345678901234567890123456789012345678901234567890123 0 130140 21 940802 IN111001 HAM001 00002{ 0000001 00000002{ FFFFFF4444FF4FFFFFF4CDFFFFFF44CCDFFF44FFFFFC4FFFFFFF4FFFFFFFFC44 1301400000210940802095111001008140010000002000000001000000002000 64 130140 21 940802 IN111001 SCR012 00002A 0001001 00002102A FFFFFF4444FF4FFFFFF4CDFFFFFF44ECDFFF44FFFFFC4FFFFFFF4FFFFFFFFC44 1301400000210940802095111001002390120000002100001001000002102100 128 139923 35 950802 IN111002 CHR001 00002B 0002001 00004402B FFFFFF4444FF4FFFFFF4CDFFFFFF44CCDFFF44FFFFFC4FFFFFFF4FFFFFFFFC44 1399230000350950802095111002003890010000002200002001000004402200 192 139923 35 950802 IN111002 TAB013 00002C 0003001 00006902C FFFFFF4444FF4FFFFFF4CDFFFFFF44ECCFFF44FFFFFC4FFFFFFF4FFFFFFFFC44 1399230000350950802095111002003120130000002300003001000006902300
#4. Determining the Record Length ============================= - obviously 64 bytes - Easy in this case since it is a sub-multiple of 256 (uvhd default)
#5. uvcp "fili1=dat1/sales0,rcs=64,typ=RSF,filo1=tmp/s0,tra=0(64)" ==============================================================
#6. vi tmp/s0 <-- examine the copied file with 'vi' ========= - 1st 3 records shown below, all listed on page '2D1'
130140 21 940802 IN111001 HAM001 00002{ 0000001 00000002{ 130140 21 940 802 IN111001 SCR012 00002A 0001001 00002102A 139923 35 950802 IN111002 CH R001 00002B 0002001 00004402B 139923 35 950802 IN111002 TAB013 00002C 000 3001 00006902C 139923 35 950807 CR5421 TAB013 00002D 0004001 00009602D - - - 12 screen lines omitted - - -
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
#7. uvcp "fili1=dat1/sales0,rcs=64,typ=RSF,filo1=tmp/s2,tra=0(64),typ=RST" ======================================================================
#8. vi tmp/s2 <-- examine the copied file with 'vi' ========= - 1st 4 records shown below, all listed on page '2D2'
130140 21 940802 IN111001 HAM001 000020 0000001 000000020 130140 21 940802 IN111001 SCR012 000021 0001001 000021021 130140 21 940802 IN111001 CHR001 000022 0002001 000044022 139923 35 950802 IN111002 TAB013 000023 0003001 000069023
#9. uvhd tmp/s2 <-- recsize defaults to r256 (4 * 64 byte records) =========== - could use option 'r64' to see 1 record at a time
10 20 30 40 50 60 r# 1 0123456789012345678901234567890123456789012345678901234567890123 0 130140 21 940802 IN111001 HAM001 000020 0000001 000000020 . 3333332222332333333244333333224443332233333323333333233333333320 130140000021094080209E1110010081D001000000200000000100000000200A 64 130140 21 940802 IN111001 SCR012 000021 0001001 000021021 . 3333332222332333333244333333225453332233333323333333233333333320 130140000021094080209E11100100332012000000210000100100000210210A 128 130140 21 940802 IN111001 CHR001 000022 0002001 000044022 . 3333332222332333333244333333224453332233333323333333233333333320 130140000021094080209E11100100382001000000220000200100000440220A 192 139923 35 950802 IN111002 TAB013 000023 0003001 000069023 . 3333332222332333333244333333225443332233333323333333233333333320 139923000035095080209E11100200412013000000230000300100000690230A
Note |
|
#9a. uvhd tmp/s2 r64h2 <-- recsize option 'r64' to see 1 record at a time ================= - option 'h2' (force HEX) to see LineFeeds
10 20 30 40 50 60 r# 1 0123456789012345678901234567890123456789012345678901234567890123 0 130140 21 940802 IN111001 HAM001 000020 0000001 000000020 . 3333332222332333333244333333224443332233333323333333233333333320 130140000021094080209E1110010081D001000000200000000100000000200A
Note |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
uvcp is handy for converting fixed record length files without LineFeeds to text type files with linefeeds that may be investigated with 'vi' or printed with 'lp' (or uvlp12, etc).
problem |
|
required |
|
vi dat1/custmas1 - 1st try to examine with 'vi' ================ - wont work, 'line too long'
uvhd dat1/custmas1 r256s2 <-- 2nd try uvhd with options: ========================= 'r256' (record-size) & 's2' (double space)
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
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
uvcp "fili1=dat1/custmas1,rcs=256,typ=RSF,filo1=tmp/cm1,rcs=80,typ=RST" ======================================================================= - see explanation of file 'typ' codes on the page '2B1'
vi tmp/cm1 <-- examine the copied file with 'vi' (no problem) ========== - 1st 3 records shown below, all listed on page '2C2'
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
uvhd tmp/cm1 r80 <-- examine with 'uvhd' ================ - note LineFeed in col 80 of each record
uvhd tmp/cm1 t <-- could also use option 't' for Text files ==============
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Example#3 |
|
uvcp "fili1=dat1/custmas0,rcs=256,typ=RSF,filo1=tmp/cm1,tra=0(120),tra=240(16)" ===============================================================================
uvhd tmp/custmas0 r256,a <-- examine INPUT EBCDIC file with uvhd ======================== - option 'a' to translate character line to ASCII - zones & digits lines show EBCDIC in hexadecimal
10 20 30 40 50 60 r# 1 0123456789012345678901234567890123456789012345678901234567890123 0 130140 EVERGREEN MOTORS LTD. 1815 BOWEN ROAD NANA FFFFFF4444CECDCDCCD4DDEDDE4DEC44444FFFF4CDECD4DDCC4444444444DCDC 130140000055597955504636920334B000018150266550961400000000005151 64 IMO BC V9S1H1 250-754-5531 LARRY WRENCH ...V@... CDD4444444444CC4EFEFCF4444FFF6FFF6FFFF4DCDDE4EDCDCC4444401357000 946000000000023059218100002500754055310319980695538000000246C000 128 .........W.....-.........X'..f.....m*..................V'...f... 0000000005300016000000002570063100095000000000000000013570016000 0C0000C0270D0540C0000C0098D0263C0444C0000C0000C0000C0246D0056C00 192 .E@...V'........c..............f..............f.C 19950531 047000570000000088000000001800068000130000000069C4FFFFFFFF444444 35C0046D0000C0023C0000C0083C0056D0012C0000C0016D3019950531000000
uvhd tmp/cm1 r256 <-- examine OUTPUT ASCII file with uvhd ================= - note zones & digits show ASCII hex codes
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
Note |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Exercise#3a |
|
uvcp "fili1=tmp/cm1,rcs=256,typ=RSF,filo1=tmp/cm1L,trl=...,rcs=...,typ=..." ===========================================================================
Note |
|
uvhd tmp/cm1L r_?_ <-- confirm translation with uvhd ================== - what recsize should you use ?
vi tmp/cm1L <-- confirm translation with 'vi' ===========
Exercise#3b |
|
solution: ============================================================================
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Example#4 |
|
uvcp "fili1=dat1/custmas2,rcs=120,typ=RST,filo1=tmp/cm2,del=8(1):D,rcs=80" ==========================================================================
vi tmp/cm2 - inspect your output to confirm deletions ? ========== (should drop 4 records, leaving 28 in output file)
Note |
|
Exercise#4b |
|
solution: ============================================================================
Exercise#4c |
|
solution: ===========================================================================
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Example#5 |
|
uvhd dat1/custmas1 r256 - display 1st record BEFORE zeroing this-year fields =======================
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}....... 0000000005300016000000002570063100095000000000000000013570000000 0C0000C0270D0540C0000C0098D0263C0444C0000C0000C0000C0246D0000C00 192 .E|...V}.......................f.....<........f.C 19950531 0470005700000000880000000018000680001300000000694233333333222222 35C0046D0000C0023C0000C0083C0056D0012C0000C0016D3019950531000000
uvcp "fili1=dat1/custmas1,rcs=256,typ=RSF,filo1=tmp/cm1,mvnx12=120(5p):0" ========================================================================= - clear this-year sales fields (12 * 5 byte packed fields) - see the 'mvn' instruction at uvcp.htm#M2
uvhd tmp/cm1 - check your results with uvhd ============ - note 12 zero fields 120-179 (this year sales) - note last year sales NOT cleared (in 180-239)
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 ........ 4442222222222442535343222233323332333324455525544442222200000000 9DF00000000002306931810000250D754D55310C12290725E38000000000C000 128 ......................................................4V}....... 0000000000000000000000000000000000000000000000000000013570000000 0C0000C0000C0000C0000C0000C0000C0000C0000C0000C0000C0246D0000C00 192 .E|...V}.......................f.....<........f.C 19950531 0470005700000000880000000018000680001300000000694233333333222222 35C0046D0000C0023C0000C0083C0056D0012C0000C0016D3019950531000000
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Exercise#5a |
|
solution: ===========================================================================
Exercise#5b |
|
solution: ===========================================================================
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Given - the dat1/sales2 file has a 6 digit date (yymmdd) in columns ===== - 14-19 of the 64 byte records - here are 1st & last records (see all listed on page '2D2')
1 2 3 4 5 6 1234567890123456789012345678901234567890123456789012345678901234 CUST# SM DATE INV# PROD# QTY PRICE AMOUNT
130140 21 940802 IN111001 HAM001 000020 0000001 000000020 406082 65 020816 IN441 HAM001 00001y 0009001 00017101y
Required - insert century digits '19' into columns 14-15, & shift the ======== remainder of the record over 2 columns, increasing the record size to 66 bytes on output.
Solution |
|
uvcp "fili1=dat1/sales2,rcs=64,typ=RST,filo1=tmp/s2,rcs=66 ========================================================== ,mvc=13(2):19,mvc=15(51)13" ===========================
vi tmp/s2 - check your output (is it correct ?) =========
1 2 3 4 5 6 123456789012345678901234567890123456789012345678901234567890123456 CUST# SM DATE INV# PROD# QTY PRICE AMOUNT
130140 21 19940802 IN111001 HAM001 000020 0000001 000000020 406082 65 19020816 IN441 HAM001 00001y 0009001 00017101y
Required - also test the 1st byte of the existing 2 digit year, ======== & if '0' insert the century as '20' (vs '19'). - add 3 instructions to the solution above - 'cmc' + 'skp' + 'mvc' (see uvcp documentation) - OR replace '190' with '200'
Note |
|
solution: ===========================================================================
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Example#7 |
|
uvcp "fili1=dat1/sales2,rcs=64,typ=RST,filo1=tmp/s2, ==================================================== mvn=38(6z+)38(6z),mvn=53(8z+)53(8z) ===================================
130140 21 940802 IN111001 HAM001 000020 0000001 000000020 130140 21 940802 IN111001 SCR012 000021 0001001 000021021 ------------ 1st 2 & last 2 INPUT records ------------ 406082 35 020815 IN33001 TAB013 00001x 0008001 00014401x 406082 65 020816 IN441 HAM001 00001y 0009001 00017101y
130140 21 940802 IN111001 HAM001 00020+ 0000001 00000020+ 130140 21 940803 IN111001 SCR012 00021+ 0001001 00021021+ ------------ 1st 2 & last 2 OUTPUT records ------------ 406082 35 020816 IN33001 TAB013 00018- 0008001 00144018- 406082 65 020816 IN441 HAM001 00019- 0009001 00171019-
If desired Experiment with other possible numeric field conversions using the various codes documented at uvcp.htm#M2.
Exercise#7a |
|
solution: ===========================================================================
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Example#8 |
|
uvcp "fili1=dat1/custmas1,rcs=256,typ=RSF,filo1=tmp/cm1,typ=ISF,isk1=0(6)" ==========================================================================
ls -l tmp <-- check the output files ========= - note there are 2 output files (data & index) - tmp/cm1.dat & tmp/cm1.idx
vi tmp/cm1.dat <-- examine the data partition with the editor ============== - works because Indexed records have a LineFeed appended (changed to x'00' if the record is deleted)
uvhd tmp/cm1.dat r257 <-- examine data partition with uvhd ===================== - specify recsize=257 to allow for delete flag
uvhd tmp/cm1.idx r256 <-- examine index partition with uvhd =====================
Exercise#8a |
|
solution: =======================================================================
Exercise#8b |
|
solution: ==========================================================================
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Script 'makeISF0' is an easy way to create empty Indexed files, which are often required before online programs can begin to accumulate records. Without utilities such as these, you would have to write a COBOL program to perform simple tasks such as this.
# makeISF0 - create/initialize an empty D-ISAM file #usage: makeISF0 filename rcsz keys # =========================== #example: makeISF0 isamtest 256 0,6,60,16 # =============================== if [[ $# -ne 3 ]]; then echo "usage: makeISF0 filename rcsz key1strt,key1lth,key2strt,key2lth,etc" exit 9; fi uvcp "fili1=/dev/null,typ=RSF,rcs=$2,filo1=$1,typ=ISFs4,isks=($3)" exit 0
#1. rm tmp/* <-- clear the tmp/ subdir ========
#2. makeISF0 tmp/isamtest 256 0,6,60,16 - create empty ISAM file ===================================
EOF on input, 0 records 0 bytes read from: /dev/null close output, 0 records written to: isamtest isamtest DISAMdat STATS: recs=0,rcsz=256,keys=2,keysz=1023 KEY1: flags=0,parts=1, start=0,length=6,type=0 KEY2: flags=1,parts=1, start=60,length=16,type=0
#3. ls -l tmp - list created files =========
-rw-rw-r-- 1 uvu group 0 Jun 07 10:02 isamtest.dat -rw-rw-r-- 1 uvu group 4096 Jun 07 10:02 isamtest.idx
Note |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
The UNIX system sort is inadequate for sorting mainframe type files because:
Example#1 |
|
uvsort "fili1=dat1/custmas2,rcs=120,typ=RST,filo1=tmp/cm2,key1=60(16)" ======================================================================
vi tmp/cm2 <-- examine the output (in sequence by city name ?) ========== - typ=RST inserts a LineFeed in last byte (so vi can be used)
Exercise#1a |
|
solution: ==========================================================================
Exercise#1b |
|
solution: ==========================================================================
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Example#2 |
|
uvsort "fili1=dat1/sales3,rcs=64,typ=RST,filo1=tmp/s3,key1u1=20(8)" ===================================================================
vi tmp/s3 <-- check your output (have records been dropped ?) =========
Exercise#2a |
|
solution: ==========================================================================
Exercise#2b |
|
solution: ==========================================================================
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Option 'u' in the 5th byte of 'key#u' specifies 'unique keys' (data reduction) which outputs only 1 record (or none) for the keys at the specified level '#'.
key_u1 |
|
key_u2 |
|
key_u4 |
|
Option 's' in the 5th byte of 'key#s' specifies selection of records for duplicate key sets at the specified key level#. IE - drop all records that had no duplicate keys at the specified key level#.
key_s1 |
|
key_s2 |
|
key_s4 |
|
key_s4b |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Example#3 |
|
uvsort "fili1=dat1/sales2,fili2=dat1/sales3,rcs=64,typ=RST, =========================================================== filo1=tmp/s23,key1=0(6)" ========================
vi tmp/s23 - examine output (do you see records from both files ?) ========== - Sorting these files together does not make much sense because of the different formats of the numeric fields but this is only an exercise.
Exercise#3a |
|
solution: ==========================================================================
Exercise#3b |
|
solution: ==========================================================================
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Example#4 |
|
uvsort "fili1=dat1/custmas1,rcs=256,typ=RSF,filo1=tmp/cm1,typ=ISF, ================================================================== key1=0(6),isk1=0(6),isk2=80(10)" ================================
NOTE |
|
Exercise#4a |
|
solution: ==========================================================================
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Given - Assume that the Index of tmp/cm1 has become corrupted ===== (tmp/cm1 was loaded on the previous page)
Required - Build a new Indexed file using only the data partition of the ======== input file: tmp/cm1.dat - Specify your output as tmp/cm1a, which will create tmp/cm1a.dat & tmp/cm1a.idx. - You could subsequently change the names of the output files back to the originals (using the 'mv' command).
uvsort "fili1=tmp/cm1.dat,rcs=129,typ=RSF,filo1=tmp/cm1a, ========================================================= rcs=128,typ=ISF,key1=0(6),del=128(1):0x00" ==========================================
Exercise#5a |
|
solution: ==========================================================================
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Example#6 |
|
uvsort "fili1=dat1/sales2,rcs=64,typ=RST,filo1=tmp/s2,key1=13(6y)" ==================================================================
cat tmp/s2 - list file to inspect results ==========
DATE cust# slmn YYMMDD invoice product qty price amount
150825 44 960804 IN1122 HAM001 000025 0005001 000125025 223240 65 980816 CR955 HAM001 000028 0008001 000224028 308685 75 990812 IN6605 SAW001 00001p 0000001 00000001p --------------------etc--------------------- 315512 33 000805 IN2255 WID115 00001u 0005001 00007501u 400002 85 010812 CR245 HAX129 00001v 0006001 00009601v 406082 55 020815 IN33001 BBQ001 00001w 0007001 00011901w || note - years 00-49 sort high
Exercise#6 |
|
Ex#6a |
|
Ex#6b |
|
Ex#6c |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
4A1. | uvcopy - Introduction & Overview |
- general purpose file maintenance & data manipulation utility | |
- parameter file driven (interpretive) | |
- user written or supplied (over 500 pre-programmed jobs supplied) |
4A2. | Pre-Programmed jobs (using the uvcopy utility) |
- table3d, calendar1, cobmap1, & many more |
4A3. | copy1 - uvcopy 'skeleton job' (template) to help you create a new job |
- copy/rename/modify to solve your current data file problem |
4A4. | Creating new uvcopy jobs |
- easy to copy demo jobs & modify for your purposes |
4B1. | example - copy dat1/custmas1, shorten records to 80 bytes, insert LF's |
4C1. | exercise - Year 2000 expansion of 6 digit date fields to 8 digits |
4C2. | - uvcopy debugging demonstration (Run OPtion 'd') |
4D1. | exercise - create a telephone list from supplied customer master file |
4D2. | exercise - sort the telephone list file by customer name |
4E1. | example - write uvcopy job to create an edited report (product sales list) |
4F1. | exercise - expand the edited report |
- show cust#, slsmn, date, invoice, product#, qty, price,& amount |
4G1. | example - run 'cmtbl2' to create summary tables from dat1/custmas1 |
- product sales by city & province |
4H1. | exercise - write a uvcopy job to create summary tables from dat1/sales2 |
- product sales by product & salesman |
4I1. | creating Delimited files for Excel, SQL, etc |
example - creating |pipe|delimited| name & address from dat1/custmas2 |
4J1. | exercise - create comma delimited customer telephone list |
4K1. | addup0 - uvcopy job to accumulate $amount in the dat1/sales2 file |
- specific version of pre-programmed job 'addup1' in Part 6 | |
(pre-programmed job to acum any field in any file) |
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
uvcopy is a 'general purpose' (can do anything) data file manipulation utility. It gives you the power of assembler without the complexity. The uvcopy interpreter interprets/executes a text file of instructions that are easily created & updated with the editor.
'uvcopy' is essential to running mainframe applications on Unix/Linux systems, because it can do many things not possible with the standard unix/linux utilities such as: processing 'packed decimal' fields, handling 'Indexed files' (compatible with Micro Focus COBOL),& field addressing by column# (common in mainframe utilities, but not in unix utilities).
uvcopy can be used to replace various mainframe utilties such as: IDCAMS, IEBGENER, IEBCOPY, DITTO, FILEAID, EASYTRIEVE, QUIKJOB, etc. The JCL converter automatically converts some of these steps to uvcopy or uvcp.
The interpretive nature of uvcopy makes it easy to learn & to use. If you have a mainframe backgound, you will probably be familiar with the uvcopy instruction formats since they are patterned after the IBM 360 assembler.
uvcopy has over 90 instructions and many of these are pwerful subfunctions. For example 'tbl' will build a summary table in memory based on any argument & up to 6 accumulators. It creates a new entry for new arguments & adds to existing entries on matching arguments. The table is usually dumped to a report file at EOF by the 'tbp' instruction (see the sales by province at '4G1').
You can see a summary of the over 90 uvcopy instructions & subfunctions starting at https://uvsoftware.ca.uvcopy3.htm#add. For a particularly powerful example see the rttdemo at https://uvsoftware.ca.uvcopy3.htm#rtt, which tables a COBOL program in memory, modifies with a search/replace table,& dumps the result to an output file. This uvcopy job requires only 12 instructions, including 'rtb' (read progam into table), another 'rtb' (read the search/replace table into memory), 'rtt' (search/replace), & 'wtb' (write modified program table to output file).
There are over 500 pre-programmed 'uvcopy jobs' supplied with the Vancouver Utility package. many of these are used in mainframe conversions. For example the COBOL converter is a uvcopy job (but the JCL converter is a C program).
Many supplied uvcopy jobs should be useful to any Unix/Linux site and especially for sites running applications that have been converted from a mainframe. For example 'uvcopy cobmap1' will create a record layout from a COBOL copybook, and 'uvcopy xcobcopy2' will create a COBOL copybook cross-reference.
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
There are over 500 pre-programmed utility jobs (using uvcopy), for example 'uvcopy table3d,directory=xxx,arg1=keyword' scans all files in a directory and creates a table summary using the 'tbl' instruction (described above).
Another useful example is 'uvcopy calendar1'
uvcopy calendar1 <-- print a calendar (with Julian dates) for the current month ================ or any range of months by options entered at the prompt
SCANjobs.htm | - scan all files in directory for specified patterns |
REPjobs.htm | - search/replace all files in directory for a pattern & replace |
by an alternate OR use table of multiple search/replace patterns |
uvcopy selectfp1 |
|
uvcopy selectft1 |
|
uvcopy selectrp1 |
|
uvcopy selectrmp1 |
|
uvcopy selectrmp3f |
|
uvcopy hexcalc1 |
|
Part_6 | - even more pre-programmed jobs |
uvcopy finds its instruction files ('parameter files' or 'uvcopy jobs') via an environmental variable 'PFPATH' in the profile (similar to 'PATH').
export PFPATH=$HOME/pf:$UV/pf/adm:$UV/pf/demo:$UV/pf/util:$UV/pf/IBM ====================================================================
Using the above export, uvcopy will look first in the 'pf' subdir in your homedir, and then in the pf/subdirs supplied with Vancouver Utilities.
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
'uvcopy' requires its instructions to be in a pre-edited file, whose name you will supply on the uvcopy command line. The following 'skeleton' parameter file is provided (in the uvadm/pf sub-directory), as a starting point, when you want to create a new job.
# copy1 - uvcopy skeleton job, copy, rename,& modify as required' # - this job is for 'text' files (see copyf1/copyI1 for Seq/ISAM) # fili1=?dat1/test100,typ=LSTl1,rcs=256 # code filenames or leave ? for prompt filo1=?tmp/$fili1,typ=LSTt,rcs=256 @run opn all open files # begin loop to get & put records until EOF loop get fili1,a0 get record into area 'a' skp> eof (condition code set > at EOF) #----------------------------- mvc b0(256),a0 move input record to output area 'b' # --- -----,----- ** add your instructions here ** #----------------------------- put filo1,b0 write record to output file skp loop return to get next record # eof cls all close files eoj end job
The 'copy1' skeleton job shown above is provided for you as a starting point intended for you to copy, rename,& modify as required. The following example suggests how you would use the copy1 uvcopy skeleton job, if you wished to create a new uvcopy job called 'fix1'.
mkdir pf <-- make subdir for your uvcopy jobs in your homedir ========
cp /home/uvadm/pf/demo/copy1 pf/fix1 - copy 'copy1' to your sub-directory ==================================== renaming as you wish (fix1)
vi pf/fix1 - modify the job as required ========== - inserting your instructions - modifying file names, types,& record sizes - don't forget to change comment lines to new name & job description
uvcopy pf/fix1 - execute uvcopy to interpret your prmfile ==============
- - if errors - - - correct errors & rerun - please see notes on next page
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
fili1=?input,typ=?LST,rcs=256 filo1=?tmp/$fili1,typ=?LSTt,rcs=256
#----------------------------- mvc b0(256),a0 move record to output area 'b' # --- -----,----- *** add your instructions here *** #-----------------------------
If you did not change anything, all this skeleton job would do is copy text file records with no changes.
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
B1 example - copy dat1/custmas1, shorten records to 80 bytes, insert LF's ==========
This will drop off the packed fields, leaving cust#,name,adrs,city,& province. See the record layouts at the begining of this section.
alternatively this exercise could be done with 'uvcp' as follows:
uvcp "fili1=dat1/custmas1,rcs=256,typ=RSF,filo1=tmp/cm1,rcs=80,typ=RST" =======================================================================
cp $UV/pf/demo/copyf1 pf/cmfix1 - copy skeleton renaming to cmfix1 ===============================
vi pf/cmfix1 <-- modify with vi as required ============
# cmfix1 - uvcopy training exercise# 4B1 <--- update name & dscrptn # - copy dat1/custmas1 to tmp/cm1, shorten rcs to 80, insert LF opr='$jobname - uvcopy ex# 4B1, copy dat1/custmas1 to tmp/cm1, rcs to 80(LF)' fili1=?dat1/custmas1,rcs=a256,typ=RSF <--- change typ from LST filo1=?tmp/cm1,rcs=b80,typ=RST <--- change typ from LSTt @run opn all loop get fili1,a0(256) skp> eof #-------------------------------- mvc b0(80),a0 <--- copy 80 bytes only #-------------------------------- put filo1,b0(80) skp loop # eof cls all eoj
Now execute uvcopy to interpret parameter file pf/cmfix1 as follows:
uvcopy pf/cmfix1 <-- execute uvcopy to interpret prmfile cmfix1 ================
If errors: correct errors & re-test until success
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
4C1 exercise - Year 2000 expansion of 6 digit date fields to 8 digits ============
given |
|
required |
|
method |
|
#1. cp /home/uvadm/pf/demo/copyf1 pf/slfix2 <-- copy & rename skeleton job =======================================
#2. vi pf/slfix2 <-- modify as shown below ============
#3. uvcopy pf/slfix2 <-- execute ================
# slfix2 - uvcopy training exercise# 4C1 <-- update name & description opr='$jobname - ex# 4C1, copy dat1/sales2 to tmp/s2, inserting century 19' fili1=?dat1/sales2,rcs=64,typ=RSF <-- change typ from LST filo1=?tmp/$fili1,rcs=66,typ=RST <-- out rcsz 66 & typ=RST (not LSTt) @run opn all loop get fili1,a0 skp> eof #-------------------------------- mvc b0(13),a0 <-- move 1st 13 bytes unchanged mvc b13(2),'19' <-- insert '19' in cols 14-15 mvc b15(51),a13 <-- move cols 14-64 to 16-66 #-------------------------------- put filo1,b0 skp loop # eof cls all eoj
4C2 exercise - same problem as above, but in addition ============
required |
|
4C3 exercise - same problem as above, but in addition ============
required |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
The uvcopy 'debugger' is activated by Run OPtion 'd', append ',rop=d' on your uvcopy command as follows:
uvcopy slfix2,rop=d ===================
slfix2 - ex# J2, copy dat1/sales2 to tmp/sl2, inserting century 19 140126:105222:slfix2: uvcopy ver=20140120 pf=/home/uvadm/pf/demo/slfix2 uvcopy LNX H64 license=20140120_10A_990301 site=Berks_EIT 0 opn.. all debug> dat1/sales2 = default fili01 - null accept or reenter ? tmp/sales2 = default filo01 - null accept or reenter ? 128 loop get.. fili1,a0 debug> 304 skp>. eof debug> 432 mvc.. b0(13),a0 <-- mov debug> 560 mvc.. b13(2),'19' <-- ins debug> 688 mvc.. b15(51),a13 <-- mov debug> 816 put.. filo1,b0 debug> 992 skp.. loop debug>p a0(60) <-- Print 1st 60 bytes in area 'a' 012345678901234567890123456789012345678901234567890123456789 -->130140 21 990802 IN111001 HAM001 000020 0000101 0000020 debug>p b <-- Print area b (defaults to 1st 60 bytes) 012345678901234567890123456789012345678901234567890123456789 -->130140 21 19990802 IN111001 HAM001 000020 0000101 00000 debug> g <-- Go (run to EOJ) 140126:105233:slfix2: EOF fili01 rds=20 size=1280: dat1/sales2 140126:105233:slfix2: EOF filo01 wrts=20 size=1320: tmp/sales2
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
4D1 exercise - create a telephone list from supplied customer master file ============
given |
|
required |
|
130140 EVERGREEN MOTORS LTD. 604-754-5531 JOHN HENRY 132588 GEECOE GENERATOR SERVICES 604-278-4488 139923 JOHNSTONE BOILER & TANKS 604-320-1845 GEORGE BROWN 142175 LILLY ELECTRIC (1973) LTD 604-521-3256 145264 D MAGRATH SUPPLIES LTD. 604-885-8274 147615 O'CONNER R.V. CENTRE 604-858-4161 BONNIE
suggested |
|
Note |
|
4D2 exercise - sort the telephone list file by customer name ============ - input file is 'tmp/custphone1' created by the above exercise - name your output file as 'tmp/custphone1s' - use 'uvsort' utility (see prior exercises in this section) - you could also program a sort within the custphone1 uvcopy job (optional exercise if time & interest permit)
4D3 exercise - drop any deleted records ('D' in column 9) ============ - try this in both 'uvsort' & the original 'custphone1' job
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
4E1 example - write a uvcopy job to create the edited report shown below =========== - The jobname will be 'slrpt1' & it will read the 'dat1/sales2' file & write the output report into tmp/slrpt1 which can be subsequently printed with 'lp' or examined with 'vi'.
1 2 3 4 1234567890123456789012345678901234567890 cust# product# amount =============================== 130140 HAM001 .20 130140 SCR012 210.21 139923 HAM001 440.22 - - - etc - - - 406082 BBQ001 1,190.17- 406082 TAB013 1,440.18- 406082 HAM001 1,710.19-
uvcopy pf/slrpt1 <-- run this demo job (provided in uvadm/pf) ================
# slrpt1 - simple example of using uvcopy for edited reports # - list cust#, product#,& amount from the dat1/sales2 demo file # - output file will be tmp/slrpt1 & is not automatically printed # - you can use 'cat' to display, 'vi' to inspect, or 'lp' to print fili1=dat1/sales2,typ=RSF,rcs=64 #input file (see layout in uvtrain.doc) filo1=tmp/$fili1,typ=LSTt,rcs=80 #output file, for subsequent more/vi/lp @run opn all open files # create report heading mvf b0(40),'cust# product# amount' putb filo1,b0(80) write report heading line to outfile put filo1,' ' write blank line before detail lines # begin loop to get records, edit & write line to report file (until EOF) loop get fili1,a0(64) get next record skp> eof (cc set > at EOF) # move cust#, product#,& edit amount to output line (area b) mvc b0(6),a0 move cust# from area a to are b mvc b10(6),a30 move product# to output area b edt b20(12),a53(9),'zzzz,zzz.99-' edit amt to out area # write line to output file putb filo1,b0(80) write line to output file skp loop repeat loop # EOF - close files & end job eof cls all eoj
Note |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
4F1 exercise - create the edited report shown below from dat1/sales2. ============ - name your uvcopy parameter file 'pf/slrpt2'. - write the output report into a file named 'tmp/slrpt2' which you can subsequently print with 'lp' or examine with 'vi'.
1 2 3 4 5 6 7 8 12345678901234567890123456789012345678901234567890123456789012345678901234567890 cust# slsmn date invoice# product# quantity price $amount ====================================================================== 130140 21 940802 IN111001 HAM001 20 .01 .20 130140 21 940802 IN111001 SCR012 21 10.01 210.21 139923 35 940802 IN111002 HAM001 22 20.01 440.22 308685 75 940812 IN6605 SAW001 10- .01 .10- 308685 75 940812 IN6605 WID115 11- 10.01 110.11- 308685 75 940812 CR8835 TAB013 12- 20.01 240.12-
Compare the required layout above with the file layout shown on page '2D2'. You can move cust#, slcmn, date, invoice#,& product# with 1 'mvc'. You can then edit qty, price,& $amount with 3 'edt' instructions. The edited output fields must be larger than the record input fields to allow for the editing symbols, but the spacing does not have to match the sample shown above, as long as it looks reasonable.
You could prepare your parameter file by copying from the 'copy1' skeleton job as previously explained, or you could copy the 'slrpt1' job (prior page), rename as slrpt2,& then modify as required.
cp /home/uvadm/pf/demo/copyf1 pf/slrpt2 <-- copy skeleton for a starting point ======================================= - or -
cp pf/slrpt1 pf/slrpt2 <-- or use the prior sample report job ======================
vi pf/slrpt2 <-- modify as required for this exercise ============
uvcopy pf/slrpt2 <-- execute uvcopy to interpret your job ================
Note |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
4G1 example - run 'cmtbl2' to create the 2 summary table reports shown below. ===========
uvcopy cmtbl2 - execute uvcopy to interpret prmfile 'cmtbl2' =============
tbl#001 pg#001 1994/08/16_11:43:03 sales by city name (this yr & last yr) -argument- -acum#1- % -acum#2- % line# count % city name thisyr sales lastyr sales 1 4 12 CALGARY 3,150.58 3 3,274.76 5 2 1 3 CHILLIWACK 4,478.00 4 8,610.30 14 3 1 3 COQUITLAM 1,420.00 1 .00 - - - etc - - - 21 4 12 VANCOUVER 24,112.72 25 1,220.16 2 22 1 3 WARBURG 17.39- 1,534.06 2 23 1 3 YELLOWKNIFE 4,901.21 5 .00 32*100 *TOTAL* 93,090.00 *100 57,826.30 *100
tbl#002 pg#001 1994/08/16_11:43:03 sales by province (this yr & last yr) -argument- -acum#1- % -acum#2- % line# count % province thisyr sales lastyr sales 1 3 9 AB 323.13 1,534.06 2 2 11 34 AL 29,530.35 31 35,979.84 62 3 17 53 BC 58,335.31 62 20,312.40 35 4 1 3 NW 4,901.21 5 .00 32*100 *TOTAL* 93,090.00 *100 57,826.30 *100
# cmtbl2 - table analysis of customer master sales history file opr='$jobname - summarize sales (thisyr&lastyr) by city name & province' rop=r1 # prompt oprtr for report disposition at EOJ fili1=?dat1/custmas1,rcs=256,typ=RSF filo1=?tmp/$fili1,rcs=80,typ=LSTt @run opn all # begin loop to read all customer master sales history records # - crossfooting & accumulating (tabling) thisyr & lastyr totals loop get fili1,a0(256) skp> eof xft $ca1,a120(5p),12 xft $ca2,a180(5p),12 tblt1f2 a60(16),'city name;thisyr sales;lastyr sales',$ca1,$ca2 tblt2f2 a77(2),'province;thisyr sales;lastyr sales',$ca1,$ca2 skp loop # end of file - print/edit the tables to a file for: lp, cat,or vi eof tbpt1s2 filo1,'sales by city name (this yr & last yr)' tbpt2s1 filo1,'sales by province (this yr & last yr)' cls all eoj
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
4H1 exercise - create the summary table reports shown below from dat1/sales2. ============ - name your uvcopy parameter file 'pf/sltbl2'. - write the output report into a file named 'tmp/sltbl2' which you can subsequently print with 'lp' or examine with 'vi'.
tbl#001 pg#001 1994/08/16_12:09:12 $sales by product# -argument- -acum#1- % line# count % product# $sales 1 1 5 BBQ001 1,190.17- 26- 2 1 5 BIT001 2,610.29 57 3 1 5 CHR001 440.22 9 - - - etc - - - 10 4 20 TAB013 29.83- 11 1 5 WHIP75 1,890.27 41 12 2 10 WID115 860.26- 19- 20*100 *TOTAL* 4,501.00 *100
tbl#002 pg#001 1994/08/16_12:09:12 $sales by salesman# -argument- -acum#1- % line# count % slsmn# $sales 1 2 10 21 210.41 4 2 3 15 33 1,700.42- 37- - - - etc - - - 7 3 15 75 350.33- 7- 8 1 5 85 960.16- 21- 20*100 *TOTAL* 4,501.00 *100
You could prepare your parameter file by copying from the 'copy1' skeleton job as previously explained, or you could copy the 'cmtbl2' job (prior page), rename as sltbl2,& then modify as required.
cp /home/uvadm/pf/demo/copy1 pf/sltbl2 <-- copy skeleton for a starting point ====================================== - or - cp /home/uvadm/pf/demo/cmtbl2 pf/sltbl2 - or use the prior sample report job =======================================
vi pf/sltbl2 <-- modify as required for this exercise ============
uvcopy pf/sltbl2 <-- execute uvcopy to interpret your job ================
Note |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
You can use uvcopy to convert fixed field records to "delimited","format" for Excel, Access, or to load RDBMS tables for Oracle or SQL Server. You can code whatever delimiter you wish on the 'var' instruction. Common choices are: comma, comma& quotes, tab, pipe (I prefer pipe '|').
Here in uvtrain, we will 1st present an illustrated examples using 'var' to create a pipe|delimited|file from the dat1/custmas2 demo file. See the entire file listed on page '2C2', but here are a few records.
130140 EVERGREEN MOTORS LTD. 1815 BOWEN ROAD NANAIMO BC V9S1H1 250-754-5531 LARRY WRENCH
132588 GEECOE GENERATOR SERVICESUNIT 170 - 2851 SIMPSON RICHMOND BC V6X2R2 604-278-4488 HARRY LIGHT
139923 JOHNSTONE BOILER & TANKS 1250 EAST PENDER STREET VANCOUVER BC V5L1W1 604-320-1845GEORGE BROWN
Layout: 01-06=cust#,11-35=name,36-60=adrs,61-76=city,78-79=prov,81-90=zip 91-102=phone#,103-120=contact
130140|EVERGREEN MOTORS LTD.|1815 BOWEN ROAD|NANAIMO|BC|V9S1H1|
132588|GEECOE GENERATOR SERVICES|UNIT 170 - 2851 SIMPSON|RICHMOND|BC|V6X2R2|
139923|JOHNSTONE BOILER & TANKS|1250 EAST PENDER STREET|VANCOUVER|BC|V5L1W1|
Note |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
# delimcustNA1 - uvcopy demo job stored in: /home/uvadm/pf/demo/ # delimcustNA1 - convert customer Name&Address to '|' delimted format # - demo conversion of fixed length records to delimited format # - see www.uvsoftware.ca/uvtrain.htm#4I1 # # uvcopy delimcustNA1,fili1=dat1/custmas1,filo1=tmp/custmasNA.pipe # ================================================================ # Layout: 01-06=cust#,11-35=name,36-60=adrs,61-76=city,78-79=prov,81-90=zip # 91-102=phone#,103-120=contact # # ** sample Input/Output - 1st of 32 records ** # # 130140 EVERGREEN MOTORS LTD. 1815 BOWEN ROAD NANAIMO BC # V9S1H1 250-754-5531 LARRY WRENCH # # 130140|EVERGREEN MOTORS LTD.|1815 BOWEN ROAD|NANAIMO|BC|V9S1H1| # opr='$jobname - convert fixed field length records to pipe delimted format' rop=r1 # option r1 causes prompt at EOF to view the output file fili1=?dat1/custmas1,rcs=256,typ=RSF filo1=?tmp/custmasNA.pipe,rcs=128,typ=LSTt @run opn all loop get fili1,a0(256) get next input record skp> eof (cc set > at EOF) # # spread out fields into area b 100 bytes apart - in preparation for 'var' clr b0(900),' ' init area b to all blanks mvc b100(6),a0 cust# to 1st field mvc b200(25),a10 name to 2nd field mvc b300(25),a35 adrs to 3nd field mvc b400(16),a60 city to 4th field mvc b500(2),a77 province to 5th field mvc b600(10),a80 postal code to 6th field var c0(128),b100(100),6,'|' convert to '|' delimited in area 'c' # ============================= 'var' is the heart of this job put filo1,c0(128) write out variable lth text record skp loop # eof cls all close all files eoj end job
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Given - demo file dat1/custmas2 (fixed field records) ===== - see layout & listing on page '2C2'
Required - write a uvcopy job to convert to a comma delimited telephone list ======== - with cust#, cust-name, telephone#,& contact-name (only 4 fields)
Note |
|
130140 EVERGREEN MOTORS LTD. 1815 BOWEN ROAD NANAIMO BC V9S1H1 250-754-5531 LARRY WRENCH
132588 GEECOE GENERATOR SERVICESUNIT 170 - 2851 SIMPSON RICHMOND BC V6X2R2 604-278-4488 HARRY LIGHT
139923 JOHNSTONE BOILER & TANKS 1250 EAST PENDER STREET VANCOUVER BC V5L1W1 604-320-1845GEORGE BROWN
Layout: 01-06=cust#,11-35=name,36-60=adrs,61-76=city,78-79=prov,81-90=zip 91-102=phone#,103-120=contact
130140,EVERGREEN MOTORS LTD.,250-754-5531, LARRY WRENCH,
132588,GEECOE GENERATOR SERVICES,604-278-4488, HARRY LIGHT,
139923,JOHNSTONE BOILER & TANKS,604-320-1845,GEORGE BROWN,
/home/useridxx <-- your homedir :-----dat1 - demo data files (copied from $UV/dat1/...) :-----pf - Parameter Files (jobs) for uvcopy :-----tmp - for your output files
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
#1. login --> your homedir =====
#2. mkdir dat1 pf tmp ================= - make subdirs if not already made for prior exercises
#3. cp $UV/dat1/custmas2 dat1 ========================= - copy demo input file to your homedir (if not already copied)
#4. Write a uvcopy job to create the delimited telephone list - choose 1 of the following 3 methods:
#4a. vi pf/delimTEL1 =============== - enter all code for the new job using 'vi' (the hard way)
#4b. cp $UV/pf/demo/copy1 pf/delimTEL1 ================================= - copy generic/skeleton uvcopy job to your homedir, renaming for your new job
#4c. cp $UV/pf/demo/delimcustNA1 pf/delimTEL1 ======================================== - copy/rename a job more similar to the desired new job
#5. vi pf/delimTEL1 =============== - modify the job as required (see desired output above)
#6. uvcopy pf/delimTEL1 =================== - execute the job (probably will not run 1st time)
#7. vi tmp/custmasTEL.csv ===================== - examine output (is it correct ?) - repeat #5, #6,& #7 until you get desired results
#8. uvcopy pf/delimTEL1,rop=d ========================= - execute job with DEBUG option - see sample debug session on page '4C2'
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
#8. vi $UV/pf/demo/delimcustTEL1 ============================ - inspect UV Software's solution (if you need help with your solution)
#9a. uvlp12 tmp/custmasTEL.csv <-- list your output =========================
#9b. uvlp12 pf/delimTEL1 <-- list your uvcopy job ===================
If desired, you could change the delimiter on the 'var' instruction to alternates & rerun the job to observe the differences.
If you want 'tab' delimiters, you need to code the tab in hexadecimal:
var c0(128),b100(100),6,x'09' convert to 'tab' delimited # ================================
If you want to "comma","delimit","with","quotes", use the 'dlm' instruction instead of the 'var' instruction. 'dlm' takes care of changing the 1st & last delimiters to just '"' vs '","'. It also has option 'n1' to omit the "quotes" on all numeric fields.
dlm c0(128),b100(100),6 <-- 'dlm' for "quoted","comma","delimiters" # ==========================
dlmn1 c0(128),b100(100),6 <-- option 'n1' to omit "quotes' on numerics # ==========================
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Given - demo file dat1/sales2 ===== - see detailed layout & listing on page '2C2' - here is column scale + 1st & last records
1 2 3 4 5 6 123456789012345678901234567890123456789012345678901234567890123 cust# slsm# date invoice# product# qty price amount 130140 21 990802 IN111001 HAM001 000020 0000101 000002020 406082 65 030816 IN441 VAR200 00001y 0000101 00000191y
Required - write a uvcopy job to accumulate $amount & display total at EOF ========
#1. Login --> /home/userxx #2. mkdir dat1 pf tmp <-- make subdirs (if not already existing) #2a. rm -f tmp/* <-- remove any existing tmp/ files #3. cp $UV/dat1/sales2 dat1 <-- copy demo file to your homedir (if not already)
#4. vi pf/addup0 <-- create code to acummulate $amt & display total at EOF ============
Note |
|
#5. uvcopy addup0 <-- execute job =============
addup0 - addup $amount in dat1/sales2 & display total at EOF 140514:205908:addup0: uvcopy ver=20140514 pf=/home/uvadm/pf/demo/addup0 uvcopy LNX H64 license=20140514_99V_930601 site=UV_Software dat1/sales2 = default fili01 - null accept or reenter ?
EOF, records=20, $amt total= 10,643.00 in 53(9) of: dat1/sales2 140514:205909:addup0: EOF fili01 rds=20 size=1280: dat1/sales2 140514:205909:addup0: EOF filo01 wrts=1 size=64: tmp/sales2.tot
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
# addup0 - uvcopy Parameter File from UVSI stored in: /home/uvadm/pf/demo/ # addup0 - addup $amount in dat1/sales2 & display total at EOF # - sales2 demo file has $amt in cols 54-62, dsplcmnt(lth) = 53(9) # - demo for UV training, see https://uvsoftware.ca/uvtrain.htm#4K1 # - specific version of general purpose addup1 for any field any file # (see addup1 at https://uvsoftware.ca/uvtrain.htm#6B1) # #usage: uvcopy addup0 <-- acum $amount in dat1/sales2 # ============= # opr='$jobname - addup $amount in dat1/sales2 & display total at EOF' fili1=?dat1/sales2,rcs=64,typ=LST # demo file 64 byte records + LF in 65 filo1=tmp/$fili1.tot,rcs=100,typ=LSTt # total displayed & written to tmp/... @run opn all open files # # begin loop to get records, adding up spcfd field man20 get fili1,a0 get a record skp> man90 (cc set > at EOF) add $ca1,1 count records add $ca2,a53(9) accumulate for total skp man20 return to get next record # # EOF - write & display record count & field total, close files & end job man90 mvfv1 b0(100),'EOF, records=$ca1, $amt total= TOTAL in 53(9) of: $fili1' edta1 g0(16),$ca2,'zzzz,zzz,zzz.99-' edit acum2 repf4 b0(100),'TOTAL',g0(16) replace pattern with edited $amt putx1 filo1,b0 write record & display (via option 'x1') cls all eoj
Note |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
5A1. | uvfix jobs - Introduction to uvfix1, uvfixA, uvfix2,& uvfixB |
- scripts make it easy to apply powerful uvcopy instructions | |
to perform whatever data file manipulation required without | |
having to write the uvcopy job framework (file I/O, etc) |
5B1. | uvfix1 - copy 1 Text file to tmp/... applying uvcopy instructions |
- may then inspect (with vi tmp/...) & copy back if desired | |
- option to output Fixed-Length files (vs default typ=LSTt text) |
5C1. | uvfixA - copy ALL Text files from 1 subdir to a 2nd subdir |
while applying uvcopy instructions | |
- may then inspect (with vi subdir2/*) & change name to subdir1 |
5D1. | uvfix2 - copy 1 Fixed-Length file to tmp/... applying uvcopy instructions |
- may then inspect (with uvhd tmp/...) & copy back if desired |
5E1. | uvfixB - copy ALL Fixed-Length files from 1 subdir to a 2nd subdir |
while applying uvcopy instructions | |
- may then inspect (with uvhd subdir2/...) & change name to subdir1 |
5F1. | uvcpfix1 - copy 1 Text file to tmp/... applying 'uvcp' instructions |
- may then inspect (with vi tmp/...) & copy back if desired | |
- simpler than uvfix1/uvcopy when changing file types only |
5G1. | uvcpfix2 - copy 1 Fixed-Length file to tmp/... applying 'uvcp' instructions |
- may then inspect (with vi tmp/...) & copy back if desired | |
- option to output text (typ=LSTt) vs default typ=RSF (Fixed Length) |
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
If you can't perform your desired data file manipulation using unix 'sed', you can do anything you can imagine with the 'uvcopy' utlity.
'uvcopy' can do many things not possible with the standard unix/linux utilities such as 'sed' - processing 'packed decimal fields', handling 'Indexed files', & 'field addressing by column#' (common in mainframe utilities, but not in unix utilities).
The interpretive nature of uvcopy makes it easy to learn & to use. If you have a mainframe backgound, you may already be familiar with the uvcopy instruction formats since they are patterned after the IBM 360 assembler, but interpretive - no compile required, just edit & execute with the uvcopy interpreter.
uvcopy has over 90 instructions and about half of these are pwerful subfunctions. For example 'fix' will convert delimited files with any specified delimiter (tab, comma, pipe, etc) to fixed formats. 'fix' is very useful to convert the tab or csv delimited files from Excel spread- sheets to fixed format files required by COBOL applications. The 'var' instruction (opposite of 'fix') will convert fixed-formats to delimited formats for importing into spread-sheets or database tables.
The 'uvfix' scripts make it easy to employ the powerful uvcopy instructions without having to program the uvcopy framework (file I/O, etc). You only need to enter the uvcopy instructions desired when prompted. See https://www.uvsoftware.ca/uvcopy3.htm for the 90 instructions available.
There are 4 'uvfix_' scripts (in /home/uvadm/sf/util/...) that call 4 'uvfix_' uvcopy jobs (from /home/uvadm/pf/util/...). The scripts make the command line as simple as possible - specify only the input file-name & record-size if fixed. The output files are written to the tmp/... subdir (in your current dir) where you can inspect & then copy back overwriting the input file if desired.
uvfix1 |
|
uvfixA |
|
uvfix2 |
|
uvfixB |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Here are some demos used to illustrate the 4 uvfix_ scripts available. You can run these demos from /home/uvadm/ using the demo files provided in /home/uvadm/dat1/...
#0. Login uvadm --> /home/uvadm #0a. Or Login yourself if you are in same group as uvadm #0b. cd /home/uvadm
Given - text file /home/uvadm/dat1/names1 ===== - multiple sets of 5 line Names & Addresses - 1st 5 records shown below
#1. more dat1/names1 <-- investigate Input file ================
Owen Townsend UV Software 4667 Hoskins Rd North Vancouver BC Canada V7K2R3
Required - replicate the records for 3 up label printing ======== - output should be as follows:
#2. uvfix1 dat1/names1 <-- run uvfix1 & enter instructions ================== at the prompts as follows: uop=q1n99r8192 - user option defaults n99 - output record count limit (high# copies to EOF) r8192 - recsize ONLY for Fixed-Length OUTPUT records if desired - for Fixed-Length, reply RSF/RST at prompt (default text typ=LSTt) - for Text files: accept default recsize & default typ=LSTt User OPtion (uop) defaults = q1r8192n999999
#2a. -->null accept or override --> <-- null entry to accept defaults #2b. -->LST = default file type --> <-- null accept typ=LST
#3. Enter Instructions or '.' to process =================================== #3a. mvc b27(25),a0 <-- move(copy) cols 1-25 to 28-53" #3b. mvc b56(25),a0 <-- move(copy) cols 1-25 to 56-71" #3c. . <-- enter '.' to end instrns & execute job"
#4. more tmp/names1 <-- inspect output file =============== - 1st 5 records as follows:
Owen Townsend Owen Townsend Owen Townsend UV Software UV Software UV Software 4667 Hoskins Rd 4667 Hoskins Rd 4667 Hoskins Rd North Vancouver BC Canada North Vancouver BC Canada North Vancouver BC Canada V7K2R3 V7K2R3 V7K2R3
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Given - tab delimited file of Employer-Codes, User-Names,& Email Addresses ===== - from Excel spreadsheet, saved as 'Tab_Delimited',& transferred to Unix - see uvhd display of 1st 4 records (field header & 1st 3 data records) - note tabs show as '.'s & x'09's in uvhd vertical hexadecimal display
required |
|
uvhd /home/owen/dat1/payemails t ================================ rec#=1 rsize=37 fptr=0 fsize=121 rcount=4 10 20 30 40 50 60 r# 1 0123456789012345678901234567890123456789012345678901234567890123 0 PayrollService.Username.EmailAddress. 5677666567766605767666604666646676770 0192FCC352693595352E1D595D19C1442533A rec#=2 rsize=32 fptr=37 fsize=121 rcount=4 10 20 30 40 50 60 r# 2 0123456789012345678901234567890123456789012345678901234567890123 37 acupay.Sheila.Sheila@acupay.com. <-- '.'s are Tabs or LineFeeds 66776705666660566666466776726660 <-- Tabs x'09' (vertical hex) 13501993859C193859C10135019E3FDA <-- LF's x'0A' (vertical hex) rec#=3 rsize=28 fptr=69 fsize=121 rcount=4 10 20 30 40 50 60 r# 3 0123456789012345678901234567890123456789012345678901234567890123 69 adcomp.Jack.Jack@adcomp.com. 6666670466604666466666726660 143FD09A13B9A13B0143FD0E3FDA rec#=4 rsize=24 fptr=97 fsize=121 rcount=4 10 20 30 40 50 60 r# 4 0123456789012345678901234567890123456789012345678901234567890123 97 adp.Linda.Linda@adp.com. 667046666046666466726660 1409C9E419C9E410140E3FDA
payrollservice username emailaddress acupay sheila sheila@acupay.com adcomp jack jack@adcomp.com adp linda linda@adp.com
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
#0. Login uvadm --> /home/uvadm #0a. Or Login yourself if you are in same group as uvadm #0b. cd /home/uvadm
#1. uvhd dat1/payemails t <-- use uvhd to investigate file ===================== - option 't' (Text file, with tab delimiters)
#2. uvfix1 dat1/payemails <-- run uvfix, specify input file only ===================== - output file will be tmp/payemails #2a. --> <-- prompt for options, reply null #2b. --> LSTt <-- prompt for output file type, reply null accept LSTt default --> reply to instruction prompts as follows:
#3. reply to instruction prompts as follows: ======================================== #3a. --> fix c100(100),a0(80),3,x'09' <-- convert to fixed fields 100 apart - copies from area 'a' to c100,c200,c300 #3b. --> mvc b00(20),c100 <-- store Employer-Code in cols 1-20 #3c. --> mvc b20(20),c200 <-- store User-Name in cols 21-40 #3d. --> mvc b40(60),c300 <-- store Email-SAddress in cols 41-100 #3e. --> trl b0(100) <-- ensure all lower-case #3f. --> . <-- '.' ends input instrns, executes, =========== & writes output to tmp/payemails
#5. vi tmp/payemails <-- inspect output ================
#6. cp tmp/payemails dat1/ <-- copyback overwriting original ====================== - or change name as desired
3a. Reads each record into area 'a' & copies to area 'b' for possible output (In example above, we fix to area 'c' & then move to area 'b' for output).
3b. Executes stored instructions on each record.
3c. Writes record from area 'b', would write to output file unchanged if you entered no instructions (just entered '.' to end instruction input).
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Given - directory of COBOL programs /home/uvadm/mf/cbls =====
Required - copy/modify all mf/cbls/* to tmp2/... ======== - clear cols 1-6 & sequence# in cols 1-4 - translate to lower case (except in quotes)
#0. Login uvadm --> /home/uvadm #0a. Or Login yourself if you are in same group as uvadm #0b. cd /home/uvadm
#1. mkdir tmp2 <-- make outpur subdir #1a. rm -f tmp2/* - or clear all files if tmp2 already exists
#2. uvfixA mf/cbls tmp2 LSTt [options] <-- indir outdir outTYP mandatory ================================== - reply to prompts as follows:
uop=q1r8192n99999 - user option defaults r8192 - output reccsize for fixed length records typ=RSF/RST - for text files: accept default recsize & default typ=LSTt n999999 - output record count limit (high# copies to EOF) User OPtion (uop) defaults = q1r8192n999999
#2a. -->null to accept or enter/override --> <-- null reply, no options required #2b. -->did you create outdir (dflt tmp) --> y <-- reply 'y' to continue
#3. reply to instruction prompts as follows: ======================================== #3a. --> clr b0(6),' ' <-- enter instrn to clear cols 1-6 #3b. --> add $ca1,1 <-- increment line counter #3c. --> mvn b0(4),$ca1 <-- insert sequence# in cols 1-4 #3d. --> trlq3 b0(80) <-- translate to lower case (except in quotes) #3e. --> . <-- enter '.' to end keyins & execute
0001 identification division. 0002 * car200 - test mainframe conversion to micro focus cobol 0003 * - vancouver utilities from www.uvsoftware.ca 0004 * - list sales details with customer name from custmas 0005 program-id. car200. 0006 environment division. 0007 input-output section. 0008 file-control.
^^^^ <-- sequence# gnerated by #3b & #3c above
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Given - dat1/custmas1 with 12 mths sales 5 bytes packed for thisyear & lastyear ===== - thisyear sales (12*5=60 bytes) in bytes 120-179 & lastyear in 180-239
Required - move this year sales to last year & clear thisyear ======== #1. uvhd dat1/custmas1 <-- investigate Input file ================== note - thisyr sales 12 * 5 bytes packed start at 120 - lastyr sales 12 * 5 bytes packed start at 180
rec#=1 rsize=256 fptr=0 fsize=8192 rcount=32 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}....... 0000000005300016000000002570063100095000000000000000013570000000 0C0000C0270D0540C0000C0098D0263C0444C0000C0000C0000C0246D0000C00 192 .E|...V}.......................f.....<........f.C 19950531 0470005700000000880000000018000680001300000000694233333333222222 35C0046D0000C0023C0000C0083C0056D0012C0000C0016D3019950531000000
#2. uvfix2 dat1/custmas1 r256 <-- run script, specify input file,& option ========================= 'r256' for input record-size - prompts for commands, reply as follows uop=q1n99r0s0 - user option defaults n99 - output record limit (n99 means all records) r0 - Input Record size must be specified r8192 - max record-size 8192 s0 - Output Recsize defaulted from Input recsize if s0 s80 - may specify a value to override the default from in recsize User OPtion (uop) defaults = q1n99r0s0r256
#2a. -->null accept or override --> <-- null reply (options on command line) #2b. -->RSF = default file type --> <-- null accept typ=RSF
#3. reply to instruction prompts as follows: ======================================== #3a. --> mvc b180(60),a120 <-- move thisyear sales to lastyear sales #3b. --> mvnx12 b120(5p),0 <-- clear 12 thisyear sales to 5 bytes packed 0 #3c. --> . <-- enter '.' end instructions & execute
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
#4. Check output file with uvhd
#4a. uvhd tmp/custmas1 <-- investigate Output file ================= - thisyr sales 12*5 bytes packed 120-179 now all 0 - lastyr sales 12*5 bytes packed 180-239 now moved from 120-179 (same as 120-179 above Input)
rec#=1 rsize=256 fptr=0 fsize=8192 rcount=32 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 ........ 4442222222222442535343222233323332333324455525544442222200000000 9DF00000000002306931810000250D754D55310C12290725E38000000000C000 128 ......................................................4V|....... 0000000000000000000000000000000000000000000000000000013570000000 0C0000C0000C0000C0000C0000C0000C0000C0000C0000C0000C0246C0000C00 192 .....W0....`........)X}..f3.....\...............C 19950531 0000053000160000000025700631000950000000000000004233333333222222 00C0270D0540C0000C0098D0263C0444C0000C0000C0000C3019950531000000
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Given - directory of sales files with 6 digit dates yymmdd in cols 14-15 ===== - Y2K demo convert 6 digit dates to 8 digits
Required - convert to 8 digit date ccyymmdd, shifting cols 14-62 to 16-64 ======== - insert cc as '20' if yy < 50 (1950) or '19' if yy > 50
#1. mkdir tmp1 tmp2 <-- make subdirs for demo #1a. rm -f tmp1/* tmp2/* - or clear if already existing
#2. cp dat1/[123] tmp1/ <-- copy sales1,2,3 from dat1/... to tmp1/...
#3. uvhd dat1/tmp1 r64 <-- investigate Input, must use uvhd (no LineFeeds) ================== - see sample Input records for uvfix2 above - note 6 digit date in bytes 13-18 (cols 14-19) rec#=1 rsize=64 fptr=0 fsize=1280 rcount=20 10 20 30 40 50 60 r# 1 0123456789012345678901234567890123456789012345678901234567890123 0 130140 21 940802 IN111001 HAM001 00002{ 0000001 00000002{ 3333332222332333333244333333224443332233333723333333233333333722 130140000021094080209E1110010081D0010000002B00000001000000002B00
rec#=20 rsize=64 fptr=1216 fsize=1280 rcount=20 10 20 30 40 50 60 r# 20 0123456789012345678901234567890123456789012345678901234567890123 1216 406082 65 020816 IN441 VAR200 00001R 0009001 00017101R 3333332222332333333244333222225453332233333523333333233333333522 406082000065002081609E441000006122000000001200009001000017101200
#4. uvfixB tmp1 tmp2 RSF r64s66 <-- indir outdir outTYP [options] =========================== may enter insize & outsize at prompts - prompts & replies as follows:
uop=q1r0s0n99 - user option defaults r0 - must specify input recsize r8192 - max record-size 8192 s0 - Output Recsize defaulted from Input recsize if s0 s80 - may specify value to override default from in recsize n99 - output record limit (n99 means all records) User OPtion (uop) defaults = q1r0n999999r64s66
#4a. -->null accept or override --> <-- null reply (options on command line) #4b. -->RSF = default file type --> <-- null accept typ=RSF #4c. -->did you create outdir --> y <-- reply 'y' to continue
#5. reply to instruction prompts as follows: ======================================== #5a. --> ins b13(51),'20' <-- assume 2000+ #5b. --> cmc a13(2),'50' <-- 1951-1999 ? #5c. --> skp< 1 #5d. --> mvc b13(2),'19' <-- yes - change '20' to '19' #5e. --> . <-- enter '.' to end keyins & execute
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
#6. uvhd dat1/sales1 r64l66 <-- investigate Ouput, must use uvhd (no LineFeeds) ======================= - showing only 1st & last records below:
rec#=1 rsize=66 fptr=0 fsize=1320 rcount=20 10 20 30 40 50 60 r# 1 012345678901234567890123456789012345678901234567890123456789012345 0 130140 21 19940802 IN111001 HAM001 00002{ 0000001 00000002{ 333333222233233333333244333333224443332233333723333333233333333722 13014000002101994080209E1110010081D0010000002B00000001000000002B00
rec#=20 rsize=66 fptr=1254 fsize=1320 rcount=20 10 20 30 40 50 60 r# 20 012345678901234567890123456789012345678901234567890123456789012345 1254 406082 65 20020816 IN441 VAR200 00001R 0009001 00017101R 333333222233233333333244333222225453332233333523333333233333333522 40608200006502002081609E441000006122000000001200009001000017101200 ^^ - Note century inserted 19/20 depending ><1950
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
'uvcpfix1' (using uvcp) is not as powerful as 'uvfix1' (using uvcopy), but is slightly simpler when changing file types only (text to Fixed-Length).
Given - dat1/products text file of variable length records ===== (Line-Feed x'0A' following last non-blank)
Required - convert to fixed-length 64 bytes ======== - store current date in cols 51-58 - use fixed length typ 'RST' which inserts LF in last byte - OK if COBOL program does not use that byte (best of both worlds) - advantages of text files (use of vi,more,etc) but still fixed length for COBOL programs
#1. more dat1/products <-- display input file ================== CHR015 LAWN CHAIR HAM010 CLAW HAMMER SAW011 HAND SAW
#2. uvcpfix1 dat1/products 64 RST 'mvc=50(8):20140201' ================================================== - 'uvcpfix1' script much easier to enter than 'uvcp' equivalent (below)
#2a. uvcp "fili1=dat1/products,rcs=4096,typ=LST,filo1=tmp/products,rcs=64,typ=RST\ ,mvc=50(8):20140201" ============================================================================= - equivalent 'uvcp' command (longer, more complex entry)
Note |
|
uvcpfix1 dat1/products 64 RST ============================= - simplest use of 'uvcpfix1' script
#3. more tmp/products <-- display output file (in subdir tmp/...) ================= - would then move elsewhere ? CHR015 LAWN CHAIR 20140201 HAM010 CLAW HAMMER 20140201 SAW011 HAND SAW 20140201
Note |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
#4. uvhd /home/uvadm/dat1/products t <-- check LF's in text input file ================================ - CR's also present, will be removed
10 20 30 40 50 60 r# 1 0123456789012345678901234567890123456789012345678901234567890123 0 CHR015 LAWN CHAIR.. 445333222445424444500 382015000C17E038192DA rec#=1 rsize=21 fptr=0 fsize=169 rcount=9
#5. uvhd /home/uvadm/tmp/products r64 <-- check LF's created in last byte ================================= of 64 byte records by typ=RST
10 20 30 40 50 60 r# 1 0123456789012345678901234567890123456789012345678901234567890123 0 CHR015 LAWN CHAIR 20140201 . 4453332224454244445222222222222222222222222222222233333333222220 382015000C17E03819200000000000000000000000000000002014020100000A rec#=1 rsize=64 fptr=0 fsize=576 rcount=9
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Given - dat1/custmas1 customer master record ===== - cust#, cust-name, address, city, prov, postal, tel#,& contact
Required - create a telephone list with selected fields: ======== - cust#, cust-name, telephone#, contact
#1. uvhd dat1/custmas1 <-- investigate Input file ================== - need uvhd since packed fields & no linefeeds - here is 1st record only
rec#=1 rsize=256 fptr=0 fsize=8192 rcount=32 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}....... 0000000005300016000000002570063100095000000000000000013570000000 0C0000C0270D0540C0000C0098D0263C0444C0000C0000C0000C0246D0000C00 192 .E|...V}.......................f.....<........f.C 19950531 0470005700000000880000000018000680001300000000694233333333222222 35C0046D0000C0023C0000C0083C0056D0012C0000C0016D3019950531000000
#2. uvcpfix2 dat1/custmas1 256 65 LSTt 'mvc=35(30)90' =================================================
#3. more tmp/custmas1 <-- display output file (in tmp/...) ================= 130140 EVERGREEN MOTORS LTD. 250-754-5531 LARRY WRENCH 139923 JOHNSTONE BOILER & TANKS 604-320-1845 GEORGE BROWN 154689 FRANKLIN RESOUCES 604-666-5489 RON BENNETT 201120 ALLTYPE RENTAL LTD. 403-246-5274 LARRY ZOLF 204700 CASE POWER EQUIPMENT 403-538-1743 JOHN JENSEN
#4. cp tmp/custmas1 dat1/custelephones ================================== - copy/rename as desired where desired
#2a. uvcp "fili1=dat1/custmas1,rcs=r256,typ=RSF,filo1=tmp/custmas1,rcs=65,typ=LSTt\ ,mvc=35(30)90" ==============================================================================
Note |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
6A1. | Overview of pre-programmed jobs |
6B1. | addup1 - sample of pre-programmed job |
- addup any field in any file via options for dsplcmnt(length) | |
- demo use & code listing | |
- general purpose version of addup0 demo job for specific file | |
- accumulates $amount in sales2 file, see paage '4K1' |
cobmap1 |
|
cleanup |
|
cobfil51 |
|
uvcmp1 |
|
scan1d |
|
rep1d |
|
6C1. | example using rep1d to modify uvlp scripts for for Xi-Text print spooler |
(uses 'spr' vs 'lp) |
rep2d |
|
6D1. | example using rep2d to modify uvlp scripts for A4 paper 8 x 12 vs letter |
8 1/2 x 11 (change paper size code from 'a2' letter to 'a26' for A4) |
datedemo1 |
|
calendar1 |
|
tabfix1 - convert tabs to blanks (each tab to specified no of blanks) tabfix2 - tab value could be every 8 cols, or 4 cols, or whatever. tabfix3 - convert tabs to blanks depending on multiple fixed tab stops.
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
table2 |
|
genverify1 |
|
genacum2 |
|
cross-references - xcobcall1, xcobcall2, xcobcopy1, xcobcopy2, xcobfile2, - xkshfile1, xkshfile2, xkshprog1, xkshprog2, - xkshproc1, xkshproc2, xkshparm1, xkshparm2 - xrefall (all of the above)
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Over 500 pre-programmed jobs are supplied (in uvadm/pf) to perform various useful functions (especially at mainframe sites converting to Unix).
A few examples are briefly described here, and references are made to the documentation section, where you will find detailed operating instructions and sample input/output.
You can run most of these jobs simply by entering uvcopy + jobname. The input file usually defaults to a supplied test/demo file & you will be prompted to accept the default or supply your own filename, for example:
uvcopy cobmap1 - run the COBOL copy-book layout job ============== - prompts for filename (defaults to a demo file)
uvcopy cobmap1,fili1=cob250.bat - specify input filename on the =============================== command line & inhibit the prompt
cobmap1 |
|
cleanup |
|
cobfil51 |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
uvcmp1 |
|
xtbl1 |
|
listISF |
|
scan1d |
|
rep1d |
|
3B4. | example using rep1d to modify uvlp scripts for for Xi-Text print spooler |
(uses 'spr' vs 'lp) |
rep2d |
|
3B1. | example using rep2d to modify uvlp scripts for A4 paper 8 x 12 vs letter |
8 1/2 x 11 (change paper size code from 'a2' letter to 'a26' for A4) | |
- changes about 75 scripts of 350 total in sf/util/... |
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
datedemo1 |
|
calendar1 |
|
tabfix1 |
|
tabfix2 |
|
tabfix3 |
|
escape1 |
|
escape2 |
|
table2 |
|
delim2fix1 |
|
genverify1 |
|
genacum2 |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
xcobcall1 - list of all CALLED-PROGRAMs in each PROGRAM xcobcall2 - crossref all PROGRAMS calling any 1 CALLED-PROGRAM xcobcopy1 - list all COPYBOOKS in any 1 PROGRAM xcobcopy2 - crossref all PROGRAMS copying any 1 COPYBOOK xcobfile2 - crossref all PROGRAMS using each external-file xkshfile1 - list all DATAFILES used in any 1 ksh SCRIPT xkshfile2 - crossref show all ksh SCRIPTs using any 1 DATAFILE xkshprog1 - list all PROGRAMs executed in any 1 ksh SCRIPT xkshprog2 - crossref show all ksh SCRIPTS executing any 1 PROGRAM xkshproc1 - list all PROCs executed in each JCL/ksh/script xkshproc2 - shows all JCL/ksh/scripts executing each PROC xkshparm1 - list all SYSIN/PARM modules in each JCL/ksh/script xkshparm2 - shows all JCL/ksh/scripts referencing each SYSIN/PARM
xrefall |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
addup1 |
|
addup2 |
|
acum1 |
|
genacum2 |
|
#1. Login --> /home/userxx #2. mkdir dat1 tmp <-- make subdirs (if not already existing) #2a. rm -f tmp/* <-- &/or remove any existing tmp/ files
#3. cp $UV/dat1/sales2 dat1 <-- copy demo file to your homedir ======================= - 1st & last records shown below
1 2 3 4 5 6 123456789012345678901234567890123456789012345678901234567890123 cust# slsm# date invoice# product# qty price amount 130140 21 990802 IN111001 HAM001 000020 0000101 000002020 406082 65 030816 IN441 VAR200 00001y 0000101 00000191y
Required |
|
#4a. uvcopy addup1 <-- minimum entry, will solicit filename & options =============
#4b. uvcopy addup1,fili1=dat1/sales2 <-- better to enter at least filename =============================== - will prompt for options (see below)
#4c. uvcopy addup1,fili1=dat1/sales2,uop=b53c9e2 =========================================== - could enter all options required (with experience) - will be prompted to allow option changes (as follows)
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
#4b. uvcopy addup1,fili1=dat1/sales2 <-- better to enter at least filename =============================== - will prompt for options (see below)
uop=b00c0e0 |
|
b53c9e2 - demo options for dat1/sales2 text records $amt cols 54-62 b53 - begin byte# (zero relative) c9 - field length e2 - decimal places to edit result
User OPtion (uop) defaults = q1b00c0e0
-->null to accept or enter/override --> b53c9e2 <-- Enter options for demo
140514:170748:addup1: EOF fili01 rds=20 size=1280: dat1/sales2 140514:170748:addup1: EOF filo01 wrts=1 size=59: tmp/sales2.tot
EOF, records=20, total= 10,643.00 in 53(9) of: dat1/sales2 ========================================================== - total displayed as above - also written to tmp/sales2.tot (1 line as above)
uvcopy addup2,fili1=dat1/sales1,uop=b53c9e2r64 ============================================== - addup2 for Fixed-Length records - dat1/sales1 64 byte records w/o LineFeeds
See the uvcopy code for 'addup1' listed on the next page. Most pre-programmed jobs are lengthy (because they are general-pupose), but addup1 is only 1 page.
Also see 'addup0' listed on page '4K1', a uvcopy job coded for a specific field ($amount) in a specific file (dat1/sales2). It is only 12 lines of code.
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
# addup1 - uvcopy Parameter File from UVSI stored in: /home/uvadm/pf/demo/ # addup1 - addup any field in a TEXT file & display total # - also write total to tmp/filename.tot # #usage: uvcopy addup1 - will prompt for filename & field dsp/lth/dcml optns # #demo: uvcopy addup1,fili1=dat1/sales2,uop=b53c9e2 # =========================================== # - sales2 demo file has $amt in cols 54-62, dsplcmnt(lth) = 53(9) # opr='$jobname - add any field in a TEXT file (Line-Feed terminated)' opr=' - also see addup2 for Fixed-Record-Length files' opr='uop=b00c0e0 - default options' opr=' b53c9e2 - demo options for dat1/sales2 text records $amt cols 54-62' opr=' b53 - begin byte# (zero relative)' opr=' c9 - field length' opr=' e2 - decimal places to edit result' uop=q1b00c0e0 # default options rop=r1 # EOF prompt for file disposition fili1=?dat1/sales2,rcs=4096,typ=LST # demo file Text records with LineFeeds filo1=tmp/$fili1.tot,rcs=100,typ=LSTt # total displayed & written to tmp/... @run opn all open files mvn $rb,$uopbb move begin col# to rgstr 'b' mvn $rc,$uopbc move field width to rgstr 'c' skp> 1 can 'field length (option c) zero/invalid' mvc e0(16),'zzz,zzz,zzz,zzz-' presume 0 dcmls cmn $uopbe,2 edit 2 dcmls ? skp< 1 mvc e0(16),'zzzz,zzz,zzz.zz-' # # begin loop to get records, adding up spcfd field man20 get fili1,a0 get a record skp> man90 (cc set > at EOF) add $ca1,1 count records add $ca2,ab0($rc18) accumulate for total skp man20 return to get next record # # EOF - write & display record count & field total # - close files & end job man90 mvfv1 b0(100),'EOF, records=$ca1, total= TOTAL in $rb($rc) of: $fili1' edta1 g0(16),$ca2,e0(16) edit acum2 repf4 b0(100),'TOTAL',g0(16) putx1 filo1,b0 write record & display cls all eoj
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
You may have to modify the 'uvlp' scripts if your site uses A4 paper 8X12 (vs letter 8 1/2 x 11) OR if you use a different print spooler such as Xi-Text which requires 'spr' command (vs 'lp') & uses option '-P...' for the printer destination (vs '-d...).
Here are samples to illustrate changes required, using 'uvlp12' with most #comment lines removed to highlight the changes required.
#!/bin/ksh # uvlp12 - print a file at 12 cpi (90 chars on 8 1/2 x 11) # - many lines removed to highlight changes for A4 # - see original uvlp12 listed on prior page # # - modified for A4 paper option a26l2 vs a2/t1/t4 # - mass change by uvcopy rep2d & search/replace table ctl/rep2d_uvlp_A4 # # uvlist $1 p60$2 a2c12$3 | lp $UVLPOPTN $UVLPDEST <-- original #commented out # ================**============================== # a2<-- letter size, change to a26 A4 size, add l2 for CR # uvlist $1 p60$2 a26l2c12$3 | lp $UVLPOPTN $UVLPDEST #<-- 'a26l2' replaces 'a2' #===============*****============================== # a26l2<-- codes for A4 paper & LF/CR (vs LF only) exit 0
#!/bin/ksh # uvlp12 - print a file at 12 cpi (90 chars on 8 1/2 x 11) # - modified for Xi-Text print spooler # - by Owen Townsend - UV Software Inc - April 2009 # # .profile should specify environmental variables for example: # export UVLPDEST="-PMISCOPIER" # export UVLPOPTN="-fdefault -s" # # uvlist $1 p60$2 a2c12$3 | lp $UVLPDEST $UVLPOPTN <-- original #commented out # ==========================**==================== # uvlist $1 p60$2 a2c12$3 | spr $UVLPDEST $UVLPOPTN #<-- 'lp' changed to 'spr' #=========================***==================== exit 0
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Here is how We changed all uvlp scripts to use A4 paper vs letter size. We also inserted option 'l2' for CR/LF (vs LF only). (vs changing customer's printer control panel options).
uvlist $1 p60$2 a2c12$3 | lp $UVLPOPTN $UVLPDEST <-- original for letter size #===============**============================== # a2<-- option for letter size
uvlist $1 p60$2 a26l2c12$3 | lp $UVLPOPTN $UVLPDEST #===============*****============================== # a26 <-- change to 'a26' for A4 paper # l2<-- insert option 'l2' for LF/CR (vs LF only)
The uvlp... scripts are stored in $UV/sf/util/... There are about 75 'uvlp' scripts. There are over 350 total scripts in sf/util/... and the other scripts will not be changed, because they will not contain unique patterns such as 'uvlist' & ' lp ' used to qualify the search/replace.
#1. vi ctl/rep2d_uvlp_A4 <-- create search/replace table for uvcopy rep2d ====================
# rep2d_uvlp_A4 - table file for rep2d search/replace all files in subdir # - mass change to uvlp scripts at Old Mutual Oct 2010 # - option a26 for A4 paper & option l2 for CR/LF # 01:30=search pattern, 31:60=replacement, 61-80=present qual,81:100=absent qual a2~~~~~~~~~~~~~~~~~~~~~~~~~~~ a26l2~~~~~~~~~~~~~~~~~~~~~~~~uvlist~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ t1~~~~~~~~~~~~~~~~~~~~~~~~~~~ a26l2~~~~~~~~~~~~~~~~~~~~~~~~uvlist~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ t4~~~~~~~~~~~~~~~~~~~~~~~~~~~ a26l2~~~~~~~~~~~~~~~~~~~~~~~~uvlist~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#2. mv sf/util sf/util.old <-- change name of existing sf/util ======================
#3. mkdir sf/util <-- make new 'util' subdir =============
#4. uvcopy rep2d,fild1=sf/util.old,fild2=sf/util,fili3=ctl/rep2d_util_A4 ==================================================================== - execute 'rep2d' mass change job
#5. vi tmp/sf_util.aud <-- examine audit report ==================
#6. vi sf/util/uvlp12 <-- spot check a few scripts =================
#7. chmod 775 sf/util/* <-- restore execute bits ===================
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Job: rep2d InDir: sf/util OutDir: tmp2 Table: ctl/rep2d_uvlp_A4 SearchBgn: SearchEnd: MatchOptns: df2g2 UserOptns: q1a1b99999c0d256e0p1 ====================================================== 2010/11/16_06:19:02 a2~~~~~~~~~~~~~~~~~~~~~~~~~~~ a26l2~~~~~~~~~~~~~~~~~~~~~~~~uvlist~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ t1~~~~~~~~~~~~~~~~~~~~~~~~~~~ a26l2~~~~~~~~~~~~~~~~~~~~~~~~uvlist~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ t4~~~~~~~~~~~~~~~~~~~~~~~~~~~ a26l2~~~~~~~~~~~~~~~~~~~~~~~~uvlist~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ====================================================== 2010/11/16_06:19:02
00030 uvlist $1 p60$2 a26l2d1c12n-240$3 | lp $UVLPOPTN $UVLPDEST 00039 1 reps @EOF: tmp2/uvlp12D
00036 then uvlist $i p60$3 a26l2c12$4 | lp $UVLPOPTN $UVLPDEST 00044 1 reps @EOF: tmp2/uvlpp12
00039 then uvlist $i p50e1$4 a26l2c12$5 | lp $UVLPOPTN $UVLPDEST 00050 1 reps @EOF: tmp2/uvlpd1p
00027 then uvlist $i p60$2 a26l2c10$3 | lp $UVLPOPTN $UVLPDEST 00035 1 reps @EOF: tmp2/uvlpd10
00031 uvlist $1 p80$2 a26l2c12v6p84$3 | lp $UVLPOPTN $UVLPDEST 00036 1 reps @EOF: tmp2/uvlp12v8
00029 uvlist $1 p60$2 a26l2c14$3 | lp $UVLPOPTN $UVLPDEST 00034 1 reps @EOF: tmp2/uvlp14
---------------- many lines omitted ---------------------
====================================================== 2010/11/16_06:19:13 EOD: 00080 reps in 0071 files of 0329 total (12545 lines) Audit filename: tmp/util_rep2d_uvlp_A4
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Here is how UV Software changed All uvlp... scripts to use the Xi-Text spooler vs the unix/linux system spooler. Xi-Text uses the 'spr' command vs the 'lp' command used by the unix/linux system spooler.
uvlist $1 p60$2 a2c12$3 | lp $UVLPDEST $UVLPOPTN <-- original ' lp ' cmd #=========================**=====================
uvlist $1 p60$2 a2c12$3 | spr $UVLPDEST $UVLPOPTN <-- change to ' spr ' #=========================***====================
The uvlp... scripts are stored in $UV/sf/util/... There are about 75 'uvlp' scripts. There are over 350 total scripts in sf/util/... and the other 240 scripts will not be changed, because they will not contain the unique patterns ' lp ' qualified by 'uvlist'.
'rep1d' can be used for this mass change, since we only need to change 1 pattern (vs multiple patterns with 'rep2d' used for A4 paper mass change). rep1d will prompt us for the search, replace,& qualifier patterns.
#1. mv sf/util sf/util.old <-- change name of existing util/ ======================
#2. mkdir sf/util <-- make new 'util' subdir =============
#3. uvcopy rep1d,fild1=sf/util.old,fild2=sf/util <-- execute 'rep1d' ============================================
#3a. pattern ------> _lp_ <-- enter search pattern ('_'s are blanks)
#3b. replacement --> _spr_ <-- enter replacement pattern ('_'s are blanks)
#3c. qualifier ----> uvlist <-- enter qualifier
#4. chmod 775 sf/util/* <-- restore execute bits ===================
#5. vi tmp/sf_util_spr <-- examine audit report ==================
Note |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
7A1. | uvqrpg Introduction & Overview |
- create multi-level total reports with simple declarations |
7B1. | qrpgEX1 - example: sales analysis by customer within salesman |
7C1. | qrpgEX82 - write uvqrpg job to accumulate amount by customer & salesman |
7D1. | qrpgEX83 - write uvqrpg job to accumulate amount by product# |
- must use built in sort to sort by product# |
7E1. | qrpgEX84 - same as preceding qrpgEX83, but add a table summary by product# |
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
uvqrpg was added to the Vancouver Utilities in 1999, and has been used with great success, replacing well known utilities such as 'easytrieve' and 'quickjob', when mainframes are converted to UNIX.
Please see the complete documentation & many examples in uvqrpg.doc. Please see uvqrpg.doc for complete documentation & more complex examples.
Goto: Begin this doc , End this doc , Index this doc , Contents this library , 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
21 130140 960802 IN111001 HAM001 000010 0001000 000010000 21 130140 960802 IN111001 SAW012 000020 0002000 000040000 21 139923 970802 IN111002 HAM001 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 44 401210 990816 CR955 HAM001 000080 0008000 000640000 44 401210 990816 IN441 BIT001 000090 0009000 000810000
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 HAM001 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 *
401210 990816 CR955 HAM001 80 80.00 6,400.00 990816 IN441 BIT001 90 90.00 8,100.00 170 * 14,500.00 * 300 ** 23,000.00 ** 452 *** 28,400.00 ***
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
# qrpgEX1 - uvqrpg example#1, sales analysis by customer within salesman # - see uvqrpg.doc for input file layout & sample report expected # #usage: uvqrpg qrpgEX1,fili1=dat1/sales4,filo1=tmp/qrpgEX1.rpt # ====================================================== # 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####' head1s2p55=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-' @end
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Given - same input file as for preceding example (/home/uvadm/dat1/sales4) ===== - for convenience you can create a dat1 subdir in your homedir & copy the sales4 test file to your directory. - only the following fields are required 01-02=salesman, 04-09=customer, 14-19=date, 54-62=amount
Required - write a qrpg job to create the report shown below. ======== - a solution is provided as qrpgEX82 in /home/uvadm/pf/demo but please don't look at it until you have tried it yourself. - name your job whatever you like & write it to pf/... in your homedir
sl# cust# date invoice product qty price amount 21 130140 960802 IN111001 HAM001 000010 0001000 000010000 21 130140 960802 IN111001 SAW012 000020 0002000 000040000 21 139923 970802 IN111002 HAM001 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 44 401210 990816 CR955 HAM001 000080 0008000 000640000 44 401210 990816 IN441 BIT001 000090 0009000 000810000
Sales Analysis by customer within salesman 2000/05/20_09:45:35 page0001 sl# cust# date amount
21 130140 96080 100.00 96080 400.00 500.00 *
139923 97080 800.00 97080 1,600.00 97080 2,500.00 4,900.00 * 5,400.00 **
44 250825 98080 3,600.00 98080 4,900.00 8,500.00 *
401210 99081 6,400.00 99081 8,100.00 14,500.00 * 23,000.00 ** 28,400.00 ***
Note |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
# qrpgEX82 - uvqrpg example #2 sales analysis by customer within salesman # - simplified example based on example qrpgEX1 in uvqrpg.doc # - see uvtrain.doc input record layout & sample report expected # - note SORT added for next example (qrpgEX83) # #usage: uvqrpg qrpgEX82,fili1=dat1/sales4,filo1=tmp/qrpgEX82.rpt # ======================================================== # fili8=?dat1/sales4,rcs=64,typ=LST filo8=tmp/sales4.sorted,rcs=80,typ=LSTt fili1=tmp/sales4.sorted,rcs=80,typ=LST filo1=?tmp/$jobname.rpt,rcs=80,typ=LSTt sort=80,'0(2),3(6)' #<-- sort by slsmn(major) & customer(minor) head2=h2000(45),'Sales Analysis by customer within salesman ' head2=h2045(25),'$datetime $page####' head1s2p55=h1000(50),'sl# cust# date amount' ctll2=a0(2),'sl#' ctll1=a3(6),'cust#' ref=a13(6),'date' acum2=a53(9),'amount',,'zzzzz,zzz.99-'
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Given - same input file as for preceding example ===== (/home/uvadm/dat1/sales4) - only the following fields are required 01-02=salesman, 31-36=product, 46-52=price, 54-62=amount
Required - write a qrpg job to create the report shown below. ======== - a solution is provided as qrpgEX83 in /home/uvadm/pf/demo but please don't look at it until you have tried it yourself.
NOTE |
|
Sales Analysis by product within salesman 2000/05/20_10:03:39 page0001 sl# product price amount
21 HAM001 10.00 100.00 30.00 800.00 900.00 *
SAW012 20.00 400.00 400.00 *
TAB013 40.00 1,600.00 50.00 2,500.00 4,100.00 * 5,400.00 **
44 BIT001 90.00 8,100.00 8,100.00 *
HAM001 60.00 3,600.00 80.00 6,400.00 10,000.00 *
SAW012 70.00 4,900.00 4,900.00 * 23,000.00 ** 28,400.00 ***
Note |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Given - same input file as for preceding examples ===== (/home/uvadm/dat1/sales4) - only the following fields are required 01-02=salesman, 31-36=product, 46-52=price, 54-62=amount
Required - write a qrpg job to create the report shown below. ======== - a solution is provided as qrpgEX83 in /home/uvadm/pf/demo but please don't look at it until you have tried it yourself. - same as ex#2 with addition of a table summary by product
Note |
|
Here is an example of table build/print for quantity by slsmn (You will change to table for amount by product)
Record detail @dtl put filo1,p0 tblt1f1 a0(2),'salesman;quantity',a38(6) --- at EOF @ttll8 put filo1,p0 tbpt1s1 filo1,'table summary of quantity by salesman' ---
You need to code the 'tbl' instruction at detail time (@dtl) executed for each record (@dtl), and the 'tbp' executed once at End Of File. (@ttll8 at total level 8 is used for @eof)
When you declare instruction processing @dtl, @ttll8, etc you then have to explicitly print (put area 'p' to output file). Printing is normally automatic, but when @dtl, @ttl, etc are present, uvqrpg assumes you might want to modify print area 'p' before you print (put filo1,p0)
Note that the 'tbl' is common to both uvcopy & uvqrpg. If your only objective is create tbl summary reports, then uvcopy is probably simpler. Use uvqrpg when you want total level control reports with table summaries at the end.
See example #4 report sample on the next page --->
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Sales Analysis by product within salesman 2000/05/20_10:03:44 page0001 sl# product price amount
21 HAM001 10.00 100.00 HAM001 30.00 800.00 HAM001 30.00 900.00 *
SAW012 20.00 400.00 SAW012 20.00 400.00 *
TAB013 40.00 1,600.00 TAB013 50.00 2,500.00 TAB013 50.00 4,100.00 * 5,400.00 **
44 BIT001 90.00 8,100.00 BIT001 90.00 8,100.00 *
HAM001 60.00 3,600.00 HAM001 80.00 6,400.00 HAM001 80.00 10,000.00 *
SAW012 70.00 4,900.00 SAW012 70.00 4,900.00 * 23,000.00 ** 28,400.00 ***
qrpgEX84 2000/05/20_10:03:45 table summary by product# tbl#001 pg#001 -argument- -acum#1- % line# count % product:amount
1 1 11 BIT001 8,100.00 28 2 4 44 HAM001 10,900.00 38 3 2 22 SAW012 5,300.00 18 4 2 22 TAB013 4,100.00 14
9*100 *TOTAL* 28,400.00 *100
Note |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Over 500 Unix shell scripts are provided (in uvadm/sf). Most of these could be useful at any Unix site, and some will be especially useful to mainframe sites converting to Unix. Only a few examples are listed here, but all scripts are listed in scripts1.htm.
Note |
|
8A1. | rename scripts - rename all files in a directory by various criteria |
- 28 rename scripts are provided to save you a lot of keyboarding | |
- extremely useful when you want to rename hundereds of long filenames | |
- lowercase, UPPERcase, change prefixes, suffixes, patterns anywhere, etc |
8A2. | example using 'rename...' scripts to rename mainframe files |
- changing 'PA.PAMFMC55.PAMQUERY.G0117V00' to pa_pamquery_g0117 | |
- could be hundreds of generations ? |
8B1. | renameL - translate filenames to lower case |
8B2. | rename-A - remove pattern occurring anywhere in filename |
8C1. | aliases - save keystrokes for often repeated commands |
8D1. | alldiff2 - see scripts1.htm#Part_4 |
- compare text files in 1 directory to a 2nd directory | |
to confirm mass changes (see REPjobs.doc ). | |
- bypasses any non-text files (with warning msg) |
8E1. | dtree - print directory tree map |
- amazingly short 'sed' script | |
- also amazingly difficult to decipher |
uvcpfix1 |
|
uvcpfix2 |
|
uvcpfix1 & uvcpfix2 - scripts calling the 'uvcp' utility that make it easier to enter the commands (vs calling uvcp directly). The scripts copy the data file to tmp/... You can then inspect & if OK, copy the tmp/ file to the desired location or overwrite the input file. See Examples & script listings at https://uvsoftware.ca/uvcp.htm#U0 - U4.
makeISF0 |
|
allcancel |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Here are a few of the 28 'rename' scripts provided. See all renmae scripts in part 1 of scripts1.htm#Part_1.
Note |
|
8B1. | renameL - translate filenames to lower case |
8B2. | rename-A - remove pattern occurring anywhere in filename |
renameAA |
|
renameB |
|
renameDU |
|
renameG |
|
renameP |
|
rename-P |
|
rename+P |
|
renameParens |
|
renameQQ |
|
renameU |
|
renameX |
|
rename-X |
|
rename+X |
|
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Here is a great example of the extreme usefulness of the 'rename' scripts. When mainframe files are transferred to unix/linux, we may want to change the names to better fit the intended use on the unix/linux system.
In this example we were converting the mainframe data files to SQL tables and we wanted to simplify the names & change the generation#s to a more meaningful year & month.
'PA.PAMFMC55.PAMQUERY.G0117V00' 'PA.PAMFMC55.PAMQUERY.G0118V00' <-- original mainframe data-file-names 'PA.PAMFMC55.PAMQUERY.G0119V00'
pa.pamquery_000001 pa.pamquery_000001 <-- desired result pa.pamquery_000001
#1. renameQQ data <-- remove Quotes from all files in data/... =============
PA.PAMFMC55.PAMQUERY.G0117V00 PA.PAMFMC55.PAMQUERY.G0118V00 PA.PAMFMC55.PAMQUERY.G0119V00
#2. renameL data <-- rename to lower case ============
pa.pamfmc55.pamquery.g0117v00 pa.pamfmc55.pamquery.g0118v00 pa.pamfmc55.pamquery.g0119v00
#3. rename-A data pamfmc55. <-- remove 'pamfmc55' =======================
pa.pamquery.g0117v00 pa.pamquery.g0118v00 pa.pamquery.g0119v00
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
For 3 files we could change the names manually, but we may have hundreds of files & making a script will reduce our manual keying dramatically.
pa.pamquery.g0117v00 pa.pamquery.g0118v00 <-- result from rename scripts (prior page) pa.pamquery.g0119v00
pa_pamquery_000001 pa_pamquery_000002 <-- desired result pa_pamquery_000003
There is a uvcopy job 'IBMGDG2UVgdg1' that will convert mainframe GDG filenames to the Vancouver Utility GDG standards with suffixes '_000001', '_000002', '_000003', etc.
#1. mv data data.old <-- rename/save current files before change ================
#2. uvcopy IBMGDG2UVgdg1,fild1=data.old,fild2=data ============================================== - copy all files converting GDG filenames from IBM to UV standards
'uvcopy IBMGDG2UVgdg1' copies all files from data.old to data, searching for files with the IBM mainframe GDG conventions & chnaging them to the Vancouver utility GDG conventions. Any non-GDG filenames are copied as is.
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
#!/bin/ksh # renameL - Korn shell script from UVSI stored in: /home/uvadm/sf/util/ # renameL - rename an entire directory of filenames to lower case # echo "rename all filenames in subdir to lower case" if [ -d "$1" ]; then : else echo "usage: renameL directory <-- arg1 must be a directory" echo " =================" exit 1; fi # reply="n" until [ "$reply" = "y" ] do echo "will rename all files in $1 to lower case OK ? y/n" read reply done # x=0; y=0 for i in $1/* do let x=x+1 f=${i##*/} typeset -l g=$f if [[ $g != $f ]]; then mv -i $1/$f $1/$g #================ let y=y+1 echo "file# $y (of $x) $1/$f - renamed to: $1/$g" fi done echo "total $y files in ${1}, $x renamed to lower case" exit 0
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
#!/bin/ksh # rename-A - Korn shell script from UVSI stored in: /home/uvadm/sf/util/ # rename-A - rename an entire directory of filenames # - removing a specified pattern that can occur Anywhere in filename # echo "rename files in subdir - removing a pattern that can occur Anywhere" if [ -d "$1" -a -n "$2" ]; then : else echo "usage: rename-A directory pattern" echo " ==========================" exit 1; fi # reply="n" until [ "$reply" = "y" ] do echo "do you have backup ? y/n" read reply done x=0; y=0 for dfn in $1/* do fn=${dfn##*/} # remove any preceding directories fn1=${fn%${2}*} # remove smallest matching suffix fn2=${fn#*${2}} # remove smallest matching prefix fn3=${fn1}${fn2} # concatenate the left & right remainders let x=x+1 if [[ $fn3 != $fn ]]; then mv -i $1/$fn $1/$fn3 #================== let y=y+1 echo "file# $x $1/$fn - renamed to: $1/$fn3" fi done echo "total $x files, $y renamed (removing $2 pattern)" exit 0
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Here are the aliases defined in the profiles provided with Vancouver Utilities. See the common_profile listed at ADMjobs.htm#1C3 starting about line 200.
alias l='ls -l' # save keystrokes on often repeated command alias rm='rm -i' # confirm removes alias mv='mv -i' # confirm renames alias cp='cp -i' # confirm copy overwrites alias rmf='rm -f' # force removes (no prompts) alias mvf='mv -f' # force renames (no prompts) alias cpf='cp -f' # force copies (no prompts) alias more='less' # less is way better than more alias grep='grep -n' # ensure -n option used on grep alias cdd='cd $RUNDATA' # quick access to data superdir alias cdl='cd $RUNLIBS' # quick access to libs superdir alias cdc='cd $CNVDATA' # quick access to data conversion superdir alias cdk='cd $CMPDATA' # quick access to data conversion superdir alias cdb='cd $BACKUP' # quick access to backup superdir alias cdr='cd $RESTORE' # quick access to restore superdir
We recommend the aliases to prompt for overwrite, such as alias rm='rm -i' Use option '-f' when you have many files (rm -f tmp/*, etc)
Aliases such as cdd='cd $RUNDATA' depend on the prior definitions (in the profiles) of RUNDATA, RUNLIBS, etc in the profiles. This is described in ADMjobs.htm#Part_1.
The result is that programmers will be changed to their testdata,testlibs,etc. But operators would be changed to their proddata, prodlibs, etc. For example the definitions of RUNDATA & RUNLIBS for a programmer might be:
export RUNDATA=/home/userxx/testdata <-- private testdata/testlibs export RUNLIBS=/home/userxx/testlibs
export RUNDATA=/p1/apps/testdata <-- common testdata/testlibs export RUNLIBS=/p1/apps/testlibs - shared by all programmers
Note that some sites may define RUNDATA & RUNLIBS with rather long pathnames & the aliases can save more keystrokes than indicated here.
A major advantage is that administrators can change the locations of data & libraries. The use of environmental variables RUNDATA & RUNLIBS means that programmers & operators do not have to change their usual commands.
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
#!/bin/ksh # alldiff2 - Korn shell script from UVSI stored in: /home/uvadm/sf/util/ # alldiff2 - script to compare all text files in 1 directory to a 2nd directory # - bypass non-text files & provide audit trail with file-counts # - write diff report to tmp/... # d1="$1"; d2="$2"; echo "alldiff2 - compare all text files in 2 subdirs & write dif report to tmp" if [[ -d "$1" && -d $2 ]]; then : else echo "usage: alldiff dir1 dir2" echo " =================" echo "example: alldiff cbls.old cbls" echo " =====================" exit 1; fi
d2b=$(basename $d2) # get basename of dir2 (drop any preceding /path/...) log=tmp/$d2b.dif # make name for output log file >$log #init logfile in tmp subdir w same name as dir2 + .dif x=0; y=0; for i in $d1/* do let x=x+1 typ=$(file $i) if [[ $typ == *text* || $typ == *script* || $typ == *spreadsheet* ]] then f=${i##*/} diff -b $d1/$f $d2/$f >>$log #=========================== if [[ $? -gt 0 ]]; then echo "diff file# $x - $d1/... vs $d2/$f" >>$log echo " " >>$log let y=y+1 fi else echo " file# $x $i - NOT a text/script file" >>$log fi done lines=$(wc -l $log) # capture line count echo "$y different of $x files compared $d1 to $d2" >>$log echo "$y diff of $x files in $d1 & $d2, report is: $lines" echo "--> use uvlp12,uvlp14,uvlp16 to laser print at 12,14,16 cpi" echo "--> enter command (vi,cat,more,uvlp12,etc, or null)" read ans if [[ ! "$ans" = "" ]]; then $ans $log; fi exit 0
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
Here is a convenient script to draw directory trees. UV Software uses it for documentation & it is illustrated here in case you wish to use it.
dtree /home/mvstest <-- try this (output illustrated below) ===================
/home/mvstest :-----testdata : :-----ap : :-----ar : :-----gl : :-----jobtmp : :-----sysout : :-----tmp : :-----wrk :-----testlibs : :-----cbl0 : :-----cbl1 : :-----cbl2 : :-----cbls : :-----cblx : :-----cpy0 : :-----cpy1 : :-----cpy2 : :-----cpys : :-----ctl : :-----jcl0 : :-----jcl1 : :-----jcl2 : :-----jcl3 : :-----jcls : :-----maps : :-----parm0 : :-----parms : :-----pf : :-----proc0 : :-----procs : :-----sf : :-----sfun : :-----tmp : :-----xref
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page
#!/bin/ksh # dtree - Korn shell script from UVSI stored in: /home/uvadm/sf/util/ # dtree - list a directory tree contributed by Howard Lobsinger # #usage: dtree directory # =============== # D=${1:-`pwd`} (cd $D; pwd) find $D -type d -print | sort | sed -e "s,^$D,,"\ -e "/^$/d"\ -e "s,[^/]*/\([^/]*\)$,\:-----\1,"\ -e "s,[^/]*/,: ,g" | more exit 0
Goto: Begin this doc , End this doc , Index this doc , Contents this library , UVSI Home-Page