A1. delim2fix1 - data entry assist
  - converts delimited data entry records into fixed field length
  records for applications requiring fixed formats such as
  most COBOL programs.
B1. lotus1 - convert fixed field length format to variable field lengths
- mainframe/cobol data to Lotus123 spreadsheet import format
C1. lotus2 - convert variable field length records to fixed field records
- Lotus123 spreadsheet export format to mainframe/cobol format
D1. gentstgl - generate a test data file with packed fields.
- this example generates a General Ledger (GL) test file.
- the GL# & description were edited into a text file, whose
  name is supplied to the gentstgl job which generates
  36 packed fields for this year, last year,& budgets.
         10000100 CURRENT ASSETS  101.00  102.00  103.00 ..etc.. 136.00
         10000200 FIXED ASSETS    201.00  202.00  203.00 ..etc.. 236.00
         10000300 LIABILITIES     301.00  302.00  303.00 ..etc.. 336.00
               ............... etc (12 records) ...................
E1. nettime1 - create Internet time report & calculate any overtime.
- time statistics file downloaded from ISP.
                 Logout Date/Time    Time Used    Time Charged
                 1997.02.01 08:07       44             44
                 1997.02.01 17:30       33             33
                                                     77 *
F1. dropdup1 - Drop duplicate records anywhere within a file.
- based on any key field & not dependent on sort sequence
- uses a table of key values & a corresponding counter
- easily modified for your particular file
G1. subfix1 - change record field data via table lookup
- illustrates a powerful technique
- real life example changing subscriber#s in thousands of records
- 2 column table of old & new#s keyed separately
H1. split1 - split 1 file into multiple files, based on a control field
  within the records (ID#, dept#, state/province, cust#,etc)
- this is a DEMO job to illustrate the technique
I1. split2 - split2 is an alternate version of split1 (see above)
- split1 assumed input file already sorted on province code, which
  it was not & therefore output files incorrect (lost records)
- this job includes a sort prior to the file split logic

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

CONTENTS of uvcopy5.doc - ADVANCED APPLICATIONS - continued

J1. chain1 - demonstrate random reads to an Indexed file
- test files supplied to run following demo
     given: 1. sequential sales detail file with cust#, etc
            2. indexed customer master file (indexed by cust#)
     required - read sales file sequentially
              - randomly read customer master, using cust# from sales file
              - get cust name from master & append to end of sales record
              - write out new extended sales detail record
K1. chain2 - uvcopy job to demo ISAM file updates
- illustrates use of ISAM file read/write/update commands
     see instructions documented in uvadm/doc/uvcopy3.doc
     1. redm5 - read key equal (cc set = if key found, unequal if not)
     2. wrt   - write new record
     3. upd   - update/rewrite existing record

interactive update simple ISAM customer name & address file 00-03 - customer# (ISAM file key) 05-78 - name & address (free format)

L1. copydir1 - copy all files in 1 directory to a 2nd directory
- intended as a framework to be copied/renamed/modified
- inserting instructions to perform desired data manipulations
  not possible with UNIX tools.
L2. parmnullfix4 - example of copydir1 copied, renamed,& modified
  - to convert nulls to blanks & clear cols 73-80
M1. cmdcml - subrtn to compare character fields with decimal points
- allowing different no of decimal points in the 2 fields
- allowing commas, signs, blanks (before &/or after)
- respecting '-' sign anywhere within specified fields
M2. cmdcmlT - uvcopy job to test the cmdcml subrtn
- '@pf2=cmdcml' at end of cmdcmlT loads subrtn when
  the cmdcmlT job is loaded
M3. cmdcml - listing of the 'cmdcml' subrtn called by uvcopy jobs
Note
  • this is a good example of how to write subrtns called by the
    '@pf2=xxxxxx' method

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

A1. delim2fix1 - convert delimited data to fixed fields for COBOL applications

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.

The unix/linux site can use the 'delim2fix1' uvcopy job to convert the delimited data to fixed field length records for the cobol programs.

Delimited input data could also be created directly with any editor for conversion to fixed field format via 'delim2fix1' or similar uvcopy jobs.

sample input - tf/delimdata

12300|Bill Gates|cr8001|-2500|-175|-150 13500|Steve Jobs|inv1015|124.95|8.75|7.50 14962|Steve Wosniak|inv2024|57550|4029|3453 24595|Jim Unruh|inv2273|2,450.00|171.50|147.00 25669|Thomas Watson|inv3234|1,550.00|108.50|93.00 30144|Presper Eckert|cr9202|-135.00|-9.45|-8.10

fixed record layout required by COBOL program

01-05 - customer number 11-30 - customer name 31-40 - invoice# or credit memo# 41-49 - sales $ amount 51-59 - federal sales tax $amt 61-69 - provincial sales tax $amt 70-70 - linefeed to allow viewing with editor

sample output - for leading signs

 12300     Bill Gates          cr8001    -00002500 -00000175 -00000150
 13500     Steve Jobs          inv1015   000012495 000000875 000000750
 14962     Steve Wosniak       inv2024   000057550 000004029 000003453
 24595     Jim Unruh           inv2273   000245000 000017150 000014700
 25669     Thomas Watson       inv3234   000155000 000010850 000009300
 30144     Presper Eckert      cr9202    -00013500 -00000945 -00000810

sample output - for signs in unit zones

 12300     Bill Gates          cr8001    00000250p 00000017u 00000015p
 13500     Steve Jobs          inv1015   000012495 000000875 000000750
 14962     Steve Wosniak       inv2024   000057550 000004029 000003453
 24595     Jim Unruh           inv2273   000245000 000017150 000014700
 25669     Thomas Watson       inv3234   000155000 000010850 000009300
 30144     Presper Eckert      cr9202    00001350p 00000094u 00000081p
Note
  • COBOL programs probably expect signs in the units position of $ fields
  • see alternate job 'delim2fix2' to create signs in zones of units

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

A2. delim2fix1 - convert free-flow data to fixed fields for cobol applications

2 versions of this demo job

delim2fix1
  • creates amount fields with separate leading signs
delim2fix2
  • creates amount fields with signs in zones of units position
  • resulting in alpha letters for negatives
  • negatives '0123456789' are 'pqrstuvwxy'

converting edited $amounts

The credit sign '-' may be entered anywhere in the field but will be always be output as leading '-' or blank (easily changed if you require trailing or zoned signs.

Any commas & periods in amount fields will be stripped out since the COBOL programs usually do not expect commas & periods in amount fields.

If the data entry people intended whole dollars when the '.' was not present, then you could test for '.' & multiply by 100 if the '.' is not present.

Note
  • see 'customization' discussions following uvcopy job listing ahead
                       ** operating instructions **
 command/queries                                        operator responses

 uvcopy delim2fix1                          - execute uvcopy job delim2fix1
 =================

tf/delimdata = default fili1, ok/rekey ? - null entry to accept default

tmp/fixdata = default filo1 ok/rekey ? - null entry to accept default


 vi tf/delimdata                           - examine input file with editor
 ===============

 vi tmp/fixdata                            - examine output file with editor
 ==============

Actually this demo job has a few added instructions to display the input & output files. The 'vi' instructions could be used at a later time, or you could of course use cat, more, uvlp12, etc to view/print I/O files.

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

A3. delim2fix1 - convert free-flow data to fixed fields for cobol applications

 # delim2fix1 - uvcopy Parameter File from UVSI stored in: /home/uvadm/pf/util/
 # delim2fix1 - convert pipe delimited data to fixed length records
 #            - based on pipe separators in editor entered data
 #
 #usage: uvcopy delim2fix1,fili1=input,filo1=output
 #       ==========================================
 #demo: uvcopy delim2fix1,fili1=tf/dataent,filo1=tmp/datafix
 #      ====================================================
 #
 #     ** test/demo input & expected output **
 #
 # 12300|Bill Gates|cr8001|-2500|-175|-150
 # 13500|Steve Jobs|inv1015|124.95|8.75|7.50
 #
 # 12300     Bill Gates          cr8001    -00002500 -00000175 -00000150
 # 13500     Steve Jobs          inv1015   000012495 000000875 000000750
 #
 #output: 00-09=cust# 10-29=name 30-39=inv# 40-49=sales$ 50-59=GST 60-69=PST
 #
 opr='$jobname - convert pipe delimited data to fixed field length records'
 #rop=r1x2    # Run OPtions to prompt user for outfile display (dflt more)
 fili1=?tf/delimdata,rcs=80,typ=LST
 filo1=?tmp/$jobname.fix,rcs=70,typ=RST
 @run
       opn   all
       msgw  '- enter to display pipe delimited input file'
       sysv1 'cat $fili1'
       msgw  '- enter to execute conversion'
 loop  get   fili1,a0(80)
       skp>  eof
 #
       fix   b0(20),a0(80),6,'|'          convert to fixed via '|' delimiters
 #                                        output 20 bytes apart in area b
       mvc   c0(5),b0                     cust# to output cols 1-5
       mvc   c10(20),b20                  cust name to cols 11-30
       mvc   c30(10),b40                  inv# to 31-40
       mvn   c40(-9z),b60(-12z)           sales $amt to 41-49
       mvn   c50(-9z),b80(-12z)           GST $amt to 51-59
       mvn   c60(-9z),b100(-12z)          PST $amt to 61-69
 #                                        mvn will rt adjust & zero left fill
       put   filo1,c0(70)                 write out current record
       add   $ca1,1                       count records
       add   $ca2,c40(9)                  accumulate amt for total
       skp   loop
 #
 eof   cls   all
 # display EOF record count & total $amt & I/O filenames
       mvfv1  d0(80),'EOF: Records=$ca1, Total$=$ca2, in=$fili1, out=$filo1'
       msg    d0(80)                     display EOF count & total$
       msgw  '- enter to display output (fixed field records)'
       sysv1 'cat $filo1'
       msg '00-09=cust# 10-29=name 30-39=inv# 40-49=sales$ 50-59=GST 60-69=PST'
       eoj

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

A4. delim2fix1 - convert free-flow data to fixed fields for cobol applications

delim2fix1 & delim2fix2

delim2fix1
  • creates amount fields with separate leading signs
delim2fix2
  • creates amount fields with signs in zones of units position
  • resulting in alpha letters for negatives
  • negatives '0123456789' are 'pqrstuvwxy'

The only difference is the following 3 instructions:

     mvn   c40(-9z),b60(-12z)      sales $amt to 41-49
     mvn   c50(-9z),b80(-12z)      GST $amt to 51-59     <-- delim2fix1
     mvn   c60(-9z),b100(-12z)     PST $amt to 61-69
     mvn   c40(9z),b60(-12z)      sales $amt to 41-49
     mvn   c50(9z),b80(-12z)      GST $amt to 51-59      <-- delim2fix2
     mvn   c60(9z),b100(-12z)     PST $amt to 61-69

customizing to your requirements

With this example you should find it easy to create similar jobs for your data entry requirements. Most of the differences will probably be in the editing of the amount & quantity fields.

Please refer to the prmfile listing on the next page & let us discuss some possible changes that you may require. Also see the details of the 'mvn' instruction in uvcopy3.doc.

For example if you wanted to output trailing '-' signs you would change:

     mvn   c40(-9z),b150(-12z)        <-- original
     mvn   c40(9z-),b150(-12z)        <-- changed leading '-' to trailing

If you wanted to assume whole $ unless the '.' present, add the following:

     mvn   c40(-9z),b150(-12z)       --- add following 3 instrns ---
     scn   b150(12),'.'              decimal point present ?
     skp=  1                         yes - skip over next instrn
     mpy   c40(-9z),100              no  - multiply by 100

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

B1. lotus1 - convert fixed length fields to lotus123 import format

This job might be used to convert files from a mainframe or cobol application for input to spreadsheet software packages such as Lotus123.

We will illustrate using customer payment records with following layout:

01-05 - customer number 11-30 - customer name 31-40 - invoice# or credit memo# 41-49 - sales $ amount 51-59 - federal sales tax $amt 61-69 - provincial sales tax $amt 70-70 - linefeed to allow viewing with editor

sample input (tf/datafix)

 13500     Steve Jobs          inv5015   000012495 000000875 000000750
 14962     Steve Wosniak       inv5024   000057550 000004029 000003453
 12300     Bill Gates          cr9001    -00002500 -00000175 -00000150
 24595     Jim Unruh           inv5273   000245000 000017150 000014700
 25669     Thomas Watson       inv1234   000155000 000010850 000009300

sample output - Lotus import format

"13500","Steve Jobs","inv5015","124.95","8.75","7.50" "14962","Steve Wosniak","inv5024","57550","4029","3453" "12300","Bill Gates","cr9001","-2500","-175","-150" "24595","Jim Unruh","inv5273","2,450.00","171.50","147.00" "25669","Thomas Watson","inv1234","1,550.00","108.50","93.00"

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

B2. lotus1 - convert fixed length fields to lotus123 import format

                       ** operating instructions **
 command/queries                                        operator responses

 uvcopy lotus1                           - execute uvcopy with prmfile lotus1
 =============

tf/datafix = default fili1, ok/rekey ? - null to accept default demo data

lotus1.tmp = default filo1 ok/rekey ? - null to accept default outfile

 vi tf/datafix                           - examine input file with editor
 vi lotus1.tmp                           - examine output file with editor
                                    note - in fact this demo will display
                                           the input & output files
                                           (remove for production)

customizing to your requirements

You should find it easy to modify this job to process your files. (Please see the lotus1 prmfile listing on the next page.)

You will modify for your record layouts & you may want to also perform record selection, field selection,& output the fields in different sequences than they appear in your master files.

As an example of record selection, if we wanted to select only credit records more than $ -100.00 we would add the following instructions at the #note1 marker in the lotus1 prmfile.

       cmn   a40(9),-100.00          record => $100.00 credit ?
       skp>  loop                    no - bypass, return to get next

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

B3. lotus1 - convert fixed length fields to lotus123 import format

 # lotus1  - convert fixed field length records to lotus123 import format
 #         - inserts "," between fields & removes trailing blanks
 # - to transfer data from mainframe/cobol applications to spreadsheets
 #
 #      sample input & output (see test/demo file tf/datafix)
 #
 #12300     Bill Gates        inv5001   00245000- 00017150- 00014700-
 #
 #"12300","Bill Gates","inv5001","00245000-","00017150-","00014700-
 #
 opr='$jobname - convert fixed field length records to lotus123 import format'
 fili1=?tf/datafix,rcs=a70,typ=RSF
 filo1=?$jobname.tmp,rcs=c80,typ=LSTt
 #note - option t of typ=LSTt truncates trailing blanks
 @run
       opn   all
 loop  get   fili1,a0(70)
       skp>  eof
 #note1 - you could add record selection coding here (see documentation)
 #note2 - you could select only desired fields from large records
 #        & in your desired sequence
       clr   b0(120),' '                  init area b to all blanks
 # spread out fields into area b 20 bytes apart - in preparation for 'var'
       mvc   b0(5),a0                     cust# to 1st field
       mvc   b20(20),a10                  cust name to 2nd field
       mvc   b40(10),a30                  inv# to 3rd field
       mvc   b60(9),a40                   sales $amt to 4th field
       mvc   b80(9),a50                   GST $amt to  5th field
       mvc   b100(9),a60                  PST $amt to 6th field
       mvc   c0(1),'"'                    insert opening quote for 1st field
       var   c1(79),b0(20),6,'","'        convert to variable format
 #                                        inserting "," & removing blanks
 #note3 - 'var' puts the "," separator between fields & after the last field
       scnr  c0(80),'," '                 scan from right for last separator
       mvc   cx0(2),'  '                  blank out the ," leaving only "
 # - scnr leaves dsplcmnt of ," in rgstr 'x' - see op1 of mvc cx0(2)
       put   filo1,c0(80)                 write out the variable lth record
       skp   loop
 #
 eof   cls   all
 # for this demo - display the small test/demo files (remove for production)
       sysv1 'cat $fili1'                 display input file
       sysv1 'cat $filo1'                 display output file
       eoj

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

C1. lotus2 - convert fixed length fields to lotus123 import format

This job might be used to convert Lotus123 export variable format files to fixed length fields suitable for mainframe or cobol applications.

We will illustrate using customer payment application where the output records must be in the following fixed field length layout:

01-05 - customer number 11-30 - customer name 31-40 - invoice# or credit memo# 41-49 - sales $ amount 51-59 - federal sales tax $amt 61-69 - provincial sales tax $amt 70-70 - linefeed to allow viewing with editor

sample input (tf/datavar)

13500","Steve Jobs","inv5015","124.95","8.75","7.50" 14962","Steve Wosniak","inv5024","57550","4029","3453" 12300","Bill Gates","cr9001","-2500","-175","-150" 24595","Jim Unruh","inv5273","2,450.00","171.50","147.00" 25669","Thomas Watson","inv1234","1,550.00","108.50","93.00"

sample output (fixed field lengths)

 13500     Steve Jobs          inv5015   000012495 000000875 000000750
 14962     Steve Wosniak       inv5024   000057550 000004029 000003453
 12300     Bill Gates          cr9001    -00002500 -00000175 -00000150
 24595     Jim Unruh           inv5273   000245000 000017150 000014700
 25669     Thomas Watson       inv1234   000155000 000010850 000009300

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

C2. lotus2 - convert fixed length fields to lotus123 import format

                       ** operating instructions **
 command/queries                                        operator responses

 uvcopy lotus2                           - execute uvcopy with prmfile lotus2
 =============

tf/datavar = default fili1, ok/rekey ? - null to accept default demo data

lotus2.tmp = default filo1 ok/rekey ? - null to accept output filename

 vi tf/datavar                           - examine input file with editor
 vi lotus2.tmp                           - examine output file with editor
                                    note - in fact this demo job will display
                                           the input & output files
                                           (remove for production)

customizing to your requirements

Please see the lotus2 prmfile listed on the next page.

Using this example as a guide, you should find it easy to create similar jobs to convert data from spreadsheets for input to mainframes, cobol programs, or any application requiring fixed field length records

The instructions following the 'fix' will be modified to conform to your required record layout. Note that the 'mvn' move numeric instruction is capable of converting the character data from the spreadsheet into most formats that your application might require - right adjusting & zero left filling for zoned, packed,or binary output. See the detailed documentation for the mvn instruction in section uvcopy3.doc.

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

C3. lotus2 - convert fixed length fields to lotus123 import format

 # lotus2  - convert lotus123 export format to fixed field length records
 #      - to transfer data from spreadsheets to mainframe/cobol applications
 #
 #      sample input & output (see test/demo file tf/datavar)
 #
 #"12300","Bill Gates","inv5001","-00245000","-00017150","-00014700"
 #
 #12300     Bill Gates        inv5001   -00245000 -00017150 -00014700
 #
 opr='$jobname - convert lotus123 export format to fixed field length records'
 fili1=?tf/datavar,rcs=a80,typ=LST
 filo1=?$jobname.tmp,rcs=c70,typ=RST
 @run
       opn   all
 loop  get   fili1,a0(80)
       skp>  eof
 #
       fix   b0(20),a0(80),6,'","'      convert to fixed via '","' delimiters
 #                                      output fields 20 bytes apart in area b
       rep   b0(20),'"',''              remove opening quote on 1st field
       rep   b100(20),'"',''            remove closing quote on last field
 # - this demo job outputs all fields in the same sequence
 # - when adapting this job to your files you can select only the fields
 #   you desire & in the sequence & format you desire for your record layout
       mvc   c0(5),b0                   cust# to output cols 1-5
       mvc   c10(20),b20                cust name to cols 11-30
       mvc   c30(10),b40                inv# to 31-40
 # use mvn instrn for the $amt fields to ensure rt adjust & zero left fill
 # will allow input amt fields to be max 12 bytes in case of -,. edit symbols
       mvn   c40(-9z),b60(-12z)         sales $amt to 41-49
       mvn   c50(-9z),b80(-12z)           GST $amt to 51-59
       mvn   c60(-9z),b100(-12z)          PST $amt to 61-69
       put   filo1,c0(70)                 write out the fixed lth record
       skp   loop
 #
 eof   cls   all
 # for this demo - display the small test/demo files (remove for production)
       sysv1 'cat $fili1'                 display input file
       sysv1 'cat $filo1'                 display output file
       eoj

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

D1. gentstgl - generate a test data file with packed fields.

This example generates a General Ledger (GL) test file.

The GL# & description were edited into a text file, whose name is supplied to the gentstgl job which generates 36 packed fields for this year, last year,& budgets.

 10000100 CURRENT ASSETS  101.00  102.00  103.00 ..etc.. 136.00
 10000200 FIXED ASSETS    201.00  202.00  203.00 ..etc.. 236.00
 10000300 LIABILITIES     301.00  302.00  303.00 ..etc.. 336.00
        ............... etc (12 records) ...................

The record layout is as follows:

001-008 - gl# 10000100, 10000200, 10000300, etc to 10001200 009-009 - account type code (a,l,r,s,c,e,p) 010-010 - delete code 011-040 - description (assets,liabilities,etc) 041-100 - this year - 12 x 5 byte packed fields 101-160 - last year - 12 x 5 byte packed fields 161-220 - budgets - 12 x 5 byte packed fields 221-255 - unused 256-256 - linefeed for unix tools (packed fields may distort displays)

                       ** operating instructions **
 commands/prompts                                           responses
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 vi tf/gentstgl                        - create text portion of records
                                         (12 records already supplied)

 uvcopy gentstgl                       - copy text portion & generate packed
 ===============                         fields

tf/glmas1 = default input, ok/change ? ---> null to accept

glmast = default output, ok/change ? ---> null to accept


 uvhd glmast                           - examine the generated output file
 ===========                             using the 'uvhd' hexdump utility

See the hexdump display (1st 3 records) on the next page:

See the gentstgl job (prmfile for uvcopy) listed 2 pages ahead:

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

D2. gentstgl - generate a test data file with packed fields.

output - displayed via the uvhd hexdump utility

*** glmast size=3072 mdate=1993093011 today=1993093013

                  1         2         3         4         5         6
         1234567890123456789012345678901234567890123456789012345678901234
       0 10000100A CURRENT ASSETS                ........ ....0....@....P
         3333333342455544524554552222222222222222001100012000130001400015
         100001001035225E4013354300000000000000000000C0000C0000C0000C0000
      64 ....`....p........................ ....0....@....P....`....p....
         0001600017000180001900010000110001200013000140001500016000170001
         C0000C0000C0000C0000C0010C0010C0010C0010C0010C0010C0010C0010C001
     128 .................... ....0....@....P....`....p..................
         8000190001000011000120001300014000150001600017000180001900010000
         0C0010C0020C0020C0020C0020C0020C0020C0020C0020C0020C0020C0030C00
     192 ...... ....0....@....P....`.                                   .
         1100012000130001400015000160222222222222222222222222222222222220
         30C0030C0030C0030C0030C0030C00000000000000000000000000000000000A
                  1         2         3         4         5         6
         1234567890123456789012345678901234567890123456789012345678901234
     256 10000200A FIXED ASSETS                  .. ....  ... 0... @... P
         3333333342445442455455222222222222222222002100022000230002400025
         10000200106985401335430000000000000000000000C0000C0000C0000C0000
     320 ... `... p... .... ....!....!....! ...!0...!@...!P...!`...!p...!
         0002600027000280002900020000210002200023000240002500026000270002
         C0000C0000C0000C0000C0010C0010C0010C0010C0010C0010C0010C0010C001
     384 ....!...."...."...." ..."0..."@..."P..."`..."p..."...."....#....
         8000290002000021000220002300024000250002600027000280002900020000
         0C0010C0020C0020C0020C0020C0020C0020C0020C0020C0020C0020C0030C00
     448 #....# ...#0...#@...#P...#`.                                   .
         2100022000230002400025000260222222222222222222222222222222222220
         30C0030C0030C0030C0030C0030C00000000000000000000000000000000000A
                  1         2         3         4         5         6
         1234567890123456789012345678901234567890123456789012345678901234
     512 10000300T TOTAL ASSETS                  ..0....0 ...00...0@...0P
         3333333352545442455455222222222222222222003100032000330003400035
         10000300404F41C01335430000000000000000000000C0000C0000C0000C0000
     576 ...0`...0p...0....0....1....1....1 ...10...1@...1P...1`...1p...1
         0003600037000380003900030000310003200033000340003500036000370003
         C0000C0000C0000C0000C0010C0010C0010C0010C0010C0010C0010C0010C001
     640 ....1....2....2....2 ...20...2@...2P...2`...2p...2....2....3....
         8000390003000031000320003300034000350003600037000380003900030000
         0C0010C0020C0020C0020C0020C0020C0020C0020C0020C0020C0020C0030C00
     704 3....3 ...30...3@...3P...3`.                                   .
         3100032000330003400035000360222222222222222222222222222222222220
         30C0030C0030C0030C0030C0030C00000000000000000000000000000000000A

q ** quit request - program ended **

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

D3. gentstgl - generate a test data file with packed fields.

 # gentstgl - generate test data file (gl master with 36 packed fields)
 #          - from edited text file of 12 gl#s & descriptions only
 # 001-008 - gl# 10000100, 10000200, 10000300, etc to 10001200
 # 009-009 - account type code (a,l,r,s,c,e,p)
 # 010-010 - delete code
 # 011-040 - description (assets,liabilities,etc)
 # 041-100 - this year - 12 x 5 byte packed fields
 # 101-160 - last year - 12 x 5 byte packed fields
 # 161-220 - budgets   - 12 x 5 byte packed fields
 # 221-255 - unused
 # 256-256 - linefeed for unix tools (packed fields may defeat unix tools)
 #
 # tf/glmas1 - supplied text file of gl#s & descriptions only
 # glmast    - will be generated from glmas1 by this job
 #           - packed field test data generated as follows:
 # 10000100  current assets 101.00   102.00   103.00  ..etc..  136.00
 # 10000200  fixed assets   201.00   202.00   203.00  ..etc..  236.00
 # 10000300  liabilities    301.00   302.00   303.00  ..etc..  336.00
 #
 fili1=?tf/glmas1,rcs=a80,typ=LST
 filo1=?glmast,rcs=b256,typ=RST
 @run
        opn    all
 loop   get    fili1,a0(80)             get text file gl# & dscrptn record
        skp>   eof                      (cc set > at EOF)
        mvc    b0(40),a0                gl# & dscrptn from edited file
        tru    b0(40)                   translate gl dscrptn to UPPER case
        add    $ca1,10000               increment rec count part of pk fields
        mvnx36 b40(5p),100              move 1.00 into all 36 packed fields
        addx35 b45(5p),b40(5p)          add overlap to create 100,200,300,etc
        addx36k0 b40(5p),$ca1           add record counter to all pk fields
 #note - option 'k0' specifies 0 lth incrmnt op2 to add $ca1 to all 36 op 1's
        put    filo1,b0(256)            write out record
        skp    loop                     repeat loop until EOF
 #
 eof    cls    all
        eoj

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

E1. nettime1 - create Internet time report & calculate any overtime

I use this job to create an Internet time & overtime usage report. At the end of the month, I can download the time statistics from my ISP.

sample input - ISP time statistics

Account type: gold Daily time: 90 min. (1.50 hours)

  Logout Date/Time    Time Used    Time Charged
  1997.02.01 08:07       44             44
  1997.02.01 17:30       33             33
  1997.02.02 20:35       23             23
  1997.02.02 21:39       33             33
  1997.02.02 22:02       15             15
  1997.02.02 23:32       89             89
  1997.02.03 16:25       27             27
  1997.02.03 21:33       32             32
  1997.02.03 21:53       20             20
  1997.02.03 23:21       33             33

sample output report

Account type: gold Daily time: 90 min. (1.50 hours)

  Logout Date/Time    Time Used    Time Charged Overtime
  1997.02.01 08:07       44             44
  1997.02.01 17:30       33             33
                                        77 *
  1997.02.02 20:35       23             23
  1997.02.02 21:39       33             33
  1997.02.02 22:02       15             15
  1997.02.02 23:32       89             89
                                       160 *      70 *
  1997.02.03 16:25       27             27
  1997.02.03 21:33       32             32
  1997.02.03 21:53       20             20
  1997.02.03 23:21       33             33
                                       112 *      22 *
                                       349 **     90 **

Please see the uvcopy job listed on the next 2 pages --->

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

E2. nettime1 - create Internet time report & calculate any overtime

 # nettime1 - create internet time report & calculate any overtime
 #          - internet time statistics downloaded from ISP
 #
 #               ** sample input file **
 #
 # Logout Date/Time    Time Used    Time Charged Overtime
 # 1997.02.01 08:07       44             44
 # 1997.02.01 17:30       33             33
 # 1997.02.02 20:35       23             23
 # 1997.02.02 21:39       33             33
 # 1997.02.02 23:32       89             89
 #
 #               ** sample output report **
 #
 # Logout Date/Time    Time Used    Time Charged  Overtime
 # 1997.02.01 08:07       44             44
 # 1997.02.01 17:30       33             33
 #                                       77 *
 # 1997.02.02 20:35       23             23
 # 1997.02.02 21:39       33             33
 # 1997.02.02 23:32       89             89
 #                                      145 *      55 *
 #                                      127 **     55 **
 #
 #required - copy lines to output report file
 #         - accumulate time charged for daily & monthly totals
 #         - calculate any overtime (more than 90 mins/day)
 #         - insert daily total & monthly total lines into report
 #         - you can run the demo as follows:
 #
 #usage: uvcopy nettime1,fili1=tf/nettime1.dat,filo1=tmp/netreport
 #       =========================================================
 #
 #       vi tmp/netreport      - inspect report
 #
 #       uvlp tmp/netreport    - print report
 #
 opr='$jobname - create internet time report & calculate any overtime'
 fili1=?tf/nettime1.dat,typ=LST,rcs=128
 filo1=?tmp/netreport,typ=LSTt,rcs=128
 @run
        opn    all
 # use 'getr' subrtn to get lines with time & copy other lines to report
        bal    getr                  get 1st time record

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

 # begin day total control group
 man20  mvc    c0(80),a0             store 1st rec in grp for day compare
        mvn    $ca1,0                clear day time accumulator
        mvn    $ca2,0                clear day overtime acum
 #
 # process each record
 man30  put    filo1,a0(80)          copy to output report file
        add    $ca1,a32(9)           accumulate for daily total
        bal    getr                  get next record
        cmc    a0(11),c0             day control break ?
        skp=   man30
 #
 # print day totals (& calculate overtime)
 man40  clr    b0(80),' '              clear total line format area
        edt    b34(9),$ca1,'zz,zz9-*'  edit day total
        add    $cb1,$ca1               acum day total for mth total
        mvn    $ca2,$ca1
        sub    $ca2,90                 test for any overtime ?
        skp<   2
        edt    b44(9),$ca2,'zz,zz9-*'  edit overtime total
        add    $cb2,$ca2               acum overtime for mth total
        put    filo1,b0(80)            write day total line to rpt file
        put    filo1,' '               create space after total
        cmc    a0(4),'~EOF'            EOF ?
        skp!   man20                   no - return to begin next day
 #
 # EOF - create final (month) total line, close files,& end job
 man50  clr    b0(80),' '              clear total line format area
        edt    b34(10),$cb1,'zz,zz9-**'  edit time total for month
        edt    b44(10),$cb2,'zz,zz9-**'  edit overtime total for month
        put    filo1,b0(80)              write final total line
        cls    all
        eoj
 #
 #------------------------------------------------------------------------
 # getr subrtn to select 'time' records
 # - write other records to the report file
 getr   get    fili1,a0(128)          get next record
        skp>   getr8                  at EOF go return with cc >
        scnp   a0(15),'####.##.##'    date/time record ?
        skp=   getr8
        put    filo1,a0(80)           no - pass thru to the report file
        skp    getr                   yes - return to get next
 # return (with cc > for EOF, else cc =)
 getr8  ret                           return to caller

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

F1. dropdup1 - drop duplicate records anywhere in file by table of key values

 # dropdup1 - drop duplicate records from a file
 #          - for Fathi at MMC, by Owen June 18/97
 #
 # - 250 byte records with 8 digit ID# starting in column 3 (zero rel 2)
 # - must only be 1 record with the same ID#
 # - duplicate records not necessarily consecutive in file
 # - file is record sequential with packed fields & no LineFeeds
 #   (so editor cannot be used)
 #
 # - duplicate ID#s entered into table below
 #   00-07 - ID#
 #   08-14 - unused (allows longer ID#s for future similar problems)
 #   15-19 - counter for records with this ID# (drop if counter > 1)
 #
 #usage: uvcopy dropdup1                     <- will prompt for ?filenames
 #       uvcopy dropdup1,fili1=xxx,filo1=yyy <- or may enter on command line
 #
 fili1=?input,typ=RSF,rcs=250
 filo1=?output,typ=RSF,rcs=250
 #
 lod=k0(20)
 12345678       00000 <-- counter in 15-19 (can be left blank)
 22222222
 33333333
 --etc--
 ~~~~~~~~~~~~~~~~~~~~ (end of table marker)
 @run
        opn    all               open files
 # begin loop to get/test/drop/write records until EOF
 loop   get    fili1,a0(250)     get current record
        skp>   eof               (cc set > at EOF)
        lok    k0(20),k0(20),a2(8)  look up table for dup ID#s
        skp!   put1              if nomatch - goto output
 # matching ID# found in table - register x points to the matching entry
 # 'kx15(5)' will be used to address bytes 15-19 as a counter for current entry
        add    kx15(5),1         count records with this ID#
        cmn    kx15(5),2         dup ? (2+ records for this ID#)
        skp<   put1              no - go output
        msg    a0(50)            yes - show part of record dropped
        skp    loop                  - bypass output (return to get next)
 put1   put    filo1,a0(250)     write out current record
        skp    loop              return to get next
 #
 #EOF - close files & end job
 eof    cls    all               close files
        eoj                      end job

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

G1. subfix1 - change record field data via table lookup

 # subfix1 - change subscriber numbers via table lookup
 #         - for Dave Jarrett, Maritime Medical
 #         - by Owen Townend, UV Software, Dec 12, 1997
 #
 # Assumptions for this demo - modify as required for actual file
 # input      - rcs=256, fixed rcsz (no linefeeds) typ=RSF
 #            - group# in cols 1-4, subscriber# in cols 5-10
 #            - zero relative byte#s 0(length 4) & 4(length 6)
 # output     - same with subscriber# changed (from right side of table)
 #            - if group# '1234' & if old# found in table (on left side)
 # table file - ASCII text file with Linefeeds (typ=LST)
 #            - old subscriber#s in cols 1-6 & new sub#s in cols 8-13
 #              (leaving 1 blank between for data entry convenience)
 #            - table file prep with editor & read here as input #2
 # old#   new#
 #123456 654321  <-- table format (old# cols 1-6, new# cols 8-13)
 #222222 700002      (zero relative byte#s 0(length 6) & 7(length 6)
 #999999 ??????    - max 10,000 entries (see was=h14000 below)
 #
 was=h140000   # assign area h for table, 10,000 entries x 14 bytes each
 fili1=?dat1/custmas1,typ=RSF,rcs=256       # input Rec Seqntl Fixed
 filo1=?tmp/custmas2,typ=RSF,rcs=256      # output same as input
 fili2=?tf/subtbl1,typ=LST,rcs=80         # using 1st 14 bytes of each record
 @run
        opn    all                  open files
        rtb    fili2,h0(14),h0(14)  read table into area h
 #
 # begin loop for each record (read,lookup new#,modify,output) until EOF
 man20  get    fili1,a0(256)        get a record
        skp>   eof                  (cc set > at EOF)
 #
 # move input area 'a' to area 'b', so we can modify without destroying input
 # (not required for this job, could modify in 'a' & put from 'a')
        mvc    b0(256),a0           move input rec to output area
 #
 # lookup table of old/new subscriber#s, but only if group# '1234' ?
        cmc    a0(4),'1234'         group# 1234 ?
        skp!   man28
        lok    h0(14),h0(6),a4(6)   subscriber# match table to record ?
        skp!   man28
        mvc    b4(6),hx7            store new subscribe# in outrec
 #note - rgstr 'x' points to the matching table entry
 # - displacement '7' (of hx7) addresses column 8 (new sub# in matching entry)
 #
 # common output (matched or unmatched)
 man28  put    filo1,b0(256)        write out current record
        skp    man20                return to get next record
 #
 # EOF - close files & end job
 eof    cls    all
        eoj

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

H1. splitting 1 file into multiple files depending on a control field

split1
  • split 1 file into multiple files, based on a control field
    within the records (ID#, dept#, state/province, cust#,etc)
  • this is a DEMO job to illustrate the technique
  demo - split ~uvadm/dat1/custmas2 into multi files by province (cols 78-79)
       - use the province codes as the output filenames in a specified subdir
  130140  EVERGREEN MOTORS LTD.    1815 BOWEN ROAD          NANAIMO       BC
  132588  GEECOE GENERATOR SERVICE UNIT 170 - 2851 SIMPSON  RICHMOND      BC
  223240  NICHOLSON CHEVROLET LTD. 7215 ARGYLL ROAD         EDMONTON      AL
  308685  FOOTHILLS ELECTRIC       3932 - 3A ST. N.W.       CALGARY       AL

  usage: uvcopy split1,fili1=dat1/custmas2,fild1=tmp     <-- try this
         =========================================

split2 vs split1

split2
  • is an alternate version of split1 (see above)
  • split1 assumed input file already sorted on province code, which
    it was not & therefore output files incorrect (lost records).
  • split2 includes a sort prior to the file split logic.
  • also illustrates using a subrtn to format outfile name & open.

  usage: uvcopy split2,fili1=dat1/custmas2,fild1=tmp
         =========================================

alternative to split2 - use uvsort prior to split1, as follows:


   1. uvsort "fili1=dat1/custmas2,rcs=200,typ=LSTt,filo1=tmp/cm2,key1=77(2)"
      ====================================================================
   2. uvcopy split1,fili1=tmp/cm2
      ===========================

See listings of split1 & split2 on the following pages --->

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

H2. splitting 1 file into multiple files depending on a control field

 # split1 - split 1 file into multiple files, based on a control field
 #          within the records (ID#, dept#, state/province, cust#,etc)
 #        - this is a DEMO job to illustrate the technique
 #
 #demo - split ~uvadm/dat1/custmas2 into multi files by province (cols 78-79)
 #     - use the province codes as the output filenames in a specified subdir
 #
 #130140  EVERGREEN MOTORS LTD.    1815 BOWEN ROAD          NANAIMO       BC
 #132588  GEECOE GENERATOR SERVICE UNIT 170 - 2851 SIMPSON  RICHMOND      BC
 #223240  NICHOLSON CHEVROLET LTD. 7215 ARGYLL ROAD         EDMONTON      AL
 #308685  FOOTHILLS ELECTRIC       3932 - 3A ST. N.W.       CALGARY       AL
 #
 #usage: uvcopy split1,fili1=dat1/custmas2,fild1=tmp
 #       =========================================
 #note - input records are 128 bytes long, this demo will shorten to 80 bytes
 #     - could do other reformatting desired at the '----' point marked below
 #
 fili1=?dat1/custmas2,typ=LST,rcs=256
 fild1=?tmp,typ=DIR,rcs=80
 filo1=xxxxx,typ=LSTt,rcs=80
 @run
        opn    fili1                  open input file
 # get 1st rec, & open 1st output file, using province of 1st rec
        get    fili1,a0               get 1st rec
        skp>   eof                    (test EOF in case empty file)
        mvc    d0(80),$fild1          format output file name dir+
        cata8  d0(80),'/'             dirname + / separator
        cata8  d0(80),a77(2)           + province code
        mvc    $filo1,d0              store 1st output filename
        opn    filo1
 #
 # begin loop: copy records, test break on province, ifso close/open file
 man20  mvc    b0(80),a0              copy inrec to outrec area (shorten to 80)
 #      ---    ----,----              other reformats in area b ???
        put    filo1,b0
        mvc    c0(80),a0              save current record for ctlbreak test
        get    fili1,a0               get next record
        cmc    a77(2),c77             ctl break on province code ?
        skp=   man20
 #
 # ctl break - close current file, open next file
 # - 1st check for EOF which would force ctl break
        cmc    a0(4),'~EOF'           EOF ?
        skp=   eof
        cls    filo1                  close current file
        mvc    d0(80),$fild1          format output file name dir+
        cata8  d0(80),'/'             dirname + / separator
        cata8  d0(80),a77(2)           + province code
        mvc    $filo1,d0              store new output filename
        opn    filo1
        skp    man20
 #
 # EOF - close files & endjob
 eof    cls    all
        eoj

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

I1. splitting 1 file into multiple files depending on a control field

 # split2 - split 1 file into multiple files, based on a control field
 #          within the records (ID#, dept#, state/province, cust#,etc)
 #        - this is a DEMO job to illustrate the technique
 #
 #demo - split ~uvadm/dat1/custmas2 into multi files by province (cols 78-79)
 #     - use the province codes as the output filenames in a specified subdir
 #
 #130140  EVERGREEN MOTORS LTD.    1815 BOWEN ROAD          NANAIMO       BC
 #132588  GEECOE GENERATOR SERVICE UNIT 170 - 2851 SIMPSON  RICHMOND      BC
 #223240  NICHOLSON CHEVROLET LTD. 7215 ARGYLL ROAD         EDMONTON      AL
 #308685  FOOTHILLS ELECTRIC       3932 - 3A ST. N.W.       CALGARY       AL
 #
 #usage: uvcopy split2,fili1=dat1/custmas2,fild1=tmp
 #       =========================================
 #
 #NOTE - this (split2) is an alternate version of split1 (see prior job)
 #     - split1 assumed the input file was already sorted on province code
 #       which it was not & therefore output files incorrect (lost records)
 #     - this job includes a sort prior to the file split logic
 #     - also illustrates using a subrtn to format outfile name & open
 #
 # alternative to this job (split2)
 # - use uvsort prior to split1, could perform as follows:
 #
 # 1. uvsort "fili1=dat1/custmas2,rcs=200,typ=LSTt,filo1=tmp/cm2,key1=77(2)"
 # 2. uvcopy split1,fili1=tmp/cm2
 #
 fili1=?dat1/custmas2,typ=LST,rcs=256
 fild1=?tmp,typ=DIR,rcs=80
 filo1=xxxxx,typ=LSTt,rcs=80
 @run
        opn    fili1                  open input file
        sxo    80,'77(2)'             open sort (sort on province)
 #
 # read input file & put to the sort
 man10  get    fili1,a0               get a record
        skp>   eof1                   (cc set > at EOF)
        sxp    a0(80)                 put to the sort (1st 80 bytes)
        skp    man10                  repeat loop until EOF
 #
 # now execute the sort
 eof1   sxs
 #
 # get records from the sort & split to multi-files depending on province code
 # get 1st rec & use province code as name for 1st output file
        sxg    a0(80)                 get record from the sort
        bal    reopn                  call subrtn to create filename & open

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

 # begin loop getting recs from sort until EOF
 man20  mvc    b0(80),a0              copy sortrec to outrec area
 #      ---    ----,----              other reformats in area b ???
        put    filo1,b0               write to current output file
        mvc    c0(80),a0              save current record for ctlbreak test
        sxg    a0(80)                 get next record from the sort
        skp>   eof2                   (cc set > if no more records)
        cmc    a77(2),c77             ctl break on province code ?
        skp=   man20
 # ctl break - close current file, open next file
        cls    filo1                  close current file
        bal    reopn                  call subrtn to create filename & open
        skp    man20
 #
 # EOF - close files & endjob
 eof2   cls    all
        eoj
 #--------------------------------------------------------------------------
 # reopn - subrtn to create new filename & re-open the new file
 #       - common subrtn, called from 2 points in mainline
 reopn  mvc    d0(80),$fild1          format output file name dir+
        cata8  d0(80),'/'             dirname + / separator
        cata8  d0(80),a77(2)           + province code
        mvc    $filo1,d0              store new output filename
        opn    filo1                  open new filename
        ret                           return to caller

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

J1. chain1 - demonstrate random reads to an Indexed file

 # chain1 - demonstrate random reads to an Indexed file
 #
 #given: 1. sequential sales detail file with cust#, etc
 #       2. indexed customer master file (indexed by cust#)
 #
 #required:
 # - read sales file sequentially
 # - randomly read the customer master file, using cust# from sales file
 # - retrieve cust name from master record & append to end of sales record
 # - write out new extended sales detail record
 # - following shows 1st sales rec, matching custmas, & output with custname
 #
 #salesin:  130140 21 940802 IN111001  HAM001  000020
 #:custmas: 130140 EVERGREEN MOTORS LTD.    1815 BOWEN ROAD     NANAIMO
 #
 #salesout: 130140 21 940802 IN111001  HAM001  000020  EVERGREEN MOTORS LTD.
 #
 #demo:
 # 1. mkdir tmp (or rm tmp/*)   # make tmp dir, or remove existing files
 #
 # 2. uvcp "fili1=dat1/custmas2,rcs=128,typ=RSF,filo1=tmp/cm2,typ=ISF,isk1=0(6)"
 #                              # load customer master to ISAM file
 #
 # 3. uvcopy chain1,fili1=dat1/sales2,filr1=tmp/cm2,filo1=tmp/sales2x
 #                              # run demo job to extend sales with cust names
 #
 # 4. vi tmp/sales2x            # inspect output, observe cust name appended
 #
 fili1=dat1/sales2,rcs=64,typ=RSF
 filr1=tmp/cm2,rcs=128,typ=ISF
 filo1=tmp/sales2x,rcs=100,typ=RST
 @run
        opn    all
 #
 # begin loop: get sales recs, chain to custmaster, write sales with custnames
 loop   get    fili1,a0
        skp>   eof
        mvf    b0(100),a0(64)           move sales rec to outarea & clr extra
 #
        clr    c0(128),' '              clear custmas rec area
        mvc    c0(6),a0                 store cust# from sales dtl
        redm5  filr1,c0(256)            read custmas option m5=read key equal
        mvc    b64(25),c10              move cust name from master to detail
        put    filo1,b0                 write dtl rec with custname extension
        skp    loop
 #
 # EOF - close files & end job
 eof    cls    all
        eoj

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

K1. chain2 - uvcopy job to demo ISAM file updates (read/write/update)

 # chain2 - uvcopy job to demo ISAM file updates (demo job in uvcopy5.doc)
 #
 # Illustrates use of ISAM file read/write/update commands
 #          - see instructions documented in uvadm/doc/uvcopy3.doc
 # 1. redm5 - read key equal (cc set = if key found, unequal if not)
 # 2. wrt   - write new record
 # 3. upd   - update/rewrite existing record
 #
 # interactive job to update a simple ISAM customer name & address file
 #
 # 00-03 - customer# (ISAM file key)
 # 05-78 - name & address (free format)
 # 79-79 - reserved for x'0A' end ISAM rec (logical rcs=79, physical rcs=80)
 #
 # you may init an empty ISAM file & update it as follows:
 #
 # 1. makeISF0 tmp/names 79 0,4         - create empty ISAM file
 #    =========================         - see script uvadm/sf/makeISF0
 #
 # 2. uvcopy chain2,filr1=tmp/names     - interactive uvcopy add/update
 #    =============================     - sample records as follows:
 #
 #    0010 Owen Townsend, 4667 Hoskins Rd, North Vancouver BC, Canada V7K2R3
 #    0020 Jean Chretien, 24 Sussex Dr, Ottawa ON, Canada
 #
 # chain2 will solicit updates, you may respond as follows:
 #
 # 1. enter cust# with name/address - creates new record if cust# not on file
 # 2. enter cust# with name/address - updates existing N&A if already onfile
 # 3. enter cust# only - displays existing N&A, or errmsg if not onfile
 #
 filr1=tmp/names,rcs=79,typ=ISF,isk1=0(4)     # declare ISAM file
 @run
        opn    all
 #
 # begin loop to solicit cust# & name/address until null reply
 man20  msg    'enter cust# (4 digits) + name&address to add or update'
        msg    'enter cust# (4 digits) ONLY to display existing records'
        msgwa1 'enter null to end job'
        skp<   eof                  cc set < if null entry
 #
        mvc    b0(79),$arg1         store entry in are 'b'
        cmcp   b0(4),'####'         cust# valid 4 digits ?
        skp=   man24
        msg    '*** cust# INVALID (not 4 digits)
        skp    man20
 #
 # if cust# only - display existing record
 man24  cmc    b5(20),' '            any name & address entered ?
        skp!   man30
        redm5  filr1,b0(79)          read by cust#
        skp=   1
        mvf    b10(30),'<-- cust# NOT on file'
        msg    b0(79)                show existing record (or errmsg)
        skp    man20

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

 # name & address entered, add if cust# not onfile, update if already in file
 man30  redm5  filr1,b0(79)          read by cust#
        skp=   man34
        wrt    filr1,b0(79)          write new record in indexed file
        mvf    b70(9),'ADDED'
        msg    b0(79)                show new record
        skp    man20                 return to get next input
 #
 # cust# already on file - update/rewrite it now
 man34  mvc    b0(79),$arg1          replace existing with new entry
        upd    filr1,b0(79)          update existing cust#
        mvf    b70(9),'UPDATED'
        msg    b0(79)                show updated record
        skp    man20                 return to get next input
 #
 # EOF (on null entry) - close files & end job
 eof    cls    all
        msg    '----------- endjob display demo file contents ------------'
        sysv1  'cat $filr1'
        eoj

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

L1. copydir1 - copy all files in 1 directory to a 2nd directory

 # copydir1 - uvcopy Parameter File from UVSI stored in: /home/uvadm/pf/demo/
 # copydir1 - copy all files from 1 directory to a 2nd directory
 #          - copies files with no changes (except removing trailing blanks)
 #          - you may modify output by inserting instructions at man30 below
 # copydir2 - alt job copies all files from 1 dir into 1 COMBINED OUTPUT FILE
 #
 #usage: uvcopy copydir1,fild1=indir,fild2=outdir
 #       ========================================
 #
 # copydir1 is intended as a framework to be copied/renamed/modified
 opr='$jobname - copy all files in 1 dir to a 2nd dir
 fild1=?indir,typ=DIR,rcs=80           #input directory
 fili1=xxxxxxxx,typ=LST,rcs=4096       #current input file from directory
 fild2=?tmp,typ=DIR,rcs=80             #output directory
 filo2=xxxxxxxx,typ=LSTt,rcs=4096      #current output file
 fili3=tmp/infiles,typ=LST,rcs=256     #file of input filenames
 @run
        opn    fild1                    open input directory
        msgwy 'did you create empty outdir (or remove all files)'
        opn    fild2                    open output directory (must exist)
        mvfv1t1 s0(80),'ls $fild1 >tmp/infiles'  expand $fild1
        sys    s0(80)                   create file of filenames (in sequence)
        opn    fili3                    open file of filenames
 #
 # begin outer loop to read directory for next filename
 man10  get    fili3,a0(80)             get next record (filename) in directory
        skp>   man90                    (cc set > at EOD)
 #
 # create input filename by concat: indir/infile & open
        clr    f0(300),' '
        mvu    f100(80),$fild1,x'00'    move dirname until ending null
        cat    f100(80),'/'             concat the '/'
        cata8  f100(80),a0(80)          concat current filename (a8 null terms)
        mvc    $fili1,f100              store input filename before open
        opn    fili1                    open current input file
 # create same filename in output subdir & open
        mvu    f200(80),$fild2,x'00'    move output dirname until null reached
        cat    f200(80),'/'             concat the '/'
        cata8  f200(80),a0(80)          concat current filename (a8 null terms)
        mvc    $filo2,f200              store output filename before open
        opn    filo2                    open current output file
 #

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

 # begin inner loop: get/put records from/to current file until EOF
 man20  get    fili1,b0(4096)           get each record into area 'b'
        skp>   man80
        mvc    d0(4096),b0              copy input area to output area
 man30  nop
 # --- INSERT YOUR INSTRUCTIONS HERE TO MODIFY RECORDS AS DESIRED ---
 #      ...    d..,...              <-- insert instructions to modify output
        put    filo2,d0(4096)           output record
        skp    man20
 #
 # EOF current file - output counts, close files,& return for next file pair
 man80  cls    fili1                    close current input file
        cls    filo2                    close current output file
        skp    man10
 #
 # end input directory - display stats, close all dirs & files, & eoj
 man90  cls    all
        eoj

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

L2. parmnullfix4 - copy all files, blank nulls, clear 73-80

 # parmnullfix4 - uvcopy Parameter File from UVSI stored in: /home/uvadm/pf/util/
 # parmnullfix4 - copy all files in 1 directory to a 2nd directory
 #              - converting any nulls to blanks & clearing cols 73-80
 # See UV Software newsletter https://uvsoftware.ca/news/parmfilenulls.htm
 #
 # uvcopy parmnullfix4,fild1=indir,fild2=outdir   <-- usage
 # ============================================
 #              - also see other scripts to perform similar functions
 # parmnullfix1 - script copy all files, blank nulls, using 'sed'
 # parmnullfix2 - script copy all files, blank nulls, clear 73-80, using 'uvcp'
 # parmnullfix3 - uvcopy job blank nulls & clear cols 73-80 - 1 file at a time
 #*parmnullfix4 - uvcopy job blank nulls & clear cols 73-80 - All files in directory
 #
 # copydir1 - uvcopy framework for jobs to copy all files from 1 directory to a 2nd
 #          - see copydir1 listed at https://uvsoftware.ca/uvcopy5.htm#L02
 #          - copied/renamed/modified to create parmnullfix4
 # parmnullfix4 - 2 instructions (clr & rep) inserted below at man30 ...
 #
 opr='$jobname - copy all files blanking nulls & clearing cols 73-80'
 fild1=?indir,typ=DIR,rcs=80           #input directory
 fili1=xxxxxxxx,typ=LST,rcs=4096       #current input file from directory
 fild2=?tmp,typ=DIR,rcs=80             #output directory
 filo2=xxxxxxxx,typ=LSTt,rcs=4096      #current output file
 fili3=tmp/infiles,typ=LST,rcs=256     #file of input filenames
 @run
        opn    fild1                    open input directory
        msgwy 'did you create empty outdir (or remove all files)'
        opn    fild2                    open output directory (must exist)
        mvfv1t1 s0(80),'ls $fild1 >tmp/infiles'  expand $fild1
        sys    s0(80)                   create file of filenames (in sequence)
        opn    fili3                    open file of filenames
 #
 # begin outer loop to read directory for next filename
 man10  get    fili3,a0(80)             get next record (filename) in directory
        skp>   man90                    (cc set > at EOD)
 #
 # create input filename by concat: indir/infile & open
        clr    f0(300),' '
        mvu    f100(80),$fild1,x'00'    move dirname until ending null
        cat    f100(80),'/'             concat the '/'
        cata8  f100(80),a0(80)          concat current filename (a8 null terms)
        mvc    $fili1,f100              store input filename before open
        opn    fili1                    open current input file
 # create same filename in output subdir & open
        mvu    f200(80),$fild2,x'00'    move output dirname until null reached
        cat    f200(80),'/'             concat the '/'
        cata8  f200(80),a0(80)          concat current filename (a8 null terms)
        mvc    $filo2,f200              store output filename before open
        opn    filo2                    open current output file
 #
 # begin inner loop: get/put records from/to current file until EOF
 man20  get    fili1,b0(4096)           get each record into area 'b'
        skp>   man80
        mvc    d0(4096),b0              copy input area to output area
 man30  nop
 # --- INSERT YOUR INSTRUCTIONS HERE TO MODIFY RECORDS AS DESIRED ---
 # -------- instructions to clear cols 73-80 & convert any nulls to blanks
        clr    d72(28),' '              clear cols 73-80
        rep    d0(256),x'00',x'20'      convert any nulls to blanks
 # -------------------------------
        put    filo2,d0(4096)           output record
        skp    man20
 #
 # EOF current file - output counts, close files,& return for next file pair
 man80  cls    fili1                    close current input file
        cls    filo2                    close current output file
        skp    man10
 #
 # end input directory - display stats, close all dirs & files, & eoj
 man90  cls    all
        eoj

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

M1. cmdcml - subrtn to compare character fields with decimal points

cmdcml
  • subrtn to compare character fields with decimal points
  • allowing different no of decimal points in the 2 fields
  • allowing commas, signs, blanks (before &/or after)
  • respecting '-' sign anywhere within specified fields
pf/cmdcmlT
  • uvcopy job to test the cmdcml subrtn
  • '@pf2=cmdcml' at end of cmdcmlT loads the subrtn when
    cmdcmlT job is loaded
tf/cmdcmlF
  • test file provided for cmdcmlT
 Note - this is a good example of how to write subrtns called by the
       '@pf2=xxxxxx' method

We will illustrate by listing the above 3 files as follows:

  1. tf/cmdcmlF - test file on this page
  2. pf/cmdcmlT - test uvcopy job on next page
  3. pf/cmdcml - the sub-routine, 2 pages ahead

    tf/cmdcmlF - test data file

 # cmdcmlF - test data file for cmdcmlT (uvcopy job to test cmdcml subrtn)
 #         1         2         3         4         5
 #12345678901234567890123456789012345678901234567890
 #                              should-be test-result
   123,456.78           12.5        >         ?
         1.23            1.3        <         ?
     1.23                  1.23     =         ?
       1.3            1.2345        >         ?
     -1.3              1.2345       <         ?
     123.00           123           =         ?

 uvcopy cmdcmlT,fili1=tf/cmdcmlF     <-- execute test job on test file
 ===============================

See the test job (pf/cmdcmlT) listed on the next page --->

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

M2. cmdcml - subrtn to compare character fields with decimal points

pf/cmdcmlT - uvcopy job to test cmdcml subrtn

 # cmdcmlT - uvcopy job to test 'cmdcml' subrtn
 #         - compare char fields with dcml places that may be different
 #         - test data file in /home/uvadm/tf/cmdcmlF
 #           has field#1 in 0(14) & field#2 in 20(10)
 #         - see more dscrptn in /home/uvadm/pf/cmdcml
 #
 # uvcopy cmdcmlT,fili1=tf/cmdcmlF     <-- execute test job on test file
 # ===============================
 #
 fili1=tf/cmdcmlF,typ=LST,rcs=80
 filo1=$jobname.tmp,typ=LSTt,rcs=80
 @run
        opn    all
 #
 # begin loop to get test data, compare & store = < > on right side
 loop   get    fili1,a0(80)
        skp>   eof
        cmc    a0(1),'#'               #comment ?
        skp=   put1
 #
        mvc    a45(1),'='              presume equal
 bal    bal    cmdcml,a0(14),a20(10)   call subrtn to compare & set cc
        skp=   put1
        skp>   gt
 #
 # less than, store '<' to override '=' presumption
 lt     mvc    a45(1),'<'
        skp    put1
 #
 # greater than, store '>' to override '=' presumption
 gt     mvc    a45(1),'>'
 #
 # common point to write out test record with = < > on right side
 put1   put    filo1,a0(80)
        skp    loop
 #
 # EOF - close files & display results (via 'sys/cat' instrns)
 eof    cls    all
        sysv1  'cat $filo1'
        eoj
 #
 #NOTE - following line will load the subrtn when uvcopy job loaded
 @pf2=cmdcml

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

M3. cmdcml - subrtn to compare character fields with decimal points

pf/cmdcml - the subrtn

 # cmdcml - subrtn to compare character fields with decimal points
 #        - allowing different no of decimal places (including none)
 #        - allowing numeric digits to be anywhere in specified field
 #        - allowing blanks before &/or after
 #        - commas & other non-digits will be ignored
 #        - will respect '-' negative indicator anywhere in field
 #
 #   bal  cmdcml,op1,op2            <-- format
 #   bal  cmdcml,a0(14),a20(10)    <-- example
 #          1         2         3         4
 #01234567890123456789012345678901234567890
 #__12,345.67___      ___12.5____    <-- sample data fields ('_' = blank)
 #______12345.67      ______12.50    <-- will adjust to same no of decimals
 #                                       before comparison
 #note - bal stores data from op1 & op2 at w0(max200) & w200(max200)
 # op1 right adjust in 20 bytes, calc decimal places,& append '0's to shorter
 cmdcml  mvn    $rj,19           op1 dcml pt rgstr j = 19 (max if no '.' found)
         sqzr   w0(20),' '       squeeze op1 right in 20 bytes
         scn    w0(20),'.'       scan for dcml pt ($rx = 19 if not found)
         skp=   1
         mvn    $rx,19           no dcml pt, set rgstr x=19 to force j=0
         sub    $rj,$rx          calc dcml places for op1 in rgstr 'j'
 #
 # op2 right adjust in 20 bytes, calc decimal places,& append '0's to shorter
         mvn    $rk,19           op1 dcml pt rgstr k = 19 (max if no '.' found)
         sqzr   w200(20),' '     squeeze op1 right in 20 bytes
         scn    w200(20),'.'     scan for dcml pt ($rx = 19 if not found)
         skp=   1
         mvn    $rx,19           no dcml pt, set rgstr x=19 to force k=0
         sub    $rk,$rx          calc dcml places for op2 in rgstr 'k'
 #
 # calc dcml places difference & insert '0's in shorter operand to equalize
         sub    $rj,$rk          op1dcmls - op2dcmls = difference
         skp=   cmdcml6
         skp>   cmdcml5
 #
 # op1dcmls < op2dcmls, append difference zeros onto op1
 cmdcml4 mpy    $rj,-1           convert diff negative# to positive#
         clr    w20($rj10),'0'   append zeros to op1 (length in rgstr j)
         skp    cmdcml6          goto common point
 #
 # op1dcmls > op2dcmls, append difference zeros onto op2
 cmdcml5 clr    w220($rj10),'0'  append zeros to op2 (length in rgstr k)
 #
 # common point (dcmls = > or <), convert to numeric & compare
 cmdcml6 mvn    $ca21,w0(30)     convert op1 to numeric binary
         mvn    $ca22,w200(30)   convert op2 to numeric binary
         cmn    $ca21,$ca22      compare & set condition code
         ret                     return to caller (will test cc)
 #

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

Visitor Counters for ThisYear and LastYear