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

Part_5 - Pre-programmed jobs (based on uvcopy)
- cobmap1,cleanup,cobfil51,uvcmp1,listISF,scan1d,rep1d,rep2d,datdemo1,
  calendar1,tabfix1/2/3,escape1/2,table2,genacum2,genverify1
- cross-references (COBOL copybooks, JCL/scripts using each program, etc)

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

Part_8 - Review Questions for students on utilities & mainframe conversions

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 http://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. Vancouver Utilities - Overview

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 http://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 http://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 http://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, etc (similar to uvsort). See uvcp documentation at http://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 http://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, etc. None of the usual Unix/Linux system utilities can do this.

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

Many 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 http://www.uvsoftware.ca/uvcopy5.htm#A01.

Note the uvcopy documentation is split into 7 books (uvcopy1 - uvcopy7). begining at http://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 http://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

8. Korn shell Scripts

The Vancouver Utilities includes over 500 Korn shell scripts. Some were written to make the mainframe conversion utilities easier to use (reduce keystrokes). Others have proven useful at many sites for various utility type functions. For example the 'rename' scripts save a lot of keystrokes when renaming files (Upper to lower, dropping suffixes, adding suffixes, etc). See renameL, rename-X, & many others in scripts.htm.

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

10. 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 http://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

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

0C2. Vancouver Utilities Training Overview

11. 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 http://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 http://www.uvsoftware.ca/cmpjobs.htm#1D2.

 uvcmp1 - compare 2 files, print mismatched records, '*' flag diffs
 2008/05/24_16:35:30 uop=q1p30r256s8t500000v2x0y0z1r64
 recsize  reccount   file-size  typ Report=rpts/warmas1.cmp
 1:   64         8           0  RSF  File1=dat1/warmas1
 2:   64         8           0  RSF  File2=dat1/warmas1a
                       1         2         3         4         5         6
 f#rec#byte# 0123456789012345678901234567890123456789012345678901234567890123
 ============================================================================
 1    1    0 33333 11111 refrigerator      961231 3-year 991231 000006733   .
             3333323333327667666767672222223333332327667233333323333333332220
             3333301111102562975214F200000096123103D951209912310000006733000A
                                               ** *      **  **      ****
 2    1      33333 11111 refrigerator      961215 4-year 001215 000005500   .
             3333323333327667666767672222223333332327667233333323333333332220
             3333301111102562975214F200000096121504D951200012150000005500000A
                                               ** *      **  **      ****

CMPjobs provide for various file types (fixed, variable, sequential, indexed, ASCII, EBCDIC) and there are options for up to 4 exclude fields (date/time,etc).

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

0C3. Vancouver Utilities Training Overview

12. 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: http://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 http://www.uvsoftware.ca/tablejobs.htm#G2

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.

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.

13. 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 http://www.uvsoftware.ca/datacnv1.htm#8F1


 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

14. uvhdc1 - 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. 'uvhdc1' 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 'uvhdc1' 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 http://www.uvsoftware.ca/uvhdcob.htm#H1. Here is the sample command & display shown at uvhdcob.htm#H3.


 uvhdc1 ar/customer.master    <-- uvhdc1 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

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

http://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 (see pages 9A1 & 9A2).

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

16. 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 http://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

17. 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: http://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

18. ADMjobs

http://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

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. Preparation for Training exercises
1A4. List of test/demo files copied to user homedirs

1B0. Unix/Linux tips for new users
1B1. Work in your working directory & address files thru subdirs
1B3. Setup a 'tmp/' subdir in your working directory (keep it clean)
1B4. script 'cleandir1' to move any files in working directory to a subdir
1B5. 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, registers, .vimrc, write
1C5. - write, quit, 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 'm' to 'mark' blocks of text for move,copy,delete,write,etc
- given demo file uvtrainEX6 (52 lines, 7 Parts)
1E2. - 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 section DATAcnv1.doc.

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

uv sub-directories used for UV training

uvadm/bin/...
  • contains Vancouver Utility programs (compiled from uvadm/src).
    (uvhd, uvlist, uvcp, uvsort, uvcopy)
  • this directory must be in your PATH (defined in your .profile)
uvadm/cobol/cpys
  • COBOL copybooks describing record layouts for data files
    (custmas1.cpy, salesdtl.cpy, etc)
uvadm/dat1/...
  • test data files for UV training exercises
    (custmas1, custmas2, custmas3, sales1, sales2, sales3, etc)
  • demo file for vi mark exercise (uvtrainEX6)
uvadm/cobol/maps
  • 'cobmap's created from COBOL copybooks
    (custmas1.map, salesdtl.map, etc)
  • shows field start/end/length/type on right side
uvadm/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)
uvadm/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
uvadm/sf/demo/..
  • script files for 'vi' editor tutorial at '1D0'
    (hello1,hello2,hello3,hello4,hello5)

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 Vancouver Utilties installed in /home/uvadm - modify as required.


 #1. export PATH=$PATH:/home/userxx/sf:/home/uvadm/bin:/home/uvadm/sf/adm\
               :/home/uvadm/sf/demo:/home/uvadm/sf/IBM:/home/uvadm/sf/util
     =====================================================================
     - search for scripts & programs, 1st in user subdir, 2nd in VU subdirs

 #2. export PFPATH=/home/userxx/pf:/home/uvadm/pf/adm:/home/uvadm/pf/demo\
                                  :/home/uvadm/pf/IBM:/home/uvadm/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

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

 #1a. cd          (OR change to your home directory if already logged in)
      ===

 #2a.  mkdir dat1       <-- make subdir for demo data files
       ==========         - to be selected from /home/uvadm/dat1/...

 #2b.  mkdir cpys       <-- make subdir for demo copybooks
       ==========         - to be selected from /home/uvadm/cobol/cpys/...

 #2c.  mkdir maps       <-- make subdir for record-layout MAPS
       ==========         - to be generated from copybooks

 #2d.  mkdir sf         <-- make subdir for scripts
       ========           - to be selected from /home/uvadm/sf/demo/...
                            and modified/written by you

 #2e. mkdir tmp         <-- make tmp subdir in your home directory
      =========             to receive output of various exercises
                          - to avoid cluttering up your homedir
                            (homedir should have subdirs ONLY, NO files)

 #3a. cp $UV/dat1/custmas* dat1  <-- copy test files to your homedir
      =========================

 #3b. cp $UV/dat1/sales* dat1    <-- copy sales files to your homedir
      =======================

 #3c. cp $UV/dat1/uvtrainEX6 dat1 <-- demo file for vi mark command
      ===========================

 #3d. cp $UV/cobol/cpys/* cpys   <-- copy COBOL copybook maps to your homedir
      ========================

 #3e. cp $UV/cobol/maps/* maps   <-- copy COBOL copybook maps to your homedir
      ========================

 #3f. cp $UV/sf/demo/hello* sf   <-- copy hello1,2,3,4,5 scripts to your homedir
      ========================       for vi editor tutorial

'UV' is an environmental variable setup in the profile as follows:


 export UV=/home/uvadm            <-- install guide suggestion
 =====================

 export UV=/u/uvsi/uvadm2         <-- alternate location of Vancouver Utilities
 ========================

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

1A4. uvtrain: Preparation for UV training exercises

training subdirs/files in your homedir

 /home/useridxx
 :-----dat1                 <-- test/demo data files
 :     :----- custmas0
 :     :----- custmas1
 :     :----- custmas2
 :     :----- custmast.dat
 :     :----- custmast.idx
 :     :----- sales0
 :     :----- sales1
 :     :----- sales2
 :-----cpys                 <-- COBOL copybooks
 :     :-----acntmas.cpy
 :     :-----citytax1.cpy
 :     :-----custmas1.cpy
 :     :-----saledtl.cpy
 :     :-----sales3.cpy
 :     :-----warmas3.cpy
 :-----maps                  <-- record layouts (maps) from copybooks
 :     :----- acntmas.map
 :     :----- citytax1.map
 :     :----- custmas1.map
 :     :----- saledtl.map
 :     :----- sales3.map
 :     :----- warmas3.map
 :-----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 source from mainframe
 :     :-----cbls         - COBOL converted for Micro Focus
 :     :-----cblx         - compile output (.int .idy .cbl .err)
 :     :-----cpys         - COBOL copybooks
 :     :-----jcl0         - JCL from mainframe
 :     :-----jcls         - JCL converted to Unix/Linux scripts
 :     :-----tmp          - temp files (keep working dir clean)

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

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'

    cnvMF41 cbl0/CAR100.cbl  <-- convert program from cbl0->cbl1->cbl2->cbls
    =======================    - script assumes cbl1,cbl2,cbls are below you

    jcl2ksh41 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

1B2. Tips for new users to Unix/Linux

example - editing & compiling programs

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

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

1B4. 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 cleanup090812    <-- make subdir to receive files
     ===================

 #3. mv cleanup090812/... 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 cleanup090812 <-- 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

1B5. 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 & table 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/tables. '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
                                 |
                           h <-- . --> l
                                 |
                                 j
 'h'  - move cursor left
 'j'  - move cursor down
 'k'  - move cursor up
 'l'  - move cursor right
 ^d   - down 1/2 screen
 ^u   -  up  1/2 screen
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 command

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

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.

 "a5yy   - yank 5 lines into register "a
 "ap     - put contents of register "a (following current line)
 "A2yy   - Append 2 more lines to contents of register "a
           (Upper case register Appends, lower case replaces)

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

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

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

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

vim Reference


 http://linuxgazette.net/152/srinivasan.html
 =============================================

This is an excellent tutorial on 'vim', which is an enhanced version of 'vi', used on most Linux systems.

