Contents by Part


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

Contents by Part (continued)


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

Part_0 Onsite Training by UV Software

0A1. Vancouver Utilities Training Overview

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.

Vancouver Utilities Only course

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

1. uvhd

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

2. uvhdcob

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

3. uvlist

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

4. uvcp

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

5. uvsort

'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

0B2. Vancouver Utilities Training Overview

6. uvcopy

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

7. uvqrpg

'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

0C1. Vancouver Utilities Training Overview

Pre-programmed jobs

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.

8. Cross References

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

0C2. Vancouver Utilities Training Overview

9. Data file Comparisons

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.

sample Data File Comparison report

 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

0C3. Vancouver Utilities Training Overview

10. Table Summary Reports

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

sample Table Summary report

 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

0D1. Vancouver Utilities Training Overview

customer chosen sub-systems

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.

11. genacum2 - generate jobs to accum ALL numeric fields

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

sample report

 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

0D2. Vancouver Utilities Training Overview

12. uvhdc2 - makes uvhdcob easier to use

'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

0D3. Vancouver Utilities Training Overview

13. convert data files to RDBMS Tables

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

Oracle batch-file to create 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;

Oracle control file to LOAD table

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

0E1. Vancouver Utilities Training Overview

writing new uvcopy jobs

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

14. table summary example


 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

uvcopy job to create table summary report

 # 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

0E2. Vancouver Utilities Training Overview

15. convert Delimited to Fixed-Field for COBOL programs

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.

sample Delimited input from Excel

      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|

sample Fixed-Field output for COBOL

 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

uvcopy job to convert Delimited to Fixed

 # 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

0F1. Vancouver Utilities Training Overview

16. ADMjobs

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
  • setting up profiles (powerful 'stub' & 'common' profile concepts).
Part2
  • RAID arrays, partitioning,& file system design.
Part3
  • Backup & restore, ondisc backups for instant recovery.
Part4
  • Advanced zip file backups run by cron, for 30 days, 12 months, 7 years.
Part5
  • using 'cron' to run backups & other jobs (nightly,weekly,monthly)
Part6
  • console logging - replaces the mainframe console logs
Part7
  • useful scripts for Unix/Linux sites
Part8
  • Networking & System Administration

17. Cross-References

 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

sample COBOL copybook cross-ref

 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
  • the '*' above indicates missing copybooks
  • this crossref script runs an additional uvcopy job
  • to check existence of the copybook in the 'cpys' subdir

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_1 Training Guide for the Vancouver Utilities

Part1 - Preparation for Training


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

1A1. uvtrain: Training Guide Introduction & Suggested Procedures

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.

Single-User Procedures

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)

Multi-User Procedures

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

1A2. uvtrain: Preparation for UV training exercises

Vancouver Utilities Installation

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

subdirs relevant for UV training

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

1A3. uvtrain: Preparation for UV training exercises

Vancouver Utilities home directory

 /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

copy profiles to /home/appsadm/env/...

 /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

Notes

  1. You may install the Vancouver Utilities anywhere desired if you change the definition of environmental variable '$UV' in the common_profile, for example:

      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...
      ======================================================
  1. Profiles provided for Vancouver Utilities reflect this directory structure. 'common_profile_uv' & 'stub_profile_uv' are distributed in the env/ subdir.

  2. Note that the common_profile distributed is named common_profile_uv & you should copy to /home/appsadm/... renaming for your site name, for example


    cp $UV/env/common_profile_uv /home/appsadm/common_profile_ABC
    =============================================================
  1. Users should copy the stub_profile_uv to their homedir, renaming as .profile for Unix, or .bash_profile for Linux, for example:


    cp $UV/env/stub_profile_uv $HOME/.profile       <-- for Unix
    =========================================
    cp $UV/env/stub_profile_uv $HOME/.bash_profile  <-- for Linux
    ==============================================
  1. It is best to address Vancouver utility files using '$UV', for example, to copy a demo file to your homedir/subdir for test/demo/exercises:


      cp $UV/dat1/custmas1 data/
      ==========================
  1. The uvadm subdirs for 'sf' (script files) & 'pf' (uvcopy parameter files) are further sub-directoried as shown above, but there is no need for you to subdirectory sf & pf in appsadm or your homedir.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1A4. uvtrain: Preparation for UV training exercises

preparation for using Vancouver Utilities

 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

1A5. uvtrain: Preparation for UV training exercises

preparation for UV training exercises

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
  • you can copy additional files as desired from $UV/...
  • 'UV' is defined in the common_profile as follows:

 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

1A6. uvtrain: Preparation for UV training exercises

training subdirs/files in your homedir

 /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

1B0. uvtrain: Tips for new users to Unix/Linux

1B1. tip#1 - stay in your 'working directory'

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

1B2. Tips for new users to Unix/Linux

advantages of working above subdirs

  1. Helps maintain a clean well organized workplace - Since all files are in subdirs, you can probably list all your subdirs on 1 screen, which reminds you of your subdir organization.

  2. Protects your files, even the infamous 'rm *' would do no harm at the working directory level, since all files are in subdirs.

  3. Garbage files (accidentally created) are highlighted & can be easily removed or moved to their proper subdir. When you list your subdirs, any files (non-subdirs) will stick out like a sore thumb.

  4. Subdirs allow you to maintain the same filename for data & programs in the various stages of conversion, or archiving, etc.

  5. Many operations require addressing multiple files in multiple subdirs and it is then best to work 1 level above the subdirs. For example:


    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

1B3. Tips for new users to Unix/Linux

example - editing & compiling programs

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.

working IN subdirs - WRONG


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

working above subdirs - RIGHT


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

Exception to the Rule

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

1B4. Tips for new users to Unix/Linux

tip#2 - setup 'tmp' sub-dir in your working directory

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

examples of using 'tmp' subdir

  1. Use 'tmp' whenever you want to redirect output to a temporary file so that you can then use the editor to explore the output. For example we might use 'grep' to find all programs using upsi as follows:


 #1a. grep 'UPSI' cbls/* >tmp/upsi    <-- extract lines with UPSI

 #1b. vi tmp/upsi                     <-- review results with editor

 #1c. uvlp12 tmp/upsi                 <-- print results
  1. Editing parts of programs & JCL/scripts into other programs/scripts For example, to copy a paragraph from apay100.cbl to apay200.cbl:


 #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

1B5. Tips for new users to Unix/Linux

tip#3 - move files in working directory to subdir

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

1B6. Tips for new users to Unix/Linux

tip#4 - File Naming Conventions

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:

  1. It makes our file names 'unique' & avoids confusion with other similar names.

  2. We can reliably use 'grep' & 'find' to search for all instances of a desired file/table name in all our directories.

  3. We can use 'vi' to '/' search for all instances of a desired file/table name when editing our scripts & programs.

  4. It makes it easy to create names for related files. 'customer2' or 'sales2' might be a variant, save, or backup copy. Or we might use 'customer1a', 'sales1a', etc.

    Misspell filenames Intentionally

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 to identify related files

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

1C1. uvtrain: vi editor - command summary (minimum essentials)

TWO modes of operation - COMMAND or INSERT

  1. COMMAND mode - cursor movement, read/write files, etc

  2. INSERT mode - enter 1 of 'i,a,A,R,o,cw' to begin insert mode - enter text (insert or replace) - hit ESCAPE to end insert mode & return to command mode

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

starting 'vi' to edit a file


 vi filename   <-- starts vi, reads the file,& displays 1st screen
 ===========       (or blank screen if creating a new file)

CURSOR MOVEMENT

                  k                       up-arrow
                  |                          |
            h <-- . --> l     left-arrow <-- . --> right-arrow
                  |                          |
                  j                     down-arrow
 ^d   - down 1/2 screen
 ^u   -  up  1/2 screen
Note
  • I use '^' to represent the 'control key'
 :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

1C2. uvtrain: vi editor - command summary (minimum essentials)

INSERT text (ESCAPE to end insert)

i
  • enter insert mode at cursor location
a
  • append text after cursor location
A
  • append text onto the end of the current line
