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
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 |
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 |
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
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.
Goto: Begin this document , End this document , UVSI Home-Page
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.
There are 2 versions of the easytrieve converter:
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.
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 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
01-02 - salesman# <-- control level #2 (major) 04-09 - customer# <-- control level #1 (minor) 14-19 - date 21-28 - invoice# 31-36 - product code 39-44 - quantity <-- to be accumulated in acum1 46-52 - price 54-62 - amount <-- to be accumulated in acum2
sl# cust# date invoice product qty price amount 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
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
# 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.
Goto: Begin this document , End this document , UVSI Home-Page
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.
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
# 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) #=================================================
Goto: Begin this document , End this document , UVSI Home-Page
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' =========================================
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|
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
# 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-'
Goto: Begin this document , End this document , UVSI Home-Page
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
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
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 |
|
typ=LSTt |
|
typ=LSTg# |
|
typ=LSTg124 |
|
typ=RSF |
|
typ=RST |
|
typ=RSR |
|
typ=ISF |
|
typ=RSV |
|
typ=IDX |
|
Goto: Begin this document , End this document , UVSI Home-Page
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
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
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 |
|
uvlp14 |
|
uvlp18 |
|
uvlp12L |
|
uvlp14L |
|
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 |
|
h |
|
--- group 2 options for laser printer ---
c15 |
|
m360 |
|
Goto: Begin this document , End this document , UVSI Home-Page
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#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
Goto: Begin this document , End this document , UVSI Home-Page
Functions unique to uvqrpg are documented in detail on following pages. Please see uvcopy1.htm for functions in common with uvcopy.
head |
|
foot |
|
ctl |
|
ref |
|
acum |
|
table |
|
opr |
|
rop |
|
uop |
|
was |
|
arg |
|
fil |
|
typ |
|
rcs |
|
isk |
|
lod |
|
Note |
Goto: Begin this document , End this document , UVSI Home-Page
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 ...'
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 '
You could modify area 'h' before headings are printed. You could modify at @bgnl8 or at the begining of the total level where applicable.
Goto: Begin this document , End this document , UVSI Home-Page
p# |
|
p57 |
|
s# |
|
s1 |
|
s2 |
|
x# |
|
x1 |
|
x2 |
|
u# |
|
u1 |
|
u2 |
|
u4 |
|
head1p57u4s2x2 - may code multiple options on desired head# function ==============
Goto: Begin this document , End this document , UVSI Home-Page
foot1=h1000(80),'................ page footings ......................' - - etc - - foot8=h8000(80),'.....................................................'
foot1l45v4=f1000(50),'Copyright UV Software Inc. 1993-2007' foot2=f2000(60),"www.uvsoftware.ca owen@uvsoftware.ca"
l# |
|
s# |
|
s1 |
|
s2 |
|
v# |
|
v1 |
|
v2 |
|
v4 |
|
Goto: Begin this document , End this document , UVSI Home-Page
ctll8 |
|
ctll7 |
|
ctll2 |
|
ctll1 |
|
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)
Goto: Begin this document , End this document , UVSI Home-Page
'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 |
|
ctll1s1=a0(6),'cust#' - no space after cust# total line
Goto: Begin this document , End this document , UVSI Home-Page
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=a20(8),'invoice',,'zzzzzzz9' ^^-------------- note 2 commas
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
'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.
'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
acum1 |
|
acum99 |
|
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
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
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'
a0 |
|
'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
'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
tablet2f3s2=a30(6),'product;qty;amt',a38(6),a53(9) <-- sample from qrpgEX2 #=================================================
Goto: Begin this document , End this document , UVSI Home-Page
tablet2f3s2=a30(6),'product;qty;amt',a38(6),a53(9) <-- sample from qrpgEX2 #================================================= ^^^^^^ <-- options coded on table function (may include 'tbp' options)
t# |
|
f# |
|
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## |
|
s# |
|
i1 |
|
i2 |
|
i4 |
|
i8 |
|
i12 |
|
Goto: Begin this document , End this document , UVSI Home-Page
j1 |
|
j2 |
|
j4 |
|
j7 |
|
z1 |
|
z2 |
|
z3 |
|
Goto: Begin this document , End this document , UVSI Home-Page
'@' 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
@ttll1 - identify instructions to be executed at total level 1 time
Note |
|
Note |
|
@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 |
|
Goto: Begin this document , End this document , UVSI Home-Page
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.
Goto: Begin this document , End this document , UVSI Home-Page
`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
`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
'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
'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
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 |
|
uvwxyz |
|
Goto: Begin this document , End this document , UVSI Home-Page
h0(1000) |
|
h1000(500) |
|
h2000(500) |
|
h3000(500) |
|
h4000(500) |
|
h5000(500) |
|
h6000(500) |
|
h7000(500) |
|
h8000(500) |
|
f0(1000) |
|
f1000(500) |
|
f2000(500) |
|
f3000(500) |
|
f4000(500) |
|
f5000(500) |
|
f6000(500) |
|
f7000(500) |
|
f8000(500) |
|
Goto: Begin this document , End this document , UVSI Home-Page
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)
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
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
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' 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
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 |
|
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:
@ttll1 --- mvc b4(6),r4 - store cust# from last rec of cust# group redm5 filr1,b0 - random read custmast Indexed file by cust#
@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
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).
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).
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
s000(1000) |
|
s000(100) |
|
s100(100) |
|
s200(100) |
|
s300(100) |
|
s400(100) |
|
s500(100) |
|
s600(100) |
|
s700(100) |
|
s800(100) |
|
s1000(1000) |
|
s1000(100) |
|
s1100(100) |
|
s1200(100) |
|
s1300(100) |
|
s1400(100) |
|
s1500(100) |
|
s1600(100) |
|
s1700(100) |
|
s1800(100) |
|
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
t0(400) |
|
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) |
|
t4(4b) |
|
t99(4b) |
|
t1000(400) |
|
t1000(4b) |
|
t1004(4b) |
|
t1008(4b) |
|
t1040(4b) |
|
t1396(4b) |
|
t2000(400) |
|
t2000(4b) |
|
t2004(4b) |
|
t2008(4b) |
|
t2396(4b) |
|
- - - - - - - etc - - - - - -
t8000(400) |
|
t8000(4b) |
|
t8004(4b) |
|
t8008(4b) |
|
t8396(4b) |
|
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
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.
t0(800) |
|
t0(8b) |
|
t8(8b) |
|
t192(8b) |
|
t1000(800) |
|
t1000(8b) |
|
t1008(8b) |
|
t1016(8b) |
|
t1080(8b) |
|
t1792(8b) |
|
t2000(800) |
|
t2000(8b) |
|
t2008(8b) |
|
t2016(8b) |
|
t2792(8b) |
|
- - - - - - - etc - - - - - -
t8000(800) |
|
t8000(8b) |
|
t8008(8b) |
|
t8016(8b) |
|
t8792(8b) |
|
Goto: Begin this document , End this document , UVSI Home-Page
Note |
|
$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 - - -
$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 |
|
Goto: Begin this document , End this document , UVSI Home-Page
example: rop=abc2d4e512f1000...x7yz
Goto: Begin this document , End this document , UVSI Home-Page
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 |
|
b999 |
|
c999 |
|
d |
|
e1 |
|
g# |
|
h2 |
|
i1 |
|
i2 |
|
i4 |
|
i8 |
|
i7 |
|
i15 |
|
j99999 |
|
k99999 |
|
Goto: Begin this document , End this document , UVSI Home-Page
o1 |
|
q1 |
|
r |
|
r1 |
|
r# |
|
Note |
|
r2 |
|
r4 |
|
r8 |
|
s0 |
|
s1 |
|
s2 |
|
Note |
|
t0 |
|
t2 |
|
u12 |
|
u99 |
|
v2000 |
|
v5000 |
|
x |
|
x1 |
|
x2 |
|
x4 |
|
x8 |
|
Goto: Begin this document , End this document , UVSI Home-Page
y70 |
|
z1 |
|
Goto: Begin this document , End this document , UVSI Home-Page
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=q1p2s0 |
|
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=i1 |
|
uop=i2 |
|
uop=i4 |
|
uop=i8 |
|
uop=i7 |
|
uop=i15 |
|
Goto: Begin this document , End this document , UVSI Home-Page
NOTE |
|
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 |
|
b__ |
|
c1/c2 |
|
d |
|
e1 |
|
g4/2/6 |
|
i# |
|
k# |
|
k9 |
|
h1 |
|
l |
|
m____ |
|
m20000 |
|
p___ |
|
p777 |
|
r1 |
|
s0 |
|
t |
|
u |
|
v9999 |
|
w2 |
|
Goto: Begin this document , End this document , UVSI Home-Page
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
01-02 - salesman# <-- control level #2 (major) 04-09 - customer# <-- control level #1 (minor) 14-19 - date 21-28 - invoice# 31-36 - product code 39-44 - quantity <-- to be accumulated in acum1 46-52 - price 54-62 - amount <-- to be accumulated in acum2
sl# cust# date invoice product qty price amount 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
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
# 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.
Goto: Begin this document , End this document , UVSI Home-Page
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.
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
# 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) #=================================================
Goto: Begin this document , End this document , UVSI Home-Page
uvqrpg qrpgEX3,fili1=dat1/sales4,filo1=tmp/qrpgEX3.rpt <-- run job (hard way) ======================================================
uvqrpg qrpgEX3 <-- run job (easy way, filenames default as shown above) ==============
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
<-- 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
Goto: Begin this document , End this document , UVSI Home-Page
qrpgEX4 is similar to examples 1 & 2, but illustrates several powerful features
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
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 --->
Goto: Begin this document , End this document , UVSI Home-Page
uvqrpg qrpgEX4,fili1=dat1/sales5 <--- run demo job ================================
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
# 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'
tblt1f3 a10(2),'slsmn;quantity;amount',a38(6),a53(9) --- tbpt1s2 filo1,'EOF summary table of qty & amt by SALESMAN'
Goto: Begin this document , End this document , UVSI Home-Page
qrpgEX5 |
|
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).
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
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 - 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
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
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
qrpgEX7 |
|
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 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
# 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' #
Goto: Begin this document , End this document , UVSI Home-Page
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.
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|
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
# 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-'
Goto: Begin this document , End this document , UVSI Home-Page
# 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
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 |
|
Goto: Begin this document , End this document , UVSI Home-Page
# 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
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
# 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'
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
# 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
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
# 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
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 |
|
copyEX1 |
|
qrpgEX4 |
|
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 |
|
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
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
# 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
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
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:
uvcopy ez2uvcopy,fili1=tf/ezdemo2,filo1=tmp/ezdemo2 ===================================================
* 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
# 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
uvcopy ezdemo2,fili1=input?,filo1=output? =========================================
Goto: Begin this document , End this document , UVSI Home-Page
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:
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.
uvcopy ez2uvqrpg,fili1=tf/ezdemo1,filo1=tmp/ezdemo1 ===================================================
---> to be supplied <---
---> to be supplied <---
Goto: Begin this document , End this document , UVSI Home-Page
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.
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).
Goto: Begin this document , End this document , UVSI Home-Page
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 |
|
dat2 |
|
ctl |
|
pfg |
|
rpts |
|
tmp |
|
Goto: Begin this document , End this document , UVSI Home-Page
#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) ===============
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|
#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.
#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 =======================================================
#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
#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).
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|
#GF1CTL:emp#=0(5N):name=6(16C):inv#=23(8C):regpay=32(8D):overtime=41(6D): =========================================================================
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
#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.
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|
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
#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.
#GF1CTL:emp#=0(5N):name=6(16C):inv#=23(8C):regpay=32(8D):overtime=41(6D): =========================================================================
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
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 ==================================================================
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
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
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