Goto:   Begin this 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 '1A3' we setup subdirs & populated with desired test/demo files.


 #1. login --> your homedir

 #2. ls -l    <-- list files 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. cp /home/uvadm/sf/demo/hello* sf
     ================================
     - copy vi tutorial scripts to 'sf' subdir in your homedir
     - already documented on page '1A3' (with subdir setup in your homedir)

 #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. --> hello4            <-- execute script (assuming $HOME/sf in PATH)
 #
 echo "======================================================="
 echo "Hello Owen - here is a random insult for your amusement"
 amuse -f "Owen is a: "
 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/hello5          <-- start 'vi' to edit this file (sf/hello5)
 # 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. --> hello5            <-- execute script (assuming $HOME/sf in PATH)
 #
 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 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 on the next page. The demo file is 52 lines long, but here is a short version for illustration. This exercise will instruct you to:

  1. Delete even-numbered parts.

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

    demo file 'uvtrainEX6'

      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 - Pre-programmed jobs (based on uvcopy)
             - cobmap1, cleanup, cobfil51, uvcmp1, xtbl1, listISF, scan1d, rep2d,
      Part_6 - uvqrpg (Quick Report Program Generator)
             - makes it easy to create control level reports (up to 8 levels)
      Part_7 - 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

1E2. uvtrain: 'vi' editor tutorial

vi ex#6 - 'mark' Exercise Instructions


 #1. Login --> you homedir

 #2. mkdir dat1                      <-- make subdir for demo file
     ==========                          (if not already made)

 #2. cp $UV/dat1/uvtrainEX6 dat1/    <-- copy demo file to subdir dat1/
     ============================        (if not already copied previously)

 #3. vi dat1/uvtrainEX6              <-- begin editing dat1/uvtrainEX6
     ==================

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

 #8. cat dat1/uvtrainEX6       <-- display results
     ===================

 #9. uvlp12 dat1/uvtrainEX6    <-- 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