r
  • replace 1 character under the cursor
  • automatically returns to command mode (no need to ESCAPE)
R
  • replace (overwrite) text until ESCAPE
cw
  • change word (from cursor to end of word)
  • ESCAPE to end change & adjust line to new word length
o
  • open (insert) a new line BELOW the cursor
O
  • open (insert) a new line ABOVE the cursor

DELETE commands

x
  • delete character (under cursor)
dd
  • delete current line
D
  • delete from the cursor to end of line

5dd - delete 5 lines (current & next 4 lines below cursor)

COPY lines (YANK & PUT)

yy
  • yank current line (into current buffer)
  • move cursor to line above intended insert point
p
  • put (insert) buffer to line below cursor
 5yy - yank 5 lines into current buffer
     - move cursor to line above intended insert point
 p   - put (insert) buffer (5 lines) below cursor

MOVE lines (DELETE & PUT)

dd
  • delete current line (& store in current buffer)
  • move cursor to line above intended insert point
p
  • put (insert) buffer to line below cursor
 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

1C3. uvtrain: vi editor - command summary (minimum essentials)

search commands

 /xxx - search for xxx anywhere in the file
      - search will wrap around EOF back to cursor location
n
  • repeat previous search (next)

substitution commands

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

Global command - to delete, etc

 :g/xxx/d          - on ALL lines (g=global), Delete lines with 'xxx'
 :g/xxx/p          - on ALL lines (g=global), Print lines with 'xxx'

miscellaneous commands

u
  • undo the last change command
U
  • Undo all changes to the current line (since cursor move to it)
 .  - repeat the previous change command
J
  • Join line below cursor onto current line
 :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
  • print the ASCII & HEX value of the character under the cursor

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1C4. uvtrain: vi editor - command summary (minimum essentials)

MARK lines & copy

m[a-z]
  • mark current line as a,b,c,... (any 1 of 26 alphas)
m a
  • mark current line as mark 'a'
  • can move cursor to some other line
mb
  • mark new current line as mark 'b'
  • no need to leave space between mark command & mark letter
 '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

MARK lines, write to tmp/, read into 2nd file

vim dir/file1 <-- edit file1

ma
  • mark desired start line as mark 'a'
  • move cursor to some other line
mb
  • mark desired end line as mark 'b'

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

1C5. uvtrain: vi editor - command summary (minimum essentials)

registers a-z

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)

registers to yank lines in file1 & put in file2

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

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
  • write & quit (same as :wq)

: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

1C6. uvtrain: vi editor - command summary (minimum essentials)

.vimrc file

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.

vim backup

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

vim References

Note
  • 'vim' is an enhanced version of 'vi', used on most Linux systems.

 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

1D0. uvtrain: 'vi' editor tutorial

files for 'vi' editor tutorial

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

1D1. uvtrain: 'vi' editor tutorial

hello1 - vi exercise #1

 # 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

1D2. uvtrain: 'vi' editor tutorial

hello2 - vi exercise #2

 # 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

1D3. uvtrain: 'vi' editor tutorial

hello3 - vi exercise #3

 # 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

1D4. uvtrain: 'vi' editor tutorial

hello4 - vi exercise #4

 # 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

1D5. uvtrain: 'vi' editor tutorial

hello5 - vi exercise #5

 # 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

1E1. uvtrain: 'vi' editor tutorial

vi exercise - correct mistakes

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

1F1. uvtrain: 'vi' editor tutorial

vi ex#6 - 'mark' lines for move,copy,delete,etc

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:

  1. Delete even-numbered parts.

  2. Reverse the order of the odd-numbered parts.


 vi dat1/uvtrain_contents  <-- edit file, modify as above
 ========================

demo file 'uvtrain_contents'

      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

1F2. uvtrain: 'vi' editor tutorial

vi ex#6 - 'mark' Exercise Instructions


 #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
  • you could omit #4d & use '.' (current line) instead of mark 'b'

 #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
  1. Continue Deleting even-numbered parts & Moving odd-numbered parts to reverse sequence. You should find the 'n' (search for Next 'Part_') useful to get to next desired part


 #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

Part_2 Training Guide for the Vancouver Utilities

Part2 - Test/Demo file layouts


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
  • test/demo files are provided in the 'dat1' sub-directory of 'uvadm'.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2A1. Test/Demo files for Vancouver Utilites Training

notes re mainframe files transferred to UNIX

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 demo files to your homedir

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

2B1. Test/Demo files for Vancouver Utilites Training

file 'typ' codes for uvcp, uvsort,& uvcopy

typ=LST
  • Text file, variable length records, LineFeed terminated x'0A'
  • may be easily edited with vi or printed with lp
  • Micro Focus COBOL organization 'Line Sequential'
typ=LSTt
  • use the 't' option for output files (filo1=xxx) to truncate
    at the last non-blank (LF x'0A' inserted after last nonblank)
  • without the 't' option output files would be fixed length and
    1 greater than the record size, specified by rcs=???.
typ=RSF
  • Fixed length records, with no LineFeeds
  • commonly used in mainframe COBOL applications
  • Micro Focus COBOL organization 'Record Sequential'
typ=RST
  • same as RSF, with LineFeed x'0A' IN last byte of rcsz
typ=RSR
  • same as RSF, with LineFeed x'0A' AFTER last byte of rcsz
  • Micro Focus COBOL organization 'Relative'
  • Note that a Relative file is the same as the data partition
    of an Indexed file (physical rcsz 1 greater than logical rcsz)
typ=ISF
  • Indexed Sequential Fixed length records
  • Index is a separate file with '.idx' extension
  • Micro Focus COBOL organization 'Indexed'
  • When loaded into an indexed file, a x'0A' byte is appended
    to each records (making physical rcsz 1 longer than logical)
  • This is same code as a LineFeed & allows viewing with 'vi'
    but this is really the delete flag & will be converted to
    x'00' for deleted records (Careful, don't use vi on ISAM files).
typ=IDXf1
  • fixed length Indexed records, same as typ=ISF
    but using Micro Focus file handler (applies to 'uxcp' not 'uvcp')
typ=IDXf3
  • variable length Indexed files (file size < 2 gig)
typ=IDXf8
  • variable length Indexed files (allowing file size > 2 gig)
  • IDXF3 & IDXf8 could be fixed records in variable format
typ=RDWz4
  • 'Record Descriptor Word' variable lth files (RDW defaults to RDWz4)
  • 4 byte record prefix with 2 byte binary recsize & 2 unused nulls
  • record size in prefix is total record size including the prefix
  • 2 byte recsize is 'BIG-END' binary (like mainframe or SUN,AIX,DEC)
  • 'little-end' machines (Intel) need to switch ends to perform math
typ=RDWz2
  • option 'z2' for 2 byte prefixes (vs 4 default above)

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2C0. Test/Demo files for Vancouver Utilites Training

dat1/custmas0 - customer master & sales history

Fixed length 256 byte records, no terminating linefeeds. 32 records containing many packed decimal fields (typical mainframe COBOL type file).

Note
  • record layouts are one relative
  • Vancouver Utility programs require zero relative addresses

dat1/custmas0 - record layout

           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)

dat1/custmas0 - EBCDIC record displayed by uvhd


 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
  • compare the above EBCDIC version to the ASCII version listed below.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2C1. Test/Demo files for Vancouver Utilites Training

dat1/custmas1 - ASCII record displayed by uvhd


 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

vertical hexadecimal & EBCDIC vs ASCII

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

packed fields same for EBCDIC & ASCII

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

2C2. Test/Demo files for Vancouver Utilites Training

dat1/custmas2 - customer master name & address only

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

dat1/custmas2 - 1st few records as seen with 'vi', 2 lines per record

 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

dat1/custmas2 - displayed by uvhd, 2 1/2 records in 1st block

 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
  • the fixed length 120 byte records are terminated by LineFeeds
  • shown as periods on the character line of the 3 line vertical hex group
  • look directly below to see x'0A' to distinguish LF's from periods x'2E'

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2C3. Test/Demo files for Vancouver Utilites Training

