uvqrpg - report writer for the Vancouver Utilities - CONTENTS

A1. Introduction & Overview
A2.  Replacements for mainframe Ditto, Easytrieve, QuikJob, etc
B1. Preliminary EXample#1 (qrpgEX1)
- sales analysis by customer within salesman
B3.  Preliminary EXample#2 (qrpgEX2)
- same as example#1, but illustrates 'table summaries'
  (an extremely powerful feature of uvqrpg).
B5.  Preliminary EXample#3 (qrpgEX8)
- illustrates Delimited file input (timecard file delimited by pipes)
C1. PFPATH environmental variable for uvqrpg to find its parameter files
D1. File declarations & Command lines
E1. File Pre-Sorting & Record Selection
sort - sort input file prior to report phase
keep - select records during sort input
drop - drop records during sort input
  (keep & drop are mutually exclusive)
F0. uvqrpg report functions (unique to uvqrpg)
F1. head - declare page headings
F2. foot - declare page footings
F3. ctl - declare control level fields
F5. ref - declare reference fields (non-ctl, non-acum)
F7. acum - declare fields to be accumulated
F10. table - declare summary tables to be accumulated & dumped at EOF
G1. '@' tags unique to uvqrpg (no equivalents in uvcopy)
 @bgnj
 @bgnl8,@bgnl7,@bgnl6,@bgnl5,@bgnl4,@bgnl3,@bgnl2,@bgnl1
 @dtl
 @ttll1,@ttll2,@ttll3,@ttll4,@ttll5,@ttll6,@ttll7,@ttll8
 @eoj
 @ovf,@pf2
H1. Instruction summary (most are common with uvcopy)
I1. Instructions unique to uvqrpg
I1. hdr - execute page heading subrtn
I2. ftr - execute page footing subrtn
J0. Work areas unique to uvqrpg
J1. h - page heading storage areas (8 headings max 500 bytes each)
J1. f - page footing storage area (8 footings max 500 bytes each)
J2. a - record input read area
J2. p - print area for fields declared on head1 (the usual)
J2. g - fixed field area, used if option 'g#' declares # of delimited fields
J3. m - print area for fields declared on head9 (for a 2nd detail line)
J3. r - prior record storage area (useful at @ttl times)
J4. q - $symbol storage area
J6. s - control level field storages (current & next)
J7. t - total accumulator storage (8 levels * 100 acums * 4 bytes each)

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

uvqrpg - report writer for the Vancouver Utilities - CONTENTS

K1. $symbols - most are same as uvcopy ($date1, etc)
 $symbols unique to uvqrpg ($page,etc)
 total acums: $t101,$t102, etc to: $t199
  - - - etc - - -
  $t801,$t802, etc to: $t899
L0. Options & option coding rules
L1.  Run options, example: rop=a1b2...z9999,etc
L2.  User options, example: uop=a1b1,etc, test via: $uopca-$uopcz,etc
L3.  File TYP options, example: typ=LSTtw2

More EXamples to illustrate various features

M1. qrpgEX1 - sales analysis by customer within salesman
M2. qrpgEX2 - same as qrpgEX1, with the addition of 'table summaries'
- an extremely powerful feature of uvqrpg
M2. qrpgEX3 - same as EX1, with customized total descriptions
M3. qrpgEX4 - similar to EX1, but illustrates several powerful features
- sorts the input file prior to the report
- indexed file used to retrieve customer names
- uvcopy instructions to calc qty*price, avg price,
- summary tables by salesman & product, dumped at end job
M4. qrpgEX5 - 12 months sales across, by customer, province & final.
M6. qrpgEX6 - accumulator selection at detail record time
M7. qrpgEX7 - illustrate printing 2 detail lines for each record
- will print Name & Address on 2 lines (for portrait 8 1/2 x 11)
M8. qrpgEX8 - illustrate Delimited file input (timecards delimited by '|' pipes)
- indicated by fili=...,typ=LSTg# g# = value of delimiter character

Yet More EXamples to illustrate more features

N1. qrpgEX91 - summary reports - inhibit detail, print only on total breaks
N2. qrpgEX92 - multi-part control fields (split control keys)
N3. qrpgEX93 - build summary tables in memory for printing at EOF, using uvqrpg
N4. copyEX93 - build summary tables in memory for printing at EOF, using uvcopy
N5. qrpgEX94 - Illustrate @get user own code to get next record
- allows you to bypass undesired records or modify record layout
 O1. Comparison: uvqrpg vs uvcopy
    - comparison listings of qrpgEX1 & copyEX1
P1. Converting EasyTrieve to uvcopy
Q1. Converting EasyTrieve to uvqrpg
R1. Converting Delimited files to Fixed length Fields for uvqrpg
genfixv1 - generate control record of largest field sizes by scanning data
genfixv2 - recalc field displacements after modifying lengths in ctl rec
genfixv3 - auto generate uvcopy job to convert delimited to fixed fields
genfixv4 - auto generate uvqrpg job to create report from fixed field file
- may then easily customize as desired

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

A1. 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 'QuikJob', 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 page Footings, with options to underline, overline, space1,2,3, etc.

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

  12. Please see the preliminary examples on the next few pages. Note that example #1 creates a sales analysis with totals by customer, salesman,& final - with just 12 lines of code.

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

A2. uvqrpg: Replacements for Mainframe Easytrieve, QuikJob, etc

uvcopy and uvqrpg have proven to be effective tools assisting conversion from IBM mainframes to a UNIX systems. uvcopy & uvqrpg can replace the functions of various Mainframe utilities such as Ditto, Easytrieve, Quickjob, etc. To save you from having to recode easytrieve & QuikJob, converters are supplied to perform this automatically.

Conversion of EasyTrieve

There are 2 versions of the easytrieve converter:

  1. ez2uvcopy - converts easytrieve jobs to uvcopy jobs - use ez2uvcopy if the easytrieve job's primary function was to reformat data files.

  2. ez2uvqrpg - converts easytrieve jobs to uvqrpg jobs - use ez2uvqrpg if the easytrieve job's primary function was to create a report.

Note that the conversion jobs are written in uvcopy, since uvcopy is intended primarily as a data manipulation tool, rather than uvqrpg which is intended primarily as a report writer utility.

Conversion to QuikJob

The QuikJob converter is much more extensive than the EasyTrieve converter, and is documented in a separate section QuikJob.htm. The quikjob2 converter has an option to convert to uvcopy or uvqrpg. I recommend you mass convert all mainframe quikjobs to both in separate interim subdirs & then select the 'best fit' to your unix quikjob subdir, depending on whether the job is more file manipulation or more report.

uxqrpg alternate version of uvqrpg

uxqrpg is an alternate version of uvqrpg to support Micro Focus COBOL IDXFORMAT3 Record Sequential Variable & Indexed Sequential Variable length files. See file typ=RSV & typ=IDX on page 'D1' in this uvqrpg.doc.

uxqrpg must be compiled with Micro Focus COBOL server express v2.2 or higher. It is therefor only applicable to Micro Focus COBOL customers. See compile instructions on page D1 of install.htm#D1.

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

B1. Preliminary Example - qrpgEX1

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

dat1/sales4 - test/demo data

 sl# cust#    date   invoice   product  qty    price   amount
           1         2         3         4         5         6
 0123456789012345678901234567890123456789012345678901234567890123
 ================================================================
 21 130140    960802 IN111001  HAM001  000010 0001000 000010000
 21 130140    960802 IN111001  SAW012  000020 0002000 000040000
 21 139923    970802 IN111002  CHR001  000030 0003000 000080000
 21 139923    970802 IN111002  TAB013  000042 0004000 000160000
 21 139923    970807 CR5421    TAB013  000050 0005000 000250000
 44 250825    980804 IN1122    HAM001  000060 0006000 000360000
 44 250825    980804 IN1122    SAW012  000070 0007000 000490000
 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 CHR001        30       30.00         800.00
            970802 IN111002 TAB013        42       40.00       1,600.00
            970807 CR5421   TAB013        50       50.00       2,500.00
                                         122 *                 4,900.00 *
                                         152 **                5,400.00 **
 44  250825 980804 IN1122   HAM001        60       60.00       3,600.00
            980804 IN1122   SAW012        70       70.00       4,900.00
                                         130 *                 8,500.00 *
     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 document End this document UVSI Home-Page

B2. qrpgEX1 - Preliminary Example

qrpgEX1 - coding required to create sample report

 # qrpgEX1 - uvcopy Parameter File from UVSI stored in: /home/uvadm/pf/demo/
 # qrpgEX1 - uvqrpg example - sales analysis by customer within salesman
 #         - see uvqrpg.doc for input file layout & sample report expected
 #
 # uvqrpg qrpgEX1,fili1=dat1/sales4,filo1=tmp/qrpgEX1.rpt <-- run job (hard way)
 # ======================================================
 #
 # uvqrpg qrpgEX1   <-- run job (easy way, filenames default as shown above)
 # ==============
 #
 rop=r1  #run option to prompt at EOJ for report disposition (vi,cat,more,etc)
 fili1=?dat1/sales4,rcs=64,typ=LST
 filo1=?tmp/$jobname.rpt,rcs=80,typ=LSTt
 head2=h2000(45),'Sales Analysis by customer within salesman '
 head2=h2045(25),'$datetime $page####'
 head1s2p55u4=h1000(50),'sl# cust#  date   invoice  product quantity'
 head1=h1050(30),'price         amount'
 ctll2=a0(2),'sl#'
 ctll1=a3(6),'cust#'
 ref=a13(6),'date'
 ref=a20(8),'invoice'
 ref=a30(6),'product'
 acum1=a38(6),'quantity',,'zz,zz9-'
 ref=a45(7),'price',,'zz,zzz.99-'
 acum2=a53(9),'amount',,'zzzzz,zzz.99-'

<-- Please relate the report on the previous page to the uvqrpg code above.

  1. Note that the fieldnames on 'ctl,ref,acum' must match the fieldnames on 'head1' & the print positions of the ctl,ref,acum data contents will be determined by the placement of the matching fieldnames within head1.

  2. Alphanumeric fields (ctl & ref) will be left justified to their matching fieldnames within head1, but numeric fields (acum) will be right justified.

  3. 'head1' is coded on 2 lines for convenience - h1000(50) & h1050(30). We could code on 1 line, but the parameter file listing would not be nice.

  4. The head1 options s2p55u4 must be on the 1st line (starting at h1000) 's2p55u4' means space 2, 55 lines per page, underline headings with '='s

  5. Re: ctl1=a3(6),'cust#' <-- indicates level 1 total control field This causes level 1 totals to print automatically at the end of each cust# record control group (cust# in bytes 3-8 of all input records).

  6. Re: acum1=a38(6),quantity,,'zz,zz9-' This edits the quantity from bytes 38-43 of each input record into the print line right justified under the matching fieldname in head1. The record field contents are accumulated to all 8 total levels. Combined with ctll1 & ctll2, acum automatically causes the printing of cust#, slsmn#,& final totals as the control fields break.

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

B3. Preliminary Example#2 - qrpgEX2

qrpgEX2 is the same as qrpgEX1, with the addition of 2 'table' functions to illustrate table summaries (an extremely powerful feature of uvqrpg). Please note the 2 table summary reports (by salesman# & by product#) at the end of the sample report below. Then please see the qrpgEX2 parameter file listed on the following page & note that it requires only 1 line of code to create each table. You could have up to 255 'table's in 1 job & the number of table entries is limited only by available memory.

sample report created by qrpgEX2

 Sales Analysis by customer within salesman   2003/05/29_11:54:14 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 ***
 qrpgEX9  2003/05/29_11:54:15  slsmn;qty;amt
 tbl#001 pg#001     -argument-            -acum#1-    %        -acum#2-    %
 line#  count    %  slsmn                      qty                  amt
     1       5  55  21                         152   33        5,400.00   19
     2       4  44  44                         300   66       23,000.00   80
             9*100   *TOTAL*                   452 *100       28,400.00 *100
 qrpgEX9  2003/05/29_11:54:15  product;qty;amt
 tbl#002 pg#001     -argument-            -acum#1-    %        -acum#2-    %
 line#  count    %  product                    qty                  amt
     1       1  11  BIT001                      90   19        8,100.00   28
     2       4  44  HAM001                     180   39       10,900.00   38
     3       2  22  SAW012                      90   19        5,300.00   18
     4       2  22  TAB013                      92   20        4,100.00   14
             9*100   *TOTAL*                   452 *100       28,400.00 *100

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

B4. Preliminary Example#2 - qrpgEX2

qrpgEX2 - coding for sample report#2 (see prior page)

 # qrpgEX2 - uvcopy Parameter File from UVSI stored in: /home/uvadm/pf/demo/
 # qrpgEX2 - uvqrpg example - sales analysis by customer within salesman
 #         - same as qrpgEX1, but with 2 'table's added
 #         - to illustrate the powerful table summary feature of uvqrpg
 #
 # uvqrpg qrpgEX2,fili1=dat1/sales4,filo1=tmp/qrpgEX2.rpt <-- run job (hard way)
 # ======================================================
 #
 # uvqrpg qrpgEX2   <-- run job (easy way, filenames default as shown above)
 # ==============
 #
 rop=r1  #run option to prompt at EOJ for report disposition (vi,cat,more,etc)
 fili1=?dat1/sales4,rcs=64,typ=LST
 filo1=?tmp/$jobname.rpt,rcs=80,typ=LSTt
 head2=h2000(45),'Sales Analysis by customer within salesman '
 head2=h2045(25),'$datetime $page####'
 head1s2p55u4=h1000(50),'sl# cust#  date   invoice  product quantity'
 head1=h1050(30),'price         amount'
 ctll2=a0(2),'sl#'
 ctll1=a3(6),'cust#'
 ref=a13(6),'date'
 ref=a20(8),'invoice'
 ref=a30(6),'product'
 acum1=a38(6),'quantity',,'zz,zz9-'
 ref=a45(7),'price',,'zz,zzz.99-'
 acum2=a53(9),'amount',,'zzzzz,zzz.99-'
 #
 tablet1f3s2=a0(2),'slsmn;qty;amt',a38(6),a53(9)
 #==============================================
 tablet2f3s2=a30(6),'product;qty;amt',a38(6),a53(9)
 #=================================================

Notes Re: qrpgEX2

  1. qrpgEX2 illustrates the 'table summary' function of uvqrpg, an extremely powerful feature. Please note the 2 'table' functions underlined above.

  2. Please relate the 2 table functions above to the 2 table summaries at the end of the sample report listed on the previous page.

  3. While the data file is being read the body of the report is being written to the report file, and the tables are being accumulated in memory.

  4. At End-Of-File, the summary tables are automatically dumped onto the end of the report

  5. Note that it requires only 1 line of code to create each table. You can have up to 255 'table's in 1 job & the number of table entries is limited only by available memory.

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

B5. Prelim Ex#3 - qrpgEX8 - delimited input

Preliminary example #3 (qrpgEX8) will illustrate 'Delimited Input Files'. Please note the sample input file below (delimited by '|' pipe symbols), followed by the sample report file created from the 'qrpgEX8' demo job which is listed on the next page.

Delimited input is specified by option g# on the file type, for example:


 fili1=?dat1/timecards,rcs=256,typ=LSTg124    #<-- note option 'g124'
 =========================================

sample Delimited Input File

 11911|Thomas Watson|inv3234|1,550.00|108.50|
 11911|Thomas Watson|inv3235|425.00|55.50|
 21945|Presper Eckert|inv4202|975.00|175.00|
 21945|Presper Eckert|cr9202|-75.00|-25.00|
 22359|John Mauchly|inv5105|1250.00|255.00|
 31975|Steve Jobs|inv1015|2500.00|500.00|
 31975|Steve Jobs|inv1016|825.50|200.75|
 41980|Bill Gates|cr8001|-2,500.00|-275.00|

sample report created by qrpgEX8

 qrpgEX8 - Payroll Report  2003/06/02_16:48:24 page0001
 emp#  name                inv#         regpay     overtime
 ==========================================================
 11911 Thomas Watson       inv3234    1,550.00       108.50
       Thomas Watson       inv3235      425.00        55.50
                                      1,975.00 *     164.00 *
 21945 Presper Eckert      inv4202      975.00       175.00
       Presper Eckert      cr9202        75.00-       25.00-
                                        900.00 *     150.00 *
 22359 John Mauchly        inv5105    1,250.00       255.00
                                      1,250.00 *     255.00 *
 31975 Steve Jobs          inv1015    2,500.00       500.00
       Steve Jobs          inv1016      825.50       200.75
                                      3,325.50 *     700.75 *
 41980 Bill Gates          cr8001     2,500.00-      275.00-
                                      2,500.00-*     275.00-*
                                      4,950.50 **    994.75 **

Please see the 'qrpgEX8' uvqrpg job coding listed on the next page --->

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

B6. Preliminary Example #3 - qrpgEX8

qrpgEX8 - coding for sample report#3

 # qrpgEX8 - uvqrpg sample report for Delimited File input
 #
 # uvqrpg qrpgEX8,fili1=dat1/timecards,filo1=tmp/qrpgEX8.rpt <-- file defaults
 # =========================================================
 #
 # uvqrpg qrpgEX8   <-- run job (easy way, filenames default as shown above)
 # ==============
 #
 rop=r1  # run option for prompt to display report
 fili1=?dat1/timecards,rcs=256,typ=LSTg124        #<-- note option 'g124'
 #Nov26/07 - delimited option changed from rop=g# to typ=LSTg#
 # - g# (of typ=LSTg#) is value of the delimiter character (g124 = '|' x'7C')
 # - g0 allows multi-byte delimiter spcfd by arg9=...
 filo1=?tmp/timecard.rpt,rcs=256,typ=LSTt
 head2=h2000(80),'$jobname - Payroll Report  $datetime $page####'
 head1s2u4=h1000(80),'emp#  name                inv#         regpay     overtime'
 ctll1=g100(5),'emp#'
 ref=g200(20),'name'
 ref=g300(8),'inv#'
 acum1=g400(10),'regpay',,'zz,zzz.99-'
 acum2=g500(10),'overtime',,'zz,zzz.99-'

Notes re qrpgEX8 & Delimited Files

  1. 'rop=r1' specifies the 'Run OPtions'. 'r1' requests a prompt for report disposition at end of job (enter command to view/print report).

  2. Input fili=...,typ=LSTg112 specifies the delimiter character, g124 = x'7C' = '|' = 'pipe character, g0 allows multi-byte delimiter spcfd by arg9=...

  3. Note that the data fields defined by ctl,ref,& acum are now addressed in area 'g' & the displacements start at 100 & are incremented by 100 depending on field# (delimiter#). Run option 'g' causes the input data (always in area 'a') to be copied to area 'g' in fixed fields 100 bytes apart. The displacement for any given field is its field# (delimiter#) multiplied by 100.

  4. A multi-byte Delimiter could be declared via 'arg9=?' if typ=LSTg0 & would default to a blank if arg9 was omitted.

  5. If you use a blank delimiter, you will probably need to specify Run OPtion 'a1' which will squeeze the input area 'a' to 1 blank between words before copying to area 'g' fixing the fields 100 bytes apart via ' ' blank delimiters.

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

C1. PFPATH environmental variable for uvqrpg to find its parameter files

PFPATH is an environmental variable that uvqrpg (& uvcopy) use to find their parameter files. The uvqrpg parameter files (also called jobs or programs) are by convention & tradition stored in sub-directories named 'pf'. There may be several of these defined by PFPATH in your .profile, for example:


 export PFPATH=$HOME/pf:./pf:/home/uvadm/pf
 ==========================================

Note that '/home/uvadm/pf' should come last, in case you assign a jobname that duplicates 1 of the demo jobs supplied with the Vancouver Utilities. PFPATH is similar to the unix PATH for programs & scripts - the sub-directories are searched in the sequence defined.

Of course you may also specify a full path or relative path (at least 1 '/') which will be always be searched first & PFPATH segments searched last.


 uvqrpg /u1/apps/libs/pubs/pf/qjobxx   <-- example of full path name
 ===================================

 uvqrpg mypf/qjobxx                    <-- relative path name
 ==================

 uvqrpg qjobxx        <-- will be prefixed with each segment of PFPATH
 =============            for multiple searches

PFPATH new as of March 2003

Prior to March 2003, uvqrpg searched 4 separate paths (PFPATH1,2,3,4) to find its parameter files (vs the current 1 ':' delimited PFPATH). For example:


 export PFPATH1=/home/uvadm/pf              <-- old method (PFPATH1,2,3,4)
 =============================

 export PFPATH=$HOME/pf:./pf:/home/uvadm/pf <-- new method (PFPATH : delimited)
 ==========================================

If you are upgrading from an older version of Vancouver Utilities, you must change the separate PFPATH1,2,3,4 to the new (& improved) ':' delimited PFPATH.

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

D1. uvqrpg: Declaring Files & Running Jobs

File 'typ' codes for uvqrpg & uvcopy

uvqrpg uses the same file, file type,& record size codes as does uvcopy.

The full explanation of file type codes may be seen in uvcopy1.doc, but here is a brief summary:

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=LSTg#
  • use option 'g' to specify delimited input files
typ=LSTg124
  • specifies delimiter as the pipe symbol '|' x'7C' = 124 decimal
  • could specify multi-byte delimiter with g0 & arg9=...
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=RSV
  • Record Sequential Variable length files compatible with Micro Focus
    COBOL IDXFORMAT3 files. Available in both uvqrpg & uxqrpg.
typ=IDX
  • Indexed Sequential Variable length files compatible with Micro Focus
    COBOL IDXFORMAT3 files. Available only in uxqrpg.

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

D2. uvqrpg: Declaring Files & Running Jobs

fil/typ/rcs example - from qrpgEX4 page 'M4'b

 fili8=?dat1/sales5,rcs=64,typ=LST         #<-- input  to sort
 filo8=?tmp/sales5.sorted,rcs=64,typ=LSTt  #--> output from sort
 fili1=?tmp/sales5.sorted,rcs=64,typ=LST   #<-- input  to report
 filo1=?tmp/$jobname.rpt,rcs=80,typ=LSTt   #--> output from report
 filr1=?dat1/custmast,rcs=256,typ=ISF      # customer master ISAM file
 sort=64,'10(2),0(6)'                      #<-- sort rcs & sort fields
  1. Please see the file 'typ' codes summarized on the previous page.

  2. The '?' prefix on the filenames specified by fili1=/filo1=/fili2=/etc causes a prompt at run time to allow you to keyin a different filename or make a null entry to accept the default.

  3. fili8 & filo8 are specified only when the uvqrpg includes a 'sort'

  4. Sort output (filo8) becomes the input to the report (fili1).

  5. Note that qrpgEX1 had no sort, did not declare fili8/filo8,& used only fili1/filo1 to declare report input & report output

  6. The physical files declared by filo8 & fili1 are temporary files and are usually assigned to a 'tmp' sub directory.

  7. The report output file is declared as: 'filo1=$jobname.rpt', which is recommended because most users will copy/rename an existing job to create the next job & this way, the report name wont need to be changed.

  8. If desired you might assign the filo1 reports to an 'rpt' sub directory, but these could also be put in tmp, if you intend to print immediately. See printing suggestions on the next page --->

    command line used to run the job


 uvqrpg qrpgEX4    <-- minimum command line, possible in this case
 ==============        since all filenames are specified within the job

 uvqrpg qrpgEX4,fili8=dat1/sales5,filo8=tmp/sales5.sorted\
 ========================================================
 ,fili1=tmp/sales5.sorted,filo1=tmp/sales5.rpt,filr1=dat1/custmast
 ==================================================================

The maximum command line is shown above, but this is redundant in this case since all the filenames specified are the same as the defaults.


 uvqrpg qrpgEX4,fili8=dat1/sales5,filo1=rpt/sales5.rpt  <-- practical
 =====================================================

This is a more practical command line specifying only the data file input & the final report output.

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

D3. uvqrpg: Declaring Files & Running Jobs

printing the output reports

I suggest you use one of the many 'uvlp' scripts provided with the Vancouver Utilities to print your output reports. These scripts use the 'uvlist' utility & are intended for laser printers. Please see uvlist.doc to see how to set up the UVLPDEST destination variable if your default printer is not a laser.


 uvlp tmp/sales5.rpt    - print at 10 cpi
 ===================      (76 chars on 8 1/2 with margin for 3 hole punching)
uvlp12
  • print at 12 cpi, allows 90 chars on 8 1/2 wide
uvlp14
  • print at 14 cpi, allows 108 chars on 8 1/2 wide
uvlp18
  • print at 14 cpi, allows 134 chars on 8 1/2 wide
uvlp12L
  • print Landscape at 12 cpi, allows 128 chars on 11" wide
uvlp14L
  • print Landscape at 14 cpi, allows 150 chars on 11" wide

The above scripts have the print characteristics (cpi, margins, etc) hard- coded for simplicity (only need to specify filename), but other scripts are provided to allow you to code the many options provided by the uvlist utility. The options are in 2 groups following the filename (page format options & laser printer options). See uvlist.doc for complete details.


 uvlsp tmp/sales5.rpt p50h c15m360
 =================================
p50
  • 50 lines per page (vs default 60)
h
  • inhibit uvlist page headings
  • don't need since you probably generate headings with uvqrpg
             --- group 2 options for laser printer ---
c15
  • 15 character per inch
m360
  • left margin in decipoints
  • this is 1/2" (since 1" = 720 decipoints)

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