- 128 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
- variable length records, max 128, linefeed terminated
- converted from custmas2 by truncating trailing blanks
- 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.

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 r256a  - execute uvhd to display dat1/custmas1
 ========================  - option 'a' to translate character line to ASCII
                      10        20        30        40        50        60
 r#        1 0123456789012345678901234567890123456789012345678901234567890123
           0 130140    EVERGREEN MOTORS LTD.    1815 BOWEN ROAD          NANA
             FFFFFF4444CECDCDCCD4DDEDDE4DEC44444FFFF4CDECD4DDCC4444444444DCDC
             130140000055597955504636920334B000018150266550961400000000005151
          64 IMO          BC V9S1H1    604-754-5531                  ........
             CDD4444444444CC4EFEFCF4444FFF6FFF6FFFF44444444444444444400000000
             946000000000023059218100006040754055310000000000000000000000C000
         128 .........W.....-.........X@..f.....m*.......................f...
             0000000005300016000000002570063100095000000000000000000000016000
             0C0000C0270C0540C0000C0098C0263C0444C0000C0000C0000C0000C0056C00
         192 .E@...V'........c..............f..............f.C
             047000570000000088000000001800068000130000000069C444444444444444
             35C0046D0000C0023C0000C0083C0056D0012C0000C0016D3000000000000000
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 r256  - execute uvhd to display dat1/custmas1
 =======================
                   1         2         3         4         5         6
         0123456789012345678901234567890123456789012345678901234567890123
       0 130140    EVERGREEN MOTORS LTD.    1815 BOWEN ROAD          NANA
         3333332222454545444244545524542222233332445442544422222222224444
         130140000056527255E0DF4F230C44E0000181502F75E02F140000000000E1E1
      64 IMO          BC V9S1H1    604-754-5531                  ........
         4442222222222442535343222233323332333322222222222222222200000000
         9DF00000000002306931810000604D754D55310000000000000000000000C000
     128 .........W0....`........)X|..f3.....\.......................f...
         0000000005300016000000002570063100095000000000000000000000016000
         0C0000C0270C0540C0000C0098C0263C0444C0000C0000C0000C0000C0056C00
     192 ...............................f.....<........f.C
         0000008900000000880000000018000680001300000000694222222222222222
         00C0026C0000C0023C0000C0083C0056D0012C0000C0016D3000000000000000

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 128 byte records, LineFeed terminated in col 128, 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-120 - contact name
          121-127 - blanks
          128-128 - line-feed

dat1/custmas2 - file contents - 1st 80 bytes of 32 records

 130140    EVERGREEN MOTORS LTD.    1815 BOWEN ROAD          NANAIMO          BC
 132588    GEECOE GENERATOR SERVICESUNIT 170 - 2851 SIMPSON  RICHMOND         BC
 139923    JOHNSTONE BOILER & TANKS 1250 EAST PENDER STREET  VANCOUVER        BC
 142175    LILLY ELECTRIC (1973) LTD16809 - 24TH AVENUE      SURREY           BC
 145264  D MAGRATH SUPPLIES LTD.    1939 KIRSCHNER ROAD      KELOWNA          BC
 147615  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.        PORT COQUITLAM   BC
 154688    TAURUS RESOURCES         1110 - 625 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                 DRAYTON VALLEY   AL
 204700    CASE POWER EQUIPMENT     12611-100 ST             GRANDE PRAIRIE   AL
 208060    E&L TRUCKING             LAND & CATTLE LTD        WARBURG          AB
 211140  D FORD NEW HOLLAND         BOX 1, 440 ELLIS ROAD    WINTERBURN       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                   NISKU            AL
 234300    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           FORT ST. JOHN    BC

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 128, 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
          081-090 - postal code
          091-102 - phone#
          103-120 - contact name
          ???-??? - line-feed after last non-blank

 vi dat1/custmas3    <-- display with 'vi'
 ================

Here are 1st 3 records as seen with 'vi', 2 lines per record, since records are > 80 characters.

 130140    EVERGREEN MOTORS LTD.    1815 BOWEN ROAD          NANAIMO       BC
 V9S1H1    604-754-5531
 132588    GEECOE GENERATOR SERVICESUNIT 170 - 2851 SIMPSON  RICHMOND      BC
 V6X2R2    604-278-4488
 139923    JOHNSTONE BOILER & TANKS 1250 EAST PENDER STREET  VANCOUVER     BC
 V5L1W1    604-320-1845GEORGE BROWN

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

2C4. Test/Demo files for Vancouver Utilites Training

dat1/custmas3 - customer master name & address only


 uvhd dat1/custmas3 r256  <-- display with 'uvhd'
 =======================    - option 'r' specifies Record-size 256 bytes

 uvhd dat1/custmas3       <-- NO 'r' option will default to 256 bytes
 ==================

uvhd will display 1st 256 bytes, if no record-size option is specified since the default is 256. You can see the 1st 2 records & part of the 3rd.

These are variable length text records terminated by LineFeeds. The LineFeeds are shown as '.' on the character line & as x'0A' on the vertical hex lines. I have inserted the '^' on the line below to point them out for you.

                   1         2         3         4         5         6
         0123456789012345678901234567890123456789012345678901234567890123
       0 130140    EVERGREEN MOTORS LTD.    1815 BOWEN ROAD          NANA
         3333332222454545444244545524542222233332445442544422222222224444
         130140000056527255E0DF4F230C44E0000181502F75E02F140000000000E1E1
      64 IMO          BC V9S1H1    604-754-5531.132588    GEECOE GENERATO
         4442222222222442535343222233323332333303333332222444444244445454
         9DF00000000002306931810000604D754D5531A13258800007553F5075E5214F
                                               ^
     128 R SERVICESUNIT 170 - 2851 SIMPSON  RICHMOND         BC V6X2R2
         5254554445544523332223333254455442254444444222222222442535353222
         20352693535E9401700D02851039D03FE002938DFE4000000000230668222000
     192  604-278-4488.139923    JOHNSTONE BOILER & TANKS 1250 EAST PENDE
         2333233323333033333322224444554442444445222544452333324455254444
         0604D278D4488A1399230000AF8E34FE502F9C5206041EB30125005134005E45
                      ^

 uvhd dat1/custmas3 t   <-- redisplay with 't' option to respect LineFeeds
 ====================     - will show only 1 record at a time
                   1         2         3         4         5         6
         0123456789012345678901234567890123456789012345678901234567890123
       0 130140    EVERGREEN MOTORS LTD.    1815 BOWEN ROAD          NANA
         3333332222454545444244545524542222233332445442544422222222224444
         130140000056527255E0DF4F230C44E0000181502F75E02F140000000000E1E1
      64 IMO          BC V9S1H1    604-754-5531.
         444222222222244253534322223332333233330
         9DF00000000002306931810000604D754D5531A

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 - customer sales EBCDIC

Fixed length 64 byte records from mainframe, still EBCDIC, not yet translated to ASCII. The sales detail records have no packed or binary fields (unlike the customer master file which had 24 x 5 byte packed fields).

Signs in zone of units digits, +0 to +9 shows as: '{ABCDEFGHI', and -0 to -9 shows as: '}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
                      10        20        30        40        50        60
 r#        1 0123456789012345678901234567890123456789012345678901234567890123
           0 130140    21 940802 IN111001  HAM001  00002{ 0000001 00000002{
             FFFFFF4444FF4FFFFFF4CDFFFFFF44CCDFFF44FFFFFC4FFFFFFF4FFFFFFFFC44
             1301400000210940802095111001008140010000002000000001000000002000
                      10        20        30        40        50        60
 r#        2 0123456789012345678901234567890123456789012345678901234567890123
          64 130140    21 940802 IN111001  SCR012  00002A 0001001 00002102A
             FFFFFF4444FF4FFFFFF4CDFFFFFF44ECDFFF44FFFFFC4FFFFFFF4FFFFFFFFC44
             1301400000210940802095111001002390120000002100001001000002102100
                      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 ASCII

Fixed length 64 byte records, now translated to ASCII, but Signs in zone of units digits, need correction after EBCDIC to ASCII translation.

Note
  • positive -0 to +9 are: '{ABCDEFGHI'
  • negative -0 to -9 are: '}JKLMNOPQR'.

For Micro Focus COBOL, unpacked positive signs are not used (just 0-9). Negative unpacked zoned digits have a x'40' bit, show as letters 'p-y'. We can correct the signs using the 'tras' instruction in 'uvcp' (next page).

          1         2         3         4         5         6
 1234567890123456789012345678901234567890123456789012345678901234
 CUST#    SLM  DATE   INV#     PROD#     QTY   PRICE    AMOUNT
 130140    21 940802 IN111001  HAM001  00002{ 0000001 00000002{
 130140    21 940802 IN111001  SCR012  00002A 0001001 00002102A
 139923    35 950802 IN111002  HAM001  00002B 0002001 00004402B
 139923    35 950802 IN111002  TAB013  00002C 0003001 00006902C
 139923    35 950807 CR5421    TAB013  00002D 0004001 00009602D
 150825    44 960804 IN1122    HAM001  00002E 0005001 00012502E
 150825    44 960804 IN1122    PLN012  00002F 0006001 00015602F
 201120    44 970807 CR5234    WHIP75  00002G 0007001 00018902G
 223240    65 980816 CR955     HAM001  00002H 0008001 00022402H
 223240    65 980816 IN441     BIT001  00002I 0009001 00026102I
 308685    75 990812 IN6605    SAW001  00001} 0000001 00000001}
 308685    75 990812 IN6605    WID115  00001J 0001001 00001101J
 308685    75 990812 CR8835    TAB013  00001K 0002001 00002401K
 315512    33 000805 IN2251    HAM001  00001L 0003001 00003901L
 315512    33 000805 IN2251    SAW051  00001M 0004001 00005601M
 315512    33 000805 IN2255    WID115  00001N 0005001 00007501N
 400002    85 010812 CR245     HAX129  00001O 0006001 00009601O
 406082    55 020815 IN33001   BBQ001  00001P 0007001 00011901P
 406082    55 020815 IN33001   TAB013  00001Q 0008001 00014401Q
 406082    65 020816 IN441     HAM001  00001R 0009001 00017101R

 vi dat1/sales1   <-- try this (BUT, it will NOT work)
 ==============

 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

 uvcp "fili1=dat1/sales0,rcs=64,typ=RSF,filo1=tmp/sales1,typ=RST,tra=0(64)"
 ==============================================================================
 - convert EBCDIC (sales0) to ASCII (sales1),& insert LineFeeds.

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 - zoned signs corrected

Fixed length 64 byte records. LineFeeds inserted in last byte for easy UNIX inspection & printing. Signs corrected for Microfocus: pos+ 0123456789, neg- pqrstuvwxy (Microfocus negative zones are x'70', so 0-9 becomes alpha 'p'-'y')

dat1/sales2 - record layout

        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 940802 IN111001  HAM001  000020 0000001 000000020
 130140    21 940802 IN111001  SCR012  000021 0001001 000021021
 139923    35 950802 IN111002  HAM001  000022 0002001 000044022
 139923    35 950802 IN111002  TAB013  000023 0003001 000069023
 139923    35 950807 CR5421    TAB013  000024 0004001 000096024
 150825    44 960804 IN1122    HAM001  000025 0005001 000125025
 150825    44 960804 IN1122    PLN012  000026 0006001 000156026
 201120    44 970807 CR5234    WHIP75  000027 0007001 000189027
 223240    65 980816 CR955     HAM001  000028 0008001 000224028
 223240    65 980816 IN441     BIT001  000029 0009001 000261029
 308685    75 990812 IN6605    SAW001  00001p 0000001 00000001p
 308685    75 990812 IN6605    WID115  00001q 0001001 00001101q
 308685    75 990812 CR8835    TAB013  00001r 0002001 00002401r
 315512    33 000805 IN2251    HAM001  00001s 0003001 00003901s
 315512    33 000805 IN2251    SAW051  00001t 0004001 00005601t
 315512    33 000805 IN2255    WID115  00001u 0005001 00007501u
 400002    85 010812 CR245     HAX129  00001v 0006001 00009601v
 406082    55 020815 IN33001   BBQ001  00001w 0007001 00011901w
 406082    55 020815 IN33001   TAB013  00001x 0008001 00014401x
 406082    65 020816 IN441     HAM001  00001y 0009001 00017101y

We can correct the sign conventions for Micro Focus COBOL with uvcp:


 uvcp "fili1=dat1/sales1,rcs=64,typ=RSF,filo1=tmp/sales2,typ=RST,tras=38(24)"
 ============================================================================

We could convert EBCDIC to ascii, correct signs,& insert LFs with 1 uvcp.


 uvcp "fili1=dat1/sales0,rcs=64,typ=RSF,filo1=tmp/sales2,typ=RST,tras=38(24)"
 ============================================================================
 - input sales0 (EBCDIC),
 - but output sales2 in tmp/... dir in case we make a mistake

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 - with +/- 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-

We can convert signs from zoned to separate with uvcp:

 uvcp "fili1=dat1/sales1,rcs=64,typ=RST,filo1=tmp/sales2\
 ,mvn=38(6+)38(6z),mvn=45(7+)45(7z),mvn=53(9+)53(9z)"
 ========================================================
Note
  • mvn 1st operand '38(6+)' is output, 2nd operand '38(6z)' is input
  • no need to specify the 'z' for zoned sign input (it is the default)

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.

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. uvlp12 - modified for Xi-Text print spooler (uses 'spr' vs 'lp)

3C6. UVLPDEST - environmental variable in profile defines printer for uvlp...
- modify to a laser printer near you

3C7. using 'rep1d' to mass change all uvlp... scripts for Xi-Text
- changes 'lp' to 'spr' in 69 scripts of 300 total in sf/util/...

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 http://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. u9999 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 -->

 --> w99999r80t2 77(2),'YK'   <-- command to write records with 'YK' in 77-78
     ======================     - 'w99999' ensures all records in file tested
                                - 'r80' option to write 80 byte Records
                                - 't2'  Terminate with LineFeeds (text file)

 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

3B1. uvtrain: Training Guide for the Vancouver Utilities

uvhdcob - display data files with COBOL field names


 uvhdcob dat1/custmas1 maps/custmas1    <-- sample command line
 ===================================
 - arg1 is the data filename & arg2 is the record layout (created from copybook)
 - 1st run 'uvcopyx cobmap1' to convert all copybooks to record layouts (cobmaps)

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. --> v    <-- 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
      v --> 10 recs verified, 4 ERRs found in rec# 10, 1st at byte# 0
      2 packed & 1 numeric bad signs/digits, 1 unprintables in char fields

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


 doc/uvlist.doc size=21344 mod=950227 now=950228:1340 ln#  78 pg#  3
 ==========================================================================

The uvlist page heading is shown above. Please note that it contains the following vital pieces of information:

      1. filename                   - doc/uvlist.doc (or whatever)
      2. file size                  - size=999999
      3. last modification date     - mod=yymmdd
      4. today's date when printed  - now=yymmdd:HHMM
      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)
uvlp12D
  • print DUPLEX at 12 cpi (90 chars across & 60 lines down)
      'D' <---- UPPER case 'V' indicates DUPLEX printing
      'L' <---- UPPER case 'L' indicates LANDSCAPE
uvlp13LD
  • Landscape Duplex, 13 cpi, 8 lpi
uvlp14L
  • print LANDSCAPE at 14 cpi (150 chars on 11" wide)
uvlp14v6
  • print Portrait at 14 cpi & 8 lpi
  • 'v6' option means 6/48" which is 8 lpi
  • 14 cpi is 108 chars across & 8 lpi is 80 lines down
uvlp16
  • print at 16 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)
uvlp20L
  • print LANDSCAPE at 20 cpi (200 chars on 11" wide)
uvlp18D
  • print DUPLEX at 18 cpi & 6 lpi (134 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 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 a2c12$3 | lp $UVLPDEST $UVLPOPTN
 #===============================================
 #
 #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

modify uvlp... scripts for Xi-Text print spooler

Many sites use a print spooler such as Xi-Text, Easy-Spooler, etc. Here is the uvlp12 script (from above) modified for Xi-Text, and with most of the #comments removed (to save space here).

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
 #
 #usage: uvlp12 filename [group1] [group2]  <-- may override default options
 #       =================================
 #
 # .profile should specify environmental variables for example:
 # export UVLPDEST="-PMISCOPIER"
 # export UVLPOPTN="-fdefault -s"
 #
 uvlist $1 p60$2 a2c12$3 | spr $UVLPDEST $UVLPOPTN
 #================================================
 exit 0

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

3C6. uvtrain: Shell Scripts provided for uvlist

set UVLPDEST to a printer near you


 #1. vi .profile    <-- edit your .profile
     ===========

 #1a. --> G         <-- goto last line
 #1b. --> o         <-- 'o' open a new line below cursor

 #1c. --> export UVLPDEST="-PMIS5100"   <-- enter new definition
          ===========================      - for Xi-text print 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).

For example, you might want to reset UVLPDEST to MISCOPIER if you have many pages to print (because MISCOPIER is faster than MIS5100). We will use uvlp12D (Duplex version) vs uvlp12 (Simplex).


 #1. export UVLPDEST="-PMISCOPIER"  <-- reset dest to high speed printer
     =============================

 #2. uvlp12D cbls/xxxxxx.cbl        <-- print big program Duplex
     =======================

 #3. export UVLPDEST="-PMIS5100"    <-- reset to .profile def
     ===========================        (or logoff/logon)
Note
  • the Xi-Text print spooler destination option is '-P'
  • vs the normal unix/linux 'lp' print spooler which is '-d'

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

3C7. uvtrain: Shell Scripts provided for uvlist

mass change all uvlp... scripts

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 70 'uvlp' scripts. There are over 300 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'.


 #1. cd $UV/sf         <-- change above the $UV/sf/util/... subdir
     =========

 #2. mv util util.old  <-- change name of existing util (with 300 scripts)
     ================

 #3. mkdir util        <-- make new 'util' subdir
     ==========

 #4. uvcopy rep1d,fild1=util.old,fild2=util  <-- execute 'rep1d' mass change job
     ======================================

 #4a. pattern ------> _lp_   <-- enter search pattern ('_'s are blanks)

 #4b. replacement --> _spr_  <-- enter replacement pattern ('_'s are blanks)

 #4c. qualifier ----> uvlist <-- enter qualifier

 #5. vi tmp/util_spr         <-- examine audit report
     ===============

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

3C8. uvtrain: Shell Scripts provided for uvlist

audit report from 'rep1d'

 Job: rep1d InDir: sf/util OutDir: tmp2 Search:  lp  Replace:  spr
 QualPresent: uvlist  Absent:   SearchBgn:
 MatchOptions:   UserOptions: q1a1b99999c0d256e0p1
 ====================================================== 2009/04/01_10:50:29
 00027 uvlist $1 p60$2 a2c08$3 | spr $UVLPOPTN $UVLPDEST
 00032                   1 reps @EOF: tmp2/uvlp08
 00030 uvlist $1 p60$2 a2c10$3 | spr $UVLPOPTN $UVLPDEST
 00035                   1 reps @EOF: tmp2/uvlp10
             - - - - - 72 replacements not shown - - - - -
 00036        then uvlist $i p60$3 a2c12$4 | spr $UVLPOPTN $UVLPDEST
 00044                   1 reps @EOF: tmp2/uvlpp12
 00034 uvlist $1 hd2p99$2 a2c18v=5.6,p99$3 | spr $UVLPDEST $UVLPOPTN
 00046                   1 reps @EOF: tmp2/uvlpmPS
 ====================================================== 2009/04/01_10:50:31
 EOD: 76 reps in 66 files of 309 total (11904 lines)
 Audit filename: tmp/util_spr

notes

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

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

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

3D0. 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. 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{
             3333332222332333333244333333224443332233333723333333233333333722
             130140000021094080209E1110010081D0010000002B00000001000000002B00
          64 130140    21 940802 IN111001  SCR012  00002A 0001001 00002102A
             3333332222332333333244333333225453332233333423333333233333333422
             130140000021094080209E111001003320120000002100001001000002102100
         128 139923    35 950802 IN111002  CHR001  00002B 0002001 00004402B
             3333332222332333333244333333224453332233333423333333233333333422
             139923000035095080209E111002003820010000002200002001000004402200
         192 139923    35 950802 IN111002  TAB013  00002C 0003001 00006902C
             3333332222332333333244333333225443332233333423333333233333333422
             139923000035095080209E111002004120130000002300003001000006902300

 #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
  • need option h2 (force hex) since LF in last byte considered normal
    and hex display would be inhibited

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 - insert LineFeeds, drop packed fields


 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 r80h2  <-- examine with 'uvhd'
 ==================    - note LineFeed in col 80 of each record
                       - option 'h2' forces hex display to see LineFeeds

 uvhd tmp/cm1 t      <-- could also use option 't' for Text files
 ==============

 uvhd tmp/cm1 th2    <-- would need option 'h2' to see LineFeeds
 ================

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=...,filo1=tmp/cm1L,trl=...,rcs=...,typ=..."
 ===========================================================================

 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=128,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
 =======================
                   1         2         3         4         5         6
         0123456789012345678901234567890123456789012345678901234567890123
       0 130140    EVERGREEN MOTORS LTD.    1815 BOWEN ROAD          NANA
         3333332222454545444244545524542222233332445442544422222222224444
         130140000056527255E0DF4F230C44E0000181502F75E02F140000000000E1E1
      64 IMO          BC V9S1H1    604-754-5531                  ........
         4442222222222442535343222233323332333322222222222222222200000000
         9DF00000000002306931810000604D754D55310000000000000000000000C000
     128 .........W0....`........)X|..f3.....\.......................f...
         0000000005300016000000002570063100095000000000000000000000016000
         0C0000C0270C0540C0000C0098C0263C0444C0000C0000C0000C0000C0056C00
     192 ...............................f.....<........f.C
         0000008900000000880000000018000680001300000000694222222222222222
         00C0026C0000C0023C0000C0083C0056D0012C0000C0016D3000000000000000

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}...f...
             0000000000000000000000000000000000000000000000000000013570016000
             0C0000C0000C0000C0000C0000C0000C0000C0000C0000C0000C0246D0056C00
         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 dat1/cm1.dat r257  <-- examine data partition with uvhd
 ======================    - specify recsize=257 to allow for delete flag

 uvhd dat1/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=128,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).
  • See the data reduction option at uvsort.doc#C4'

 uvsort "fili1=dat1/sales3,rcs=64,typ=RST,filo1=tmp/s3,key1u=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 LAST record of a duplicate set
    at the specified key level#. ('u1' is the default if 1/2 omitted)