dat1/custmas3 - customer master name & address only

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

dat1/custmas3 - all 32 records (80 bytes each)

 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

2D0. Test/Demo files for Vancouver Utilites Training

dat1/sales0 - sales detail (0=EBCDIC)

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)

dat1/sales0 - record layout

        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)

dat1/sales0 - EBCDIC display by 'uvhd'


 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
  • we have shown only the 1st 3 records of the EBCDIC file above
  • we will show all 20 records for the ASCII file below
  • no need to show zones & digits for ASCII files with no packed fields

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2D1. Test/Demo files for Vancouver Utilites Training

dat1/sales1 - customer sales detail

          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

2D2. Test/Demo files for Vancouver Utilites Training

dat1/sales2 - ASCII zoned signs

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

2D3. Test/Demo files for Vancouver Utilites Training

dat1/sales3 - separate signs

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)

dat1/sales3 - record layout

        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-

convert Zoned signs to Separate signs trailing

 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

Part_3 Training Guide for the Vancouver Utilities

Part3 - basic Vancouver Utilities


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

Part3 - Contents (continued)


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

3A1. uvtrain: Training Guide for 'uvhd'

'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
  • only a few commands will be demonstrated here in 'uvtrain'
  • see full doc & all commands at https://www.uvsoftware.ca/uvhd.htm
  • browse, search, update, scan/replace, write/select, print, translate

sample 'uvhd' - browsing file with packed fields


 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

3A2. uvtrain: Training Guide for 'uvhd'

uvhd Search/Update data in specified fields

Example
  • search for 'AL' in bytes 77-78 (0 relative)

 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

3A3. uvtrain: Training Guide for 'uvhd'

uvhd - write selected records


 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

3A4. uvtrain: Training Guide for 'uvhd'

uvhd drop records demo

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

3B1. uvtrain: Training Guide for the Vancouver Utilities

uvhdcob - display data files with COBOL field names


 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)

uvhdcob - sample display

 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

3B2. uvhdcob 'verify' test/demo

The 'v' verify command searches from the current record until it finds a record with at least 1 bad data field & displays that record. 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

display rec# 10 with bad data fields

 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

3C1. uvtrain: uvlist Program Description

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


 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

3C2. uvtrain: Shell Scripts provided for uvlist

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*

uvlp___ scripts - a few samples of 68 total

uvlp10
  • print at 10 cpi, 76 chars on 8 1/2" wide (portrait)