E1. uvqrpg: File Pre-Sorting & Record Selection (keep/drop)

sort

 sort=rcsz,'key1,key2,...,key8'     #<-- function format

sort=rcsz,'dsp1(lth1),dsp2(lth2),...,dsp8(lth8)'

 sort=64,'10(2),0(6)'               #<-- example from qrpgEX4
 sort=64,'10(2ca),0(6ca),53(9zd)'   #<-- character/zoned, ascending/descending

The sort sorts the file declared by 'fili8' to 'filo8', which must be the same physical filename as 'fili1', which is the input to the report phase. Please see the qrpgEX4 example, listed on page 'M4a'

The sort facility is similar to the sort in uvsort or uvcopy. You can see more details in uvsort.doc or uvcopy.doc.

keep/drop examples

keep#c#=dsp(lth),cc'constant' <-- function format

 drop1=a13(2),<'97'               <-- example from qrpgEX4
 keep1=a13(2),>'96'                 - same thing using keep vs drop
 keep1c1=a10(2),='21'        - select if slsmn = 21
 keep1c2=a13(2),>'97'             AND if  year > 97
 keep2c1=a10(2),='44'        - OR     if slsmn = 44
 keep2c2=a13(2),>'97'             AND if  year > 97

keep/drop format & rules

  1. keep & drop are only active when used in conjunction with 'sort'

  2. keep & drop are mutually exclusive

  3. Up to 8 keep or drop selections (OR conditions) (keep1,keep2,...,keep8)

  4. Each selection may have up to 5 AND conditions, coded via option c#, which is optional and often not required. (keep1c1,keep1c2,...,keep1c5) - - - etc - - - (keep8c1,keep8c2,...,keep8c5)

  5. Op1 dsp(lth) defines a field in the input record (dsp zero relative)

  6. 'cc' is the condition code (=,<,>,!,<=,=>)

  7. 'constant' is the data to be compared to the record field, using the specified condition code to determine a match or nomatch

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

F0. Functions unique to uvqrpg

Functions unique to uvqrpg are documented in detail on following pages. Please see uvcopy1.htm for functions in common with uvcopy.

Functions unique to uvqrpg

head
  • declare page Headings
foot
  • declare page Footings
ctl
  • declare control level fields
ref
  • declare reference fields (non-ctl, non-acum)
acum
  • declare fields to be accumulated
table
  • declare summary tables to be accumulated & dumped at EOF

Functions in common with uvcopy

opr
  • operator message
rop
  • run option declaration
uop
  • user option declaration
was
  • work area size assignment
arg
  • command line arguments
fil
  • file declarations (fili1-8,filo1-8,filr1-8,fild1-8)
typ
  • file-type declaration (& file-type options)
rcs
  • record-size declaration
isk
  • ISAM file key declaration
lod
  • load a data table into a work area
  • declare 2nd file of instructions to load at run-time
Note
  • Also see 'Instructions in common with uvcopy' listed on pages 'H1'-'H3'.
  • Functions are declarations that indirectly control uvqrpg processing,
    but Instructions are actions that you code to directly control
    processing.

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

F1. Functions unique to uvqrpg

head - declare report headings

 head8=h8000(80),'.....................................................'
 head7=h7000(80),'...'
       - - etc - -
 head2=h2000(100),'...'
 head1=h1000(130),'....... head1 field-names matched on ctl/ref/acum .......'
 head9=h9000(130),'... head9 optional 2nd line print for current record ...'

head - example

 head2=h2000(70),'Sales Analysis by customer within salesman $dttm1 $page'
 head1=h1000(70),'sl# cust#   date  invoice  product quantity  price   amount'
 head9=h9000(50),'     custname '

head - rules

  1. Up to 8 page headings may be declared, and each page heading may be up to 500 characters wide.

  2. Page headings will print in reverse order (head8, head7, etc to head1). Page headings are optional except for head1, and uvqrpg will print only as many as declared headings as were declared on head1, head2, etc.

  3. head1 is used to declare printing positions for ctl/ref/acum fields, by coding the fieldnames within the print line where ever you want the corresponding data (from ctl/ref/acum) to be printed. Non-edited fields are left aligned under matching field-name. Edited fields are right aligned under matching field-name.

  4. head9 (optional) may be used to print a 2nd detail line for the current record. Any fieldnames in head9 matched on ctl/ref/acum functions cause their field data to be printed on a 2nd line aligned under the fieldname in head9.

  5. Page headings are printed automatically at @bgnl8 & on page overflow. The default line count is 52, which may be modified by option 'p' on head1 (see example below).

  6. Use the 'h1' option (on ctll7h1-ctll1h1) to print headings at begining of the desired control group rather than only at begin job or on overflow. In the qrpgEX4 example, 'ctll2h1' is used for new page at begin salesman control level.

  7. Page headings are stored in area 'h' (see details on page 'J6').

You could modify area 'h' before headings are printed. You could modify at @bgnl8 or at the begining of the total level where applicable.

  1. You can also print page headings via the 'hdr' instruction. See page 'I1'.

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

head - declare report headings (continued)

head - options

p#
  • lines per page (default p52)
  • before automatic overflow & page heading subroutine
p57
  • example, code as 'head1p57' to specify 57 lines per page
s#
  • extra space after printing heading (head1,2,3,,4,5,6,7,8,& 9)
s1
  • default 1 (no blank line before next)
s2
  • space 2 after head1 (leaves blank line before 1st detail line)
x#
  • extra space after printing the corresponding detail line
  • applies only to head1 & head9 (2nd detail line)
x1
  • default 1 (no blank line before next)
x2
  • space 2 after head1 (leaves blank line before 1st detail line)
u#
  • underline heading with =====
u1
  • underline heading with 79 '='s
u2
  • underline heading with 131 '='s
u4
  • underline heading with '='s to right hand non-blank

example of heading options


 head1p57u4s2x2 - may code multiple options on desired head# function
 ==============

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

F2. Functions unique to uvqrpg

foot - declare report headings

 foot1=h1000(80),'................ page footings ......................'
    - - etc - -
 foot8=h8000(80),'.....................................................'

foot - example

 foot1l45v4=f1000(50),'Copyright UV Software Inc. 1993-2007'
 foot2=f2000(60),"www.uvsoftware.ca owen@uvsoftware.ca"

foot - rules

  1. Up to 8 page footings may be declared, and each page footing may be up to 500 characters wide.

  2. Page footings are printed automatically on page overflow, or when page headings are forced by option 'h1' on the 'ctl' function at begining of a level control break, or you can use the 'ftr' instruction to explicitly print page footings.

  3. You must code the desired line# on foot1 using option 'l' (see the foot1 example above). You must be sure option 'p' (lines per page) on head1 leaves enough room for your footers.

  4. Page footings are stored in area 'f' (see details on page 'J6'). You could modify area 'f' before footings are printed. You could modify at @bgnl8 (begin job) or at the begining of any control level (@bgnl1,etc) or on a total level control break (@ttll1, @ttll2, etc)

    foot - options

l#
  • line# where footings begin (must be coded on foot1).
  • see example above (foot1l45v4=f1000,'...').
s#
  • extra space after printing
s1
  • default (leaves no blank line after)
s2
  • space 2 (leave 1 blank line after)
v#
  • overline with ===
v1
  • overline footing with 79 '='s
v2
  • overline footing with 131 '='s
v4
  • overline footing with '='s to right hand non-blank
  • see example above (foot1l45v4=f1000,'...').

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

F3. Functions unique to uvqrpg

ctl - declare control level fields

ctll8
  • declare control field for level 8 totals
ctll7
  • declare control field for level 7 totals
    - - - etc - - -
ctll2
  • declare control field for level 2 totals
ctll1
  • declare control field for level 1 totals

ctl - examples

ctll1=a0(6),'customer'

ctll2=a10(2),'slsmn'

 ctll1=a0(6),'customer',p5(6)     <-- may specify print position
                                      (usually determined by match in head1)
 ctll1=a0(6),'customer',,'zzzzz9' <-- may specify edit pattern
                                      (unusual for ctl fields)

ctl - rules

  1. 'ctl' defines record fields to control total level breaks.

  2. Up to 8 control fields, ctll8 is most major, ctll1 is most minor. Control fields are usually defined in reverse order.

  3. The op2 fieldname will usually be matched in 'head1' wherever you desire the data to be printed, aligned to left side of unedited fieldnames, or to the right side of edited fieldnames.

  4. The control field data will be inserted in area 'p' at the corresponding control level & you have an opportunity to modify before printing if you declare 'bgnl#'

  5. Control fields are stored in area 's' (see page 'J5')

  6. Control level field declarations ctll8-ctll1, control when any user coded instructions are executed under the @bgnl8-@bgnl1 or @ttll1-@ttll8 tags. See detailed discussion on pages 'G1'-'G3' (@tags unique to uvqrpg).

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

F4. Functions unique to uvqrpg

ctl - options

'h1' - force new page at this control level

        ctll2h1=a0(2),'sl#'        - force new page at level#2

'p#' - part# of control key (for multiple parts at any 1 level)

        ctll1p1=a0(2),'sl#'       - part 1 of control key for level 1
        ctll1p2=a3(6),'cust'      - part 2 of control key for level 1
 'i1' - inhibit error msg if fieldname not found in head1
      - use when you do not want to print the control field
        ctll1i1=a0(2),'sl#'       - inhibit printing sl# control field
 's#' - extra space after corresponding total line
 's1' - space 1, leaves no blank lines after total line
 's2' - space 2 (default), leaves 1 blank line after total line
 's3' - space 3, leaves 2 blank lines after total line
 's8' - etc to max s8
 's2' - space 2 is the default (no need to code ctll1s2)
Note
  • You might use space 1 (no blank lines) for summary total printing
  • record detail printing inhibited by '@dtl nop'
        ctll1s1=a0(6),'cust#'     - no space after cust# total line

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

F5. Functions unique to uvqrpg

ref - reference fields for printing only

ref=a13(6),'date'

ref=a30(6),'product'

ref=a46(7),'price',,'zz,zzz.99-'

 ref=a13(6),'date',p11(6)          <-- may specify print position
                                       (but usually determined by head1)

ref=a20(8),'invoice',,'zzzzzzz9' <-- may edit any numeric field

ref - rules

  1. 'ref' specifies record fields that are ONLY to be moved or edited into the print line (area 'p') at detail time (@dtl).

  2. If the print position is not explicitly specified via operand 3, 'ref' fields are aligned to the left side of the matching field-name in the 'head1' area, assuming no edit mask was coded in operand 4. If an edit mask was coded, the data is right aligned to the matching fieldname.

  3. Note that 'ref' fields are stored in the print line only at @dtl time, as opposed to 'ctl' fields which are stored at @bgn times, and as opposed to 'acum' fields which are stored both at @dtl time & at all @ttl times for which a 'ctl' field has been defined.

  4. Note that all uvcopy/uvqrpg address displacements are ZERO relative. The demo record layouts were specified as columns which are 1 relative. You must subtract 1 for the zero relative byte displacements.

  5. Please note that you will usually have to code 2 commas prior to coding the edit mask (op4), since the explicit print position (op3) is usually omitted (determined automatically from the matching name in head1).

    ref=a20(8),'invoice',,'zzzzzzz9'
                        ^^-------------- note 2 commas
  1. We have already explained that the fieldnames assigned on the 'ref' functions (date, product, etc) determine the print position by matching names in head1.

You can also use these names as '$' symbols on any 'intructions' that may be coded at the various processing points provided (@bgn,@dtl,@ttl) You can also use $symbols for the fieldnames defined on ctl & acum. Some examples are:

    @dtl    cmc    $date(2),'96'
            skp<   1
            tbl    $sl#,'slsmn;amount',$amount

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

F6. Functions unique to uvqrpg

ref option 'i'

'i1' - inhibit error message if fieldname not found in head1

 refi1=a13(6),'date'              <-- example of option 'i1'

Option i1 is provided in case you want to ignore the error emssage that you would get if the fieldname were not found in head1. You could still use $date to reference the field in the record area, but $date_p would be defined as p0(0).

 'i2' - inhibit printing this field at detail time, but allow at total times
      - this does not make sense for 'ref' fields, but is useful for 'acum'
        counting to inhibit showing '1' on every detail line.

ref option 'x'

'x#' - to edit multiple consecutive fields with 1 instruction


 refx12=a120(5p),'January',,'zzz,zzz.99-'
 ========================================

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

F7. Functions unique to uvqrpg

acum - declare fields to be accumulated

acum1
  • 1st field to be accumulated from record at detail time
acum99
  • 99th field to be accumulated from record at detail time

acum - examples

acum1=a38(6),'quantity',,'zzz,zz9-'

acum2=a53(9),'amount',,'zzzz,zzz.99-'

 acum2=a53(9),'amount',p55(12),'zzzz,zzz.99-'  <-- optional print position
 acum3=1,'count,,'zz,zz9'                  <-- op1 may be '1' to count records

acum - rules

You may specify up to 100 record fields to be accumulated, acum0 to acum99, but acum0 usually not used.

Total acumulators are stored in area 't' (see on page 'J7'). You usually do not need to address directly, but may do so if desired, via $symbols ($t101,$t102,etc thru $t899).

Acum fields are automatically edited into the print area @dtl time. You may specify the print position via op3, but it is usually omitted, and it is then determined by the matching fieldname in 'head1'. Edited field data will be aligned to the right side of the fieldname in the head1 area.

If @dtl is not specified, the print area is automatically written to the output report file. The print line will also include data from any 'ctl' and 'ref' fields. If you do specify @dtl (for user own code), the automatic print/write is inhibited & you are expected to execute your own output, for example:

 @dtl   ---                  <-- modify print area ??
        ---
        putb  filo1,p0       <-- write area 'p' to report file

If you want to inhibit printing at @dtl time (& only print at @ttl time), you could specify @dtl without a 'put', for example:

@dtl nop

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

F8. Functions unique to uvqrpg

acum rules (continued)

 acum2=a53(9),'amount',,'zzzz,zzz.99-'     <-- example

Addition to the level1 accumulators occurs after any @dtl processing, so you could modify or store more fields to be accumulated. Acum fields for the current record have been stored in the level 0 ttl area, making it easy for you to modify or store more, before you return when they will be added to level 1 acums.

For example (based on qrpgEX4), if you wanted to calculate 15% salesman commission for customer & salesman totals, but not to print on detail lines (qty=acum1=$t001, amt=acum2=$t002):

 @dtl   mvn   $t003,$t002        store amt ($t002) in $t003 (unused)
        mpy   $t003,15
        div   $t003,100          calc 15% in acum3

Acum $t003 will then be accumulated thru the specified total levels, but will not be automatically printed, since you had no acum3 to specify where it is to print. You could code @ttll1,@ttll2,etc own code to edit from the total acums ($t103,$t203,etc), or you could specify a non-existent blank field for acum3 to carry the fieldname & print position.

acum3 a200(1),'commission,,'zz,zzz.99-'

a200(1) could be a blank column in input record or beyond the rcsz which will be blank. 'commission' will have a match in your 'head1' line to indicate where it will print.

head1=h1000(78),'sl# cust# date invoice product qty price amount commission'

acum options

a0
  • inhibit '*' asterisk total ID markers
  • otherwise * ttll1, ** ttll2, *** ttll3, *4* ttll4, *5* ttll5, etc

'x' - consecutive (repeat) field count


 acum1x12g3=a120(5p),'January',,'zzzz,zzz.99-'   <-- option 'x' example
 =============================================

You can use the 'x' option when your input record has multiple consecutive fields that you wish to edit to consecutive print fields. The example above is taken from qrpgEX5 (listed later on page 'M5'). The customer master record has 12 * 5 byte packed fields starting with January in columns 121- 125. These 12 fields will be edited to 12 * 12 byte fields & accumulated for multiple total levels depending on the control fields declared.

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