key_u2
  • 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 last record of a duplicate set
    (at the specified key# level)
key_s2
  • select all records of a duplicate set
    (at the specified key# level)
key_s2b
  • 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=128,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. copy1 - uvcopy 'skeleton job' (template) to help you create a new job
- copy/rename/modify to solve your current data file problem

4A3. 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

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

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

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 source file of instructions. For example to execute 1 of the supplied uvcopy demo jobs:


 uvcopy calendar1  <-- print a calendar (with Julian dates) for the current month
 ================      or any range of months by options entered at the prompt

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.

Why do we need uvcopy ?

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

uvcopy is easy to learn

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 about half 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 '4G1'.

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

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

4A3. 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
        skp>   eof
 #--------------------------------
        mvc    b0(80),a0                    <--- copy 80 bytes only
 #--------------------------------
        put    filo1,b0
        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

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

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

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

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

4J3. exercise - create comma delimited customer telephone list

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

Part_5 Training Guide for the Vancouver Utilities

Part5 - Pre-Programmed Jobs

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
  • see example here on page '3C7'
    (changing all 76 uvlp__ scripts to your printer destination)
  • see complete details at REPjobs.htm#E0
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
datdemo1
  • 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.
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#8F1
 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

5A1. 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

5A2. 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
  • see example here on page '3C7'
    change all uvlp___ scripts from 'lp' to 'spr' (Xi-Text spooler)
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.
datdemo1
  • 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

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

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

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

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

5A4. 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

Part_6 Training Guide for the Vancouver Utilities

Part6 - uvqrpg (Quick Report Program Generator)


6A1. uvqrpg Introduction & Overview
- create multi-level total reports with simple declarations

6B1. qrpgEX1 - example: sales analysis by customer within salesman

6C1. qrpgEX82 - write uvqrpg job to accumulate amount by customer & salesman

6D1. qrpgEX83 - write uvqrpg job to accumulate amount by product#
- must use built in sort to sort by product#

6E1. 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

6A1. 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

6B1. 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

6B2. 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

6C1. 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 into directory
    pf within your own home directory.

/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

6C2. 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

6D1. 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

6E1. 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

6E2. 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_7 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

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

7A2. example using 'rename...' scripts to rename mainframe files
- changing 'PA.PAMFMC55.PAMQUERY.G0117V00' to pa_pamquery_g0117
- could be hundreds of generations ?

7B1. renameL - translate filenames to lower case
7B2. rename-A - remove pattern occurring anywhere in filename

7C1. aliases - save keystrokes for often repeated commands

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

7E1. dtree - print directory tree map
- amazingly short 'sed' script
- also amazingly difficult to decipher
uvcpF2L
  • script using uvcp to convert Fixed length records w/o LineFeeds
  • to text files with LineFeeds inserted after last nonblank
  • makes it easier to use the 'uvcp' utility
uvcpL2F
  • script using uvcp to convert text files to Fixed length records
  • use when you need to convert a text file for use in a mainframe
    type application that requires fixed length with no LineFeeds.
allcancel
  • cancel all print requests for the current user
  • very useful when you have printer problems
  • no parameters required
makeISF0
  • create an empty ISAM file with specified
    filename, rcsz,& keys

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

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

7B1. renameL - translate filenames to lower case

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

7A2. 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_g0117
      pa_pamquery_g0118                <-- desired result
      pa_pamquery_g0119

 #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-X data v00               <-- remove suffiX 'v00'
     =================
      pa.pamfmc55.pamquery.g0117
      pa.pamfmc55.pamquery.g0118
      pa.pamfmc55.pamquery.g0119

 #4. renameP data pa.pamfmc55. pa_   <-- change Prefix to 'pa_'
     =============================
      pa_pamquery.g0117
      pa_pamquery.g0118
      pa_pamquery.g0119

 #5. renameAA data . _               <-- change '.' to '_'
     =================
      pa_pamquery_g0117
      pa_pamquery_g0118
      pa_pamquery_g0119

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

7A3. Renaming All files in a directory

make script to ReName GDG# to Year/Month

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. The following assumes that 'g0117' is for January 2009 & a new GDG was created each month.

      pa_pamquery_g0117
      pa_pamquery_g0118    <-- result from rename scripts (prior page)
      pa_pamquery_g0119
      pa_pamquery_0901
      pa_pamquery_0902     <-- desired result (GDG replaced with year/month)
      pa_pamquery_0903

 #1. ls data >sf/rename1   <-- create file of data file names
     ===================

 #2. vi sf/rename1         <-- edit the file/script
     =============

 #2a. --> :%s/^/mv data\/    <-- insert 'mv data/' at begin (^) each line

 #2b. --> :%s/$/  data\//    <-- append '  data/' at end each line

 #2c. --> :wq                <-- Write & Quit

 #3. uvcp "fili1=sf/rename1,typ=LSTt,rcs=80,filo1=sf/rename2,mvc=22(12)3
     ===================================================================
     - copy cols 3-14 'pa_pamquery' to col 22 (at end existing command)

 #4. vi sf/rename2           <-- edit result
     =============

 #4a. --> manually key desired yymm
      --> ... up to you to work out ...
     # rename2 - script to rename GDG files with year/month 'yymm'
     mv data/pa_pamquery_g0117  data/pa_pamquery_0901
     mv data/pa_pamquery_g0118  data/pa_pamquery_0901
     mv data/pa_pamquery_g0119  data/pa_pamquery_0902

 #5. chmod 775 sf/rename2    <-- set execute permissions
     ====================

 #6. sf/rename2              <-- execute script to rename as desired
     ==========

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

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

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

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

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

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

7D2.

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

Permuted Index of Keywords from ** Headings **

A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z 

1C4 .vimrc: file

1C4 A-z: registers a-z
0D1 Accum: 13. genacum2 - generate jobs to accum ALL numeric fields
6C1 Accumulate: qrpgEX82 - accumulate amount by customer & salesman
6D1 Accumulate: qrpgEX83 - accumulate amount by product#
2C2 Address: dat1/custmas2 - customer master name & address only
2C3 Address: dat1/custmas3 - customer master name & address only
2C4 Address: dat1/custmas3 - customer master name & address only
3J1 Adjust: uvcp ex#7a - right adjust, left zero fill
0F1 Admjobs: 18. ADMjobs
1B1 Advantages: of working above subdirs
7C1 Aliases: - save keystrokes for often repeated commands
7D1 Alldiff2: - compare all text files in 2 directories
3E1 Allow: uvcp ex#2 - inserting LineFeeds to allow editing/printing
6C1 Amount: qrpgEX82 - accumulate amount by customer & salesman
6D1 Amount: qrpgEX83 - accumulate amount by product#
4G1 Analysis: table analysis with uvcopy - demo
4H1 Analysis: creating table analysis reports - exercise
6B1 Analysis: qrpgEX1 - sales analysis by customer within salesman
7B2 Anywhere: rename-A - remove pattern occurring anywhere in filename
2C1 Ascii: dat1/custmas1 - ASCII record displayed by uvhd
2C1 Ascii: packed fields same for EBCDIC & ASCII
2C1 Ascii: vertical hexadecimal & EBCDIC vs ASCII
2D1 Ascii: dat1/sales1 - customer sales ASCII
3D0 Ascii: 3D1. translate EBCDIC to ASCII & insert LineFeeds
3D2 Ascii: use 'uvcp' to translate to ASCII
3D3 Ascii: use 'uvcp' to translate to ASCII & Insert LineFeeds
3F1 Ascii: uvcp ex#3 - translate EBCDIC to ASCII
3C8 Audit: report from 'rep1d'

3B2 Bad: display rec# 10 with bad data fields
0D3 Batch-file: Oracle batch-file to create table
3A1 Browsing: sample 'uvhd' - browsing file with packed fields
2C2 Bytes: dat1/custmas2 - file contents - 1st 80 bytes of 32 records

3F2 Case: uvcp ex#3a - translate to lower case
7B1 Case: renameL - rename all files to Lower case
0D1 Chosen: customer chosen sub-systems
3H1 Clearing: multiple contiguous packed fields
0C1 Cobol: sample COBOL copybook cross-ref
0E2 Cobol: 17. convert Delimited to Fixed-Field for COBOL programs
0E2 Cobol: sample Fixed-Field output for COBOL
3B1 Cobol: uvhdcob - display data files with COBOL field names
3C3 Cobol: uvlp scripts for printing mainframe COBOL reports
6B2 Coding: qrpgEX1 - coding required to create sample report
4J1 Comma: create comma delimited customer telephone list
4J1 Comma: sample ',' comma delimited output
1C1 Command: TWO modes of operation - COMMAND or INSERT
1C3 Command: Global command - to delete, etc
1C4 Command: mark command
3D0 Command: uvcp - command line Data File Utility
1C2 Commands: DELETE commands
1C3 Commands: miscellaneous commands
1C3 Commands: search commands
1C3 Commands: substitution commands
7C1 Commands: aliases - save keystrokes for often repeated commands
1B5 Common: prefixes to identify related files
7D1 Compare: alldiff2 - compare all text files in 2 directories
0C2 Comparisons: 11. Data file Comparisons
1B2 Compiling: example - editing & compiling programs
3K2 Console: log
3H1 Contiguous: clearing multiple contiguous packed fields
0D3 Control: Oracle control file to LOAD table
1B5 Conventions: tip#4 - File Naming Conventions
1C2 Copy: COPY lines (YANK & PUT)
1E1 Copy: vi ex#6 - 'mark' lines for move,copy,delete,etc
4A2 Copy1: - skeleton/template for new uvcopy jobs
0C1 Copybook: sample COBOL copybook cross-ref
2D2 Corrected: dat1/sales2 - zoned signs corrected
3O2 Corrupted: uvsort ex#5 - rebuild files with corrupted Indexes
0A1 Course: Vancouver Utilities Only course
0C1 Cross: 10. Cross References
0C1 Cross-ref: sample COBOL copybook cross-ref
5A4 Cross-references: Cross-References
1C1 Cursor: CURSOR MOVEMENT
2C0 Custmas0: dat1/custmas0 - EBCDIC record displayed by uvhd
2C0 Custmas0: dat1/custmas0 - customer master & sales history
2C0 Custmas0: dat1/custmas0 - record layout
2C1 Custmas1: dat1/custmas1 - ASCII record displayed by uvhd
2C2 Custmas2: dat1/custmas2 - customer master name & address only
2C2 Custmas2: dat1/custmas2 - file contents - 1st 80 bytes of 32 records
4I1 Custmas2: demo file dat1/custmas2 - 1st 3 records
4J1 Custmas2: demo file dat1/custmas2 - 1st 3 records
2C3 Custmas3: dat1/custmas3 - customer master name & address only
2C4 Custmas3: dat1/custmas3 - customer master name & address only
0D1 Customer: chosen sub-systems
2C0 Customer: dat1/custmas0 - customer master & sales history
2C2 Customer: dat1/custmas2 - customer master name & address only
2C3 Customer: dat1/custmas3 - customer master name & address only
2C4 Customer: dat1/custmas3 - customer master name & address only
2D0 Customer: dat1/sales0 - customer sales EBCDIC
2D1 Customer: dat1/sales1 - customer sales ASCII
4J1 Customer: create comma delimited customer telephone list
6B1 Customer: qrpgEX1 - sales analysis by customer within salesman
6C1 Customer: qrpgEX82 - accumulate amount by customer & salesman

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

A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z 

2C0 Dat1: dat1/custmas0 - EBCDIC record displayed by uvhd
2C0 Dat1: dat1/custmas0 - customer master & sales history
2C0 Dat1: dat1/custmas0 - record layout
2C1 Dat1: dat1/custmas1 - ASCII record displayed by uvhd
2C2 Dat1: dat1/custmas2 - customer master name & address only
2C2 Dat1: dat1/custmas2 - file contents - 1st 80 bytes of 32 records
2C3 Dat1: dat1/custmas3 - customer master name & address only
2C4 Dat1: dat1/custmas3 - customer master name & address only
2D0 Dat1: dat1/sales0 - EBCDIC display by 'uvhd'
2D0 Dat1: dat1/sales0 - customer sales EBCDIC
2D0 Dat1: dat1/sales0 - record layout
2D1 Dat1: dat1/sales1 - customer sales ASCII
2D2 Dat1: dat1/sales2 - record layout
2D2 Dat1: dat1/sales2 - zoned signs corrected
2D3 Dat1: dat1/sales3 - record layout
2D3 Dat1: dat1/sales3 - with +/- separate signs
4I1 Dat1: demo file dat1/custmas2 - 1st 3 records
4J1 Dat1: demo file dat1/custmas2 - 1st 3 records
6B1 Dat1: /home/uvadm/dat1/sales4 - test/demo data
6B1 Dat1: /home/uvadm/dat1/sales4 record layout
6C1 Dat1: /home/uvadm/dat1/sales4 - test/demo data
0C2 Data: 11. Data file Comparisons
0D3 Data: 15. convert data files to RDBMS Tables
3A2 Data: uvhd Search/Update data in specified fields
3B1 Data: uvhdcob - display data files with COBOL field names
3B2 Data: display rec# 10 with bad data fields
3D0 Data: uvcp - command line Data File Utility
6B1 Data: /home/uvadm/dat1/sales4 - test/demo data
6C1 Data: /home/uvadm/dat1/sales4 - test/demo data
1C2 Delete: DELETE commands
1C2 Delete: MOVE lines (DELETE & PUT)
1C3 Delete: Global command - to delete, etc
1E1 Delete: vi ex#6 - 'mark' lines for move,copy,delete,etc
3G1 Deleting: uvcp ex#4 - Selecting or Deleting records
0E2 Delimited: 17. convert Delimited to Fixed-Field for COBOL programs
0E2 Delimited: sample Delimited input from Excel
0E2 Delimited: uvcopy job to convert Delimited to Fixed
4I1 Delimited: creating Delimited files for Excel, SQL, etc
4I1 Delimited: sample '|' delimited format
4J1 Delimited: create comma delimited customer telephone list
4J1 Delimited: sample ',' comma delimited output
4J3 Delimiters: experiment with alternate delimiters
1E1 Demo: file 'uvtrainEX6'
3C1 Demo: uvlist demo
4G1 Demo: table analysis with uvcopy - demo
4I1 Demo: file dat1/custmas2 - 1st 3 records
4I2 Demo: uvcopy listing of demo job
4J1 Demo: file dat1/custmas2 - 1st 3 records
6B1 Demo: /home/uvadm/dat1/sales4 - test/demo data
6C1 Demo: /home/uvadm/dat1/sales4 - test/demo data
7D1 Directories: alldiff2 - compare all text files in 2 directories
7D2 Directories: dtree script to illustrate directories
1B0 Directory: 1B1. tip#1 - stay in your 'working directory'
1B3 Directory: tip#2 - setup 'tmp' sub-dir in your working directory
1B4 Directory: tip#3 - move files in working directory to subdir
3C3 Directory: printing all files in a directory
7A1 Directory: rename all files in directory
7A2 Directory: example - ReNaming All files in a directory
7D1 Directory: dtree - draw directory tree
2D0 Display: dat1/sales0 - EBCDIC display by 'uvhd'
3B1 Display: uvhdcob - display data files with COBOL field names
3B1 Display: uvhdcob - sample display
3B2 Display: rec# 10 with bad data fields
2C0 Displayed: dat1/custmas0 - EBCDIC record displayed by uvhd
2C1 Displayed: dat1/custmas1 - ASCII record displayed by uvhd
4A1 Does: how does uvcopy find its parameter files ?
7D1 Draw: dtree - draw directory tree
3E2 Drop: uvcp ex#2 - insert LineFeeds, drop packed fields
3M2 Drop: option 'u' (key#u1/2) - drop duplicate records
7D1 Dtree: - draw directory tree
7D2 Dtree: script to illustrate directories
3M2 Duplicate: option 's' (key#s1/2) - select duplicate records
3M2 Duplicate: option 'u' (key#u1/2) - drop duplicate records

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

A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z 

0D2 Easier: 14. uvhdc1 - makes uvhdcob easier to use
4A1 Easy: uvcopy is easy to learn
2C0 Ebcdic: dat1/custmas0 - EBCDIC record displayed by uvhd
2C1 Ebcdic: packed fields same for EBCDIC & ASCII
2C1 Ebcdic: vertical hexadecimal & EBCDIC vs ASCII
2D0 Ebcdic: dat1/sales0 - EBCDIC display by 'uvhd'
2D0 Ebcdic: dat1/sales0 - customer sales EBCDIC
3D0 Ebcdic: 3D1. translate EBCDIC to ASCII & insert LineFeeds
3F1 Ebcdic: uvcp ex#3 - translate EBCDIC to ASCII
1C1 Edit: starting 'vi' to edit a file
4E1 Edited: creating edited reports with uvcopy
4F1 Edited: creating edited reports with uvcopy - exercise
1B2 Editing: example - editing & compiling programs
3E1 Editing: uvcp ex#2 - inserting LineFeeds to allow editing/printing
1D0 Editor: files for 'vi' editor tutorial
3K2 Empty: script makeISF0 - create an empty Indexed file
3K2 Empty: script makeISF0 - create an empty Indexed file
1C2 Escape: INSERT text (ESCAPE to end insert)
0E1 Example: 16. table summary example
1B2 Example: - editing & compiling programs
7A2 Example: - ReNaming All files in a directory
1B3 Examples: of using 'tmp' subdir
0E2 Excel: sample Delimited input from Excel
4I1 Excel: creating Delimited files for Excel, SQL, etc
1B2 Exception: Exception to the Rule
1D1 Exercise: hello1 - vi exercise #1
1D2 Exercise: hello2 - vi exercise #2
1D3 Exercise: hello3 - vi exercise #3
1D4 Exercise: hello4 - vi exercise #4
1D5 Exercise: hello5 - vi exercise #5
1E2 Exercise: vi ex#6 - 'mark' Exercise Instructions
3I1 Exercise: Exercise#6a - improve Y2K solution above
3K2 Exercise: Exercise#9 - test makeISF0 as follows
4F1 Exercise: creating edited reports with uvcopy - exercise
4H1 Exercise: creating table analysis reports - exercise
4J1 Exercise: subdirs used for this exercise
1A3 Exercises: preparation for UV training exercises
4J3 Experiment: with alternate delimiters

3C2 Few: uvlp___ scripts - a few samples of 68 total
3B1 Field: uvhdcob - display data files with COBOL field names
3J1 Field: uvcp ex#7 - numeric field conversions
0D1 Fields: 13. genacum2 - generate jobs to accum ALL numeric fields
2C1 Fields: packed fields same for EBCDIC & ASCII
3A1 Fields: sample 'uvhd' - browsing file with packed fields
3A2 Fields: uvhd Search/Update data in specified fields
3B2 Fields: display rec# 10 with bad data fields
3E2 Fields: uvcp ex#2 - insert LineFeeds, drop packed fields
3H1 Fields: clearing multiple contiguous packed fields
7B2 Filename: rename-A - remove pattern occurring anywhere in filename
1B5 Filenames: Misspell filenames Intentionally
3J1 Fill: uvcp ex#7a - right adjust, left zero fill
4A1 Find: how does uvcopy find its parameter files ?
0E2 Fixed: uvcopy job to convert Delimited to Fixed
0E2 Fixed-field: 17. convert Delimited to Fixed-Field for COBOL programs
0E2 Fixed-field: sample Fixed-Field output for COBOL
3K2 Follows: Exercise#9 - test makeISF0 as follows
4I1 Format: sample '|' delimited format

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

A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z 

7A3 Gdg: make script to ReName GDG# to Year/Month
0D1 Genacum2: 13. genacum2 - generate jobs to accum ALL numeric fields
0D1 Generate: 13. genacum2 - generate jobs to accum ALL numeric fields
1C3 Global: Global command - to delete, etc

1D1 Hello1: - vi exercise #1
1D2 Hello2: - vi exercise #2
1D3 Hello3: - vi exercise #3
1D4 Hello4: - vi exercise #4
1D5 Hello5: - vi exercise #5
2C1 Hexadecimal: vertical hexadecimal & EBCDIC vs ASCII
2C0 History: dat1/custmas0 - customer master & sales history
6B1 Home: /home/uvadm/dat1/sales4 - test/demo data
6B1 Home: /home/uvadm/dat1/sales4 record layout
6C1 Home: /home/uvadm/dat1/sales4 - test/demo data
1A4 Homedir: training subdirs/files in your homedir
4A1 How: does uvcopy find its parameter files ?

1B5 Identify: common prefixes to identify related files
7D2 Illustrate: dtree script to illustrate directories
3I1 Improve: Exercise#6a - improve Y2K solution above
3K1 Indexed: loading Indexed files with uvcp
3K1 Indexed: uvcp ex#8a - load 2 key Indexed file
3K2 Indexed: script makeISF0 - create an empty Indexed file
3K2 Indexed: script makeISF0 - create an empty Indexed file
3O1 Indexed: sorting & loading Indexed files
3O2 Indexes: uvsort ex#5 - rebuild files with corrupted Indexes
1C1 Insert: TWO modes of operation - COMMAND or INSERT
1C2 Insert: INSERT text (ESCAPE to end insert)
1C2 Insert: INSERT text (ESCAPE to end insert)
3D0 Insert: 3D1. translate EBCDIC to ASCII & insert LineFeeds
3D3 Insert: use 'uvcp' to translate to ASCII & Insert LineFeeds
3E2 Insert: uvcp ex#2 - insert LineFeeds, drop packed fields
3E1 Inserting: uvcp ex#2 - inserting LineFeeds to allow editing/printing
1E2 Instructions: vi ex#6 - 'mark' Exercise Instructions
1B5 Intentionally: Misspell filenames Intentionally
5A1 Interpreter: Pre-Programmed Jobs - for the uvcopy interpreter
4A1 Its: how does uvcopy find its parameter files ?

3K1 Key: uvcp ex#8a - load 2 key Indexed file
3L1 Key: uvsort ex#1 - sort seqntl file on 1 key
3M1 Key: sorting with Unique key option 'u'
3M2 Key: option 's' (key#s1/2) - select duplicate records
3M2 Key: option 'u' (key#u1/2) - drop duplicate records
7C1 Keystrokes: aliases - save keystrokes for often repeated commands
0C1 Korn: 8. Korn shell Scripts

2C0 Layout: dat1/custmas0 - record layout
2D0 Layout: dat1/sales0 - record layout
2D2 Layout: dat1/sales2 - record layout
2D3 Layout: dat1/sales3 - record layout
6B1 Layout: /home/uvadm/dat1/sales4 record layout
4A1 Learn: uvcopy is easy to learn
3J1 Left: uvcp ex#7a - right adjust, left zero fill
3D0 Line: uvcp - command line Data File Utility
3D3 Linefeed: use 'uvhd' to see the Linefeed codes
3D0 Linefeeds: 3D1. translate EBCDIC to ASCII & insert LineFeeds
3D3 Linefeeds: use 'uvcp' to translate to ASCII & Insert LineFeeds
3E1 Linefeeds: uvcp ex#2 - inserting LineFeeds to allow editing/printing
3E2 Linefeeds: uvcp ex#2 - insert LineFeeds, drop packed fields
4J1 List: create comma delimited customer telephone list
4I2 Listing: uvcopy listing of demo job
0D3 Load: Oracle control file to LOAD table
3K1 Load: uvcp ex#8a - load 2 key Indexed file
3K1 Loading: Indexed files with uvcp
3O1 Loading: sorting & loading Indexed files
3K2 Log: console log
3F2 Lower: uvcp ex#3a - translate to lower case
7B1 Lower: renameL - rename all files to Lower case

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

A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z 

2A1 Mainframe: notes re mainframe files transferred to UNIX
3C3 Mainframe: uvlp scripts for printing mainframe COBOL reports
3K2 Makeisf0: Exercise#9 - test makeISF0 as follows
3K2 Makeisf0: script makeISF0 - create an empty Indexed file
3K2 Makeisf0: script makeISF0 - create an empty Indexed file
0D2 Makes: 14. uvhdc1 - makes uvhdcob easier to use
1C4 Mark: command
1E1 Mark: vi ex#6 - 'mark' lines for move,copy,delete,etc
1E2 Mark: vi ex#6 - 'mark' Exercise Instructions
2C0 Master: dat1/custmas0 - customer master & sales history
2C2 Master: dat1/custmas2 - customer master name & address only
2C3 Master: dat1/custmas3 - customer master name & address only
2C4 Master: dat1/custmas3 - customer master name & address only
1C3 Miscellaneous: commands
1B5 Misspell: Misspell filenames Intentionally
1C1 Modes: TWO modes of operation - COMMAND or INSERT
3C5 Modified: uvlp12 modified for Xi-Text print spooler
3C5 Modify: uvlp... scripts for Xi-Text print spooler
7A3 Month: make script to ReName GDG# to Year/Month
1B4 Move: tip#3 - move files in working directory to subdir
1C2 Move: MOVE lines (DELETE & PUT)
1E1 Move: vi ex#6 - 'mark' lines for move,copy,delete,etc
1C1 Movement: CURSOR MOVEMENT
3N1 Multi-file: input to uvsort
1A1 Multi-user: Multi-User Procedures

1B5 Naming: tip#4 - File Naming Conventions
3C6 Near: set UVLPDEST to a printer near you
4A1 Need: Why do we need uvcopy ?
7A1 Need: 'rename' scripts - Why you need them
0E1 New: writing new uvcopy jobs
4A2 New: copy1 - skeleton/template for new uvcopy jobs
4A3 New: creating a new uvcopy job
0D1 Numeric: 13. genacum2 - generate jobs to accum ALL numeric fields
3J1 Numeric: uvcp ex#7 - numeric field conversions

7B2 Occurring: rename-A - remove pattern occurring anywhere in filename
7C1 Often: aliases - save keystrokes for often repeated commands
1C1 Operation: TWO modes of operation - COMMAND or INSERT
3M1 Option: sorting with Unique key option 'u'
3M2 Option: 's' (key#s1/2) - select duplicate records
3M2 Option: 'u' (key#u1/2) - drop duplicate records
3F2 Optional: ex#3b (optional) - translate 1 of your files
4J2 Optional:
3P1 Options: uvsort ex#6 - Y2K sort options
0D3 Oracle: Oracle batch-file to create table
0D3 Oracle: Oracle control file to LOAD table
6A1 Overview: uvqrpg OVERVIEW

2C1 Packed: fields same for EBCDIC & ASCII
3A1 Packed: sample 'uvhd' - browsing file with packed fields
3E2 Packed: uvcp ex#2 - insert LineFeeds, drop packed fields
3H1 Packed: clearing multiple contiguous packed fields
4A1 Parameter: how does uvcopy find its parameter files ?
7B2 Pattern: rename-A - remove pattern occurring anywhere in filename
0C1 Pre-programmed: 9. Pre-programmed jobs
5A1 Pre-programmed: Pre-Programmed Jobs - for the uvcopy interpreter
1B5 Prefixes: common prefixes to identify related files
1A2 Preparation: for using Vancouver Utilities
1A3 Preparation: for UV training exercises
3C5 Print: modify uvlp... scripts for Xi-Text print spooler
3C5 Print: uvlp12 modified for Xi-Text print spooler
3C6 Printer: set UVLPDEST to a printer near you
3C3 Printing: all files in a directory
3C3 Printing: uvlp scripts for printing mainframe COBOL reports
3E1 Printing: uvcp ex#2 - inserting LineFeeds to allow editing/printing
4J2 Procedure: suggested procedure
1A1 Procedures: Multi-User Procedures
1A1 Procedures: Single-User Procedures
6D1 Product: qrpgEX83 - accumulate amount by product#
6E1 Product: qrpgEX84 = qrpgEX83 + table summary by product#
0E2 Programs: 17. convert Delimited to Fixed-Field for COBOL programs
1B2 Programs: example - editing & compiling programs

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

A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z 

6B1 Qrpgex1: qrpgEX1 - sales analysis by customer within salesman
6B1 Qrpgex1: sample report created by qrpgEX1
6B2 Qrpgex1: qrpgEX1 - coding required to create sample report
6C1 Qrpgex82: qrpgEX82 - accumulate amount by customer & salesman
6C1 Qrpgex82: report sample for qrpgEX82
6D1 Qrpgex83: qrpgEX83 - accumulate amount by product#
6D1 Qrpgex83: report sample for qrpgEX83
6E1 Qrpgex83: qrpgEX84 = qrpgEX83 + table summary by product#
6E1 Qrpgex84: qrpgEX84 = qrpgEX83 + table summary by product#
6E2 Qrpgex84: report sample for qrpgEX84
1C5 Quit: WRITE & QUIT

0D3 Rdbms: 15. convert data files to RDBMS Tables
3O2 Rebuild: uvsort ex#5 - rebuild files with corrupted Indexes
3B2 Rec: display rec# 10 with bad data fields
2C0 Record: dat1/custmas0 - EBCDIC record displayed by uvhd
2C0 Record: dat1/custmas0 - record layout
2C1 Record: dat1/custmas1 - ASCII record displayed by uvhd
2D0 Record: dat1/sales0 - record layout
2D2 Record: dat1/sales2 - record layout
2D3 Record: dat1/sales3 - record layout
6B1 Record: /home/uvadm/dat1/sales4 record layout
2C2 Records: dat1/custmas2 - file contents - 1st 80 bytes of 32 records
3A3 Records: uvhd - write selected records
3G1 Records: uvcp ex#4 - Selecting or Deleting records
3M2 Records: option 's' (key#s1/2) - select duplicate records
3M2 Records: option 'u' (key#u1/2) - drop duplicate records
4I1 Records: demo file dat1/custmas2 - 1st 3 records
4J1 Records: demo file dat1/custmas2 - 1st 3 records
1C5 Reference: vim Reference
0C1 References: 10. Cross References
1C4 Registers: a-z
1B5 Related: common prefixes to identify related files
7B2 Remove: rename-A - remove pattern occurring anywhere in filename
7A1 Rename: 'rename' scripts - Why you need them
7A1 Rename: all files in directory
7A3 Rename: make script to ReName GDG# to Year/Month
7B1 Rename: renameL - rename all files to Lower case
7B2 Rename-a: rename-A - remove pattern occurring anywhere in filename
7B1 Renamel: renameL - rename all files to Lower case
7A2 Renaming: example - ReNaming All files in a directory
3C8 Rep1d: audit report from 'rep1d'
7C1 Repeated: aliases - save keystrokes for often repeated commands
1B2 Right: working above subdirs - RIGHT
3J1 Right: uvcp ex#7a - right adjust, left zero fill
1B2 Rule: Exception to the Rule

2C0 Sales: dat1/custmas0 - customer master & sales history
2D0 Sales: dat1/sales0 - customer sales EBCDIC
2D1 Sales: dat1/sales1 - customer sales ASCII
6B1 Sales: qrpgEX1 - sales analysis by customer within salesman
2D0 Sales0: dat1/sales0 - EBCDIC display by 'uvhd'
2D0 Sales0: dat1/sales0 - customer sales EBCDIC
2D0 Sales0: dat1/sales0 - record layout
2D1 Sales1: dat1/sales1 - customer sales ASCII
2D2 Sales2: dat1/sales2 - record layout
2D2 Sales2: dat1/sales2 - zoned signs corrected
2D3 Sales3: dat1/sales3 - record layout
2D3 Sales3: dat1/sales3 - with +/- separate signs
6B1 Sales4: /home/uvadm/dat1/sales4 - test/demo data
6B1 Sales4: /home/uvadm/dat1/sales4 record layout
6C1 Sales4: /home/uvadm/dat1/sales4 - test/demo data
6B1 Salesman: qrpgEX1 - sales analysis by customer within salesman
6C1 Salesman: qrpgEX82 - accumulate amount by customer & salesman
2C1 Same: packed fields same for EBCDIC & ASCII
0C1 Sample: COBOL copybook cross-ref
0C3 Sample: Table Summary report
0D1 Sample: report
0E2 Sample: Delimited input from Excel
0E2 Sample: Fixed-Field output for COBOL
3A1 Sample: 'uvhd' - browsing file with packed fields
3B1 Sample: uvhdcob - sample display
3C4 Sample: shell script for uvlist
4D1 Sample: report
4E1 Sample: output report
4F1 Sample: output report
4G1 Sample: output report
4H1 Sample: output report
4I1 Sample: '|' delimited format
4J1 Sample: ',' comma delimited output
6B1 Sample: report created by qrpgEX1
6B2 Sample: qrpgEX1 - coding required to create sample report
6C1 Sample: report sample for qrpgEX82
6D1 Sample: report sample for qrpgEX83
6E2 Sample: report sample for qrpgEX84
3C2 Samples: uvlp___ scripts - a few samples of 68 total
7C1 Save: aliases - save keystrokes for often repeated commands
1C3 Search: commands
3A2 Search: uvhd Search/Update data in specified fields
3D3 See: use 'uvhd' to see the Linefeed codes
3M2 Select: option 's' (key#s1/2) - select duplicate records
3A3 Selected: uvhd - write selected records
3G1 Selecting: uvcp ex#4 - Selecting or Deleting records
2D3 Separate: dat1/sales3 - with +/- separate signs
3L1 Seqntl: uvsort ex#1 - sort seqntl file on 1 key
3C6 Set: UVLPDEST to a printer near you
1B3 Setup: tip#2 - setup 'tmp' sub-dir in your working directory
0C1 Shell: 8. Korn shell Scripts
3C4 Shell: sample shell script for uvlist
2D2 Signs: dat1/sales2 - zoned signs corrected
2D3 Signs: dat1/sales3 - with +/- separate signs
1A1 Single-user: Single-User Procedures
4A2 Skeleton: copy1 - skeleton/template for new uvcopy jobs
3H1 Solution: uvcp ex#5 - solution
3I1 Solution: Exercise#6a - improve Y2K solution above
3L1 Sort: uvsort ex#1 - sort seqntl file on 1 key
3P1 Sort: uvsort ex#6 - Y2K sort options
3M1 Sorting: with Unique key option 'u'
3O1 Sorting: & loading Indexed files
3A2 Specified: uvhd Search/Update data in specified fields
3C5 Spooler: modify uvlp... scripts for Xi-Text print spooler
3C5 Spooler: uvlp12 modified for Xi-Text print spooler
4I1 Sql: creating Delimited files for Excel, SQL, etc
1C1 Starting: 'vi' to edit a file
1B0 Stay: 1B1. tip#1 - stay in your 'working directory'
1B3 Sub-dir: tip#2 - setup 'tmp' sub-dir in your working directory
1A2 Sub-directories: uv sub-directories used for UV training
0D1 Sub-systems: customer chosen sub-systems
1B3 Subdir: examples of using 'tmp' subdir
1B4 Subdir: tip#3 - move files in working directory to subdir
1A4 Subdirs: training subdirs/files in your homedir
1B1 Subdirs: advantages of working above subdirs
1B2 Subdirs: working IN subdirs - WRONG
1B2 Subdirs: working above subdirs - RIGHT
4J1 Subdirs: used for this exercise
1C3 Substitution: commands
4J2 Suggested: procedure
4F1 Suggestions:
4H1 Suggestions:
0C3 Summary: 12. Table Summary Reports
0C3 Summary: sample Table Summary report
0E1 Summary: 16. table summary example
0E1 Summary: uvcopy job to create table summary report
6E1 Summary: qrpgEX84 = qrpgEX83 + table summary by product#

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

A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z 

0C3 Table: 12. Table Summary Reports
0C3 Table: sample Table Summary report
0D3 Table: Oracle batch-file to create table
0D3 Table: Oracle control file to LOAD table
0E1 Table: 16. table summary example
0E1 Table: uvcopy job to create table summary report
4G1 Table: analysis with uvcopy - demo
4H1 Table: creating table analysis reports - exercise
6E1 Table: qrpgEX84 = qrpgEX83 + table summary by product#
0D3 Tables: 15. convert data files to RDBMS Tables
4J1 Telephone: create comma delimited customer telephone list
4A2 Template: copy1 - skeleton/template for new uvcopy jobs
3C6 Temporary: changes to UVLPDEST & UVLPOPTN
3K2 Test: Exercise#9 - test makeISF0 as follows
6B1 Test: /home/uvadm/dat1/sales4 - test/demo data
6C1 Test: /home/uvadm/dat1/sales4 - test/demo data
1C2 Text: INSERT text (ESCAPE to end insert)
7D1 Text: alldiff2 - compare all text files in 2 directories
7A1 Them: 'rename' scripts - Why you need them
1B0 Tip: 1B1. tip#1 - stay in your 'working directory'
1B3 Tip: tip#2 - setup 'tmp' sub-dir in your working directory
1B4 Tip: tip#3 - move files in working directory to subdir
1B5 Tip: tip#4 - File Naming Conventions
1B3 Tmp: examples of using 'tmp' subdir
1B3 Tmp: tip#2 - setup 'tmp' sub-dir in your working directory
3C2 Total: uvlp___ scripts - a few samples of 68 total
1A2 Training: uv sub-directories used for UV training
1A3 Training: preparation for UV training exercises
1A4 Training: subdirs/files in your homedir
2A1 Transferred: notes re mainframe files transferred to UNIX
3D0 Translate: 3D1. translate EBCDIC to ASCII & insert LineFeeds
3D2 Translate: use 'uvcp' to translate to ASCII
3D3 Translate: use 'uvcp' to translate to ASCII & Insert LineFeeds
3F1 Translate: uvcp ex#3 - translate EBCDIC to ASCII
3F2 Translate: ex#3b (optional) - translate 1 of your files
3F2 Translate: uvcp ex#3a - translate to lower case
7D1 Tree: dtree - draw directory tree
1D0 Tutorial: files for 'vi' editor tutorial
1C1 Two: TWO modes of operation - COMMAND or INSERT
2B1 Typ: file 'typ' codes for uvcp, uvsort,& uvcopy

3M1 Unique: sorting with Unique key option 'u'
2A1 Unix: notes re mainframe files transferred to UNIX
3A2 Update: uvhd Search/Update data in specified fields
0A1 Utilities: Vancouver Utilities Only course
1A2 Utilities: preparation for using Vancouver Utilities
3D0 Utility: uvcp - command line Data File Utility
6B1 Uvadm: /home/uvadm/dat1/sales4 - test/demo data
6B1 Uvadm: /home/uvadm/dat1/sales4 record layout
6C1 Uvadm: /home/uvadm/dat1/sales4 - test/demo data
0B2 Uvcopy: 6. uvcopy
0E1 Uvcopy: job to create table summary report
0E1 Uvcopy: writing new uvcopy jobs
0E2 Uvcopy: job to convert Delimited to Fixed
2B1 Uvcopy: file 'typ' codes for uvcp, uvsort,& uvcopy
4A1 Uvcopy: Why do we need uvcopy ?
4A1 Uvcopy: how does uvcopy find its parameter files ?
4A1 Uvcopy: is easy to learn
4A1 Uvcopy: is powerful
4A1 Uvcopy: what is 'uvcopy' ?
4A2 Uvcopy: copy1 - skeleton/template for new uvcopy jobs
4A3 Uvcopy: creating a new uvcopy job
4E1 Uvcopy: creating edited reports with uvcopy
4F1 Uvcopy: creating edited reports with uvcopy - exercise
4G1 Uvcopy: table analysis with uvcopy - demo
4I2 Uvcopy: listing of demo job
5A1 Uvcopy: Pre-Programmed Jobs - for the uvcopy interpreter
0B1 Uvcp: 4. uvcp
2B1 Uvcp: file 'typ' codes for uvcp, uvsort,& uvcopy
3D0 Uvcp: - command line Data File Utility
3D2 Uvcp: use 'uvcp' to translate to ASCII
3D3 Uvcp: use 'uvcp' to translate to ASCII & Insert LineFeeds
3E1 Uvcp: ex#2 - inserting LineFeeds to allow editing/printing
3E2 Uvcp: ex#2 - insert LineFeeds, drop packed fields
3F1 Uvcp: ex#3 - translate EBCDIC to ASCII
3F2 Uvcp: ex#3a - translate to lower case
3G1 Uvcp: ex#4 - Selecting or Deleting records
3H1 Uvcp: ex#5 - solution
3I1 Uvcp: ex#6 - Y2K conversion
3J1 Uvcp: ex#7 - numeric field conversions
3J1 Uvcp: ex#7a - right adjust, left zero fill
3K1 Uvcp: loading Indexed files with uvcp
3K1 Uvcp: ex#8a - load 2 key Indexed file
0B1 Uvhd: 1. uvhd
2C0 Uvhd: dat1/custmas0 - EBCDIC record displayed by uvhd
2C1 Uvhd: dat1/custmas1 - ASCII record displayed by uvhd
2D0 Uvhd: dat1/sales0 - EBCDIC display by 'uvhd'
3A1 Uvhd: sample 'uvhd' - browsing file with packed fields
3A2 Uvhd: Search/Update data in specified fields
3A3 Uvhd: - write selected records
3D3 Uvhd: use 'uvhd' to see the Linefeed codes
0D2 Uvhdc1: 14. uvhdc1 - makes uvhdcob easier to use
0B1 Uvhdcob: 2. uvhdcob
0D2 Uvhdcob: 14. uvhdc1 - makes uvhdcob easier to use
3B1 Uvhdcob: - display data files with COBOL field names
3B1 Uvhdcob: - sample display
0B1 Uvlist: 3. uvlist
3C1 Uvlist: demo
3C4 Uvlist: sample shell script for uvlist
3C3 Uvlp: scripts for printing mainframe COBOL reports
3C5 Uvlp...: modify uvlp... scripts for Xi-Text print spooler
3C7 Uvlp...: mass change all uvlp... scripts
3C5 Uvlp12: modified for Xi-Text print spooler
3C2 Uvlp___: scripts - a few samples of 68 total
3C6 Uvlpdest: set UVLPDEST to a printer near you
3C6 Uvlpdest: temporary changes to UVLPDEST & UVLPOPTN
3C6 Uvlpoptn: temporary changes to UVLPDEST & UVLPOPTN
0B2 Uvqrpg: 7. uvqrpg
6A1 Uvqrpg: OVERVIEW
0B1 Uvsort: 5. uvsort
2B1 Uvsort: file 'typ' codes for uvcp, uvsort,& uvcopy
3L1 Uvsort: ex#1 - sort seqntl file on 1 key
3N1 Uvsort: multi-file input to uvsort
3O2 Uvsort: ex#5 - rebuild files with corrupted Indexes
3P1 Uvsort: ex#6 - Y2K sort options
1E1 Uvtrainex6: demo file 'uvtrainEX6'

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

A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z 

0A1 Vancouver: Vancouver Utilities Only course
1A2 Vancouver: preparation for using Vancouver Utilities
2C1 Vertical: hexadecimal & EBCDIC vs ASCII
1C5 Vim: Reference

4A1 What: is 'uvcopy' ?
6B1 Within: qrpgEX1 - sales analysis by customer within salesman
1B0 Working: 1B1. tip#1 - stay in your 'working directory'
1B1 Working: advantages of working above subdirs
1B2 Working: IN subdirs - WRONG
1B2 Working: above subdirs - RIGHT
1B3 Working: tip#2 - setup 'tmp' sub-dir in your working directory
1B4 Working: tip#3 - move files in working directory to subdir
1C5 Write: WRITE & QUIT
3A3 Write: uvhd - write selected records
0E1 Writing: new uvcopy jobs
1B2 Wrong: working IN subdirs - WRONG

3C5 Xi-text: modify uvlp... scripts for Xi-Text print spooler
3C5 Xi-text: uvlp12 modified for Xi-Text print spooler

3I1 Y2k: Exercise#6a - improve Y2K solution above
3I1 Y2k: uvcp ex#6 - Y2K conversion
3P1 Y2k: uvsort ex#6 - Y2K sort options
1C2 Yank: COPY lines (YANK & PUT)
7A3 Year: make script to ReName GDG# to Year/Month
3C6 You: set UVLPDEST to a printer near you
7A1 You: 'rename' scripts - Why you need them

3J1 Zero: uvcp ex#7a - right adjust, left zero fill
2D2 Zoned: dat1/sales2 - zoned signs corrected

A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z 

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

Visitor Counters for ThisYear and LastYear

ThisYear=000089   (J=0,F=64,M=25,A=0,M=0,J=0,J=0,A=0,S=0,O=0,N=0,D=0)
LastYear=001644   (J=86,F=112,M=184,A=269,M=157,J=120,J=103,A=109,S=115,O=140,N=126,D=123)