uvlp12
  • print at 12 cpi (90 chars on 8 1/2" wide)
uvlp14
  • print at 14 cpi (108 chars on 8 1/2" wide)
uvlp16
  • print at 14 cpi (120 chars on 8 1/2" wide)
uvlp18
  • print at 18 cpi (134 chars on 8 1/2" wide)
uvlp20
  • print at 18 cpi (150 chars on 8 1/2" wide)
uvlp12v6
  • print at 12 cpi & 8 lpi (90 chars across & 80 lines down)
    note v6 means 6/48" which is 8 lpi
uvlp12D
  • print DUPLEX at 12 cpi (90 chars across & 60 lines down)
      'D' <---- UPPER case 'D' indicates DUPLEX printing
      'L' <---- UPPER case 'L' indicates LANDSCAPE
uvlp12L
  • print LANDSCAPE at 12 cpi (140 chars on 11" wide)
uvlp14L
  • print LANDSCAPE at 14 cpi (150 chars on 11" wide)
uvlp16L
  • print LANDSCAPE at 16 cpi (160 chars on 11" wide)
uvlp18L
  • print LANDSCAPE at 18 cpi (180 chars on 11" wide)
uvlp20L
  • print LANDSCAPE at 20 cpi (200 chars on 11" wide)
uvlp12LD
  • print Landscape & DUPLEX at 12 cpi & 6 lpi (134 chars & 60 lines)
uvlp14LD
  • print Landscape & DUPLEX at 14 cpi & 6 lpi (150 chars & 60 lines)
uvlp16LD
  • print Landscape & DUPLEX at 16 cpi & 6 lpi (160 chars & 60 lines)
uvlp18LD
  • print Landscape & DUPLEX at 18 cpi & 6 lpi (180 chars & 60 lines)

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3C3. uvtrain: Shell Scripts provided for uvlist (continued)

uvlp scripts for printing mainframe COBOL reports

The following scripts allow for 132 characters wide (Landscape at 13 cpi), and 66 lines per page (8 lines/inch if Landscape).

uvlp13L
  • Landscape Simplex, 13 cpi, 8 lpi
  • 132 cols wide & 66 lines down on 8 1/2 x 11
uvlp13LD
  • Landscape Duplex, 13 cpi, 8 lpi
uvlp13LA
  • Landscape Automatic
  • Simplex if lines < 1000, Duplex if lines > 1000
uvlp18
  • Portrait Simplex, 18cpi, 8 lpi
  • 132 cols wide & 66 lines down on 8 1/2 x 11
uvlp18D
  • Portrait Duplex, 18cpi, 7 lpi
uvlp18A
  • Portrait Automatic
  • Simplex if lines < 1000, Duplex if lines > 1000

printing all files in a directory

uvlpd12
  • print all files in a directory at 12 cpi
uvlpd12A
  • print all files in directory
  • Automatic (Simplex or Duplex) depending on lines <> 300
uvlpd18
  • print all files in a directory at 18 cpi
uvlpd1p
  • print all files in directory, but only 1st page of each file
uvlpp
  • print all files in a directory matching a specified prefix
uvlpp12
  • print all files in a directory matching a specified prefix
    at 12 cpi (vs 10 cpi default)

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3C4. uvtrain: Shell Scripts provided for uvlist

sample shell script for uvlist

 #!/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
  • also see 'uvlp12D', same as above but Duplex

 vi /home/sf/util/uvlp12D   <-- inspect Duplex version
 ========================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3C5. uvtrain: Shell Scripts provided for uvlist

set UVLPDEST to a printer near you

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

temporary changes to UVLPDEST & UVLPOPTN

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

3C6. uvtrain: Shell Scripts provided for uvlist

modify uvlp scripts for A4 paper or Xi-Text spooler

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 modified for A4 paper

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

search/replace table for rep2d mass change job

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

operating instructions for rep2d


 #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

3D1. Vancouver Utilties Training Guide

uvcp - command line Data File Utility

'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).

3D1. uvcp ex#1 - translate EBCDIC to ASCII & insert LineFeeds

Example
  • dat1/sales0, an EBCDIC file
  • fixed record length with no LineFeeds
  • perform the following:
  1. try to view the file with 'vi' (wont work since EBCDIC & no LineFeeds)
  2. investigate with 'uvhd' & NO options (assumes ASCII & recsize 256)
  3. investigate with 'uvhd' & option 'a' translate chars to ASCII
  4. determine the record length (using 'uvhd')
  5. use 'uvcp' to translate to ASCII
  6. check result with 'vi' (wont work since LineFeeds NOT present)
  7. use 'uvcp' to translate to ASCII & insert LineFeed in last byte
  8. check result with 'vi' (now works since LineFeeds present)
  9. investigate with 'uvhd' & option 'h2' to see LineFeed codes

 #1. vi dat1/sales0  <-- 1st try to examine with 'vi'
     ==============    - screen display might be:
 ñóðñôð@@@@òñ@ùôðøðò@ÉÕñññððñ@@ÈÁÔððñ@@ððððòÀ@ððððððñ@ðððððððòÀ@@ñóðñôð@@@@òñ@ùôð
 øðò@ÉÕñññððñ@@âÃÙðñò@@ððððòÁ@ðððñððñ@ððððòñðòÁ@@ñóùùòó@@@@óõ@ùõðøðò@ÉÕñññððò@@ÃÈ
 Ùððñ@@ððððòÂ@ðððòððñ@ððððôôðòÂ@@ñóùùòó@@@@óõ@ùõðøðò@ÉÕñññððò@@ãÁÂðñó@@ððððòÃ@ððð
 óððñ@ððððöùðòÃ@@ñóùùòó@@@@óõ@ùõðøð÷@ÃÙõôòñ@@@@ãÁÂðñó@@ððððòÄ@ðððôððñ@ððððùöðòÄ@@
                    - - - 12 screen lines omitted - - -
Note
  • entire file appears as 1 line for vi,lp,etc since NO LineFeeds
  • appears as multiple lines on screen since it wraps at column 80
  • you could not print the file, would see only 1 line of garbage

 #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

3D2. using uvcp to translate EBCDIC to ASCII & insert LineFeeds


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

use 'uvcp' to translate to ASCII


 #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

3D3. using uvcp to translate EBCDIC to ASCII & insert LineFeeds

use 'uvcp' to translate to ASCII & Insert LineFeeds


 #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

use 'uvhd' to see the Linefeed codes


 #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
  • lineFeeds x'0A' in last byte of each 64 byte record

 #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
  • option h2 (force hex) is now the default (will not show in future)

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3E1. uvcp - command line Data File 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).

uvcp ex#2 - inserting LineFeeds to allow editing/printing

problem
  • dat1/custmas1 cannot be displayed/printed with vi/lp because
    of the presence of packed fields & the absence of linefeeds.
  • see uvhd of dat1/custmas1 on page '2C1'
required
  • Copy the file with uvcp, truncating the records at col 80
    & inserting a LineFeed in col 80.
  • This will omit the packed fields (cols 121-240) & still
    retain most of the name & address.

 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

3E2. uvcp - command line Data File Utility

uvcp ex#2 - solution


 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

3F1. uvtrain: uvcp - command line Data File Utility

uvcp ex#3 - translate EBCDIC to ASCII

Example#3
  • translate dat1/custmas0 to ASCII, writing output to tmp/cm1

 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
  • first byte '1' is x'F1' in EBCDIC, but x'31' in ASCII
  • the 'E' of EVERGREEN is x'C5' in EBCDIC, but x'45' in ASCII
  • packed fields (120-239) appear different on character line
    because the packed digits translate differently in EBCDOC/ASCII
  • the hexadecimal zones & digits prove they are unchanged

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3F2. uvtrain: uvcp - command line Data File Utility

uvcp ex#3a - translate to lower case

Exercise#3a
  • prior exercise copied original dat1/custmas1 to tmp/cm1
  • now copy tmp/cm1 to tmp/cm1L translating to lower case
  • output 80 byte records with a LineFeed in col 80.
  • fill in the '...'s below, then key it & run it

 uvcp "fili1=tmp/cm1,rcs=256,typ=RSF,filo1=tmp/cm1L,trl=...,rcs=...,typ=..."
 ===========================================================================
Note
  • see file 'typ' codes listed on page '2B1'
  • choose the typ code that inserts LF in last byte of record-size.
  • in this example you could omit coding typ=... on the output side
    and chnage the input side 'typ=RSF' to 'typ=RST', because 'typ=RST'
    has no effect on input side, but is effective on output side.

 uvhd tmp/cm1L r_?_   <-- confirm translation with uvhd
 ==================     - what recsize should you use ?

 vi tmp/cm1L     <-- confirm translation with 'vi'
 ===========

ex#3b (optional) - translate 1 of your files

Exercise#3b
  • translate 1 of your own files to EBCDIC, to lower, to UPPER

 solution:
 ============================================================================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3G1. uvtrain: uvcp - command line Data File Utility

uvcp ex#4 - Selecting or Deleting records

Example#4
  • copy dat1/custmas2 to tmp/cm2 dropping records with a 'D' in col 9
  • see dat1/custmas2 listed on page '2C2'
  • shorten records from 120 to 80 bytes
  • see more examples at uvcp.htm#J1

 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
  • Also see the 'uvhd' utility 'w' (write) command to select
    records interactively (& investigate file at same time).
Exercise#4b
  • copy dat1/custmas2 to tmp/cm2, selecting 'CALGARY' customers
  • that are not deleted ('D' in column 9)
  • you will need 2 select instructions (sel1 & sel2)
  • write your solution below, then key it & run it

 solution:
 ============================================================================
Exercise#4c
  • (optional) copy 1 of your own files selecting or deleting records
  • on whatever basis makes sense to you

 solution:
 ===========================================================================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3H1. uvtrain: uvcp - command line Data File Utility

clearing multiple contiguous packed fields

Example#5
  • copy dat1/custmas1 to tmp/cm1, zeroing this-year monthly sales
  • 12 * 5 byte packed fields in columns 121-180.

 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 ex#5 - solution


 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

3H2. uvtrain: uvcp - command line Data File Utility

Exercise#5a
  • same as above, but move the this-year fields to last-year,
  • before clearing the this-year fields
  • write your solution below, then key it & run it

 solution:
 ===========================================================================
Exercise#5b
  • (optional) Perform a similar operation on 1 of your own files
  • if you have a suitable file

 solution:
 ===========================================================================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3I1. uvtrain: uvcp - command line Data File Utility

uvcp ex#6 - Y2K conversion


 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
  • given below (key it, run it,& confirm your results match below)

 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

Exercise#6a - improve Y2K solution above


 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
  • Also see uvcopy exercise '4C1' which is the same as this.
  • uvcopy is easier to code when you have more than 2 or 3 instructions.

 solution:
 ===========================================================================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3J1. uvtrain: uvcp - command line Data File Utility

uvcp ex#7 - numeric field conversions

Example#7
  • convert dat1/sales2 file to same format as dat1/sales3
  • write your output to tmp/s2
  • signs in the quantity & amount fields are to be converted
    from zones of units digits to separate trailing '-' or '+'
    (see the 2 'mvn' instructions below)

 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.

uvcp ex#7a - right adjust, left zero fill

Exercise#7a
  • copy dat1/sales3 to tmp/s3
  • right-adjust & left zero fill cols 23-28 invoice# numeric portion
  • 'IN111001' would be unchanged
  • 'CR5421 ' would become 'CR005421'

 solution:
 ===========================================================================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3K1. uvtrain: uvcp - command line Data File Utility

loading Indexed files with uvcp

Example#8
  • copy dat1/custmas1 to tmp/cm1, creating an Indexed file
  • whose key is the customer# (cols 1-6)

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

uvcp ex#8a - load 2 key Indexed file

Exercise#8a
  • copy dat1/custmas1 to a 2 key Indexed file (tmp/cm1)
  • 1st key cust# cols 1-6, 2nd key city cols 61-76
  • shorten the output records to 80 bytes

 solution:
 =======================================================================
Exercise#8b
  • copy the Indexed file you created above to a sequential file.
  • copy tmp/cm1 to tmp/cm1s.
  • you do not have to specify the keys (isk1 & isk2) for the input
    file (the ISAM file software determines this on file open).

 solution:
 ==========================================================================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3K2. uvtrain: uvcp - command line Data File Utility

script makeISF0 - create an empty Indexed file

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.

script makeISF0 - create an empty Indexed file

 # 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

Exercise#9 - test makeISF0 as follows


 #1. rm tmp/*        <-- clear the tmp/ subdir
     ========

 #2. makeISF0 tmp/isamtest 256 0,6,60,16  - create empty ISAM file
     ===================================

console log

       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
  • the data partition is (of course) zero length (empty)
  • the index partition is initially 4096 & will grow as records
    are added to the data partition

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3L1. uvtrain: 'uvsort' - Sort Utility for UNIX systems

The UNIX system sort is inadequate for sorting mainframe type files because:

  1. The UNIX sort cannot sort files without LineFeeds (files transferred from mainframes do not have Linefeeds).

  2. The UNIX sort cannot sort on packed, binary, or signed keys (& does not have a Year 2000 field type)

  3. The UNIX sort cannot process Indexed files (would not respect deleted records on input & cannot load output).

  4. The UNIX sort lacks mainframe capabilities such as: - record selection/deletion based on specified values in specified bytes - selecting records with unique or duplicate keys

    uvsort ex#1 - sort seqntl file on 1 key

Example#1
  • sort the dat1/custmas2 by city name (cols 61-76)
  • write output to tmp/cm2 with same record size & same file type

 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
  • sort the dat1/custmas2 file by city name within province
    (city name cols 61-76, province cols 78-79)
  • output 80 byte records with a LineFeed in column 80
  • see key specifications at uvsort.htm#C1
  • see more examples of uvsorts starting at uvsort.htm#L0
  • confirm your output sequence with 'vi'

 solution:
 ==========================================================================
Exercise#1b
  • Sort the dat1/sales3 file by $AMOUNT (cols 54-62) DESCENDING.
  • Write output to tmp/s3 with same record size & same file type

 solution:
 ==========================================================================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3M1. uvtrain: uvsort - data file Sort Utility

sorting with Unique key option 'u'

Example#2
  • Sort dat1/sales3 by invoice# (cols 21-28) with data reduction
  • Data Reduction means outputting only 1 record for each
    unique sort key (invoice# in this case).
  • option key_u1 selects FIRST record of duplicate set
  • option key_u2 selects LAST record of duplicate set
  • option key_u4 selects NO records of duplicate set
    (retaining only records with no duplicate sort keys)

 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
  • Sort dat1/sales3 by product# (cols 31-36) with data reduction

 solution:
 ==========================================================================
Exercise#2b
  • Try sorting with Data Reduction on 1 of your own files,
    using whatever sort key(s) make sense to you.
  • If your records do not have linefeeds (typ=RSF), specify
    your output as typ=RST, so you can easily examine with vi.

 solution:
 ==========================================================================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3M2. uvsort options to select records on UNIQUE or DUPLICATE keys

option 'u' (key#u1/2) - drop duplicate records

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
  • will drop duplicates EXCEPT for the FIRST record of a duplicate set
    at the specified key level#.
key_u2
  • will drop duplicates EXCEPT for the LAST record of a duplicate set
    at the specified key level#.
key_u4
  • will drop ALL records of DUPLICATE KEY SETS, retaining only those
    records that had no duplicate keys at the specified key level.

option 's' (key#s1/2) - select duplicate records

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
  • select only the FIRST record of a duplicate set
    (at the specified key# level)
key_s2
  • select only the LAST record of a duplicate set
    (at the specified key# level)
key_s4
  • select all records of a duplicate set
    (at the specified key# level)
key_s4b
  • select all records of a duplicate set, with option 'b'
    to insert a blank line between duplicate sets

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3N1. uvtrain: uvsort - data file Sort Utility

multi-file input to uvsort

Example#3
  • Sort dat1/sales2 & dat1/sales3 together on customer#
  • Write your output to tmp/s23, record size 64, typ=RST.

 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
  • Sort dat1/sales1, dat1/sales2, dat1/sales3 together on product#.
  • Write your output to tmp/s123, record size 64, typ=RST.
  • See 3 methods of multi-file input, explained at uvsort.htm#K1.

 solution:
 ==========================================================================
Exercise#3b
  • (optional) Try a multi-file sort using some of your own files

 solution:
 ==========================================================================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3O1. uvtrain: uvsort - data file Sort Utility

sorting & loading Indexed files

Example#4
  • sort dat1/custmas1 by cust# (key1) & load an Indexed file.
  • write your output to tmp/cm1, record size 256, typ=ISF
  • 1st ISAM key (isk1) is to be cust# cols 1-6
  • 2nd ISAM key (isk2) is to be postal code cols 81-90

 uvsort "fili1=dat1/custmas1,rcs=256,typ=RSF,filo1=tmp/cm1,typ=ISF,
 ==================================================================
                                   key1=0(6),isk1=0(6),isk2=80(10)"
                                   ================================
NOTE
  • see explanation of file 'typ' codes on page '2B1'
Exercise#4a
  • Try sorting & loading an Indexed file with 1 of your files.
  • Specify whatever sort keys & ISAM keys make sense to you.

 solution:
 ==========================================================================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3O2. uvtrain: uvsort - data file Sort Utility

uvsort ex#5 - rebuild files with corrupted Indexes


 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
  • Try this procedure using 1 of your own Indexed files

 solution:
 ==========================================================================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3P1. uvtrain: uvsort - data file Sort Utility

uvsort ex#6 - Y2K sort options

Example#6
  • sort dat1/sales2 on columns 14-19 (a 6 digit date yymmdd)
  • using the Year2000 option 'y' of '13(6y)'

 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
  • repeat the above sort varying options:
Ex#6a
  • without Year2000 option 'y' change '13(6y)' to '13(6)'
  • list file to confirm that 00,01,02 now sort low
Ex#6b
  • with 'run option y__' to change Y2K window
  • append ',rop=y98' onto the command line shown above
  • list file to see results
Ex#6c
  • with 'run option 'y__z1' to change window & specify sliding windows
  • append ',rop=y98z1' onto the command line shown above
  • list file to see results

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_4 Training Guide for the Vancouver Utilities

Part4 - uvcopy (most powerful utility)


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

4A1. 'uvcopy' - Powerful File Maintenance & Data Manipulation Utility

what is 'uvcopy' & why we need it ?

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

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

pre-programmed uvcopy jobs

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

4A2. 'uvcopy' - Powerful File Maintenance & Data Manipulation Utility

more pre-programmed jobs

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
  • select files from indir to outdir with or without a match
    on up to 3 patterns (on any line in the file)
uvcopy selectft1
  • select files from indir to outdir with or without a match
    to a table of multiple patterns.
uvcopy selectrp1
  • select records from 1 file matching a specified pattern
uvcopy selectrmp1
  • select records from a directory of files by patterns,
    outputting matching records to 1 combined output file
uvcopy selectrmp3f
  • select records from a directory of files by patterns,
    outputting matching records to 1 separate files
    in an output directory
uvcopy hexcalc1
  • convert between decimal & hexadecimal

Part_6 - even more pre-programmed jobs

how does uvcopy find its parameter files ?

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

4A3. 'uvcopy' - Powerful File Maintenance & Data Manipulation Utility

copy1 - skeleton/template for new uvcopy jobs

'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

4A4. customizing uvcopy 'skeleton' job to solve current problems

creating a new uvcopy job

  1. Copy the 'copy1' skeleton job to whatever name you decide to assign to your new job. I strongly recommend you keep your param files in a sub-directory from your home directory similar to the 'pf' directory which is a sub-directory from the 'uvadm' home directory.

  2. Edit your new job. Be sure to change the jobname on line 1; you don't need to change on the 'opr' statement since it is coded as '$jobname'. Be sure to fill in your job description on line 1 & on the 'opr' statement.

  3. Modify the input/output file declarations if required Note that the skeleton job file declarations are as follows:

      fili1=?input,typ=?LST,rcs=256
      filo1=?tmp/$fili1,typ=?LSTt,rcs=256
  1. Insert your instructions as required into the get/put loop:

      #-----------------------------
            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.
  1. Debug your job. You probably wont get it right 1st time, but the diagnostics usually pinpoint your clerical errors. The logic is up to you, but the interpretive nature of uvcopy allows you to change & rerun very quickly. Also see the 'debug' option which is documented on the last few pages of uvcopy2.doc.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

4B1. uvcopy - Powerful File Maintenance & Data Manipulation Utility


 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. uvcopy - Powerful File Maintenance & Data Manipulation Utility


 4C1 exercise - Year 2000 expansion of 6 digit date fields to 8 digits
 ============
given
  • dat1/sales2 test file (see listing & layout on page '2D2')
  • 64 byte records with date yymmdd in columns 14-19
required
  • insert century digits '19' in columns 14-15,& shift the
    remainder of the record over 2 columns, increasing the
    record size to 66 bytes.
method
  • copy, rename,& edit the uvcopy copyf1 skeleton job as follows:

 #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
  • also test the 1st digit of the existing 2 digit year, &
    if '0' - insert the century as '20' (vs '19')

 4C3 exercise - same problem as above, but in addition
 ============
required
  • test the 1st 2 digits of the existing 2 digit year, &
    if 00-29, insert the century as '20' (vs '19')

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

4C2. uvcopy - Powerful File Maintenance & Data Manipulation Utility

uvcopy debugging demo

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

Notes re uvcopy debugging

  1. See uvcopy debug commands at uvcopy2.htm#J2 - J3

  2. In the demo above, we used 'null entries' to execute instructions to the end of the 1st get/put loop (opn,get,skp>,mvc,mvc,mvc,put,skp),

  3. We then used 'p' to print area 'a' & 'b' Input & Output areas

  4. We then used 'g' to Go to EOJ

  5. In longer jobs, the 't' (run until specified tag/label encountered) is very useful, to run quickly to an area of the program where you want to stop & Print various areas.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

4D1. uvcopy - Powerful File Maintenance & Data Manipulation Utility


 4D1 exercise - create a telephone list from supplied customer master file
 ============
given
  • dat1/custmas2 (demo customer master file - see page '2C2')
  • relevant fields for this exercise are:
    001-006 - cust#
    011-035 - customer name
    091-102 - telephone#
    103-120 - contact name
required
  • create a telephone list as follows:
    01-06 - cust#
    11-35 - customer name
    39-50 - telephone#
    53-70 - contact name

sample report

 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
  • assign your new uvcopy jobname as 'custphone1'
  • write the output file to tmp/custphone1
  • as a starting point, you can copy & rename an existing job
    such as: pf/copy1, pf/copyf1, or pf/cmfix1 (prior exercise)
  • modify the copied & renamed job as required
  • test & debug: uvcopy pf/custphone1
Note
  • you can see the solution in /home/uvadm/pf/demo/custphone1
  • But, DONT LOOK until you write your own solution

 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. uvcopy - Powerful File Maintenance & Data Manipulation Utility

creating edited reports with uvcopy


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

sample output report

          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
  • The next exercise will ask you to prepare a similar report from the
    same file. It might be easier for you to copy & rename this job &
    then modify it as required.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

4F1. uvcopy - Powerful File Maintenance & Data Manipulation Utility

creating edited reports with uvcopy - exercise


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

sample output report

          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-

suggestions

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
  • you can see the solution in /home/uvadm/pf/demo/slrpt2
  • But, DONT LOOK until you write your own solution

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

4G1. uvcopy - Powerful File Maintenance & Data Manipulation Utility

table analysis with uvcopy - demo


 4G1 example - run 'cmtbl2' to create the 2 summary table reports shown below.
 ===========

 uvcopy cmtbl2  - execute uvcopy to interpret prmfile 'cmtbl2'
 =============

sample output report

 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. uvcopy - Powerful File Maintenance & Data Manipulation Utility

creating table analysis reports - exercise


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

sample output report

 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

suggestions

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
  • you can see the solution in /home/uvadm/pf/demo/sltbl2
  • But, DONT LOOK until you write your own solution

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

4I1. 'uvcopy' - Powerful File Maintenance & Data Manipulation Utility

creating Delimited files for Excel, SQL, etc

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.

demo file dat1/custmas2 - 1st 3 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

sample '|' delimited format

 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
  • see the 'delimcustNA1' job listed on the next page
  • see several more examples begining at uvcopy5.htm#A1.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

4I2. demo job to create pipe delimited N&A

uvcopy listing of demo job

 # 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

4J1. 'uvcopy' - Powerful File Maintenance & Data Manipulation Utility

create comma delimited customer telephone list


 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
  • the answer is supplied in $UV/pf/demo/delimcustTEL1
  • BUT, DO NOT LOOK, until you have created your own job

demo file dat1/custmas2 - 1st 3 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

sample ',' comma delimited output

 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,

subdirs used for this exercise

      /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

4J2. exercise - create comma delimited customer telephone list

suggested procedure


 #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

4J3. exercise - create comma delimited customer telephone list

optional


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

experiment with alternate delimiters

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

4K1. 'uvcopy' - Powerful File Maintenance & Data Manipulation Utility

addup0 - accumulate $amount in the dat1/sales2


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

addup1 demo


 #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
  • see code for addup0 listed on the next page

 #5. uvcopy addup0  <-- execute job
     =============

console log from addup0 execution

      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

4K2. addup0 - accumulate $amount in the dat1/sales2

addup0 - uvcopy code listing

 # 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
  • 'addup0' is a specific version of pre-programmed job 'addup1' in Part 6
  • that accumulates any field in any file by entering filename & options
    for displacement & length.
  • addup1 for Text files & addup2 for Fixed-Record-Length files
    (max record-size 4096 bytes)

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_5 Training Guide for the Vancouver Utilities

part 5 - uvfix jobs


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

5A1. CNVaids: Vancouver Utility Aids

uvfix scripts & uvcopy jobs

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.

uvfix scripts - easy way to use uvcopy

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
  • 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
  • may then inspect (with vi subdir2/*) & change name to subdir1
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
  • may then inspect (with uvhd subdir2/...) & change name to subdir1

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

5B1. uvfix scripts & uvcopy jobs

demo uvfix1,A,2,B

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

uvfix1 ex#1 - modify 1 text file with 'mvc'


 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

5B2. uvfix scripts & uvcopy jobs

uvfix1 ex#2 - convert Tab-delimited file to Fixed-format


 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
  • convert to the Fixed-Format shown below

 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

Fixed-Format created by uvfix1 from tab-delimited

 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

uvfix1 ex#2 (continued) Tab-delimited to Fixed-format


 #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

Notes

  1. See all uvcopy instructions documented at www.uvsoftware.ca/uvcopy3.htm

  2. uvfix1 prompts for instructions until you ennter '.' to end input.

  3. uvfix1 executes as follows:

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

  1. If you wanted to inhibit output, you would enter 'ret<' instruction, which returns with condition code <, which inhibits the ussual write. You would precede with some compare for something & skip 1 (over the ret<) if you want to output the record (ret= is automatic at end your instructions).

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

5C1. uvfix scripts & uvcopy jobs

uvfixA - modify ALL Text files in subdir


 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

sample output - 1st 8 lines of 1st program

 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

5D1. uvfix scripts & uvcopy jobs

uvfix2 - modify 1 Fixed-length file


 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

uvfix2 - move thisyear to last & clear thisyear


 #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

5E1. uvfix scripts & uvcopy jobs

uvfixB - modify ALL Fixed-Length files in subdir


 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

uvfixB (cont) - Y2K demo check 1st output file


 #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

5F1. CNVaids: Vancouver Utility Aids

uvcpfix1 - modify a text file with uvcp

'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 is often simpler than this example which demos 'mvc'
  • often we only want to change the file type from text to fixed
  • in which case the above example would be:

      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
  • We can not see the Line-Feeds with more (or vi, cat, head, etc)
  • see next page for confirmation with uvhd

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

confirm LineFeeds with uvhd


 #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

5G1. CNVaids: Vancouver Utility Aids

uvcpfix2 - modify 1 Fixed-length file


 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

equivalent 'uvcp' command


 #2a. uvcp "fili1=dat1/custmas1,rcs=r256,typ=RSF,filo1=tmp/custmas1,rcs=65,typ=LSTt\
      ,mvc=35(30)90"
      ==============================================================================
Note
  • using the 'uvcpfix2' script is much easier than using 'uvcp' directly
  • often simpler than this example which demos moving fields
  • often you simply want to change file types & record sizes

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_6 Training Guide for the Vancouver Utilities

Pre-Programmed Jobs - summary


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
  • create COBOL record layouts from source programs or copybooks
cleanup
  • source code maintenance utility job with options to:
    translate, sequence#, insert quotes, etc
cobfil51
  • create a report of files used in COBOL programs, showing:
    external-name,open-modes,org,access,copybookname,internal-name
uvcmp1
  • compare data files that have packed/binary fields & NO LineFeeds
  • shows mismatched record pairs in vertical hexadecimal
    with differences flagged with '*'s
scan1d
  • scan all files in a directory for 1,2,or 3 patterns & create a
    report with all matching lines, line#s,& filenames.
rep1d
  • copy all files in a directory to a 2nd directory,
    replacing any 1 pattern with an alternate, optionally
    qualified by must be present & must be absent patterns on same line

6C1. example using rep1d to modify uvlp scripts for for Xi-Text print spooler
(uses 'spr' vs 'lp)
rep2d
  • copy all files in a directory to a 2nd directory modifying via
    a table of search patterns, replacements,& optional qualifiers
    which have been pre-edited into a file

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
  • convert dates between calendar, julian,& days-since-1900
calendar1
  • create calendar from any start date to any end date
 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

Pre-Programmed Job Summary - continued

table2
  • general purpose job to read a file, building tables of counts & values
    to be accumulated by a specified argument field, and dumped to a report
    file at EOF (for viewing &/or printing).
  • see complete details at TABLEjobs.htm#C1
genverify1
  • generate jobs to verify All numeric fields in 1 or All files
  • see complete details at DATAcnv1.htm#8D1
genacum2
  • generate jobs to accumulate All numeric fields in 1 or All files
  • see complete details at DATAcnv1.htm#8G1
 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

6A1. uvtrain: Training Guide for the Vancouver Utilities

Pre-Programmed Jobs - for the uvcopy interpreter

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
  • see COBaids.htm#A1
  • create COBOL record layouts from source programs or copybooks
  • prints field lengths, types, start,& end byte values
  • this information is required by the various programs such as
    any sort utility, the uvcopy utility, etc.
  • especially useful during conversion to check the validity of
    the file transfers & data conversions.
  • I suggest generating cobmaps for the entire directory of copy-
    books & mounting in a 3 ring binder for easy availability.
cleanup
  • see COBaids.htm#B1 or CNVaids.htm#2D1
  • source code maintenance utility job with options to:
  • translate to UPPER case
  • translate to lower case (except within quotes)
  • sequence# in cols 1-6 (or clear, or store from 73-78)
  • gang program name in cols 73-80 (or clear)
  • convert single quotes to double quotes (or vice-versa)
  • translate copybook names to UPPER or lower case
  • enclose copybook names in single or double quotes
  • enclose call program names in sig-le or double quotes
  • insert TIP/ix FSE options control record (lower case, etc)
cobfil51
  • create a report of files used in COBOL programs, showing:
    external-name,open-modes,org,access,copybookname,internal-name
  • especially useful for conversion planning
  • may sort & select the output records, for example:
    select tape files only (require changes for conversion)

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6A2. uvtrain: Pre-Programmed Jobs - for the uvcopy interpreter

uvcmp1
  • see CMPjobs.htm#A1
  • compare data files that have packed/binary fields & NO LineFeeds
  • can not use 'diff' for fixed record length files without LineFeeds
  • handles variable length & Indexed files that may have inserts
  • up to 4 'exclude fields' provided for date/time stamps, etc
  • 1st used for Y2K, but now used to verify mainframe data conversions.
  • shows mismatched record pairs in vertical hexadecimal
    with differences flagged with '*'s
xtbl1
  • see AIDjobs.htm#C1
  • general purpose word table analysis, alternative to xrefA
  • You can specify any 'keyword',& the item to be tabled as a
    word offset from the keyword (+1,+2,+3,or -1,-2,etc)
  • ideal when you only need to know the frequency of the target-
    words & not the list of filenames containing the targets.
listISF
  • see LISTjobs.htm#D1
  • copy any ISAM file to a text file for easy display or print.
  • may specify reading by any key (default 1st key)
  • ISAM input file may have up to 9 keys & rcsz up to 4096
  • options to extract portions of the file & truncate the records
scan1d
  • see SCANjobs.htm#E1 or CNVaids.htm#2G1 (better example)
  • scan all files in a directory for any 1 pattern & create a
    report with all matching lines, line#s,& filenames.
  • a 2nd pattern (qualifier) may be coded which must be present.
  • a 3rd pattern (qualifier) may be coded which must NOT be present.
rep1d
  • copy all files in a directory to a 2nd directory,
    replacing any 1 pattern with an alternate, optionally:
    qualified by a must be present on same line pattern
    qualified by a must be absent on same line pattern
  • see complete details at REPjobs.htm#E0

3B4. example using rep1d to modify uvlp scripts for for Xi-Text print spooler
(uses 'spr' vs 'lp)
rep2d
  • see REPjobs.htm#G1
  • scan all files in a directory for matches to a table of
    search patterns, replacements,& optional qualifiers.
  • patterns & alternates will be pre-edited into a file whose
    name may be specified on the command line or (solicited).
  • the table also has optional 3rd & 4th columns for qualifying
    patterns which must be present or not present for a valid match.
  • all files will be copied to a new directory that may be
    spot checked before renaming as the original.

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

6A3. uvtrain: Pre-Programmed Jobs - for the uvcopy interpreter

datedemo1
  • see UVjobs1.htm#K1
  • convert dates between calendar, julian,& days-since-1900
  • solicits dates & input formats,& display all output formats.
  • allows add or sub to days-since-1900 & display all 3 outputs
calendar1
  • see UVjobs1.htm#L1
  • create calendar from any start date to any end date
    calendar, julian, days-since-1900, alpha-date
    19991201 1999335 036494 3 Wed Dec 01 1999
    -------------etc--------------
    19991231 1999365 036524 5 Fri Dec 31 1999
tabfix1
tabfix2
  • see UVjobs1.htm#E2
  • convert tabs to blanks depending on a tab value option
    (solicited from operator) & the current column position.
  • The tab value would be every 8 cols, or 4 cols, or whatever.
tabfix3
  • see UVjobs1.htm#E3
  • convert tabs to blanks depending on multiple fixed tab stops.
  • tab stops solicited from operator as options a,b,c,etc
  • defaults for COBOL source: a7b12c20d30e40f50g60h73
escape1
  • concatenate a Laser printer control file with a text data
    file & 'lp' the result file.
  • the control file contains '!' (pseudo escapes) that are
    converted to true escapes (x'1B') for printer commands.
escape2
  • converts the '!' pseudo escapes to true escapes within only
    1 file of combined escape sequences + data & 'lp's result.
  • for special forms, labels, etc
table2
  • see TABLEjobs.htm#C1
  • general purpose job to read a file, building tables of counts & values
    to be accumulated by a specified argument field, and dumped to a report
    file at EOF (for viewing &/or printing).
  • specify table arguments & acum fields by displacement & length
  • example1: summarize sales qty & amount by product#
  • example2: count records by state/province, slsmn, or any other field
delim2fix1
  • convert "delimited","files" to fixed length
  • convert Excel spread sheet inputs to fixed field format
    usually required by COBOL programs
genverify1
  • generate jobs to verify All numeric fields in 1 or All files
  • uvcopy jobs generated from COBOL copybooks
  • see complete details at DATAcnv1.htm#8D1
genacum2
  • generate jobs to accumulate All numeric fields in 1 or All files
  • uvcopy jobs generated from COBOL copybooks
  • see complete details at DATAcnv1.htm#8G1

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6A4. Pre-Programmed Jobs - for the uvcopy interpreter

Cross-References

 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
  • master script to create all abovereports in subdir xref/...
  • see scripts & examples at CNVaids.htm#Part_3

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6B1. Pre-Programmed Jobs - for the uvcopy interpreter

addup any field in any file by options for dsp(lth)

addup1
  • accumulate any field by entering options for displacement & length
  • addup1 for Text files terminated by Line-Feeds (max recsize 4096)
addup2
  • accumulate any field by entering options for dsplcmnt,length,& recsize
  • addup2 for Fixed-Length record files (max recsize 4096)
acum1
  • similar to addup1/addup2, but provides more options for:
  • field types (numeric unpacked, packed, binary)
  • cross-footing multiple consecutive same size/type fields
  • ASCII or EBCDIC
  • see details at CNVaids.htm#8I1
genacum2
  • generate jobs to accumulate ALL numeric fields in a file
  • automatically generated from the COBOL copybook
  • see complete details at DATAcnv1.htm#8G1

addup1 demo


 #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
  • Read sales2 file, accumulate $amount cols 54-62
  • at EOF, display total (also writes total line to tmp/sales2.tot)

 #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

6B2. addup any field in any file by options for dsp(lth)

addup1 demo - enter options when prompted


 #4b. uvcopy addup1,fili1=dat1/sales2  <-- better to enter at least filename
      ===============================    - will prompt for options (see below)
uop=b00c0e0
  • default options
     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)

addup2 demo as follows:


 uvcopy addup2,fili1=dat1/sales1,uop=b53c9e2r64
 ==============================================
 - addup2 for Fixed-Length records
 - dat1/sales1 64 byte records w/o LineFeeds

addup1 sample pre-programmed job code listing

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

6B3. addup any field in any file by options for dsp(lth)

addup1 sample pre-programmed job code listing

 # 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

6C1. Pre-Programmed Jobs - for the uvcopy interpreter

example - mass change all uvlp scripts for A4 paper

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.

uvlp12 modified for A4 paper

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

uvlp12 modified for Xi-Text print spooler

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

6C2. Pre-Programmed mass change jobs

rep2d mass change uvlp... scripts for A4 paper

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.

create search/replace table


 #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

6C3. Pre-Programmed mass change jobs

audit report from 'rep2d'

 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

notes

  1. rep2d writes the audit report of 'changed lines only' to the tmp/... subdir

  2. The audit report is named as: subdir + '_' + search-pattern 'tmp/util_uvlp_A4' for this example

  3. rep2d allows multiple search/replace/qualifier entries in a table that is created with the editor prior to executing rep2d.

  4. If you only have one set of search/replace/qualifier patterns, you can use 'rep1d' which will prompt for the patterns.

  5. Most of the uvlp scripts were coded with 'a2' (letter size) which we need to change to 'a26' (A4 size), but some uvlp scripts were coded with a paper tray ('t1' or 't4'), hence the 2nd & 3rd table entries shown above.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6D1. Pre-Programmed mass change jobs

rep1d mass change uvlp... scripts for Xi-Text spooler

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
  • we will not show the audit report here, since similar to the audit
    report already shown for A4 paper change above.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_7 Training Guide for the Vancouver Utilities

Part6 - uvqrpg (Quick Report Program Generator)


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

7A1. uvqrpg - report writer for the Vancouver Utilities

uvqrpg OVERVIEW

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.

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

  2. Similar to uvcopy, but includes additional functions for report writing.

  3. Built-in sort, to sort input file prior to the control level report phase.

  4. Record Selection (keep or drop) during sort input. - up to 8 'OR' selections (keep1-keep8, or drop1-drop8) - up to 5 'AND' conditions for each 'OR' selection (keep1c1-keep1c5, keep2c1-keep2c5, etc -> keep8c1-keep8c5)

  5. Up to 8 control fields & corresponding total levels.

  6. Up to 100 accumulators per total level. $t100-$t199, $t200-$t299, etc thru $t800-$t899

  7. Up to 8 page headings.

  8. Record fields are declared using functions 'ctl', 'ref', or 'acum'. ctl/ref/acum fields are defined by displacement & length, and field-names are assigned, which area matched in 'head1' to determine print position.

  9. Page heading #1 (head1) specifies field positions simply by coding the field-names within the print line where ever you want them to print. The fieldnames must match those assigned on the ctl/ref/acum statements. The data will be aligned to the left character of the name if unedited but to the right character of the field is edited.

  10. Most reports can be created by function declarations only (fili1,filo1, head,ctl,ref,acum) without needing to use uvcopy instructions. But at any point required, you can use the powerful uvcopy instruction set for customizations or complex data manipulation.

  11. uvqrpg includes 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 (limited only by available memory).

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

7B1. uvqrpg - report writer for the Vancouver Utilities

qrpgEX1 - sales analysis by customer within salesman

/home/uvadm/dat1/sales4 record layout

 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

/home/uvadm/dat1/sales4 - test/demo data

 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

sample report created by qrpgEX1

 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

7B2. uvqrpg - Preliminary Example#1 (qrpgEX1)

qrpgEX1 - coding required to create sample report

 # 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

7C1. uvqrpg - report writer for the Vancouver Utilities

qrpgEX82 - accumulate amount by customer & salesman


 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

/home/uvadm/dat1/sales4 - test/demo data

 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

report sample for qrpgEX82

 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
  • see the uvqrpg solution on the next page --->
  • BUT, write your solution, BEFORE YOU LOOK

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7C2. uvtrain: uvqrpg - qrpgEX82 continued

 # 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

7D1. uvqrpg - report writer for the Vancouver Utilities

qrpgEX83 - accumulate amount by product#


 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
  • use the preceding example (qrpgEX82) as a guide in creating
    your solution. This example is similar except it is sorted
    & totalled by product# rather than customer#.

report sample for qrpgEX83

 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
  • the solution can be seen at /home/uvadm/pf/demo/qrpgEX83
  • BUT, write your solution, BEFORE YOU LOOK

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7E1. uvqrpg - report writer for the Vancouver Utilities

qrpgEX84 = qrpgEX83 + table summary by product#


 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
  • the summary table requires only 1 instruction to build & 1 to print
    see qrpgEX3 in uvqrpg.doc to see samples of these instructions.

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

7E2. uvqrpg - qrpgEX84 continued

report sample for qrpgEX84

 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
  • the solution can be seen at /home/uvadm/pf/demo/qrpgEX84
  • BUT, write your solution, BEFORE YOU LOOK

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_8 Training Guide for the Vancouver Utilities

Part7 - Korn shell scripts supplied with Vancouver Utilities

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
  • an active link indicates scripts listed here
  • see scripts1.htm for other scripts

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
  • copy Text files changing file-type, record-size,& reformat
uvcpfix2
  • copy Fixed-Length records changing type, size,& reformat

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
  • create an empty ISAM file with specified
    filename, rcsz,& keys
allcancel
  • cancel all print requests for the current user
  • very useful when you have printer problems
  • no parameters required

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8A1. Korn shell scripts supplied with Vancouver Utilities

rename all files in directory

Here are a few of the 28 'rename' scripts provided. See all renmae scripts in part 1 of scripts1.htm#Part_1.

Note
  • an active link indicates scripts listed here
  • see scripts1.htm for other scripts

8B1. renameL - translate filenames to lower case

8B2. rename-A - remove pattern occurring anywhere in filename
renameAA
  • replace pattern with alternate anywhere
renameB
  • change any embedded blanks to underscores
renameDU
  • change any '$' dollar signs to '_' underscores
renameG
  • change GDG suffixes G0001V00 to _000001, etc
  • from mainframe format to VU JCL converter format
renameP
  • replace existing prefix with alternate
rename-P
  • remove a specified prefix
rename+P
  • add a specified prefix
renameParens
  • rename using name from within embedded (parens)
renameQQ
  • remove Quotes on filenames (FTP'd from mainframe)
renameU
  • translate filenames to UPPER case
renameX
  • change specified extension to a specified alternate
rename-X
  • remove a specified extension
rename+X
  • add a specified extension

'rename' scripts - Why you need them

  1. These scripts rename all files in a specified directory, meeting a specified condition (optionally).

  2. These scripts save a lot of manual keyboard entries when hundreds of files must be renamed - boring, error-prone work.

  3. Renaming hundreds of files is often required during mainframe conversions.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8A2. Vancouver Utility scripts for Conversion & General use

example - ReNaming All files in a directory

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

8A3. Renaming All files in a directory

Re-naming mainframe GDG files to VU standards

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

8B1. Korn shell scripts supplied with Vancouver Utilities

renameL - rename all files to Lower case

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

8B2. Korn shell scripts supplied with Vancouver Utilities

rename-A - remove pattern occurring anywhere in filename

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

8C1. Korn shell scripts supplied with Vancouver Utilities

aliases - save keystrokes for often repeated commands

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

notes

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

8D1. Korn shell scripts supplied with Vancouver Utilities

alldiff2 - compare all text files in 2 directories

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

8D1. Korn shell scripts supplied with Vancouver Utilities

dtree - draw directory tree

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

8D2.

dtree script to illustrate directories

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

Visitor Counters for ThisYear and LastYear