F9. Functions unique to uvqrpg

acum options (continued)

 'g' - gap between edited fields generated by option 'x'
 'g3 - would leave 3 spaces between edited fields
     - for the '*','**','***' total level indicators
 'i1' - inhibit automatic editing to the print area
        (inhibits the error message if fieldname not found in head1)
      - use when you do not want to print the field
      - perhaps to inhibit the automatic edit to print (area p)
        at detail record time, but allow you to use the $fieldname
        to address the field for printing at @dtl & @ttl times
        (by coding your own 'edt' instructions)
      - see example in qrpgEX5
 'i2' - inhibit editing into the detail line, but do edit into total lines.
      - might be used for a count when you don't want to show '1' on every line
        only the counts on the total lines.

        acum3i2=1,'count,,'zz,zz9' <-- count records, inhibit '1' on detail lines
        ==========================

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

F10. build summary tables in memory & dump to report at EOF

table - build summary tables in memory, append to report at EOF


 tablet2f3s2=a30(6),'product;qty;amt',a38(6),a53(9)  <-- sample from qrpgEX2
 #=================================================

uvqrpg 'table' vs 'uvcopy' tbl

  1. The 'table' function in uvqrpg is similar to the 'tbl' instruction in uvcopy. See uvcopy3.htm for the complete details on 'tbl'. Here in uvqrpg.doc, we will document only the differences (mostly in the options).

  2. 'table' can appear among the other uvqrpg functions (acum, ref, ctl, etc). You do not have to code under the '@dtl' as for uvcopy instructions.

  3. The tables are dumped automatically at end of file. You do not need to code 'tbp' instructions under '@ttll8' as is required to dump the 'tbl' summaries.

  4. Note that you need to code the table report options on the 'table' function vs the 'tbp' instruction, since the 'tbp' is no longer required to dump the tables. Please see the 'tbp' options documented on the next page.

    Limitations of 'table' vs 'tbl'

  5. 'table' functions are automatically executed for all records, whereas you could selectively execute 'tbl's depending on record type via the uvcopy style instructions coded underneath the '@dtl' tag.

  6. 'table' functions are limited to 1 contiguous argument field, whereas you could concatenate record fields for the 'tbl' instructions.

  7. 'table' headings are limited vs 'tbl' where you can define headings on the 'tbp' or on the 'tbh' instructions.

  8. 'table's are always appended to the end of the main report defined by 'filo1'. With 'tbl' & 'tbp' you could direct the table summaries to other files defined by filo2, filo3, etc.

  9. uvcopy style instructions also provide 'tbd' (would be coded at '@ttll8') allow you to dump tbls in a binary record format (vs report format), for subsequent sorting & reporting.

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

F11. build summary tables in memory & dump to report at EOF

Options for 'table'


 tablet2f3s2=a30(6),'product;qty;amt',a38(6),a53(9)  <-- sample from qrpgEX2
 #=================================================
      ^^^^^^ <-- options coded on table function (may include 'tbp' options)
t#
  • specifies the table# (t1 - t999)
f#
  • specifies the editing format to be used when the table is subsequently
    dumped (written to the output file), via the 'tbp' instruction.
  • 12 pre-programmed formats are supplied (f1-f12)
  • See the table formats documented under 'tbf' in uvcopy3.htm.

'tbp' options that may be coded on 'table'

You need to code the table report options on the 'table' function vs the 'tbp' instruction, since the 'tbp' is no longer required to dump uvqrpg tables.

l##
  • specify lines per page, for formfeed & page headings
  • 'l54' on 'tablet1l54' would specify 54 lines per page (default is 50)
s#
  • space # of lines after the total line
  • the default is to generate a formfeed after each table
  • use the s option when printing multiple short tables
    that you wish to appear on the same page
i1
  • inhibit page headings, except on 1st page
i2
  • inhibit the blank line between headings & data lines
  • included in i1 or i8
i4
  • inhibit the FormFeed between pages
  • independent of i1 or i8
i8
  • inhibit page headings on all pages
  • overrides i1
i12
  • inhibit all page headings & the Formfeeds between pages
    (i12 = i8 + i4)
  • i1 & i2 are invoked by i8

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

F12. build summary tables in memory & dump to report at EOF

table/tbp options (continued)

j1
  • inhibit total lines
j2
  • inhibit the blank line between data lines & total line
j4
  • inhibit the FormFeed (or spacing if option s) between tables
j7
  • inhibit total lines, blank lines prior,& FF/spacing after
    (j7 = j1 + j2 + j4)
  • these 3 options are independent of 1 another
z1
  • inhibit writing lines with all accumulators = zero
  • regardless of the automatic entry 'count'
    (the counts would then not add up to the total count)
  • breaks in the line sequence#'s would indicate dropped entries
z2
  • re-sequence the line#'s
  • to not indicate dropped entries due to all accumulators = zero
  • this option would be meaningless without z1
z3
  • inhibit writing lines with all acums zero & re-sequence line#'s
    (z3 = z1 + z2)

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

G1. '@' tags unique to uvqrpg

'@' tags declare 'when' uvcopy instructions are to be executed.

'@tags' are optional,and not required for most simple control level reports. You may specify for customizations & complex data manipulation. For example, see example #2 (qrpgEX4 on page 'M4')

 @bgnj    - instructions to be executed at begin job (BEFORE files opened)
 @bgnl8   - instructions to be executed at begining of control level 8
            which occurs only once at the begining of the job
          - same as @bgnj, but after files have been opened
          - @bgnl8 is more useful than @bgnj, since you probably want the
            files open for whatever instructions you wish to execute
            at the begining of the job.
 @bgnl7   - instructions to be executed at begining of control level 7
 @bgnl6   - instructions to be executed at begining of control level 6
 @bgnl5   - instructions to be executed at begining of control level 5
 @bgnl4   - instructions to be executed at begining of control level 4
 @bgnl3   - instructions to be executed at begining of control level 3
 @bgnl2   - instructions to be executed at begining of control level 2
 @bgnl1   - instructions to be executed at begining of control level 1
 @dtl     - instructions to be executed at record detail time

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

G2. '@' tags unique to uvqrpg (continued)

 @ttll1   - identify instructions to be executed at total level 1 time
Note
  • record fields declared on 'acum' fields have already been edited
    edited into area 'p', but not automatically written to the output
    report file (as would be the case if '@ttl's were not declared).
  • You must explicitly print (putb filo1,p0), since declaring @ttl
    always inhibits the automatic output.
Note
  • the above comments for @ttll1 also apply to @ttll2-@ttll8
 @ttll2   - instructions to be executed at total level 2 time
 @ttll3   - instructions to be executed at total level 3 time
 @ttll4   - instructions to be executed at total level 4 time
 @ttll5   - instructions to be executed at total level 5 time
 @ttll6   - instructions to be executed at total level 6 time
 @ttll7   - instructions to be executed at total level 7 time
 @ttll8   - instructions to be executed at total level 8 time
          - @ttll8 occurs only once at EOF (primary file fili1)
          - same as @eoj, but before files are closed
 @eoj     - instructions to be executed at EOJ time (AFTER files closed)
 @ovf     - instructions to be executed on page overflow
          - default 52 lines, but may modify via head option p (head1p52)
          - declaring @ovf inhibits the automatic page headings
          - you could modify the page headings stored in area 'h'
            (see area 'h' layout further below)
          - you could then use 'hdr' to execute the standard page headings
            (which will print the number of lines declared via head8...head1)
          - could use the 'ftr' instruction to print page footers declared
            via foot1, foot2, etc, max foot8.
 @get     - user own code to get next record
          - allows you to bypass undesired records or modify record layout
          - must get into area 'a', omitting is same as following:
 @get   get   fili1,a0
          - see sample job /home/uvadm/pf/qrpgEX95 which demonstrates @get
 @pf2     - uvcopy subrtns to be loaded dynamically (see uvcopy1.doc)
Note
  • Any 1 group of uvcopy instructions (for @bgn,@dtl,@ttl,etc)
    is ended simply by coding the next group of @bgn,@dtl,@ttl,etc).

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

H1. uvqrpg: Instructions - in common with uvcopy

Simple control level reports may be created using only the uvqrpg functions (head,ctl,ref,acum), but for customized reports or complex data manipulation, you may use the powerful uvcopy instruction set, at various times in the built-in uvqrpg program cycle (see @bgn,@dtl,@ttl, etc above).

Most instructions are common with uvcopy. The instructions are listed here & on the next 2 pages, but please see uvcopy3.doc for detailed descriptions.

Instructions - in common with uvcopy

  1. logical: mvc,mvf,mvr,cat,clr,edt,anc,orc,shf
  2. arithmetic: mvn,add,sub,mpy,div,pac,unp,xft
  3. comp/test/skip: cmc,cmn,skp,nop,tst,tsb,mwb
  4. sequential I/O: opn,cls,get,put,rel,rtb,wtb
  5. Indexed I/O: set,red,wrt,upd,del,lck,ulk
  6. message&control: msg,can,eoj,tim,wat,bal,ret
  7. translation: tra,tre,trl,tru,trt,hxc,chx,vhx
  8. scan&replace: scn,rep,mvu,sct,rpt,sts,rts
  9. squeeze-insert: sqz,sqf,jus,cnt,ins,ctr
  10. conversion: fix,var,swp,dat,rfm
  11. special: sys,lok,pop,fxt,env,evt,xxa,xxb,xxc
  12. sort: sxo,sxp,sxs,sxg,sxc,srt
  13. table: tbl,tbf,tbh,tbp,tbd

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

H2. uvqrpg: Instructions - in common with uvcopy

INDEX to INSTRUCTIONS in uvcopy3.doc

 `add` - add op2 data to op1 data & store result in op1                  - 28
 `anc` - ANd Character (erase bits in op1 with corresponding 0 bits in op- 17
 `bal` - branch & link to a subroutine                                   - 67
 `cat` - concatenate op2 data onto op1 data (within op1 limits)          - 13
 `can` - cancel the uvcopy job                                           - 65
 `chx` - convert character representation of hex to true hex data        - 74
 `clr` - clear the op1 area to the op2 byte value                        - 14
 `cls` - close a file - or all files that are open if op1 = 'all'        - 42
 `cmc` - compare and set internal condition code for following skp       - 35
 `cmn` - compare numeric & set condition code for following skp          - 37
 `cnt` - count the number of op2 patterns in the op1 area                - 99
 `ctr` - center data within the op1 area                                 -101
 `data type codes` - data type & sign codes in op1/op2 lengths           - 22
 `dat` - convert dates between any 2 of: calendar,julian,& days-since-190-106
 `del` - delete a record in an ISAM indexed file                         - 61
 `div` - divide the op1 data by the op2 data & store result in op1       - 31
 `edt` - edit op2 data into op1 area controlled by op3 mask              - 15
 `env` - get value for any specified environmental variable              -114
 `eoj` - end the job                                                     - 65
 `evt` - get & table the values for all environmental variables          -115
 `fix` - convert variable field format to fixed length fields            -102
 `fxt` - add a uvcopy instruction to the execution table                 -113
 `get` - next record from a sequential file & store in the op2 area      - 43
 `hxc` - convert hex data to hex character representation                - 74
 `ins` - insert op2 data prior to op1 data                               -100
 `lck` - lock a DISAM Indexed file                                       - 62
 `lok` - look-up a table of data (op1) for match to argument (op2)       -109
 `mpy` - multiply op1 data by op2 data & store result in op1             - 30
 `msg` - display a msg (1 or 2 lines) on stdout                          - 63
 `msgw` - display message & wait for reply (option "w" of msg)           - 64
 `mvc` - move character data from op2 to op1 for op1 length              -  8
 `mvf` - move op2 to op1 for lth op2 & fill excess op1 with op3 char     -  9
 `mvr` - move data from op2 to op1 right adjusted, left filled with op3  - 11
 `mvp` - move op2 to op1, if all EBCDIC blanks, convert to ASCII blanks  - 12
 `mvn` - move numeric data depending on op1/op2 types & lengths          - 21
 `mvu` - move op2 data to op1 area until the op3 pattern detected        - 84
 `opn` - open a file - or all files declared if op1 = 'all'              - 41
 `orc` OR Character - set 1 bits in op1 with corresponding 1 bits in op2 - 18
 `pac` - pack the op2 data into the op1 area                             - 32
 `pop` - process option string into process/user option storage          -112
 `put` - a record to a sequential file                                   - 47
 `rel` - set file pointer (relative record# or relative byte#)           - 52
 `red` - read a record from an ISAM indexed file                         - 58
 `ret` - return from a subroutine (to the instruction following the bal) - 69
 `rep` - scan op1 replacing all op2 patterns with the op3 data           - 82
 `rpt` - replace by table                                                - 89
 `rtb` - read a table of data into the op1 area (at run time)            - 53
 `rts` - scan a table for a pattern & replace with an alternate          - 94
 `scn` - scan op1 area for op2 pattern & set cc equal if found           - 76
 `sct` - scan by table                                                   - 87

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

H3. uvqrpg: INDEX to uvcopy INSTRUCTIONS (continued)

 `set` - set key of reference & file pointer in an ISAM indexed file     - 57
 `shf` - shift data a specified number of bits left or right             - 20
 `skeleton` - template job to copy, rename,& modify as required          -  5
 `skp` - skip to a tag (or number of instrns) if condition code matches  - 38
 `sort` (external) - sxo, sxp, sxs, sxg, sxc                             -120
 `sqz` - squeeze out occurrences of the op2 character from op1           - 97
 `sqf` - squeeze multiple contiguous fields & blank fill at the end      - 98
 `srt` - internal sort (tables, record arrays, etc)                      -118
 `sts` - scan a table for a character string                             - 92
 `sub` - subtract the op2 data from the op1 data & store result in op1   - 29
 `subrtn example` - cymd compare 6 digit dates for Year 2000             - 68
 `swp` - swap left & right sides of data in op1 based on op2 separator   -105
 `sys` - issue system commands - call the shell to execute op1 string    -108
 `table instruction overview` - build tables in memory to dump at EOJ    -126
 `table formats` - supplied formats available (f1-f12)                   -135
 `table entry layout` - dumped by tbd (unedited)                         -138
 `tbl` - build tables in memory to be dumped at end of job               -127
 `tbf` - declare formats to be used when editing tables to output files  -129
 `tbh` - declare table column (field) headings                           -130
 `tbp` - print (edit) the table entries into a file (usually at eoj)     -131
 `tbd` - dump (unedited) the table entries into a file (usually at eoj)  -133
 `tim` - get current date & time & store in area y for user access       - 66
 `tra` - translate to ASCII (from EBCDIC)                                - 70
 `tre` - translate to EBCDIC (from ASCII)                                - 70
 `tru` - translate to UPPER case (any lower case present)                - 71
 `trl` - translate to lower case (any UPPER case present)                - 71
 `trt` - translate via user specified (or modified) translate table      - 72
 `trs` - translate/search command                                        - 73
 `tst` - test each op1 sub-field for match to any op2 sub-field          - 39
 `tsb` - test 1 byte of data for any match to the bits in the 1 byte op2 - 40
 `ulk` - unlock a DISAM Indexed file                                     - 62
 `unp` - unpack the op2 data into the op1 area                           - 33
 `upd` - update a record in an ISAM indexed file                         - 60
 `var` - convert multi fixed length fields to a variable length string   -104
 `vhx` - convert data to vertical hexadecimal representation             - 75
 `wat` - wait a specified number of seconds                              - 66
 `wrt` - write a new record into an ISAM indexed file                    - 59
 `wtb` - write a table of data from the op1 area (at run time)           - 55
 `xft` - crossfoot multiple op2 fields & store the result in op1         - 34
 `xor` - eXclusive OR (bit manipulation)                                 - 19
 `xxa` - call user subfunction (written in C & linked to uvcopy)         -116

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

I1. Instructions - unique to uvqrpg

hdr - print page headings

'hdr' is a special instruction to perform the uvqrpg page heading subroutine. Hdr is in effect a 'bal' to the uvqrpg built-in page heading subroutine.

        hdr                  <-- hdr instruction
        bal  prthdr          <-- behaves like a 'bal' to builtin subrtn

You don't have to code 'prthdr', but it might look as follows, assuming you had specified 3 headings (head3,head2,head1s2). Note s2 option on head1.

 prthdr put  filo1,h3000(500)
        put  filo1,h2000(500)
        put  filo1,h1000(500)
        put  filo1,' '              space 2 after head1
        ret

Of course if you want to do things the hard way you could write a subrtn similar to the above & do your own 'bal prthdr'.

But it is easier to use the 'hdr' instruction, which you might use at the begining of a total control level:

 @bgnl2  ---
         hdr                 <-- print page headings at begin level 2
         ---

And you could use the 'hdr' instruction at page overflow time '@ovf'.

 @ovf    ---
         hdr                 <-- print page headings at page overflow time
         ---

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

I2. Instructions - unique to uvqrpg

ftr - print page footings

'ftr' is a special instruction to perform the uvqrpg page footing subroutine. ftr is in effect a 'bal' to the uvqrpg built-in page footing subroutine.

        ftr                  <-- ftr instruction
        bal  prtftr          <-- behaves like a 'bal' to builtin subrtn

You don't have to code 'prtftr', but it might look as follows, assuming you had specified 2 footings (foot1,foot2).

 prtftr putb filo1,f1000(500)
        putb filo1,f2000(500)
        ret

Of course if you want to do things the hard way you could write a subrtn similar to the above & do your own 'bal prtftr'. But it is easier to use the 'ftr' instruction, which you might use at if you need to write your own 'ovf' (page overflow) routine.

 @ovf    ---
         ftr                 <-- print page footings at page overflow time
         ---
         hdr                 <-- print page headings at page overflow time
         ---

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

J0. Work Areas Unique to uvqrpg

Work Areas Unique to uvqrpg

uvqrpg has 26 work areas that may be addressed using the 26 lower case letters of the alphabet. Here we will emphasize the work areas that are unique to uvqrpg.

J1. h - page heading storage areas (8 headings max 500 bytes each)
J1. f - page footing storage area (8 footings max 500 bytes each)
J2. a - record input read area
J2. p - print area for fields declared on head1 (the usual)
J2. g - fixed field area, used if typ=LSTg# specifies delimited input
J3. m - print area for fields declared on head9 (for a 2nd detail line)
J3. r - prior record storage area (useful at @ttl times)
J4. q - $symbol storage area
J6. s - control level field storages (current & next)
J7. t - total accumulator storage (8 levels * 100 acums * 4 bytes each)
bcdegijklno
  • available to the user (areas not listed above or below)
  • these areas default to 1024 bytes
  • you may increase via the 'was=...' function see uvcopy1.htm
uvwxyz
  • reserved work areas for uvqrpg (same assignments as uvcopy)
  • please see uvcopy2.htm for detailed explanations

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

J1. Work Areas Unique to uvqrpg

area 'h' - page heading storage

h0(1000)
  • not used
h1000(500)
  • storage area for headings from the 'head1' function
h2000(500)
  • head2 storage
h3000(500)
  • head3
h4000(500)
  • head4
h5000(500)
  • head5
h6000(500)
  • head6
h7000(500)
  • head7
h8000(500)
  • head8

area 'f' - page footing storage

f0(1000)
  • not used
f1000(500)
  • storage area for footings from the 'foot1' function
f2000(500)
  • foot2 storage
f3000(500)
  • foot3
f4000(500)
  • foot4
f5000(500)
  • foot5
f6000(500)
  • foot6
f7000(500)
  • foot7
f8000(500)
  • foot8

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

J2. work areas unique to uvqrpg

area 'a' - record input area

The built-in logic cycle of uvqrpg reads the input records into area 'a' and you must specify area 'a' on your ctl, ref,& acum functions. If you use the option to code your own instructions, you can read other files (such as Indexed master files for random lookups) into any unassigned area (Any area BUT: a,f,h,m,p,q,r,s,t,u,v,w,x,y,z)

area 'p' - print area

uvqrpg uses area 'p' to format the fields defined on ctl/ref/acum functions, and to edit & print the total levels depending on ctll1-ctll8. No explicit instructions are required for simple reports, but you may use @tag instructions to modify area 'p' if desired.

Printing (putb filo1,p0) is normally automatic, but is inhibited if you declare @dtl, or @ttll1-@ttll8, in which case you must explicitly execute the 'putb filo1,p0' to write the output lines desired (after any modifications desired).

Note that the detail & total fields have already been edited into area 'p' when you are given control via @dtl or @ttll1-@ttll8. You may clear/re-edit as you see fit before you 'putb filo1,p0'.

Note that 'ctll#' level control fields are moved/edited into area 'p' at the corresponding '@bgnl#' level time, but these are never printed at @bgnl# time, but are left to be printed by following '@dtl' time.

If desired, you could print them at this time, or you might get additional information to be printed (such as looking up ISAM files for customer names).

You need to understand that the automatic print at @dtl time will always blank area 'p' after printing, but you should code the blank after if you declare @dtl and code your own 'put' instructions.

 @dtl   ---
        putb   filo1,p0          <-- note 'b' option to blank after output

area 'g' fixed fields for Delimited input file

Input fili=...,typ=LSTg# causes the input data (always in area 'a') to be copied to area 'g' into fixed fields 100 bytes apart. The field delimiter is defined by the value of option g# (on fili=... typ=LSTg#) or by arg9=... if typ=LSTg0).

The displacement for any given field is its field# (delimiter#) multiplied by 100. The data fields defined by ctl,ref,& acum are then addressed in area 'g' as g100, g200, g300, etc. For example (from qrpgEX8):

ctll1=g100(5),'emp#' ref=g200(20),'name' ref=g300(8),'inv#' acum1=g400(10),'regpay',,'zz,zzz.99-'

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

J3. work areas unique to uvqrpg

area 'm' print area for 2nd line of detail

uvqrpg uses area 'm' to format fields defined on ctl/ref/acum functions, ONLY if the fieldnames are matched in head9 (vs matching in head1 which uses the normal area 'p'). Any acum fieldnames matched in head9 would also cause their totals to print on a 2nd line at total time.

Printing (putb filo1,m0) is normally automatic, but is inhibited if you declare @dtl, or @ttll1-@ttll8, in which case you must explicitly execute the 'putb filo1,m0' to write the output lines desired (after any modifications desired).

Note that the detail & total fields have already been edited into area 'p' & 'm' when you are given control via @dtl or @ttll1-@ttll8. You may clear/re-edit as you see fit before you 'putb filo1,p0' & 'putb filo1,m0'.

Note that 'ctll#' level control fields are moved/edited into area 'p' or 'm' at the corresponding '@bgnl#' level time, but these are never printed at @bgnl# time, but are left to be printed by following '@dtl' time.

If desired, you could print them at this time, or you might get additional information to be printed (such as looking up ISAM files for customer names).

You need to understand that the automatic print at @dtl time will always blank area 'p' & area 'm' after printing, but you should code the blank after if you declare @dtl and code your own 'put' instructions.

 @dtl   ---
        putb   filo1,p0     <-- note 'b' option to blank area 'p' after output
        ---
        putb   filo1,m0     <-- note 'b' option to blank area 'm' after output

area 'r' previous record at Total times

Area 'r' gives you access to the previous detail record at total times. When a control break occurs, area 'a' will contain the next record (the one that caused the control break). If you are coding instructions @ttll times you might need some fields from the last record of the control group just ending. For example, to lookup master files using customer#, product#, etc.

 @ttll1 ---
        mvc    b0(6),r0        - store cust# from last rec of cust# group
        redm5  filr1,b0        - random read custmast Indexed file by cust#

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

J4. work areas unique to uvqrpg

area 'q' - $symbol table

Fields on ctl/ref/acum functions will be stored here in the same format as allowed in uvcopy, for example the fields from qrpgEX1 would be:

Note
  • $symbol length increased from 16 to 32 (as of March 13/2008)
  • area q entries from 32 to 48
 lod=q0(48)
 $sl#             =a0(2)
 $cust#           =a4(6)
 $date            =a13(6)
 $invoice                 =a20(6)
 $product                         =a30(6)
 $quantity                        =a38(6)
 $price                           =a45(7)
 $amount                          =a53(9)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 June2009 - area q $symbol defs now FREE FORMAT
          - orinal 32 byte entries increased to 48 (symbol 16 to 32)
          - '=' field-def shifted to col 34, fixed format stored in area q

You may use the $symbols in your own code uvcopy instructions coded at the various times (@bgnl8-@bgnl1,@dtl,@ttll1-@ttll8)

You may add additional $symbols to the table by declaring the 'lod=q0(48)' prior to any ctl/ref/acum functions. Automatically created symbols from ctl/ref/acum will be stored following your symbols. This means that your symbols would be found first in the event of duplicate symbols.

Using the above sample fields at '@ttl' times would address the fields in the 'next' record (that caused the control break). Using the example from the previous page, the code without $symbols & then with $symbols would be:

code example withOUT $symbols

 @ttll1 ---
        mvc    b4(6),r4        - store cust# from last rec of cust# group
        redm5  filr1,b0        - random read custmast Indexed file by cust#

code example WITH $symbols

 @ttll1 ---
        mvc    b4(6),$cust#_r  - store cust# from last rec of cust# group
        redm5  filr1,b0        - random read custmast Indexed file by cust#

uvqrpg automatically assigns $symbols (in areas a,r,p,& m) for all fields that you define on ctl/ref/acum functions (see next page), But you have to add $symbols for any other areas desired such as area 'b' above for the customer master file random read.

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

J5. work areas unique to uvqrpg

automatic $symbol assignments

uvqrpg automatically assigns $symbols (in areas a,r,p,& m) for all fields that you define on ctl/ref/acum functions. For example (using just 3 fields) the automatic assignments might be:

 lod=q0(48)
 $sl#                             =a0(2)
 $sl#_r                           =r0(2)    - 'r' dsplcmnts same as 'a'
 $sl#_p                           =p0(2)
 $cust#                           =a4(6)
 $cust#_r                         =r4(6)
 $cust#_p                         =p5(6)    - 'p' dspls depend on head1
 $custname                        =a64(6)
 $custname                        =r64(6)
 $custname                        =m12(6)   - 'm' dspls if coded on head9
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Area 'r' displacements will always be the same as area 'a' (record layout). Area 'p' displacements depend on where you positioned the fieldnames within 'head1'. Area 'm' $symbols will be assigned instead of area 'p' if you coded the fieldname on 'head9' (vs head1).

Print Area $symbols

You may use $symbols with '_p' or '_m' suffixes to address fields in the print area (area 'p' for normal detail print line, or area 'm' for the optional 2nd detail line).

Previous Record $symbols

You may use $symbols with '_r' suffix to address fields in the prior record save area (area r). You should use these fields at @ttll1-@ttll8 times to address the record fields for the control totals being printed, rather than area 'a' fields which belong to the NEXT record (causing the control break).

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

J6. work areas unique to uvqrpg

area 's' - control field storage

s000(1000)
  • control fields for the CURRENT record group
s000(100)
  • not used
s100(100)
  • current field stored from ctll1
s200(100)
  • current field stored from ctll2
s300(100)
  • current field stored from ctll3
s400(100)
  • current field stored from ctll4
s500(100)
  • current field stored from ctll5
s600(100)
  • current field stored from ctll6
s700(100)
  • current field stored from ctll7
s800(100)
  • current field stored from ctll8
s1000(1000)
  • control fields for the NEXT record group
  • stored from the record causing the control break
s1000(100)
  • not used
s1100(100)
  • next record field stored from ctll1
s1200(100)
  • next record field stored from ctll2
s1300(100)
  • next record field stored from ctll3
s1400(100)
  • next record field stored from ctll4
s1500(100)
  • next record field stored from ctll5
s1600(100)
  • next record field stored from ctll6
s1700(100)
  • next record field stored from ctll7
s1800(100)
  • next record field stored from ctll8

Control fields are stored consecutively, so that we can easily test for control breaks by always comparing from the current control break up to the end of ctll8.

This forces control breaks when the next record data field just happens to match the current record at the specified level but in fact a control break is indicated by a higher level

At EOF the next record area is filled with '~EOF' in 1st 4 bytes & all '~' tildes thruout the next record area, thus forcing control breaks.

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

J7. work areas unique to uvqrpg

area 't' - total accumulators

t0(400)
  • level 0 totals
  • acum fields from current record are stored here, before the
    user is given control at @dtl time (if any), after the user
    returns, the level 0 totals will be added to level 1 totals.
  • this allows the user to modify or store additional totals
    to be accumulated thru the total levels specified.
  • Please see qrpgEX6 example of storing values in level 0

As of Feb 2000 accumulators may be 4 or 8 bytes, depending on compile argument H32 or H64/S64

This page is for 4 byte acums, see 8 byte layout on the next page --->

Usually you do not need to care, since you will use the $symbols, vs the area 't' displacement & length.

t0(4b)
  • acum0 on total level 0 - $t000 (usually not used)
t4(4b)
  • acum1 on total level 1 - $t001
t99(4b)
  • acum99 on total level 1 - $t099
t1000(400)
  • total level 1 accumulators (4 bytes each for 32 bit machines)
t1000(4b)
  • acum0 on total level 1 - $t100 (usually not used)
t1004(4b)
  • acum1 on total level 1 - $t101
t1008(4b)
  • acum2 on total level 1 - $t102
t1040(4b)
  • acum10 on total level 1 - $t110
t1396(4b)
  • acum99 on total level 1 - $t199
t2000(400)
  • total level 2 accumulators
t2000(4b)
  • acum0 on total level 2 - $t200
t2004(4b)
  • acum1 on total level 2 - $t201
t2008(4b)
  • acum2 on total level 2 - $t202
t2396(4b)
  • acum99 on total level 2 - $t299
        - - - - - - - etc - - - - - -
t8000(400)
  • total level 8 accumulators
t8000(4b)
  • acum0 on total level 8 - $t800
t8004(4b)
  • acum1 on total level 8 - $t801
t8008(4b)
  • acum2 on total level 8 - $t802
t8396(4b)
  • acum99 on total level 8 - $t899

For 64 bit machines, the accumulators are expanded to 8 bytes.

See the layout for 64 bit 8 byte accumulators on the next page --->

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

J8. work areas unique to uvqrpg

area 't' - total accumulators

As of Feb 2000 accumulators may be 4 or 8 bytes, depending on compile argument H32 or H64/S64

<---- see 4 byte layout on the previous page.

Usually you do not need to care, since you will use the $symbols, vs the area 't' displacement & length.

area 't' layout for 8 byte accumulators

t0(800)
  • level 0 totals
t0(8b)
  • acum0 on total level 0 - $t000 (usually not used)
t8(8b)
  • acum1 on total level 1 - $t001
t192(8b)
  • acum99 on total level 1 - $t099
t1000(800)
  • total level 1 accumulators (4 bytes each for 32 bit machines)
t1000(8b)
  • acum0 on total level 1 - $t100 (usually not used)
t1008(8b)
  • acum1 on total level 1 - $t101
t1016(8b)
  • acum2 on total level 1 - $t102
t1080(8b)
  • acum10 on total level 1 - $t110
t1792(8b)
  • acum99 on total level 1 - $t199
t2000(800)
  • total level 2 accumulators
t2000(8b)
  • acum0 on total level 2 - $t200
t2008(8b)
  • acum1 on total level 2 - $t201
t2016(8b)
  • acum2 on total level 2 - $t202
t2792(8b)
  • acum99 on total level 2 - $t299
        - - - - - - - etc - - - - - -
t8000(800)
  • total level 8 accumulators
t8000(8b)
  • acum0 on total level 8 - $t800
t8008(8b)
  • acum1 on total level 8 - $t801
t8016(8b)
  • acum2 on total level 8 - $t802
t8792(8b)
  • acum99 on total level 8 - $t899

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

K1. $symbols unique to uvqrpg

Note
  • see uvcopy.doc for many $symbols in common, such as:
 $date      - current date ccyymmdd (8 bytes)
 $time      - current time hhmmss (6 bytes)
 $datetime  - current date&time ccyy/mm/dd_HH:MM:SS (19 bytes)
 $alphadate - current date & time, example: 1 Mon Oct 4 1999
    - - - etc - - -

$symbols unique to uvqrpg

 $page#### - current page#
           - may code in head2 (or head3) wherever page# desired
 $t100 - total level 1 accumulator 00, same as t1000(4b)
 $t101 - total level 1 accumulator 01, same as t1004(4b)
 $t102 - total level 1 accumulator 02, same as t1008(4b)
 $t199 - total level 1 accumulator 99, same as t1396(4b)
 $t201 - total level 2 accumulator 01, same as t2004(4b)
 $t202 - total level 2 accumulator 02, same as t2008(4b)
 $t299 - total level 2 accumulator 99, same as t2396(4b)
               - - - - - etc - - - - -
 $t801 - total level 8 accumulator 01, same as t8004(4b)
 $t802 - total level 8 accumulator 02, same as t8008(4b)
 $t899 - total level 8 accumulator 99, same as t8396(4b)
               >>> OR for 8 byte accumulators <<<
 $t100 - total level 1 accumulator 00, same as t1000(8b)
 $t101 - total level 1 accumulator 01, same as t1008(8b)
 $t102 - total level 1 accumulator 02, same as t1016(8b)
 $t199 - total level 1 accumulator 99, same as t1792(8b)
 $t201 - total level 2 accumulator 01, same as t2008(8b)
 $t202 - total level 2 accumulator 02, same as t2016(8b)
 $t299 - total level 2 accumulator 99, same as t2792(8b)
               - - - - - etc - - - - -
 $t801 - total level 8 accumulator 01, same as t8008(8b)
 $t802 - total level 8 accumulator 02, same as t8016(8b)
 $t899 - total level 8 accumulator 99, same as t8792(8b)
Note
  • You usually do not need to worry about the layout difference
    for 4 byte of 8 byte accumulators, since you would normally
    use the $symbols vs the area 't' displacements & lengths

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

L0. uvqrpg: OPTIONS - 6 kinds

  1. run options - specified via the 'rop=' function (within the parameter file or on the command line) - may also be specified via 'export UVQRPGROP=' - applies to the entire run - meanings are dedicated & preassigned by uvqrpg - example: rop=d for debug mode - See run options documented on page 'L1'

  2. user options - specified via the 'uop=' function (within the parameter file or on the command line) - applies to the entire run - meanings are assigned by the user (except for 'i' & 'q') - example: uop=s2 might mean space 2 (vs space 1 default) uop=p3 might mean 3 pages of labels desired - tested by the user (not by the uvqrpg program as rop) example: cmn $uopbs,2 space 2 ? - See user options documented on page 'L2'

  3. file options - appended to the typ spec of file declarations - applies to that particular file - example: typ=LSTt (t option truncates trailing blanks) - See file options documented on page 'L3'

  4. instruction options - appended to individual instructions - applies only to that instruction - example: trlq1 (q1 inhibits translate within quotes) - Not documented here, see details in uvcopy2.doc

  5. alternative instruction option areas - Not documented here, see details in uvcopy2.doc

  6. process options - Not documented here, see details in uvcopy2.doc

    Option Coding Rules

 example: rop=abc2d4e512f1000...x7yz
  1. Options must be 1 contiguous string with no blanks (except in quotes).

  2. Valid options are the 26 lower case letters.

  3. The letter options may be specified in any sequence.

  4. Each letter used should only be specified once in the string. But if duplicated the last option value overrides any previous value.

  5. The option letter may be followed by a numeric value which is often bit coded for suboptions - a7 includes a1+a2+a4.

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

L1. 'rop' - declare uvqrpg RUN options

Run options are used to declare options that modify the operation of of the uvqrpg program. Run options (rop) are tested only by the uvqrpg program itself vs user options (uop) which are usually tested by user instructions.

'rop' may be declared in the parameter file, on the command line, or at the prompt caused if 'rop=q1' is specified in the prmfile. You may also use 'export UVQRPGROP=d' to set debug mode for uvqrpg in scripts.

a1
  • area 'a' pre-processing for the delimited file (see option 'g' below)
  • 'a1' causes input records (in area a) to be squeezed to 1 blank between
    fields. The field delimiter is defined by fili1=...,typ=LSTg# or
    arg9=... if typ=LSTg0 (to allow multi-byte delimiter).
  • After squeezing the area 'a' input fields are copied over to area 'g'
    & fixed 100 bytes apart via the delimiters.
  • option 'a1' should be used when you specify a blank delimiter.
b999
  • bypass count, number of records to be bypassed on 1st get to
    sequential file input (also see option 'c' stop count)
c999
  • record process stop count (might be thought of as a 'c'opy count).
  • number of records to be processed from sequential file input
    before signalling an early EOF.
d
  • set debug mode; will display each instruction before execution
    & allows user to set breakpoints & display areas.
    (see complete debug documentation further below)
e1
  • enable interupt (usually '^C' or the DELETE key)
  • will report current I/O record counts & allow close or continue
  • disabled by default since 'uvqrpg's within scripts might be zombied
  • enable when you run uvqrpg from command line by appending ',rop=e1'
g#
  • declare Delimited file input, the #number is the maximum field count.
  • Nov26/07 - obsolete, delimited input now signalled by typ=LSTg#
  • max fields 100 always allowed
h2
  • halt at end of job, until operator hits enter
i1
  • inhibit uvqrpg startup msg #1 (version, date, prmfile name)
i2
  • inhibit uvqrpg startup msg #2 (copyright, rgstrn#, name)
i4
  • inhibit 'opr' messages
i8
  • inhibit uvqrpg EOF statistics msgs (record counts, etc)
i7
  • inhibit uvqrpg startup messages & all 'opr' messages
  • used by 'uvqrpgx' script which repeats uvqrpg for all files in dir
i15
  • inhibit all msgs above, including EOF statistics
j99999
  • instruction storage area, default size is 64,000 bytes which is
    room for about 500 instructions & you will need to increase
    for big parameter files (allow about 120 bytes per instruction)
  • you can wait until you get an error message & then increase it
k99999
  • constant storage pool for instruction constants
  • default size is 32,000 may increase if the total of your constants
    exceeds this value (will get error message)

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

L1a. 'rop' - uvqrpg RUN options - continued

o1
  • inhibit automatic file opens & get 1st record
  • might be used if you code '@bgnj' for user own code at begin job
    (could open files, bypass records, etc)
q1
  • causes prompt for 'rop' option changes & additions
  • same as for 'uop' (see next page)
r
  • Report Disposition options
r1
  • prompt operator for Report Disposition at End of Job
  • operator may enter desired command: vi,cat,more,uvlp12,etc
    (or for Windows/DOS: edit,type,more,print,etc)
r#
  • the digit identifies the output file# to be reported 1-8 (filo1-filo8)
  • prompting the operator is the default
  • see option 'x' below to specify the desired command with no prompt
Note
  • option 'r1' is coded in the demo jobs (qrpgEX1,2,3,4,5,6,7,8)
r2
  • 'more' is automatically selected without operator intervention
r4
  • 'uvlp12' is automatically selected
r8
  • 'uvlp12L' is automatically selected (Landscape vs Portrait)
s0
  • create packed sign output (op1) same as last input (op2)
    (default if option s not declared)
s1
  • create packed decimal signs as x'_C' (vs default x'_F')
s2
  • create packed decimal signs as x'_F' (vs default x'_C')
  • numeric instrns (mvn,add,etc) may have options s0/s1/s2
    which would over-ride the global run options s0/s1/s2
Note
  • Micro Focus COBOL requires x'_F' signs for pic 9 comp-3 fields,
    but x'_C' signs for pic S9 comp-3 fields.
  • this applies to linked programs, '.int's work either way
t0
  • load default ASCII to EBCDIC translate table
    neutral (no change) for characters > x'80'
t2
  • loads alternate ASCII to EBCDIC translate table
    characters > x'80' translated to EBCDIC blank x'40'
u12
  • no of tables (tbl instructions) provided - default is 12
u99
  • may increase as required
v2000
  • no of table entries in total for all tables - default 2000
v5000
  • may increase as required
  • Each entry is only 4 bytes (or 8 bytes on 64 bit machines)
x
  • Report Disposition Commands
x1
  • 'vi' is automatically selected without operator intervention
x2
  • 'more' is automatically selected without operator intervention
x4
  • 'uvlp12' is automatically selected
x8
  • 'uvlp12L' is automatically selected (Landscape vs Portrait)

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

L1b. 'rop' - uvqrpg RUN options - continued

y70
  • set Year2000 window for field type 'y' on sort keys
    & also for option 'y' on compare instructions 'cmcy' & 'cmny'
  • option 'y' assumes 1st 2 bytes of field is the year (no century)
  • 'rop=y70' means that years 70-99 = 1970-1999,
    00-69 = 2000-2069
z1
  • option 'z1' specifies sliding windows, for example in 1998
    'rop=y70z1' window value would be 98+70 = 168-100 = 68
    meaning years 68-99 = 1968-1999,
    00-67 = 2000-2067

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

L2. uvqrpg: 'uop' - declare USER run options

User options are assigned & tested by the user (except for uops 'q' & 'i').

     uop=p2s0          - 'p2' might mean 2 pages of output desired
                       - 's0' might mean display on screen (vs spool 's1')
     ---   ---           (might test as in following example)
     cmn   $uopbs,1    - spool or display ?
     skp<  display
     ---   ---

Note that user options may be specified in 3 places:

 1 - defaults in the parameter file (prior to fili/filo declaration)
     uop=q1a1b2c3               - q1 will prompt allowing change to a,b,c
     fili1=tf/cusmas
 2 - on the command line, for example:
     uvqrpg prmfilex,uop=q0     - this turns off the prompt
 3 - at the prompt caused by the 'q1' option in the prmfile
     a1b2c3                     - reply just the options you wish to change

The options are cumulative; any repeated option letter values would replace preceding values.

uop option 'q'

uop=q1p2s0
  • q1 causes oprtr query at run init
  • null reply accepts the defaults

Option 'q1' specified on the 'uop' function causes a prompt at run initiation time to allow the operator to override the defaults

Alternatively 'uop=q0' is often specified on the command line to inhibit the prompt from the 'uop=q1....' line in the parameter file, especially when the job is being repeated for all files in the directory via the uvqrpgx script.

uop option 'i'

uop=i1
  • inhibits uvqrpg startup msg #1
uop=i2
  • inhibits uvqrpg startup msg #2
uop=i4
  • inhibits all 'opr' displays
uop=i8
  • inhibit uvqrpg EOF statistics msgs (record counts, etc)
uop=i7
  • inhibits startup messages & all 'opr' displays
  • used by 'uvqrpgx' script that repeats uvqrpg for all files in a dir
uop=i15
  • inhibit all msgs above, including EOF statistics

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

L3. uvqrpg: 'file typ' options

NOTE
  • the primary documentation for file typ options is in section F4 of
    uvcopy1.htm#F4 Only a brief 1 line description is given here.
 fili1=testinp,rcs=256,typ=ISFk3l1
                              ****   <-- file typ options key#3 lock readonly
 filo1=xxx,rcs=5000,typ=RSVv500
                           ****      <-- Record Seqntl Variable min rcsz option
a
  • append to the file's existing contents
b__
  • buffer size option - default 8k (8192 bytes)
c1/c2
  • convert unprintable characters to periods/blanks
d
  • DOS option to insert/expect a CR (Carriage Return) as well LF
e1
  • inhibit errmsg when LineFeed not found within record size specified
g4/2/6
  • get active/deleted/both data records from typ=RSV file
    RSV is Record Sequential VARIABLE (Micro Focus COBOL I3 compatible)
    can also use with the data partition of a type I3 Indexed Variable file
i#
  • copy ISAM keys from input fili# fili1-8 to output filo1-8
k#
  • set key of reference for an indexed file (default k1)
k9
  • (typ=ISFk9) causes retrieval in sequence by key #9
h1
  • wait on locked file, retries every 10 seconds until lock released
l
  • file locking options for DISAM indexed files
    l0=EXCLUSIVE, l1=READONLY, l2=AUTOLOCK, l4=MANULOCK, l8=NOLOCKS
m____
  • monitor option (report progress every ____ records)
m20000
  • default is every 20,000 records
p___
  • permissions given to the file when closed (else umask defaults)
p777
  • would set read,write,execute permission for owner,group,& others
r1
  • typ=RSRr1 Relative files MF COBOL drop record if last byte = x'00'
s0
  • display EOF statistics for all file types
    s1=inhibit basic, s2=inhibit ISAM summary, s4=request key stats
t
  • truncate trailing blanks, applies to typ=LST
u
  • UNIX system file unbuffered (open/read vs fopen/fread)
  • required for 9 track tape reads on 2145-03
v9999
  • variable length records for IDXFORMAT3 files typ=IDX or typ=RSV
w2
  • warning for existing output files to be over-written

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

M0. uvqrpg Examples to illustrate various Features & Options

The following pages will present several examples to illustrate the many options & features that you may need.

M1. qrpgEX1 - sales analysis by customer within salesman
M2. qrpgEX2 - same as qrpgEX1, with the addition of 'table summaries'
- an extremely powerful feature of uvqrpg
M3. qrpgEX3 - same as EX1, with customized total descriptions
M4. qrpgEX4 - similar to EX1, but illustrates several powerful features
- sorts the input file prior to the report
- indexed file used to retrieve customer names
- uvcopy instructions to calc qty*price, avg price,
- summary tables by salesman & product, dumped at end job
M5. qrpgEX5 - 12 months sales across, by customer, province & final.
- illustrates the 'x' option for multiple consecutive fields
- edit & accumulate 12 months sales thru 3 total levels
  with only 1 instruction
M6. qrpgEX6 - accumulator selection at detail record time
- when you need to test record fields to determine accumulator
- specify acum zero, then store values in total level zero
  whose acums are added to level 1 after @dtl time
M7. qrpgEX7 - illustrate printing 2 detail lines for each record
- will print Name & Address on 2 lines (for portrait 8 1/2 x 11)
M8. qrpgEX8 - illustrate Delimited file input (timecards delimited by '|' pipes)
- indicated by fili1=...,typ=LSTg# (g112 for '|' delimiter)
N1. qrpgEX91 - summary report, inhibit detail, print only on total breaks
N2. qrpgEX92 - multi-part control fields (split control keys)
N3. qrpgEX93 - build summary tables in memory for printing at EOF
- using uvqrpg
- table entries limited only by available memory
- up to 255 tables per job
N4. copyEX93 - same as qrpgEX93 using uvcopy vs uvqrpg
- build summary tables in memory for printing at EOF
- using uvcopy (vs uvqrpg)
- uvcopy is probably better that uvqrpg for table summaries
- uvqrpg is better for total level control
N5. qrpgEX94 - Illustrate @get user own code to get next record
- allows you to bypass undesired records or modify record layout

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

M1. qrpgEX1 - sales analysis by customer within salesman

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

dat1/sales4 - test/demo data

 sl# cust#    date   invoice   product  qty    price   amount
           1         2         3         4         5         6
 0123456789012345678901234567890123456789012345678901234567890123
 ================================================================
 21 130140    960802 IN111001  HAM001  000010 0001000 000010000
 21 130140    960802 IN111001  SAW012  000020 0002000 000040000
 21 139923    970802 IN111002  CHR001  000030 0003000 000080000
 21 139923    970802 IN111002  TAB013  000042 0004000 000160000
 21 139923    970807 CR5421    TAB013  000050 0005000 000250000
 44 250825    980804 IN1122    HAM001  000060 0006000 000360000
 44 250825    980804 IN1122    SAW012  000070 0007000 000490000
 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 CHR001        30       30.00         800.00
            970802 IN111002 TAB013        42       40.00       1,600.00
            970807 CR5421   TAB013        50       50.00       2,500.00
                                         122 *                 4,900.00 *
                                         152 **                5,400.00 **
 44  250825 980804 IN1122   HAM001        60       60.00       3,600.00
            980804 IN1122   SAW012        70       70.00       4,900.00
                                         130 *                 8,500.00 *
     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 document End this document UVSI Home-Page

M1a. uvqrpg report writer - Preliminary Example#1 (qrpgEX1)

qrpgEX1 - coding required to create sample report

 # qrpgEX1 - uvcopy Parameter File from UVSI stored in: /home/uvadm/pf/demo/
 # qrpgEX1 - uvqrpg example - sales analysis by customer within salesman
 #         - see uvqrpg.doc for input file layout & sample report expected
 #
 # uvqrpg qrpgEX1,fili1=dat1/sales4,filo1=tmp/qrpgEX1.rpt <-- run job (hard way)
 # ======================================================
 #
 # uvqrpg qrpgEX1   <-- run job (easy way, filenames default as shown above)
 # ==============
 #
 rop=r1  #run option to prompt at EOJ for report disposition (vi,cat,more,etc)
 fili1=?dat1/sales4,rcs=64,typ=LST
 filo1=?tmp/$jobname.rpt,rcs=80,typ=LSTt
 head2=h2000(45),'Sales Analysis by customer within salesman '
 head2=h2045(25),'$datetime $page####'
 head1s2p55u4=h1000(50),'sl# cust#  date   invoice  product quantity'
 head1=h1050(30),'price         amount'
 ctll2=a0(2),'sl#'
 ctll1=a3(6),'cust#'
 ref=a13(6),'date'
 ref=a20(8),'invoice'
 ref=a30(6),'product'
 acum1=a38(6),'quantity',,'zz,zz9-'
 ref=a45(7),'price',,'zz,zzz.99-'
 acum2=a53(9),'amount',,'zzzzz,zzz.99-'

<-- Please relate the report on the previous page to the uvqrpg code above.

  1. Note that the fieldnames on 'ctl,ref,acum' must match the fieldnames on 'head1' & the print positions of the ctl,ref,acum data contents will be determined by the placement of the matching fieldnames within head1.

  2. Alphanumeric fields (ctl & ref) will be left justified to their matching fieldnames within head1, but numeric fields (acum) will be right justified.

  3. 'head1' is coded on 2 lines for convenience - h1000(50) & h1050(30). We could code on 1 line, but the parameter file listing would not be nice.

  4. The head1 options s2p55u4 must be on the 1st line (starting at h1000) 's2p55u4' means space 2, 55 lines per page, underline headings with '='s

  5. Re: ctl1=a3(6),'cust#' <-- indicates level 1 total control field This causes level 1 totals to print automatically at the end of each cust# record control group (cust# in bytes 3-8 of all input records).

  6. Re: acum1=a38(6),quantity,,'zz,zz9-' This edits the quantity from bytes 38-43 of each input record into the print line right justified under the matching fieldname in head1. The record field contents are accumulated to all 8 total levels. Combined with ctll1 & ctll2, acum automatically causes the printing of cust#, slsmn#,& final totals as the control fields break.

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

M2. Preliminary Example#2 - qrpgEX2

qrpgEX2 is the same as qrpgEX1, with the addition of 2 'table' functions to illustrate table summaries (an extremely powerful feature of uvqrpg). Please note the 2 table summary reports (by salesman# & by product#) at the end of the sample report below. Then please see the qrpgEX2 parameter file listed on the following page & note that it requires only 1 line of code to create each table. You could have up to 255 'table's in 1 job & the number of table entries is limited only by available memory.

sample report created by qrpgEX2

 Sales Analysis by customer within salesman   2003/05/29_11:54:14 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 ***
 qrpgEX9  2003/05/29_11:54:15  slsmn;qty;amt
 tbl#001 pg#001     -argument-            -acum#1-    %        -acum#2-    %
 line#  count    %  slsmn                      qty                  amt
     1       5  55  21                         152   33        5,400.00   19
     2       4  44  44                         300   66       23,000.00   80
             9*100   *TOTAL*                   452 *100       28,400.00 *100
 qrpgEX9  2003/05/29_11:54:15  product;qty;amt
 tbl#002 pg#001     -argument-            -acum#1-    %        -acum#2-    %
 line#  count    %  product                    qty                  amt
     1       1  11  BIT001                      90   19        8,100.00   28
     2       4  44  HAM001                     180   39       10,900.00   38
     3       2  22  SAW012                      90   19        5,300.00   18
     4       2  22  TAB013                      92   20        4,100.00   14
             9*100   *TOTAL*                   452 *100       28,400.00 *100

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

M2a. Preliminary Example#2 - qrpgEX2

qrpgEX2 - coding for sample report#2 (see prior page)

 # qrpgEX2 - uvcopy Parameter File from UVSI stored in: /home/uvadm/pf/demo/
 # qrpgEX2 - uvqrpg example - sales analysis by customer within salesman
 #         - same as qrpgEX1, but with 2 'table's added
 #         - to illustrate the powerful table summary feature of uvqrpg
 #
 # uvqrpg qrpgEX2,fili1=dat1/sales4,filo1=tmp/qrpgEX2.rpt <-- run job (hard way)
 # ======================================================
 #
 # uvqrpg qrpgEX2   <-- run job (easy way, filenames default as shown above)
 # ==============
 #
 rop=r1  #run option to prompt at EOJ for report disposition (vi,cat,more,etc)
 fili1=?dat1/sales4,rcs=64,typ=LST
 filo1=?tmp/$jobname.rpt,rcs=80,typ=LSTt
 head2=h2000(45),'Sales Analysis by customer within salesman '
 head2=h2045(25),'$datetime $page####'
 head1s2p55u4=h1000(50),'sl# cust#  date   invoice  product quantity'
 head1=h1050(30),'price         amount'
 ctll2=a0(2),'sl#'
 ctll1=a3(6),'cust#'
 ref=a13(6),'date'
 ref=a20(8),'invoice'
 ref=a30(6),'product'
 acum1=a38(6),'quantity',,'zz,zz9-'
 ref=a45(7),'price',,'zz,zzz.99-'
 acum2=a53(9),'amount',,'zzzzz,zzz.99-'
 #
 tablet1f3s2=a0(2),'slsmn;qty;amt',a38(6),a53(9)
 #==============================================
 tablet2f3s2=a30(6),'product;qty;amt',a38(6),a53(9)
 #=================================================

Notes Re: qrpgEX2

  1. qrpgEX2 illustrates the 'table summary' function of uvqrpg, an extremely powerful feature. Please note the 2 'table' functions underlined above.

  2. Please relate the 2 table functions above to the 2 table summaries at the end of the sample report listed on the previous page.

  3. While the data file is being read the body of the report is being written to the report file, and the tables are being accumulated in memory.

  4. At End-Of-File, the summary tables are automatically dumped onto the end of the report

  5. Note that it requires only 1 line of code to create each table. You can have up to 255 'table's in 1 job & the number of table entries is limited only by available memory.

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

M3. uvqrpg report writer - Example#2 (qrpgEX3)

qrpgEX3 - illustrates customized total descriptions


 uvqrpg qrpgEX3,fili1=dat1/sales4,filo1=tmp/qrpgEX3.rpt  <-- run job (hard way)
 ======================================================

 uvqrpg qrpgEX3  <-- run job (easy way, filenames default as shown above)
 ==============

qrpgEX3 - sample report

 Sales Analysis by customer within salesman   2003/04/18_15:59:23 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
                Customer Total *          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
                Customer Total *         122 *                 4,900.00 *
                Salesman Total **        152 **                5,400.00 **
 44  250825 980804 IN1122   HAM001        60       60.00       3,600.00
            980804 IN1122   SAW012        70       70.00       4,900.00
                Customer Total *         130 *                 8,500.00 *
     401210 990816 CR955    HAM001        80       80.00       6,400.00
            990816 IN441    BIT001        90       90.00       8,100.00
                Customer Total *         170 *                14,500.00 *
                Salesman Total **        300 **               23,000.00 **
                   Final Total ***       452 ***              28,400.00 ***
 ====================================         <-- option 'v4' to overline
 Copyright UV Software Inc. 1993-2007         <-- from 'foot1'
 www.uvsoftware.ca owen@uvsoftware.ca         <-- from 'foot2'

Please see the uvqrpg program (parameter file) listed on the next page --->

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

M3a. uvqrpg report writer - Example#2 (qrpgEX3)

<-- Please see the report on the previous page

 # qrpgEX3 - uvcopy Parameter File from UVSI stored in: /home/uvadm/pf/demo/
 # qrpgEX3 - uvqrpg example, sales analysis by customer within salesman
 #         - same as qrpgEX1, with customized total descriptions & page Footings
 #         - see uvqrpg.doc for input file layout & sample report expected
 #
 # uvqrpg qrpgEX3,fili1=dat1/sales4,filo1=tmp/qrpgEX3.rpt  <-- run job (hard way)
 # ======================================================
 # uvqrpg qrpgEX3   <-- run job (easy way, filenames default as shown above)
 # ==============
 rop=r1   #run option to prompt at EOJ for report disposition (vi,cat,more,etc)
 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####'
 head1s2p40u4=h1000(50),'sl# cust#  date   invoice  product quantity'
 head1=h1050(30),'price         amount'
 foot1l45v45=f1000(50),'Copyright UV Software Inc. 1993-2007'
 foot2=f2000(60),"www.uvsoftware.ca owen@uvsoftware.ca"
 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-'
 @ttll1 mvf   p15(18),'Customer Total *'
        putb  filo1,p0
 @ttll2 mvf   p15(18),'Salesman Total **'
        putb  filo1,p0
 @ttll8 mvf   p15(18),'   Final Total ***'
        putb  filo1,p0

Notes re qrpgEX3

  1. This job is the same as qrpgEX1, with some uvcopy instructions added to customize total descriptions. Page Footings are also illustrated.

  2. '@ttll1' indicates the following instructions will be executed at total level 1 time, customer# break coded by: ctll1=a3(6),'cust#'

  3. '@ttll2' indicates the following instructions will be executed at total level 2 time, salesman# break coded by: ctll2=a0(2),'sl#'

  4. '@ttll8' is always used for the Final totals (1 higher than the highest ctll# coded)

  5. Be sure to use the 'b' option on 'putb filo1,p0' to blank the print line (area 'p') after printing. Otherwise the total descriptions & '*'s would remain & garbage up subsequent print lines.

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

M4. qrpgEX4 - sales analysis by customer within salesman

qrpgEX4 is similar to examples 1 & 2, but illustrates several powerful features

  1. sorts the input file prior to the report
  2. indexed file to retrieve customer names
  3. uvcopy instructions to calc qty*price, avg price,
  4. summary tables by salesman & product, dumped at end job

    dat1/sales5 record layout

 01-06 - customer#       <-- control level #1 (minor)
 11-12 - salesman#       <-- control level #2 (major)
 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

dat1/sales5 - test/demo data


 cust#    sl# date   invoice   product  qty    price   amount
 ==============================================================
 130140    44 960802 IN111001  HAM001  000010 0001000 000010000
 130140    44 960802 IN111001  SCR012  000020 0002000 000040000
 139923    21 970802 IN111002  CHR001  000030 0003000 000080000
 139923    21 970802 IN111002  TAB013  000042 0004000 000160000
 139923    21 970807 CR5421    TAB013  000050 0005000 000250000
 250825    44 980804 IN1122    HAM001  000060 0006000 000360000
 250825    44 980804 IN1122    PLN012  000070 0007000 000490000
 401210    21 990816 CR955     HAM001  000080 0008000 000640000
 401210    21 990816 IN441     BIT001  000090 0009000 000810000
           Notes re: sample report shown on next page --->
  1. See '?' beside amount for product CHR001 & TAB013 because the amount does not agree with the recalculation of qty * price. (see code @dtl in qrpgEX4 job 2 pages ahead)

  2. Name for cust# 250825 is blank on the sample report, because there is no matching record for cust# 250825 in the dat1/custmast ISAM file. (see code @bgnl1 in qrpgEX4 job 2 pages ahead)

  3. Note the (built-in) 'sort' sorts the input data by salesman(major) & customer(minor) to achieve the desired total level control effect. The sort was not required for qrpgEX1 (previous example) because the its test file (dat1/sales4) was already in sequence by slsmn/customer, but the test file here (dat1/sales5) is not already in sequence.

  4. Also note that records prior to 1997 have been dropped from the report via the keep/drop function which is effective during the sort.

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

M4a. uvqrpg report writer - Example#3 (qrpgEX4)


 uvqrpg qrpgEX4,fili1=dat1/sales5          <--- run demo job
 ================================

sample report created by qrpgEX4

 Sales Analysis by customer within salesman  2003/03/21_11:24:22 page0001
 sl# cust#    date   invoice  product quantity     price        amount
 ===============================================================================
 21  139923  JOHNSTONE BOILER & TANKS
              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 *
     401210  COAST RANGE CONSTRUCTION
              990816 IN441    BIT001        90     90.00      8,100.00
              990816 CR955    HAM001        80     80.00      6,400.00
                                           170 *             14,500.00 *
            avg price =      66.43         292 **            19,400.00 **
 44  250825
              980804 IN1122   PLN012        70     70.00      4,900.00
              980804 IN1122   HAM001        60     60.00      3,600.00
                                           130 *              8,500.00 *
            avg price =      65.38         130 **             8,500.00 **
                                           422 ***           27,900.00 ***
 qrpgEX4  2003/03/21_11:24:23  summary table of qty & amt by salesman
 tbl#001 pg#001     -argument-            -acum#1-    %        -acum#2-    %
 line#  count    %  slsmn                 quantity               amount
     1       5  71  21                         292   69       19,400.00   69
     2       2  28  44                         130   30        8,500.00   30
             7*100   *TOTAL*                   422 *100       27,900.00 *100
 qrpgEX4  2003/03/21_11:24:23  summary table of qty & amt by product
 tbl#002 pg#001     -argument-            -acum#1-    %        -acum#2-    %
 line#  count    %  product               quantity               amount
     1       1  14  BIT001                      90   21        8,100.00   29
     2       3  42  HAM001                     170   40       10,800.00   38
     3       1  14  PLN012                      70   16        4,900.00   17
     4       2  28  TAB013                      92   21        4,100.00   14
             7*100   *TOTAL*                   422 *100       27,900.00 *100

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

M4b. uvqrpg report writer - Example#2 (qrpgEX4)

 # qrpgEX4 - uvcopy Parameter File from UVSI stored in: /home/uvadm/pf/demo/
 # qrpgEX4 - uvqrpg example - sales analysis by customer within salesman
 #         - see input record layout & sample output report in uvqrpg.doc
 #         - similar to EX1, but illustrates several powerful features
 #         - sorts the input file, with record selection (prior to the report)
 #         - indexed file used to retrieve customer names
 #         - uvcopy instructions to calc qty*price, avg price,
 #         - summary tables by salesman & product, dumped at end job
 #
 #usage: uvqrpg qrpgEX4,fili8=dat1/sales5,filo1=tmp/qrpgEX4.rpt
 #       ======================================================
 #
 rop=r1   #run option to prompt at EOJ for report disposition (vi,cat,more,etc)
 fili8=?dat1/sales5,rcs=64,typ=LST         #<-- input  to sort
 filo8=tmp/sales5.sorted,rcs=64,typ=LSTt   #--> output from sort
 fili1=tmp/sales5.sorted,rcs=64,typ=LST    #<-- input  to report
 filo1=?tmp/$jobname.rpt,rcs=80,typ=LSTt   #--> output from report
 filr1=?dat1/custmast,rcs=256,typ=ISF   # customer ISAM file to get cust name
 sort=64,'10(2),0(6)'                   # 1st sort by slsmn# & customer#
 keep1=a13(2),>'96'                     # select sales 1997-1999
 head2=h2000(44),'Sales Analysis by customer within salesman '
 head2=h2044(30),'$datetime $page####'
 head1s2u1=h1000(50),'sl# cust#    date   invoice  product quantity'
 head1=h1050(30),'price        amount'
 ctll2=a10(2),'sl#'
 ctll1=a0(6),'cust#'
 ref=a13(6),'date'
 ref=a20(8),'invoice',p20(8)
 ref=a30(6),'product'
 acum1=a38(6),'quantity',p39(7),'zz,zz9-'
 ref=a45(7),'price',,'zz,zzz.99-'
 acum2=a53(9),'amount',,'zzzz,zzz.99-'
 #
 # on 1st rec of cust# group - get cust name from ISAM file
 # - cust# has already been moved to p4(6) & slsmn# to p0(2) if 1st of sl grp
 @bgnl1 mvf     c0(256),a0(6)       store cust# key in read area
        redm5   filr1,c0(256)       random read by cust#
        mvc     p12(25),c10         store cust name in print area
        putb    filo1,p0(80)        print line with cust# & name
 #
 # at record detail time - verify qty * price = amount
 # - build summary tables of qty & amt by slsmn# & product# to dump at EOF
 # - when @dtl declared, ctl/ref/acum fields already edited in area 'p',
 #   & automatic printing (writing to output file) is inhibited
 # - we must re-edit into 'p' if we wish to change pre-edited fields
 # - accumulations will be performed after we return ($amount will be OK)
 @dtl   mvn     $ca1,$quantity      to recalc qty * price = amount
        mpy     $ca1,$price
        cmn     $ca1,$amount        qty * price = amount ?
        skp=    1
        mvc     $amount_p(1),'?'    no - flag amt with '?'
        putb    filo1,p0(80)        write detail line to report
        tblt1f3 $sl#,'slsmn;quantity;amount',$quantity,$amount
        tblt2f3 $product,'product;quantity;amount',$quantity,$amount

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

 # at slsmn total time - calculate avg price for salesman
 # - when @ttl declared, totals already edited into area 'p'
 #   & automatic printing (writing to output file) is inhibited
 # - we can add more data to print area & output the modified line
 @ttll2 mvn     $ca2,$t202          slsm total amt (level#2, acum#2)
        div     $ca2,$t201          divide by ttl qty = avg price
        mvc     p11(12),'avg price = '
        edt     p23(10),$ca2,'zzz,zzz.99'
        putb    filo1,p0(80)        write slsmn total line to report
 #
 # at ttll8 (EOF) - dump summary tables to end of control level report file
 # - files still open at @ttll8 (would be closed @eoj)
 @ttll8 putb    filo1,p0(80)        write final total line (alrdy edited)
 ##     hdr                  # page headings before tables (##commented out)
        putb    filo1,' '    # space before table dump
        tbpt1s2 filo1,'summary table of qty & amt by salesman'
        tbpt2s2 filo1,'summary table of qty & amt by product'

Notes re: qrpgEX4 coding

  1. The uvqrpg solution above requires 37 lines of non-comment code. 16 lines of functions (head,ref,ctl) & 20 lines of uvcopy instructions. The uvcopy instructions in qrpgEX4 are used for extended but optional customizations (& were not used at all in qrpgEX1).

  2. Please compare the qrpgEX4 job listed above to the 'equivalent uvcopy' copyEX4, which requires 80 instructions. CopyEX4 is not listed here, but you can edit or print it from ~uvadm/pf/copyEX4.

  3. Please note the summary tables of qty & amt by salesman & product (see end of sample report 2 pages back). Each table requires only 1 line to build & 1 line to print (at EOF). For example, the instructions for the salesman table build/print are:

       tblt1f3 a10(2),'slsmn;quantity;amount',a38(6),a53(9)
         ---
       tbpt1s2  filo1,'EOF summary table of qty & amt by SALESMAN'
  1. You can code up to 255 tables per uvqrpg or uvcopy job The number of lines per table is limited only by available memory

  2. Note that the table arguments (slsmn & product in this case) may appear in any sequence in the input data file. The 1st occurrence of an argument value (eg. slsmn#) creates a new table entry, but subsequent occurrences will accumulate into the existing table entry.

  3. The table entries will always be dumped out in sequence at EOF, with percentages calculated on each line of the 100% total at the bottom. The tbl/tbp instructions demonstrate the power of these utilities (how many lines of COBOL would it take to duplicate these ?)

  4. Re: @ttll8 putb filo1,p0 <-- write final total line We must print explicitly since declaring @ttll8 inhibits the auto print.

  5. You can uncomment the '## hdr' line if you want the tables on a new page

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

M5. qrpgEX5 - illustrate 'x' option multi consecutive fields

qrpgEX5
  • 12 months sales report with totals by customer, province,& final.

qrpgEX5 illustrates the acum 'x' option, to edit & accumulate multiple consecutive same size fields through multiple total levels - all this with only one instruction.

 acum1x12g3=a120(5p),'January',,'zzzz,zzz.99-'

The customer master record has 12 * 5 byte packed fields starting with January in columns 121-125. These 12 fields will be edited to 12 * 12 byte fields & accumulated for multiple total levels (cust#, province,& final).

dat1/custmas1 - relevant fields

           001-006 - customer#
           011-035 - customer name
           078-079 - province
           121-180 - this year sales 12 x 5 byte packed fields

 uvhd dat1/custmas1 r256       - use uvhd to display packed 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

Note the 24 x 5 byte packed fields in cols 121-240. The packed fields & the lack of linefeeds mean that you cannot examine this file with 'vi' or print it with 'lp'.

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

M5a. qrpgEX5 - illustrate 'x' option multi consecutive fields

qrpgEX5 - sample report

 12 Months Sales Analysis by customer within 1999/10/12_15:31:05 page0001
 prov cust# customer-name             January      February         March
 AL 204700  CASE POWER EQUIPMENT       212.48-     1,611.82           .00
    223240  NICHOLSON CHEVROLET LT      14.43        138.10           .00
    224700  OTTO MOBILES WESTERN L        .00      2,809.00      2,809.00
    308685  FOOTHILLS ELECTRIC            .00           .00        270.33
    318833  TOP NOTCH CONSTRUCTION     383.55           .00           .00
                                       185.50 *    4,597.56 *    3,079.33 *
 BC 132588  GEECOE GENERATOR SERVI      46.80        183.85           .00
    142175  LILLY ELECTRIC (1973)         .00           .00     10,761.58
    150825  RIGGERS INDUSTRIAL            .00         65.16-          .00
    152355  SHAW, JOHN                    .00        424.48           .00
    154688  TAURUS RESOURCES              .00      2,112.81      3,552.78
    400002  ACKLANDS LTD               274.83         50.17        135.86
    406082  PRECAM RENTALS LTD:         52.46           .00           .00
                                       414.24 *    2,706.15 *   14,491.36 *
                                       599.74 **   7,433.24 **  17,570.69 **

qrpgEX5 - uvqrpg code

 # qrpgEX5 - uvcopy Parameter File from UVSI stored in: /home/uvadm/pf/demo/
 # qrpgEX5 - uvqrpg example#3, 12 month's sales report by cust, prov,& final
 #         - custmast file has 12 * 5 byte packed fields cols 121-180
 #         - see uvqrpg.doc for input file layout & expected report
 #
 # This example demonstrates acum option 'x' to edit & accumulate multiple
 # consecutive same size record fields thru multiple total levels depending
 # on the control levels declared - all with 1 instruction.
 #
 #usage: uvqrpg qrpgEX5,fili8=dat1/custmast,filo1=tmp/qrpgEX5.rpt
 #       ========================================================
 #
 rop=r1   #run option to prompt at EOJ for report disposition (vi,cat,more,etc)
 fili8=?dat1/custmast,rcs=256,typ=ISF         #<-- input  to sort
 filo8=tmp/custmast.sorted,rcs=256,typ=RSF    #--> output from sort
 fili1=tmp/custmast.sorted,rcs=256,typ=RSF    #<-- input  to report
 filo1=?tmp/$jobname.rpt,rcs=200,typ=LSTt     #--> output from report
 sort=256,'77(2),0(6)'                        # sort by province# & customer#
 head2=h2000(44),'12 Months Sales Analysis by customer within province'
 head2=h2044(30),'$datetime $page####'
 head1s2u4=h1000(60),'prov cust# customer-name             January      February'
 head1=h1060(60),'       March          April          May          June '
 head1=h1120(55),'    July        August     September       October      '
 head1=h1175(30),' November      December'
 ctll1=a77(2),'prov'
 ref=a0(6),'cust#',p3(6)
 ref=a10(22),'customer-name'
 acum1x12g3=a120(p5),'January',,'zzz,zzz.99-'
 #Note: acum 'x12' option to edit & acum 12 consecutive fields thru 3 ttl levels
 #      acum 'g3' option to leave gap of 3 spaces to allow for *** total ID's

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

M6. qrpgEX6 - illustrate Accumulator Selection at Detail Record Time

qrpgEX6 sample report

 Sales by customer & salesman with yearly totals ac1999/10/26_09:39:45 page0001
 sl# cust#  date   product        1999           1998           1997 -
 21  139923 970802 CHR001          .00 *          .00 *     4,900.00 *
     401210 990816 BIT001    14,500.00 *          .00 *          .00 *
                             14,500.00 **         .00 **    4,900.00 **
 44  130140 960802 HAM001          .00 *          .00 *       500.00 *
     250825 980804 PLN012          .00 *     8,500.00 *          .00 *
                                   .00 **    8,500.00 **      500.00 **
                             14,500.00 ***   8,500.00 ***   5,400.00 ***

Sometimes you can not know which record fields are to be accumulated into which accumulators, when the 'acum' function must be declared.

uvqrpg allows you to specify zero on the acum function, so you can use @dtl coding to determine the proper acum,& then store the values in to level zero acums, which are added to level 1 acums after @dtl coding.

Please examine the qrpgEX6 solution on the next page --->

1 - 'acum's are declared (with 0 values) as follows:

      acum1=0,'1999',,'zzzz,zzz.99-'
      acum2=0,'1998',,'zzzz,zzz.99-'
      acum3=0,'1997',,'zzzz,zzz.99-'

2 - $amount's can be stored in the desired acum & edited to the proper position in the print line as follows: (showing code only for 1999)

      # test year & determine desired acum#
      @dtl   ---
      year99 mvn    $t001,$amount         store $amt in level 0 acum1 (1999)
             edt    $1999,$amount,'zzzzz,zzz.99-'

3 - $amount was defined with option 'i1' to inhibit printing

     refi1=a53(9),'amount'      # define $amount for use on instructions
                                # rather than using: displacement(length)
     year99 mvn    $t001,a53(9)
            edt    $1999,a53(9),'zzzzz,zzz.99-'

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

M6a. qrpgEX6 - illustrate Accumulator Selection at Detail Record Time

Please see the sample report on the previous page, corresponding to the coding below.

 # qrpgEX6 - uvcopy Parameter File from UVSI stored in: /home/uvadm/pf/demo/
 # qrpgEX6 - uvqrpg example#1, sales analysis by customer within salesman
 #         - see uvqrpg.doc for input file layout & report expected
 #
 # illustrates - ACCUMULATOR SELECTION AT DETAIL RECORD TIME
 #             - accumulate by year 99, 98, 97 (across the page)
 #        note - acum=0 on acums, then store $amt in $t001,$t002,$t003
 #             - level 0 totals are auto added to level 1 after @dtl
 #
 #usage: uvqrpg qrpgEX6,fili1=dat1/sales5,filo1=tmp/qrpgEX6.rpt
 #       ======================================================
 #
 rop=r1   #run option to prompt at EOJ for report disposition (vi,cat,more,etc)
 fili8=?dat1/sales5,rcs=64,typ=LST         #<-- input  to sort
 filo8=tmp/sales5.sorted,rcs=64,typ=LSTt   #--> output from sort
 fili1=tmp/sales5.sorted,rcs=64,typ=LST    #<-- input  to report
 filo1=?tmp/$jobname.rpt,rcs=80,typ=LSTt   #--> output from report
 sort=64,'10(2),0(6)'                   # 1st sort by slsmn# & customer#
 head2=h2000(50),'Sales by salesman & customer with yearly totals '
 head2=h2050(30),'$datetime $page####'
 head1s2p55=h1000(25),'sl# cust#  date   product '
 head1=h1025(45),'        1999           1998           1997 -'
 ctll2=a10(2),'sl#'
 ctll1=a0(6),'cust#'
 ref=a13(6),'date'
 ref=a30(6),'product'
 refi1=a53(9),'amount'  # define $amount for use below, 'i1' inhibits print
 acum1=0,'1999',,'zzzz,zzz.99-'
 acum2=0,'1998',,'zzzz,zzz.99-'
 acum3=0,'1997',,'zzzz,zzz.99-'
 # at detail record - test year & store $amt in level 0 acum 1,2,3 (99,98,97-)
 @dtl   cmc    a13(2),'98'                year < = > 98 ?
        skp=   year98
        skp<   year97
 # not =, not <, must be > (1999)
 year99 mvn    $t001,$amount              store $amt in level 0 acum1 (1999)
        edt    $1999,$amount,'zzzzz,zzz.99-'
        skp    end
 year98 mvn    $t002,$amount              store $amt in level 0 acum2 (1998)
        edt    $1998,$amount,'zzzzz,zzz.99-'
        skp    end
 year97 mvn    $t003,$amount              store $amt in level0 acum3 (1997-)
        edt    $1997,$amount,'zzzzz,zzz.99-'
        skp    end
 end    nop

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

M7. qrpgEX7 - printing 2 detail lines per record

qrpgEX7
  • illustrate printing 2 detail lines for each record
  • will print Name & Address on 2 lines (for portrait 8 1/2 x 11)
  • input dat1/custmas1 test file (see record layout below)

dat1/custmas1 - record layout

 000-005 - customer#
 008-008 - delete flag (D)
 010-034 - customer name
 035-059 - address
 060-076 - city
 077-078 - province
 080-089 - postal code
 090-101 - phone#
 102-119 - contact name
 120-239 - sales history 24 x 5 byte packed fields
 240-255 - not used

Customer Name & Address listing

 Customer Name & Address list 2003/04/19_10:58:45 page0001
 cust#  customer-name             address
        city            prov postal  telephone    contact
 ========================================================
 130140 EVERGREEN MOTORS LTD.     1815 BOWEN ROAD
        NANAIMO         BC   V9S1H1  250-754-5531  LARRY WRENCH
 132588 GEECOE GENERATOR SERVICES UNIT 170 - 2851 SIMPSON
        RICHMOND        BC   V6X2R2  604-278-4488  HARRY LIGHT
 139923 JOHNSTONE BOILER & TANKS  1250 EAST PENDER STREET
        VANCOUVER       BC   V5L1W1  604-320-1845 GEORGE BROWN
 142175 LILLY ELECTRIC (1973) LTD 16809 - 24TH AVENUE
        SURREY          BC   V4B5E7  604-534-9787  FRITZ BERNAUS

The Name & Address fields from each record are printed on 2 lines so we can use 8 1/2 x 11 inch paper Portrait. Please see the uvqrpg parameter file listed on the next page & note how 'head1' & 'head9' are used to declare on which line the fields are to be printed.

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

M7a. qrpgEX7 - printing 2 detail lines per record

qrpgEX7 - parameter file

 # qrpgEX7 - uvcopy Parameter File from UVSI stored in: /home/uvadm/pf/demo/
 # qrpgEX7 - uvqrpg example#6, to demo 2 line print for each detail record
 #         - see uvqrpg.doc for input file layout & expected report
 #
 #Note - fieldnames coded in 'head9' (vs 'head1') cause their matching
 #       ctl/ref/acum fields to be printed on a 2nd line
 #
 #usage: uvqrpg qrpgEX7,fili8=dat1/custmast,filo1=tmp/qrpgEX7.rpt
 #       ========================================================
 #
 rop=r1   #run option to prompt at EOJ for report disposition (vi,cat,more,etc)
 fili1=dat1/custmas1,rcs=256,typ=RSF         #<-- input  to report
 filo1=?tmp/$jobname.rpt,rcs=200,typ=LSTt    #--> output from report
 head2=h2000(44),'Customer Name & Address list $datetime $page####'
 #1234567890123456789012345678901234567890123456789012345678901234567890123456789
 head1=h1000(80),'cust#  customer-name             address '
 head9s2u4x2=h9000(80),'       city            prov postal  telephone    contact'
 ref=a0(6),'cust#'
 ref=a10(25),'customer-name'
 ref=a35(25),'address'
 ref=a60(16),'city'
 ref=a77(2),'prov'
 ref=a80(8),'postal'
 ref=a90(12),'telephone'
 ref=a102(18),'contact'
 #

Notes re qrpgEX7

  1. 'head9' is used to declare the fieldnames to be printed on line 2 (vs head1 fieldnames for line 1).

  2. The 'ref' field definitions do not need to indicate line 1 or line 2. uvqrpg automatically places them on the 1st or 2nd line depending on where a fieldname match is found (on head1 or on head9).

  3. The options for underlining headings, spacing, etc are now moved from 'head1' to 'head9' (head9u4s2x2=...).

  4. Note that option 'x2' on head9 specifies the extra spacing for the 2nd detail line (to space between Name & Address for different customers). Option 's2' specifies the extra spacing for the head9 line itself.

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

M8. Preliminary Example #3 - qrpgEX8

Preliminary example #3 (qrpgEX8) will illustrate 'Delimited Input Files'. Please note the sample input file below (delimited by '|' pipe symbols), followed by the sample report file created from the 'qrpgEX8' demo job which is listed on the next page.

sample Delimited Input File

 11911|Thomas Watson|inv3234|1,550.00|108.50|
 11911|Thomas Watson|inv3235|425.00|55.50|
 21945|Presper Eckert|inv4202|975.00|175.00|
 21945|Presper Eckert|cr9202|-75.00|-25.00|
 22359|John Mauchly|inv5105|1250.00|255.00|
 31975|Steve Jobs|inv1015|2500.00|500.00|
 31975|Steve Jobs|inv1016|825.50|200.75|
 41980|Bill Gates|cr8001|-2,500.00|-275.00|

sample report created by qrpgEX8

 qrpgEX8 - Payroll Report  2003/06/02_16:48:24 page0001
 emp#  name                inv#         regpay     overtime
 ==========================================================
 11911 Thomas Watson       inv3234    1,550.00       108.50
       Thomas Watson       inv3235      425.00        55.50
                                      1,975.00 *     164.00 *
 21945 Presper Eckert      inv4202      975.00       175.00
       Presper Eckert      cr9202        75.00-       25.00-
                                        900.00 *     150.00 *
 22359 John Mauchly        inv5105    1,250.00       255.00
                                      1,250.00 *     255.00 *
 31975 Steve Jobs          inv1015    2,500.00       500.00
       Steve Jobs          inv1016      825.50       200.75
                                      3,325.50 *     700.75 *
 41980 Bill Gates          cr8001     2,500.00-      275.00-
                                      2,500.00-*     275.00-*
                                      4,950.50 **    994.75 **

Please see the 'qrpgEX8' uvqrpg job coding listed on the next page --->

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

M8a. Preliminary Example #3 - qrpgEX8

qrpgEX8 - coding for sample report#3

 # qrpgEX8 - uvqrpg sample report for Delimited File input
 #
 # uvqrpg qrpgEX8,fili1=dat1/timecards,filo1=tmp/qrpgEX8.rpt <-- file defaults
 # =========================================================
 #
 # uvqrpg qrpgEX8   <-- run job (easy way, filenames default as shown above)
 # ==============
 #
 rop=r1    # run option for prompt to display report
 #Nov26/07 - delimited option changed from rop=g# to typ=LSTg#
 # - g# (of typ=LSTg#) is value of the delimiter character (g124 = '|' x'7C')
 # - g0 allows multi-byte delimiter spcfd by arg9=...
 fili1=?dat1/timecards,rcs=256,typ=LSTg124
 filo1=?tmp/timecard.rpt,rcs=256,typ=LSTt
 head2=h2000(80),'$jobname - Payroll Report  $datetime $page####'
 head1s2u4=h1000(80),'emp#  name                inv#         regpay     overtime'
 ctll1=g100(5),'emp#'
 ref=g200(20),'name'
 ref=g300(8),'inv#'
 acum1=g400(10),'regpay',,'zz,zzz.99-'
 acum2=g500(10),'overtime',,'zz,zzz.99-'

Notes re qrpgEX8 & Delimited Files

  1. 'rop=r1' specifies the 'Run OPtions'. 'r1' requests a prompt for report disposition at end of job (enter command to view/print report).

  2. Input fili=...,typ=LSTg112 specifies the delimiter character, g124 = x'7C' = '|' = 'pipe character, g0 allows multi-byte delimiter spcfd by arg9=...

  3. Note that the data fields defined by ctl,ref,& acum are now addressed in area 'g' & the displacements start at 100 & are incremented by 100 depending on field# (delimiter#). Run option 'g' causes the input data (always in area 'a') to be copied to area 'g' in fixed fields 100 bytes apart. The displacement for any given field is its field# (delimiter#) multiplied by 100.

  4. A multi-byte Delimiter could be declared via 'arg9=?' if typ=LSTg0 & would default to a blank if arg9 was omitted.

  5. If you use a blank delimiter, you will probably need to specify Run OPtion 'a1' which will squeeze the input area 'a' to 1 blank between words before copying to area 'g' fixing the fields 100 bytes apart via ' ' blank delimiters.

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

N1. More EXamples - SUMMARY REPORTS - inhibit detail, print on total breaks

 # qrpgEX91 - uvcopy Parameter File from UVSI stored in: /home/uvadm/pf/demo/
 # qrpgEX91 - uvqrpg example#11, sales by product & salesman
 #
 # This job illustrates a SUMMARY REPORT (no detail record printing)
 # - total levels by product within slsmn & final
 # Compare to qrpgEX92 which illustrates multi-part control fields
 #
 #note qrpgEX91,92,93,etc demo different methods of statistical reports
 # - varying total level controls, detail vs summary, split keys, tables, etc
 # - see uvqrpg.doc for input file layout & sample report expected
 #
 #usage: uvqrpg qrpgEX91,fili8=dat1/sales5,filo1=tmp/qrpgEX91.rpt
 #       ========================================================
 #
 rop=r1   #run option to prompt at EOJ for report disposition (vi,cat,more,etc)
 fili8=?dat1/sales5,rcs=64,typ=LST
 filo8=tmp/sales5.sorted,rcs=64,typ=LSTt
 fili1=tmp/sales5.sorted,rcs=64,typ=LST
 filo1=?tmp/$jobname.rpt,rcs=80,typ=LSTt
 sort=64,'10(2),30(6)'
 head2=h2000(40),'$jobname - sales by product within slsmn'
 head2=h2040(30),'  $datetime $page####'
 head1s2p55=h1000(60),'sl#  product sale-count   quantity         amount'
 ctll2=a10(2),'sl#'
 ctll1s0=a30(6),'product'              #<-- option s0 nospace after ttll1
 acum1=1,'sale-count',,'zz,zz9-'
 acum2=a38(6),'quantity',,'zz,zz9-'
 acum3=a53(9),'amount',,'zzzz,zzz.99-'
 @dtl   nop                            #<-- inhibit detail record print

sample report - illustrating SUMMARY report (totals only)

 qrpgEX91 - sales by product within slsmn  1999/10/20_12:45:42 page0001
 sl#  product sale-count   quantity         amount
 21   CHR001           1 *       30 *       800.00 *
      HAM001           1 *       10 *       100.00 *
      SAW012           1 *       20 *       400.00 *
      TAB013           2 *       92 *     4,100.00 *
                       5 **     152 **    5,400.00 **
 44   BIT001           1 *       90 *     8,100.00 *
      HAM001           2 *      140 *    10,000.00 *
      SAW012           1 *       70 *     4,900.00 *
                       4 **     300 **   23,000.00 **
                       9 ***    452 ***  28,400.00 ***
Note
  • We have inhibited record detail printing via '@dtl nop'
  • We specified no spacing for total level 1 lines via option 's0' on
    ctll1s0=a30(6),'product'

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

N2. More EXamples - MULTI-PART CONTROL FIELDS (split control keys)

 # qrpgEX92 - uvcopy Parameter File from UVSI stored in: /home/uvadm/pf/demo/
 # qrpgEX92 - uvqrpg example#92, sales by product & salesman (combined)
 #
 # This job illustrates: MULTI-PART CONTROL FIELDS
 # - see ctll1p1 & ctll1p2 below, split keys (multi-part control level)
 # - totals by product & slsmn, combined, ie multi-part ctl key
 # Compare to qrpgEX91 which illustrated multi-level control totals
 #
 #note qrpgEX91,92,93,etc demo different methods of statistical reports
 # - varying total level controls, detail vs summary, split keys, tables, etc
 # - see uvqrpg.doc for input file layout & sample report expected
 #
 #usage: uvqrpg qrpgEX92,fili8=dat1/sales5,filo1=tmp/qrpgEX92.rpt
 #       ========================================================
 #
 rop=r1   #run option to prompt at EOJ for report disposition (vi,cat,more,etc)
 fili8=?dat1/sales5,rcs=64,typ=LST
 filo8=tmp/sales5.sorted,rcs=64,typ=LSTt
 fili1=tmp/sales5.sorted,rcs=64,typ=LST
 filo1=?tmp/$jobname.rpt,rcs=80,typ=LSTt
 sort=64,'10(2),30(6)'
 head2=h2000(40),'$jobname - sales by salesman & product (combined)'
 head2=h2040(30),'  $datetime $page####'
 head1s2p55=h1000(60),'sl#  product sale-count   quantity         amount'
 ctll1p1=a10(2),'sl#'                  #<-- multi-part control part1
 ctll1p2=a30(6),'product'              #<-- multi-part control part2
 acum1=1,'sale-count',,'zz,zz9-'
 acum2=a38(6),'quantity',,'zz,zz9-'
 acum3=a53(9),'amount',,'zzzz,zzz.99-'
 @dtl   nop                            #<-- inhibit detail record print

sample report - illustrating MULTI-PART CONTROL fields

 qrpgEX92 - sales by product within slsmn  1999/10/20_12:45:37 page0001
 sl#  product sale-count   quantity         amount
 21   CHR001           1 *       30 *       800.00 *
 21   HAM001           1 *       10 *       100.00 *
 21   SAW012           1 *       20 *       400.00 *
 21   TAB013           2 *       92 *     4,100.00 *
 44   BIT001           1 *       90 *     8,100.00 *
 44   HAM001           2 *      140 *    10,000.00 *
 44   SAW012           1 *       70 *     4,900.00 *
                       9 **     452 **   28,400.00 **

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

N3. qrpgEX93 - uvqrpg example#93, sales by product & salesman (combined)

 # qrpgEX93 - uvcopy Parameter File from UVSI stored in: /home/uvadm/pf/demo/
 # qrpgEX93 - uvqrpg example#93, sales by product & salesman (combined)
 #
 # This is a 'uvqrpg' job 'qrpgEX93' to illustrate TABLE SUMMARY reports
 # - build tables in memory for printing at EOF (no printing until EOF)
 # - no file sorting required, tables are built in sequence in memory
 #
 # Compare to 'uvcopy' job 'copyEX93' which creates the same table summary
 #   as this (qrpgEX93), but using 'uvcopy' vs 'uvqrpg'
 # uvcopy might be better for 'tbl' table summaries
 #  - when you do not need detail printing or multiple total levels
 #  - see uvqrpg.htm#F10 which lists advantages/limitations of uvcopy/uvqrpg
 #
 # Also compare to qrpgEX92 which sorted & printed on level control breaks
 # - vs accumulating tables in memory & dumping at EOF
 #
 #note qrpgEX91,92,93,etc demo different methods of statistical reports
 # - varying total level controls, detail vs summary, split keys, tables, etc
 # - see uvqrpg.doc for input file layout & sample report expected
 #
 #usage: uvqrpg qrpgEX93,fili1=dat1/sales5,filo1=tmp/qrpgEX93.rpt
 #       ========================================================
 #
 rop=r1   #run option to prompt at EOJ for report disposition (vi,cat,more,etc)
 fili1=?dat1/sales5,rcs=64,typ=LST
 filo1=?tmp/$jobname.rpt,rcs=80,typ=LSTt
 #
 # at detail time - move sl#/product# together & build table in memory
 @dtl   mvc     c0(2),a10           slsmn# to work area
        mvc     c3(6),a30           append product# leaving 1 space
        tblt1f3 c0(9),'slsmn/product;quantity;amount',a38(6),a53(9)
 #
 # at ttll8 (EOF) - dump summary tables to end of control level report file
 @ttll8 tbpt1s2 filo1,'summary table of qty & amt by salesman'

sample report

 qrpgEX93  1999/10/21_15:23:32  summary table of qty & amt by salesman
 tbl#001 pg#001     -argument-          -acum#1-    %      -acum#2-    %
 line#  count    %  slsmn/product       quantity             amount
     1       1  11  21 BIT001                 90   19      8,100.00   28
     2       1  11  21 CHR001                 30    6        800.00    2
     3       1  11  21 HAM001                 80   17      6,400.00   22
     4       2  22  21 TAB013                 92   20      4,100.00   14
     5       2  22  44 HAM001                 70   15      3,700.00   13
     6       1  11  44 PLN012                 70   15      4,900.00   17
     7       1  11  44 SCR012                 20    4        400.00    1
             9*100   *TOTAL*                 452 *100     28,400.00 *100

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

N4. copyEX93 - uvcopy example#93, sales by product & salesman (combined)

 # copyEX93 - uvcopy Parameter File from UVSI stored in: /home/uvadm/pf/demo/
 # copyEX93 - uvcopy example#93, sales by product & salesman (combined)
 #
 # This is 'uvcopy' job copyEX93' to illustrate TABLE SUMMARY reports
 # - build tables in memory for printing at EOF (no printing until EOF)
 # - no file sorting required, tables are built in sequence in memory
 #
 # Compare to 'uvqrpg' job 'qrpgEX93' which creates the same report
 # - using uvqrpg vs uvcopy
 # uvcopy might be better for 'tbl' table summaries
 #  - when you do not need detail printing or multiple total levels
 #  - see uvqrpg.htm#F10 which lists advantages/limitations of uvcopy/uvqrpg
 #
 # qrpgEX91,92,93,etc demo different methods of statistical reports
 # - varying total level controls, detail vs summary, split keys, tables, etc
 # - see uvqrpg.doc for input file layout & sample report expected
 #
 #usage: uvqrpg copyEX93,fili2=dat1/sales5,filo2=tmp/copyEX93.rpt
 #       ========================================================
 #
 fili2=?dat1/sales5,rcs=64,typ=LST
 filo2=?tmp/$jobname.rpt,rcs=80,typ=LSTt
 @run
        opn     all
 # begin loop to get & process records until EOF
 loop   get     fili2,a0             get next record
        skp>    eof                  (cc set > at EOF)
 # move slsmn & product together for table argument
        mvc     c0(2),a10            slsmn#
        mvc     c3(6),a30            product# (leave space between)
        tblt1f3 c0(9),'slsmn/product;quantity;amount',a38(6),a53(9)
        skp     loop                 repeat loop until EOF
 # EOF - dump summary table from memory
 eof    tbpt1s2 filo2,'summary table of qty & amt by slsmn & product'
        cls     all
        eoj

sample report

 copyEX93  1999/10/21_15:23:22  summary table of qty & amt by slsmn & product
 tbl#001 pg#001     -argument-          -acum#1-    %      -acum#2-    %
 line#  count    %  slsmn/product       quantity             amount
     1       1  11  21 BIT001                 90   19      8,100.00   28
     2       1  11  21 CHR001                 30    6        800.00    2
     3       1  11  21 HAM001                 80   17      6,400.00   22
     4       2  22  21 TAB013                 92   20      4,100.00   14
     5       2  22  44 HAM001                 70   15      3,700.00   13
     6       1  11  44 PLN012                 70   15      4,900.00   17
     7       1  11  44 SCR012                 20    4        400.00    1
             9*100   *TOTAL*                 452 *100     28,400.00 *100

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

N5. qrpgEX94 - example to illustrate '@get' user code to get next record

 # qrpgEX94 - uvcopy Parameter File from UVSI stored in: /home/uvadm/pf/demo/
 # qrpgEX94 - uvqrpg example to demonstrate @get user own code to get next record
 #          - same as qrpgEX1 sales analysis by customer within salesman
 #            with @get to get 1st record & any record to bypass 'TAB' records
 #
 #usage: uvqrpg qrpgEX94,fili1=dat1/sales4,filo1=tmp/qrpgEX1.rpt
 #       =======================================================
 #
 rop=r1   #run option to prompt at EOJ for report disposition (vi,cat,more,etc)
 fili1=?dat1/sales4,rcs=64,typ=LST
 filo1=?tmp/$jobname.rpt,rcs=80,typ=LSTt
 head2=h2000(45),'Sales Analysis by customer within salesman '
 head2=h2045(25),'$datetime $page####'
 head1s2p55u4=h1000(50),'sl# cust#  date   invoice  product quantity'
 head1=h1050(30),'price         amount'
 ctll2=a0(2),'sl#'
 ctll1=a3(6),'cust#'
 ref=a13(6),'date'
 ref=a20(8),'invoice'
 ref=a30(6),'product'
 acum1=a38(6),'quantity',,'zz,zz9-'
 ref=a45(7),'price',,'zz,zzz.99-'
 acum2=a53(9),'amount',,'zzzzz,zzz.99-'
 @get  nop                 <-- begin @get user own code to get next record
 get1  get    fili1,a0
       add    $ca1,1                  count records
       cmn    $ca1,1                  1st record ?
       skp<=  get1
       scn    a0(64),'TAB'            record to be skipped ?
       skp=   get1

This job is the same as qrpgEX1, see page 'M1' for sample report, BUT with '@get' user own code added to bypass the first record & bypass any record with 'TAB' anywhere in the record.

You must get records from 'fili1' into area 'a'. Omitting @get own code is equivalent to the following:

 @get  get    fili1,a0              <-- default if @get omitted

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

O1. Comparison: uvqrpg vs uvcopy

Note that uvqrpg can generate equivalent reports with about 20% of the lines of code. Uvqrpg also requires much less knowledge of the instruction formats used by uvcopy.

qrpgEX1
  • uvqrpg example #1
  • sales analysis by customer within salesman,
    with totals by customer, salesman,& final (at EOF)
  • already listed up front on page 'B2', but re-listed
    here for easy comparison to copyEX1.
  • 12 lines of code, listed on the next page --->
copyEX1
  • uvcopy example #1
  • creates same report as qrpgEX1
  • 50 lines of code, listed 2 pages ahead --->
qrpgEX4
  • uvqrpg example #4
  • 30 lines of code, not listed here (already listed up front)
  • sales analysis by customer within salesman.
  • similar to qrpgEX1, but with several additional features
    illustrating the use of uvcopy instructions (in uvqrpg):
        1 - illustrates the uvqrpg built-in sort to sort the input file
            in the sequence required for the total control levels
        2 - random reads to customer master file to get customer name
        3 - verify $amount by recalc qty * price, & flag '?' if not same
copyEX4
  • uvcopy example #4
  • creates same report as qrpgEX1
  • 90 lines of code, not listed here, but readily available in pf
            vi /home/uvadm/pf/copyEX4       - investigate with vi
            uvlp12 /home/uvadm/pf/copyEX4   - list for closer study

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

O2. uvqrpg vs uvcopy - comparison listings

Please compare this job 'qrpgEX1' to 'copyEX1' listed on the next page.

These 2 jobs create the same report, but the uvqrpg job does it in only 12 lines of code vs 50 lines for the uvcopy equivalent.

 # qrpgEX1 - uvcopy Parameter File from UVSI stored in: /home/uvadm/pf/demo/
 # qrpgEX1 - uvqrpg example - sales analysis by customer within salesman
 #         - see uvqrpg.doc for input file layout & sample report expected
 #
 # uvqrpg qrpgEX1,fili1=dat1/sales4,filo1=tmp/qrpgEX1.rpt <-- run job (hard way)
 # ======================================================
 #
 # uvqrpg qrpgEX1   <-- run job (easy way, filenames default as shown above)
 # ==============
 #
 rop=r1  #run option to prompt at EOJ for report disposition (vi,cat,more,etc)
 fili1=?dat1/sales4,rcs=64,typ=LST
 filo1=?tmp/$jobname.rpt,rcs=80,typ=LSTt
 head2=h2000(45),'Sales Analysis by customer within salesman '
 head2=h2045(25),'$datetime $page####'
 head1s2p55u4=h1000(50),'sl# cust#  date   invoice  product quantity'
 head1=h1050(30),'price         amount'
 ctll2=a0(2),'sl#'
 ctll1=a3(6),'cust#'
 ref=a13(6),'date'
 ref=a20(8),'invoice'
 ref=a30(6),'product'
 acum1=a38(6),'quantity',,'zz,zz9-'
 ref=a45(7),'price',,'zz,zzz.99-'
 acum2=a53(9),'amount',,'zzzzz,zzz.99-'

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

O3. uvqrpg vs uvcopy - comparison listings

copyEX1 - uvcopy equivalent of qrpgEX1

 # copyEX1 - example of using uvcopy for control level reports
 #         - sales analysis with qty & amount totals by customer within salesman
 #         - see sample data & sample reports in uvtrain.doc or uvcopy5.doc
 #         - also compare to qrpgEX1 (example#1 in uvqrpg.doc)
 #           which is a lot easier way to create control level reports
 #
 fili1=?dat1/sales4,typ=LST,rcs=64        #input (sales2 layout in uvtrain.doc)
 filo1=?tmp/$jobname.rpt,typ=LSTt,rcs=80  #output, for subsequent more/vi/lp
 @run
        opn    all                 open files
        get    fili1,a0            get 1st record (for ctl break logic below)
 # create report headings
   mvfv1 h0(80),'Sales Analysis by Customer within Salesman $datetime $page'
        putb   filo1,h0(80)        write header #1 to output report file
        mvf    h0(40),'sl# cust#    date   invoice   product'
        mvf    h38(40),'quantity    price      amount'
        putb   filo1,h0(80)        write header #2
        put    filo1,' '           write blank line before detail lines
 #
 # begin salesman control level#2(major)
 bgnl2  mvn    $cb1,0              clear lvl 2 qty acum
        mvn    $cb2,0              clear lvl 2 amount acum
        mvc    p0(2),a0            store slsmn# to print on 1st line of slsmn
 #
 # begin customer control level#1(minor)
 bgnl1  mvn    $ca1,0              clear lvl 1 qty acum
        mvn    $ca2,0              clear lvl 1 amount acum
        mvc    p4(6),a4            store cust# to print on 1st line of cust
 #
 # begin loop: edit/write line, get next record, test for control break
 dtl    mvc    p13(23),a13         move date/invoice/product to print area
        edt    p38(8),a38(6),'zzz,zz9-'       edit qty to out area
        edt    p46(10),a46(7),'zz,zzz.99-'    edit price
        edt    p58(13),a53(9),'zzzzz,zzz.99-'  edit $amount
        putb   filo1,p0(80)        write line to output file
        add    $ca1,a38(6)         add dtl rec QTY to lvl1(cust) acum
        add    $ca2,a53(9)         add dtl rec AMT to lvl1(cust) acum
        mvc    r0(64),a0           save current rec for control break test
        get    fili1,a0(64)        get next record
        cmc    a0(10),r0           control break cust#, slsmn#, or EOF ?
        skp=   dtl                 same cust# - repeat detail loop
 #
 # level 1 control break - print customer totals of qty & amount
 ttl1   edt    p38(8),$ca1,'zzz,zz9-'       edit cust ttl qty
        edt    p58(13),$ca2,'zzzzz,zzz.99-'  edit cust ttl $amount
        mvc    p46(1),'*'          identify level1 totals with 1 '*'
        mvc    p71(1),'*'
        putb   filo1,p0(80)        write line to output file
        add    $cb1,$ca1           add lvl1(cust) QTY ttl to lvl2(slm)
        add    $cb2,$ca2           add lvl1(cust) AMT ttl to lvl2(slm)
        cmc    a0(2),r0            control break slsmn# or EOF ?
        skp=   bgnl1               same sl# - return to next cust# group

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

 # level 2 control break - print salesman totals of qty & amount
 ttl2   edt    p38(8),$cb1,'zzz,zz9-'       edit slmn# ttl qty
        edt    p58(13),$cb2,'zzzzz,zzz.99-'  edit slmn# ttl $amount
        mvc    p46(2),'**'         identify level2 totals with 2 '*'s
        mvc    p71(2),'**'
        putb   filo1,p0(80)        write line to output file
        put    filo1,' '           space after slsmn totals
        add    $cc1,$cb1           add lvl2(slsm) QTY ttl to lvl3(final)
        add    $cc2,$cb2           add lvl2(slsm) AMT ttl to lvl3(final)
        cmc    a0(4),'~EOF'        EOF ?
        skp!   bgnl2               no - return to next slsmn# group
 #
 # EOF - print final totals, close files,& end job
 eof    edt    p38(8),$cc1,'zzz,zz9-'       edit final ttl qty
        edt    p58(13),$cc2,'zzzzz,zzz.99-'  edit final ttl $amount
        mvc    p46(3),'***'        identify level 3(EOF) totals with 3 '*'s
        mvc    p71(3),'***'
        putb   filo1,p0(80)        write line to output file
        cls    all
        eoj

NOTES

The uvcopy code shown on the 2 pages above is listed here, so you can appreciate how brief & easy the uvqrpg coding is in comparison.

Uvcopy coding requires 50 lines to create the same report as uvqrpg does in 12 lines. Of course this is because uvqrpg is specially designed for control level reports whereas uvcopy is not. There are many other tasks for which uvcopy is more suitable than uvqrpg.

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

P1. Converting EasyTrieve to uvcopy

uvqrpg can replace 'EasyTrieve' if you are converting from an IBM mainframe to a UNIX systems. To save you from having to recode the EasyTrieve jobs a converter is supplied to perform this function automatically. There are two versions of the easytrieve converter:

  1. ez2uvcopy - converts easytrieve jobs to uvcopy jobs - documented here in section 'P' - use for easytrieve jobs that reformat data files

  2. ez2uvqrpg - converts easytrieve jobs to uvqrpg jobs - documented in the next section 'Q'. - use for easytrieve jobs that create reports

    ez2uvcopy conversion demo


 uvcopy ez2uvcopy,fili1=tf/ezdemo2,filo1=tmp/ezdemo2
 ===================================================

ez2uvcopy conversion demo - sample INPUT

 * EZDEMO1 - Reformat Name & Address records
 * - see easytrieve conversion at www.uvsoftware.ca/eztrvetc.htm
 *
 FILE FILEA SYS004 FB (100 4000) TAPE (REWIND)
 RECA       1   100   A
 NAME       1    30   A
 ADDR1     31    30   A
 CITY      61    20   A
 *
 FILE FILEB SYS005 FB (80 4000) TAPE (REWIND)
 RECB       1    80   A
 NAMEW      1    25   A
 ADDR1W    26    25   A
 CITYW     51    25   A
 *
 JOB INPUT FILEA
 MOVE SPACES TO RECB
 NAMEW   = NAME
 ADDR1W  = ADDR1
 CITYW   = CITY
 PUT FILEB

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

P2. Converting EasyTrieve to uvcopy

ez2uvcopy conversion demo - sample OUTPUT

 # ezdemo1 - uvcopy job converted from EasyTrieve by Vancouver Utilities
 #         - ez2uvcopy run on 2008/03/24_07:29:10 at UV_Software
 was=a8192b8192c8192d8192e8192f8192g8192h8192q24000s8192
 #* ezdemo1 - reformat name & address records
 #* - see easytrieve conversion at www.uvsoftware.ca/eztrvetc.htm
 #FILE FILEA SYS004 FB (100 4000) TAPE (REWIND)
 fili1=?${FILEA},rcs=00100,typ=RSF
 #FILE FILEB SYS005 FB (80 4000) TAPE (REWIND)
 fili2=?${FILEB},rcs=00080,typ=RSF
 #NB - 'FILE's converted to fili1=..., fili2=..., etc
 #   - usually need to change last fili2=... to filo2=... & typ=RSF to typ=LSTt
 #   - might need to modify 'fineof' label to any EOF PROCs that may be coded
 #JOB INPUT FILEA
 lodc1=q0(48)
 $reca                            =a0(100c)
 $name                            =a0(30c)
 $addr1                           =a30(30c)
 $city                            =a60(20c)
 $recb                            =b0(80c)
 $namew                           =b0(25c)
 $addr1w                          =b25(25c)
 $cityw                           =b50(25c)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 @run
        opn    all
 loop   get    fili1,a0            get next record
        skp>   fineof
        add    $ca1,1              count records in file
        clr    $recb,' '
        mvf    $namew,$name
        mvf    $addr1w,$addr1
        mvf    $cityw,$city
        put    filo2,b0
        skp    loop
 # EOF
 fineof cls    all
        eoj

executing the converted job


 uvcopy ezdemo2,fili1=input?,filo1=output?
 =========================================

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

Q1. Converting EasyTrieve to uvqrpg

uvqrpg can replace 'EasyTrieve' if you are converting from an IBM mainframe to a UNIX systems. To save you from having to recode the EasyTrieve jobs a converter is supplied to perform this function automatically.

There are 2 versions of the easytrieve converter:

  1. ez2uvcopy - converts easytrieve jobs to uvcopy jobs

  2. ez2uvqrpg - converts easytrieve jobs to uvqrpg jobs

Use ez2uvqrpg if the easytrieve job's primary function was to create a report. Use ez2uvcopy if the easytrieve job's primary function was to reformat data files.

Note that the conversion jobs are written in uvcopy, since uvcopy is intended primarily as a data manipulation tool, rather than uvqrpg which is intended as a report writer utility.

ez2uvqrpg conversion demo


 uvcopy ez2uvqrpg,fili1=tf/ezdemo1,filo1=tmp/ezdemo1
 ===================================================

ez2uvqrpg demo input job

 ---> to be supplied <---

ez2uvqrpg demo output job

 ---> to be supplied <---

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

R1. Convert Delimited files to Fixed Fields for uvqrpg

Convert Delimited files to Fixed Fields for uvqrpg

Note that Run OPtion 'g#' for Delimited file input to uvqrpg was added to uvqrpg in June 2003. Please see qrpgEX8 on page 'B5' for a Delimited example. Prior to June 2003, this section 'R' offered a method of processing Delimited files, by first converting them to Fixed Field files.

This section is retained in case you want to convert Delimited to Fixed Field. Note that it is faster to process fixed length records & these files can also be used for random relative record# files & most indexed files use fixed length records in the data partition.

sample Delimited data file

 11911|Thomas Watson|inv3234|1,550.00|108.50|
 21945|Presper Eckert|cr9202|-135.00|-9.45|
 31975|Steve Jobs|inv1015|124.95|8.75|
 31976|Steve Wosniak|inv2024|5,755.00|402.00|
 41980|Bill Gates|cr8001|-2,500|-175|

We will use the '|' delimited file above as our test file to demonstrate our conversion jobs, which will automatically determine the longest field sizes, the field types,& the field displacements (based on consecutive field sizes with a field gap option which defaults to 1).

Overview - Converting Delimited to Fixed field

  1. genfixv1 - scan delimited file & create control record of largest field sizes

  2. vi ctl/xxx - user may edit the generated control record to: - assign desired fieldnames for genfixv3 below - modify the generated field sizes - possibly modify field types & field displacements

  3. genfixv2 - recalc control record field positions - based only on the field sizes in the control record - use after step 2 (easier than manually calculating new positions)

  4. genfixv3 - uses control record from genfixv1 to generate a uvcopy job to convert the delimited file to a fixed length file

  5. genfixv4 - uses the control record from genfixv1 (or genfixv2) to generate a uvqrpg job to create a report from the fixed field file

  6. uvcopy xxx - execute auto generated uvcopy job to convert delimited to fixed

  7. uvqrpg xxx - execute auto generated uvqrpg to create report from fixed field

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

R2. Convert Delimited files to Fixed Fields for uvqrpg

subdirs required

To run this system, you should setup a set of subdirectories similar to those listed below. You could modify these names, but it will be less confusing if you maintain the convention since the documentation & the utility jobs (genfixv1,genfixv2,genfixv3,& genfixv4) use this.

We need separate subdirs so we can maintain the same filename as our we progress thru the system. The control file & the generated uvcopy job will be assigned the same name as the data file they process, which is OK as long as they are in separate subdirs.

You can test in the /home/uvadm superdir, but for your own files you should setup a similar set of subdirs in some approriate superdir. When you run the system, stay in the superdir, do not change in & out of the subdirs to view your files, address them via subdir/filename (since the next step requires you to be back at the superdir level).

dat1
  • input delimited data files to be converted
  • /home/uvadm/dat1/timecards is supplied for testing
dat2
  • output data files converted to fixed format
ctl
  • control files, generated by genfixv1 (by scanning delimited data)
  • may modify field lengths & recalc displacements with genfixv2
    which outputs to tmp subdir (when happy copy back to ctl)
pfg
  • generated uvcopy Parameter Files (or jobs)
rpts
  • reports created by uvqrpg
tmp
  • tmp subdir, receives genfixv2 output for edit & copy back to ctl
  • required for various things such as intermediate sort files

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

R3. Convert Delimited files to Fixed Fields for uvqrpg

Operating Instructions - genfixv1/genfixv2


 #1. uvcopy genfixv1,fili1=dat1/timecards,filo1=ctl/timecards,uop=d1f5g1
     ===================================================================

'uop=d1f5g1' specifies user options. 'd1' specifies delimiter after last field (d0 if not). 'f5' specifies 5 fields (must agree with delimiters counted). 'g1' specifies the gap (1 blank) between fields.


 #1a. uvcopy genfixv1   <-- easier way (files & options default as shown above)
      ===============

sample input Delimited data file

 11911|Thomas Watson|inv3234|1,550.00|108.50|
 21945|Presper Eckert|cr9202|-135.00|-9.45|
 31975|Steve Jobs|inv1015|124.95|8.75|
 31976|Steve Wosniak|inv2024|5,755.00|402.00|
 41980|Bill Gates|cr8001|-2,500|-175|

sample output control record


 #GF1CTL:F01=0(5N):F02=6(14C):F03=21(7C):F04=29(8D):F05=38(6D):
 ==============================================================

 #2. vi ctl/timecards    <-- edit to assign fieldnames & modify field lengths
     ================

For example, assume user assigns the fieldnames shown below & increases length of name from 14 to 16,& invoice from 7 to 8.

user's modified control file


 #GF1CTL:emp#=0(5N):name=6(16C):inv#=21(8C):regpay=29(8D):overtime=38(6D):
 =========================================================================

After changing various field lengths, you can see that the displacements are now incorrect, so we run genfixv2 to recalculate the displacements.


 #3. uvcopy genfixv2,fili1=ctl/timecards,filo1=tmp/timecards
     =======================================================

sample output (displacements recalculated)


 #GF1CTL:emp#=0(5N):name=6(16C):inv#=23(8C):regpay=32(8D):overtime=41(6D):
 =========================================================================

 #4. vi tmp/timecards          <-- check the output
     ================

 #5. cp tmp/timecards ctl      <-- if OK copy back (overwriting) to ctl
     ====================

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

R4. Convert Delimited files to Fixed Fields for uvqrpg

Operating Instructions - genfixv3


 #6. uvcopy genfixv3,fili1=ctl/timecards,filo1=pfg/timecards,arg1=\|
     ===============================================================

'genfixv3' generates a uvcopy job to convert the delimited file to a fixed length file, based on the control file created by genfixv1 & genfixv2 (as illustrated on the previous page).

sample Delimited data file

 11911|Thomas Watson|inv3234|1,550.00|108.50|
 21945|Presper Eckert|cr9202|-135.00|-9.45|
 31975|Steve Jobs|inv1015|124.95|8.75|
 31976|Steve Wosniak|inv2024|5,755.00|402.00|
 41980|Bill Gates|cr8001|-2,500|-175|

sample control record


 #GF1CTL:emp#=0(5N):name=6(16C):inv#=23(8C):regpay=32(8D):overtime=41(6D):
 =========================================================================

sample output uvcopy job

 opr='timecards - convert delimited file to fixed field file'
 opr='uvcopy job generated by genfixv3, using control record ctl/timecards'
 was=a4000b4000c12000
 fili1=?dat1/timecards,rcs=512,typ=LST
 filo1=?dat2/timecards,rcs=512,typ=LSTt
 @run
        opn    all
 loop   get    fili1,a0
        skp>   eof
        fix    b0(100),a0(512),005,'|'    fix input fields 100 bytes apart
        mvn    c0(-5),b0(20)              emp#
        mvc    c6(16),b100                name
        mvc    c23(8),b200                inv#
        mvn    c32(-8),b300(20)           regpay
        mvn    c41(-6),b400(20)           overtime
 put1   putb   filo1,c0
        skp    loop
 eof    cls    all
        eoj

'fix' is the vital instruction here. It 'fix'es the variable delimited fields 100 bytes apart, making it easy for the following mvc/mvn instructions to move the fields to the fixed field layout indicated by the control record. If you are interested, you can look up the details on any instruction in section uvcopy3.htm which has a hyperlink for each instruction.

See next page for the execution of the generated job --->

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

R5. Convert Delimited files to Fixed Fields for uvqrpg

Executing the generated uvcopy job


 #7. uvcopy pfg/timecards,fili1=dat1/timecards,filo1=dat2/timecards
     ==============================================================

You can test with the supplied delimited test file dat1/timecards (shown immediately below). You should get the Fixed Field output shown further below.

sample input - Delimited fields

 11911|Thomas Watson|inv3234|1,550.00|108.50|
 21945|Presper Eckert|cr9202|-135.00|-9.45|
 31975|Steve Jobs|inv1015|124.95|8.75|
 31976|Steve Wosniak|inv2024|5,755.00|402.00|
 41980|Bill Gates|cr8001|-2,500|-175|

sample output - Fixed Fields

 11911 Thomas Watson    inv3234  00155000 010850
 21945 Presper Eckert   cr9202   -0013500 -00945
 31975 Steve Jobs       inv1015  00012495 000875
 31976 Steve Wosniak    inv2024  00575500 040200
 41980 Bill Gates       cr8001   -0002500 -00175

 #7a. cat dat2/timecards   <-- verify that you get the same results as above
      ==================

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

R6. Convert Delimited files to Fixed Fields for uvqrpg

Operating Instructions - genfixv4


 #8. uvcopy genfixv4,fili1=ctl/timecards,filo1=pfg/timecards.uvq,arg1=\|
     ===================================================================

'genfixv4' generates a uvqrpg job to create a report from the Fixed Field length file which was converted from the Delimited file by the uvcopy job created by genfixv3. 'genfixv4' uses the control file created by genfixv1 & which may have been modified & recalculated by genfixv2.

sample control record


 #GF1CTL:emp#=0(5N):name=6(16C):inv#=23(8C):regpay=32(8D):overtime=41(6D):
 =========================================================================

sample output uvqrpg job

 opr='timecards - uvqrpg report generated by genfixv4 (may modify/customize)'
 opr='         - reports all fields defined by control record ctl/timecards'
 fili1=?dat2/timecards,rcs=512,typ=LST
 filo1=?rpts/timecards,rcs=512,typ=LSTt
 head2=h2000(55),'timecards - uvqrpg report generated by genfixv4 '
 head2=h2055(30),'$datetime $page#### '
 head1s2u4p52=h1000(256),'emp#  name             inv#       regpay overtime'
 ref=a0(5),,'emp#'
 ref=a6(16),,'name'
 ref=a23(8),,'inv#'
 ref=a32(8),,'regpay','z,zzz.99-'
 ref=a41(6),,'overtime','z,zzz.99-'

See next page for the execution of the generated job --->

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

R7. Convert Delimited files to Fixed Fields for uvqrpg

Executing the generated uvqrpg job

We can test with the fixed field data file created by the uvcopy job which was created by genfixv3 from control file created by genfixv1/genfixv2 from the supplied test file dat1/timecards


 #9. uvqrpg pfg/timecards.uvq,fili1=dat1/timecards,filo1=rpts/timecards
     ==================================================================

sample input data file

 11911 Thomas Watson    inv3234  00155000 010850
 21945 Presper Eckert   cr9202   -0013500 -00945
 31975 Steve Jobs       inv1015  00012495 000875
 31976 Steve Wosniak    inv2024  00575500 040200
 41980 Bill Gates       cr8001   -0002500 -00175

sample output report

 timecards - uvqrpg report generated by genfixv4    2003/04/21_11:48:07 page0001
 emp#  name             inv#          regpay overtime
 ====================================================
 11911 Thomas Watson    inv3234     1,550.00   108.50
 21945 Presper Eckert   cr9202        135.00-    9.45-
 31975 Steve Jobs       inv1015       124.95     8.75
 31976 Steve Wosniak    inv2024     5,755.00   402.00
 41980 Bill Gates       cr8001         25.00-    1.75-

 #9a. cat rpts/timecards   <-- verify that you get the same results as above
      ==================

Now you are ready to try these procedures on 1 of your owen files. Since you now understand them, you can use the concise Operating Instructions shown on the next page --->

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

R8. Convert Delimited files to Fixed Fields for uvqrpg

Operating Instruction Summary

Here is a concise summary of the operating instructions, without the showing the test/demo file inputs & outputs (see the previous pages).


 #1. uvcopy genfixv1,fili1=dat1/timecards,filo1=ctl/timecards,uop=d1f5g1
     ===================================================================
          - scan the delimited data file & create the control record

 #2. vi ctl/timecards    <-- edit to assign fieldnames & modify field lengths
     ================

 #3. uvcopy genfixv2,fili1=ctl/timecards,filo1=tmp/timecards
     =======================================================
          - recalculate field displacements (after modifying field lengths)

 #4. vi tmp/timecards          <-- check the output
     ================

 #5. cp tmp/timecards ctl      <-- if OK copy back (overwriting) to ctl
     ====================

 #6. uvcopy genfixv3,fili1=ctl/timecards,filo1=pfg/timecards,arg1=\|
     ===============================================================
          - generate a uvcopy job to convert the delimited file to Fixed Field

 #7. uvcopy pfg/timecards,fili1=dat1/timecards,filo1=dat2/timecards
     ==============================================================
          - execute the generated uvcopy job to convert delimited to fixed

 #8. uvcopy genfixv4,fili1=ctl/timecards,filo1=pfg/timecards.uvq,arg1=\|
     ===================================================================
          - generate a uvqrpg job to convert the delimited file to Fixed Field

 #9. uvqrpg pfg/timecards.uvq,fili1=dat1/timecards,filo1=rpts/timecards
     ==================================================================
          - execute the generated uvqrpg to create a report from the fixed file

 #10. cat rpts/timecards   <-- verify that you get the same results as above
      ==================

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

Visitor Counters for ThisYear and LastYear

ThisYear=000655   (J=116,F=142,M=137,A=127,M=133,J=0,J=0,A=0,S=0,O=0,N=0,D=0)
LastYear=001416   (J=150,F=157,M=124,A=129,M=118,J=100,J=139,A=96,S=91,O=85,N=91,D=136)