This section includes several sample uvcopy jobs & is intended to help you to write uvcopy jobs to solve your own unique problems.
You can run these jobs with testdata provided. Study the uvcopy instruction listings & when you see an instruction you do not fully understand, please look it up in the alpha index provided at the begining of uvcopy3.htm.
01A. | cnvtcm - convert customer name & address records from EBCDIC to ASCII |
Also reformats record field layout |
02A. | cnvtgl - convert G/L records from EBCDIC to ASCII |
Optionally convert numeric fields from packed to unpacked | |
or from packed to binary |
03A. | slsedit1 - sales detail record validation, pricing,& extension |
- random access to ISAM customer & product master files |
03B. | slsedit2 - sales detail record validation, pricing,& extension |
- tables the customer & product master files in memory | |
for faster access while processing the sales detail file. |
04A. | slstbl1 - table analysis of the sales detail file |
- build summary tables by customer# & product# | |
- illustrates the powerful 'tbl' instruction |
05A. | slstbl2 - table analysis of customer master sales history file |
Summarizes this year & last year crossfooted sales totals | |
by city name & by province |
06A. | prtinv1 - print multiple copies of an invoice varying the copy# |
One copy of the invoice is prepared with the editor & then | |
this job is run with an option specifying the no of copies. | |
The job scans the text for the copy# pattern & substitutes | |
copy# 1 of 3, copy# 2 of 3, copy# 3 of 3 (for example) |
07A. | sort2 - demonstrates the sort facility in uvcopy, which is intended |
to be used when you need more power & flexibility than | |
the uvsort program provides. | |
This example simply sorts 2 files together, but you could | |
add record selections & reformatting at input or output time. |
08A. | sortmf1 - sort multiple text files together on any specified key field. |
- solicits filenames until a null entry is made | |
- written for variable length text files, but could be modified | |
for fixed length records if required. |
Goto: Begin this document , End this document , UVSI Home-Page
09A. | pswsort1 - sample/demo sort using the /etc/passwd file |
- converts variable format to fixed fields via the ':' delimiters | |
- drops UNIX system entries (any user# < 100) | |
- sorts on the comment field (often used for user name) | |
- creates report on output (with field headings & date/time) | |
10A. | NAsort2 - demonstrates the powerful combination of the uvcopy built-in |
sort & the uvcopy data scanning & manipulation instructions. | |
- sort a delimited Name&Adrs file on prov/state & postal/zip | |
- the province/state & postal/zip codes can be anywhere in | |
fields 4 & 5 of the ';' delimited variable length input file. | |
- extract the province/state & postal/zip using the pattern | |
scanning instruction of uvcopy (@=any alpha,#=any numeric,etc) | |
- append the sort key at columns 111-122 of a fixed length | |
128 byte sort record (input text in cols 1-110). | |
- drop the sort key off on the sort output phase, writing | |
variable length text from cols 1-110 max. |
11A. | cmreport - Demo #3 of the sort facility within the uvcopy utility. |
- Sort the cusmas file, creating an edited report on output. |
12A. | recovIS1 - recover Microfocus COBOL ISAM files with corrupted indices |
12B. | recovIS2 - recover MBP COBOL ISAM files with corrupted indices |
13A. | tblookLE - drop records from a fixed record length file that match |
any entry in a range table of low...high items | |
- This job is customized to search a range table of | |
invoice#s & drop records whose inv# falls in any range | |
- Uses the <= option of the table lookup instruction which | |
searches down the table for the 1st entry > than search arg | |
& then backs up to the preceding entry (low end of range) | |
- The high end range is then checked with a compare instrn |
14A. | tblookGE - copy a sales detail file, looking up a table of invoice#s & |
inserting data into detail records from matching table entries | |
- This job was created simply to test the '>' option of the | |
table lookup instruction - searches down a table for the 1st | |
entry = or > than the search argument |
15A. | addup3 - Currency conversion calculations |
- convert $US sales to CDN & accumulate for total at EOF |
16A. | ctlfix1 - convert tabs, FormFeeds,& Carriage Returns to blanks |
- option to drop blank lines | |
- uvlist also has options for these, but you might want to | |
modify this job for your unique requirements |
Goto: Begin this document , End this document , UVSI Home-Page
17A. | printPCL5 - print a file of mixed PCL5 printer control codes & data to print |
- converts pseudo escapes '!'s to true escapes x'1B' & ';'s to linefeeds | |
- prepare your escape sequence control file with the editor | |
using '!' exclamations for escapes x'1B' & ';' semi-colons for LineFeeds x'0A' | |
uvcopy printPCL5,fili1=tf/AGMmeetingPCL5 <-- sample command | |
<-- sample data file below: | |
!E!&k2G!&l0320U!&l0048C!(s4101T!(s0060V!(s0001P!(s0003B!(s0000S!&l0001X | |
; AGM Meeting;March 03/2019 7PM;Mollie Nye House;940 Lynn Valley Rd. |
18A. | printBIG2 - print BIG BOLD letters for posters,notices,etc (portrait mode) |
- input data from a pre-edited text file (see printBIG1 solicits input) | |
- use ';' for newline, use ':' for new page | |
- user options for point size, vertical spacing, italics, typeface | |
- for HP PCL5 compatible printers | |
uvcopy printBIG2,fili1=tf/AGMmeeting,uop=p60x20 <-- sample command | |
<-- sample data file below: | |
; AGM Meeting;March 03/2019 7PM;Mollie Nye House;940 Lynn Valley Rd. |
Note |
|
Also see the many pre-programmed jobs that present complete solutions to several common problems that may be useful to your site. (UVjobs1, UVjobs2, LASERjobs, LABELjobs, TEXTjobs, SCANjobs, REPjobs, etc)
Goto: Begin this document , End this document , UVSI Home-Page
given |
|
01-08=cust#,09=status,10-34=company,35-59=adrs1,60-84=adrs2, 85-109=adrs3,110-116=zip,117-122=telephone(packed), 176-200=contact-name
required |
|
001-008 = cust# - to be key1 009-009 = status - any 'd' status records to be deleted 010-034 = contact name (from 176-200 of input record) 035-059 = adrs1 060-084 = adrs2 & adrs3 squeezed together 085-093 = zip code - to be key2 094-103 = telephone# unpacked 104-104 = line feed terminator so backup versions can be easily viewed with a line editor
solution |
|
# cnvtcm - parameter file for the uvcopy utility # - to convert the EBCDIC customer master file to a UNIX ASCII # 2 key indexed contact name & address file fili1=/dev/rmt0,typ=RSF,rcs=a256 filo1=contacts,typ=ISF,rcs=b104,isk1=0(8),isk2=84(9) @run opn all loop get fili1,a0(256) skp> eof cmc a8(1),'d' # logically deleted record ? skp= loop # yes - bypass, return to get next mvc c0(256),a0 # move entire record to work area 'c' tra c0(256) # translate entire work area to ASCII mvc b0(9),c0 # move cust#,status from 'c' to outrec 'b' mvc b9(25),c175 # move contact name from w/a to outrec mvc b34(25),c35 # move adrs1 from w/a to outrec sqzf c59(50),' ' # squeeze adrs2 & adrs3 together in w/a mvc b59(25),c59 # move combined adrs2+adrs3 to adrs2 out mvc b84(7),c109 # move zip code from w/a to outrec unp b93(10),a116(6) # unpack the telephone# put filo1,b0(104) # write out the record skp loop # return to get next record eof eoj
uvcopy cnvtcm =============
Goto: Begin this document , End this document , UVSI Home-Page
given: |
|
required: |
|
solution (a) - leaving packed fields as is ------------------------------------------
# cnvtgl - convert G/L records from EBCDIC to ASCII # & optionally convert packed numeric to unpacked or binary fili1=/dev/rmt0,typ=RSF,rcs=240 filo1=glmaster,typ=ISF,rcs=240,isk1=0(20) @run opn all loop get fili1,a0(240) skp> eof mvc b0(240),a0 tra b0(60) # translate 1st 60 cols only # (unpacked portions only) # --- # marker for inserts by solutions b & c put filo1,b0(240) skp loop eof cls all eoj
solution (b) - unpacking packed fields to ASCII zoned numeric ------------------------------------------------------------- (insert following instruction into (a) at --- marker)
mvnx36 b60(-10za),a60(5pe) # convert 36 EBCDIC packed fields # to ASCII unpacked numeric # with leading '-' sign if negative # - also change output rcs=420
solution (c) - converting packed fields to binary integers ---------------------------------------------------------- (insert following instruction into (a) at --- marker)
mvnx36 b60(4b),a60(5pe) # convert 36 EBCDIC packed fields # to binary long integers # - also change output rcs=204
Goto: Begin this document , End this document , UVSI Home-Page
(a) - translates only the gl# & the description (not packed fields) - you do not need to code 'mvc 0(240)0' before the 'tra' instrn since uvcopy automatically moves the input record to the output record area before your 1st instrn is executed.
(b) - 'mvn' with repeat option 'x36' converts all 36 packed fields from 5 byte packed EBCDIC to 10 byte zoned ASCII with separate leading sign byte '-' if negative.
(c) - 'mvn' with repeat option 'x36' converts all 36 packed fields from 5 byte packed EBCDIC to 4 byte binary long integers. - note that the 's' option to switch from big end to little end is only required if you were converting binary mainframe fields.
Goto: Begin this document , End this document , UVSI Home-Page
given |
|
01-08 - customer# 11-18 - product# 21-26 - quantity sold --------following fields added to output file (sales.tmp) 31-38 - unit price from product master 41-49 - extended price (unit price * quantity) 51-80 - customer name from customer master 81-100- product description from product master
customer master (tf/cusmas1) record layout as follows: 01-08 - customer# 11-40 - customer name
product master (tf/prodmas1) record layout as follows: 01-08 - product# 11-30 - product description 31-38 - unit price
required |
|
#1. mkdir tmp - make directory for temporary files =========
#2. uvsort "fili1=tf/cusmas1,rcs=80,typ=LST,filo1=tmp/cm1,typ=ISF,key1=0(8)" =======================================================================
#3. uvsort "fili1=tf/prodmas1,rcs=80,typ=LST,filo1=tmp/pm1,typ=ISF,key1=0(8)" =======================================================================
#4a. uvcopy slsedit1 =============== - or - #4b. uvcopy slsedit1,fili1=tf/slsdtl1,filr1=tmp/cm1,filr2=tmp/pm1 ,filo1=tmp/sales.ext
Goto: Begin this document , End this document , UVSI Home-Page
ARC00000 DOODAD00 000010 DATEX000 GADGET01 000005 DATEX000 WIDGET02 000020 OMEGA000 THINGME3 000015 UNISYS01 WIDGET02 -00010 UNISYS01 WIDGET01 000020
ARC00000 ALLINSON-ROSS CORP. DATEX000 DATEX SERVICES LTD. OMEGA000 OMEGA COMPUTER SERVICES LTD. UNISYS00 UNISYS CANADA (TORONTO) UNISYS01 UNISYS CANADA (VANCOUVER) UVSI0000 UV SOFTWARE INC.
DOODAD00 doodad - small 00000500 DOODAD01 doodad - large 00000750 GADGET00 gadget - small 00002500 GADGET01 gadget - large 00002750 THINGME0 thingme - universal 00001250 WIDGET00 widget - small 00000500 WIDGET01 widget - medium 00000750 WIDGET02 widget - large 00001000
ARC00000 DOODAD00 000010 00000500 000005000 Allinson-Ross Corp. doodad - small DATEX000 GADGET01 000005 00002750 000013750 Datex Services Ltd. gadget - large DATEX000 WIDGET02 000020 00001000 000020000 Datex Services Ltd. widget - large OMEGA000 THINGME3 000015 00000000 000000000 Omega Computer Services Ltd. UNISYS01 WIDGET02 -00010 00001000 00001000p Unisys Canada (Vancouver) widget - large UNISYS01 WIDGET01 000020 00000750 000015000 Unisys Canada (Vancouver) widget - medium
Goto: Begin this document , End this document , UVSI Home-Page
# slsedit1 - sales detail record edit & price extension # - uses following files supplied in directory uvadm/tf # # tf/slsdtl1 record: 01-08=cust#, 11-18=prod#, 21-26=price # tf/cusmas1 record: 01-08=cust#, 11-40=customer name # tf/prodmas1 record: 01-08=prod#, 11-30=product dscrptn, 31-38=unit price # # - see operating instructions for: example #3a in uvcopy4.doc of volume 2 # - custmas1 & prodmas1 must 1st be loaded into ISAM files for random lookup # uvsort "fili1=tf/cusmas1,rcs=80,typ=LST,filo1=tmp/cm1,typ=ISF,key1=0(8)" # uvsort "fili1=tf/prodmas1,rcs=80,typ=LST,filo1=tmp/pm1,typ=ISF,key1=0(8)" # #required - lookup customer & product master files via cust# & prod# # - add customer name & product description to sales record output # - price & extend the dtl record copying to an output file # 31-38=unit price, 41-49=extended price, 51-80=custname, # 81-100=product dscrptn opr='$jobname - sales detail description, pricing,& extension' fili1=tf/slsdtl1,rcs=80,typ=LST # sales detail input filr1=tmp/cm1,rcs=80,typ=ISF,isk1=0(8) # customer master (ISAM random) filr2=tmp/pm1,rcs=80,typ=ISF,isk1=0(8) # product master (ISAM random) filo1=tmp/sales.ext,rcs=100,typ=LSTt # output - priced & extended sales dtl @run opn all # begin loop to get & process each sales detail record loop get fili1,a0(80) get a sales detail record skp> eof # lookup customer & product masters via cust# & prod# in sales dtl record clr c0(80),' ' clear area for cust master read mvc c0(8),a0 store cust# for random read redm5 filr1,c0(80) read cust master by cust# key clr d0(80),' ' clear area for product master read mvc d0(8),a10 store prod# for random read redm5 filr2,d0(80) read product master by prod# key # describe, price,& extend detail record - using info from master files mvf b0(100),a0(80) move input record to output area mvn b30(8),d30(8) price from product master record mvn b40(9),d30(8) prepare for price extension mpy b40(9),b20(6) multiply price by qty mvc b50(30),c10 move cust name to dtl rec mvc b80(20),d10 move product dscrptn to dtl rec put filo1,b0(100) write out current detail record skp loop return to get next dtl # # EOF - close files & end job eof cls all eoj
Goto: Begin this document , End this document , UVSI Home-Page
This is an alternative to example #03A. Rather than loading ISAM files for random reads by key, the customer & product master files are loaded into memory for much faster access while processing the detail file.
These tables are also written out (with totals by cust# & prod#) at the end of the job - just to illustrate the capability.
given |
|
required |
|
Note |
|
uvcopy slsedit2 ===============
Goto: Begin this document , End this document , UVSI Home-Page
ARC00000 DOODAD00 000010 DATEX000 GADGET01 000001 DATEX000 WIDGET01 000002 OMEGA000 THINGME3 000005 UNISYS01 WIDGET01 000020 UNISYS01 WIDGET02 000010
ARC00000 ALLINSON-ROSS CORP. DATEX000 DATEX SERVICES LTD. OMEGA000 OMEGA COMPUTER SERVICES LTD. UNISYS00 UNISYS CANADA (TORONTO) UNISYS01 UNISYS CANADA (VANCOUVER) UVSI0000 UV SOFTWARE INC.
DOODAD00 doodad - small 00000500 DOODAD01 doodad - large 00000750 GADGET00 gadget - small 00002500 GADGET01 gadget - large 00002750 THINGME0 thingme - universal 00001250 WIDGET00 widget - small 00000500 WIDGET01 widget - medium 00000750 WIDGET02 widget - large 00001000
Goto: Begin this document , End this document , UVSI Home-Page
ARC00000 DOODAD00 000010 00000500 000005000 Allinson-Ross Corp. doodad - small DATEX000 GADGET01 000001 00002750 000002750 Datex Services Ltd. gadget - large DATEX000 WIDGET01 000002 00000750 000001500 Datex Services Ltd. widget - medium OMEGA000* THINGME3 000005 UNISYS01 WIDGET01 000020 00000750 000015000 Unisys Canada (Vancouver) widget - medium UNISYS01 WIDGET02 000010 00001000 000010000 Unisys Canada (Vancouver) widget - large
ARC00000 Allinson-Ross Corp. 000005000 DATEX000 Datex Services Ltd. 000004250 OMEGA000 Omega Computer Services Ltd. UNISYS00 Unisys Canada (HO Toronto) UNISYS01 Unisys Canada (Vancouver) 000025000 UVSI0000 UV Software Inc.
DOODAD00 doodad - small 00000500 000005000 DOODAD01 doodad - large 00000750 GADGET00 gadget - small 00002500 GADGET01 gadget - large 00002750 000002750 THINGME0 thingme - universal 00001250 WIDGET00 widget - small 00000500 WIDGET01 widget - medium 00000750 000016500 WIDGET02 widget - large 00001000 000010000
Goto: Begin this document , End this document , UVSI Home-Page
# slsedit2 - sales detail record edit & price extension # - uvcopy4.doc example #3 # - this job illustrates several uvcopy programming techniques # # tf/slsdtl1 record: 01-08=cust#, 11-18=prod#, 21-26=price # tf/cusmas1 record: 01-08=cust#, 11-40=customer name # tf/prodmas1 record: 01-08=prod#, 11-30=product dscrptn, 31-38=unit price # #required - validate cust# & prod# (if invalid flag dtl rec with * col9) # - add customer name & product description to sales record output # - price & extend the dtl record copying to an output file # 31-38=unit price, 41-49=extended price, 51-80=custname, # 81-100=product dscrptn opr='$jobname - sales detail validation, pricing,& extension' was=m2000p2000 # reserve areas for cusmas & prodmas tables in memory fili1=tf/slsdtl1,rcs=80,typ=LST # sales detail input fili2=tf/cusmas1,rcs=80,typ=LST # customer master - will be tabled fili3=tf/prodmas1,rcs=80,typ=LST # product master - will be tabled filo1=sales.tmp,rcs=100,typ=LSTt # output - priced & extended sales dtl filo2=cussum.tmp,rcs=50,typ=LSTt # output to display customer sum ttls filo3=prodsum.tmp,rcs=50,typ=LSTt # output to display product sum ttls @run opn all # program initialization - load cusmas & prodmas files into memory # for later lookup to validate cust# & prod# and get price rtb fili2,m0(50),m0(50) read cusmas into area m rtb fili3,p0(50),p0(50) read prodmas into area p # begin loop to get & process each sales detail record loop get fili1,a0(80) get a sales detail record skp> eof clr b0(100),' ' clear output record area mvc b0(80),a0 move dtl to output record area # validate cust# & prod# by table lookup, if invalid go flag * col9 # note - use of registers m & p to save displacement of matching entries # - option z1 is required to init rgstrs to 0 before lookup begins lokz1 mm0(50),b0(8) lookup cusmas table by cust# skp! err lokz1 pp0(50),b10(8) lookup prodmas table by product# skp! err # price & extend detail record - using price from prodmas table #note - lok instrn left rgstr 'm' pointing to matching cusmas rec # & rgstr 'p' pointing to matching prodmas rec & price is 30 bytes more mvn b30(8),pp30(8) price from prodmas table entry mvn b40(9),pp30(8) prepare for price extension mpy b40(9),b20(6) multiply price by qty mvc b50(30),mm10 move cust name to dtl rec mvc b80(20),pp10 move product dscrptn to dtl rec add mm40(9),b40(9) accumulate for customer summary ttls add pp40(9),b40(9) accumulate for product summary ttls skp put # common point if cust#/prod# invalid - flag '*' in col9 (pricing bypassed) err mvc b8(1),'*' flag dtl record error # common point to write detail record to outout file put put filo1,b0(100) write out current detail record skp loop return to get next dtl
Goto: Begin this document , End this document , UVSI Home-Page
# end of detail file # write out customer & product tables with option to display summary totals eof wtbed filo2,m0(50),m0(50) wtbed filo3,p0(50),p0(50) cls all eoj
Goto: Begin this document , End this document , UVSI Home-Page
Given |
|
01-08 - customer code 11-18 - product code 21-26 - quantity sold
Required |
|
uvcopy slstbl1,fili1=tf/slsdtl3 ===============================
tbl#001 pg#001 1994/05/28_14:46:53 sales by customer -argument- -acum#1- % -acum#2- % line# count % customer qty sold1 count1
1 4 8 ARC00000 40 9 4 8 2 4 8 COMPAQ00 100 23 4 8 3 8 16 DATEX000 100 23 8 16 4 4 8 DEC00000 80 19 4 8 5 4 8 DELL0000 40 9 4 8 6 4 8 EPSON000 20 4 4 8 7 4 8 IBM00001 20- 4- 4 8 8 4 8 IBM00002 40- 9- 4 8 9 4 8 OMEGA000 60 14 4 8 10 8 16 UNISYS01 40 9 8 16
48*100 *TOTAL* 420 *100 48 *100
tbl#002 pg#001 1994/05/28_14:46:53 sales by product -argument- -acum#1- % -acum#2- % line# count % product qty sold2 count2
1 4 8 DOODAD00 40 9 4 8 2 4 8 DOODOO00 20- 4- 4 8 3 8 16 GADGET01 120 28 8 16 4 8 16 THINGME3 80 19 8 16 5 8 16 WIDGET01 160 38 8 16 6 16 33 WIDGET02 40 9 16 33
48*100 *TOTAL* 420 *100 48 *100
Goto: Begin this document , End this document , UVSI Home-Page
# slstbl1 - uvcopy Parameter File from UVSI stored in: /home/uvadm/pf/demo/ # slstbl1 - table analysis of sales detail file # - summarize qty sold by customer & by product opr='$jobname - table analysis of sales detail file' rop=r1 #run option to prompt at EOJ for report disposition (vi,cat,more,etc) fili1=tf/slsdtl3,rcs=80,typ=LST filo1=tmp/$fili1,rcs=80,typ=LSTt @run opn all # begin loop to read all sales detail records # - accumulating (tabling) the sales qty for printing at eoj loop get fili1,a0(80) skp> eof tblt1f1 a0(8),'customer;qty sold1;count1;',a20(6z),1 tblt2f1 a10(8),'product;qty sold2;count2;',a20(6z),1 skp loop # # EOF - dump (tbp) tables to files for subsequent vi, lp, etc # - 'rop=r1' above causes prompt for file disposition at EOJ eof tbpt1s2 filo1,'sales by customer' tbpt2s2 filo1,'sales by product' cls all eoj #
The 'tbl' instruction is used to build the tables as each record is processed & the 'tbp' instruction is used to print/edit the tables at the end of the file.
See the complete documentation for 'tbl' in the instruction reference manual (uvcopy3.doc).
You can see how easy it is to use this powerful feature on your files.
Also see the 'wordtbl1' demo job in TEXTjobs.doc which uses the 'tbl' instruction to perform word usage analysis on any text file.
Goto: Begin this document , End this document , UVSI Home-Page
Given |
|
001-006 - customer# 011-035 - customer name 036-060 - address 061-076 - city 078-079 - province 081-090 - postal code 091-102 - phone# 103-120 - contact name 121-180 - this year sales 12 x 5 byte packed fields 181-240 - last year sales 12 x 5 byte packed fields 241-244 - credit codes 245-250 - date of last change 251-256 - unused
required |
|
uvcopy slstbl2 - execute the job ==============
lp slstbl2.tmp - print the output tables
vi slstbl2.tmp - or view with the editor
Please see the output reports on the next page
Please see the job listing 2 pages ahead
Goto: Begin this document , End this document , UVSI Home-Page
tbl#001 pg#001 1994/05/29_14:17:53 sales by city name (this yr & last yr) -argument- -acum#1- % -acum#2- % line# count % city name thisyr sales lastyr sales
1 4 8 CALGARY 3,150.58 2 3,274.76 5 2 1 2 CHILLIWACK 4,478.00 3 8,610.30 13 3 1 2 COQUITLAM 1,420.00 1 .00 4 1 2 DELTA 827.15 .00 5 1 2 DRAYTON VALLEY 228.01 1,765.10 2 6 11 23 EDMONTON 32,979.92 29 35,587.18 54 7 1 2 FORT MCMURRAY 1,000.00- 849.88 1 8 1 2 FORT ST. JOHN 52.46 608.06 9 1 2 GRANDE PRAIRIE 1,318.41 1 427.54 10 1 2 HOPE 75.70 173.25 11 1 2 KELOWNA 233.25 .00 12 1 2 LANGLEY 2,188.90 1 .00 13 1 2 NANAIMO 14,727.63 13 232.91 14 1 2 NISKU 5,725.00 5 1,742.59 2 15 1 2 NORTH VANCOUVER 655.65 .00 16 1 2 PORT COQUITLAM 424.48 .00 17 1 2 POWELL RIVER 410.25 .00 18 3 6 PRINCE GEORGE 1,951.35 1 4,395.21 6 19 1 2 QUESNEL 66.01 4,432.47 6 20 1 2 RICHMOND 434.98 640.04 21 1 2 SIDNEY 1,963.84 1 .00 22 1 2 SQUAMISH 234.41 .00 23 1 2 SURREY 10,761.58 9 .00 24 1 2 THREE HILLS 340.52 .00 25 4 8 VANCOUVER 24,112.72 21 1,220.16 1 26 1 2 WARBURG 17.39- 1,534.06 2 27 1 2 WINTERBURN 40.14 .00 28 1 2 YELLOWKNIFE 4,901.21 4 .00
46*100 *TOTAL* 112,684.76 *100 65,493.51 *100
tbl#002 pg#001 1994/05/29_14:17:53 sales by province (this yr & last yr) -argument- -acum#1- % -acum#2- % line# count % province thisyr sales lastyr sales
1 5 10 AB 1,750.50 1 2,286.74 3 2 17 36 AL 41,014.69 36 42,894.37 65 3 23 50 BC 65,018.36 57 20,312.40 31 4 1 2 NW 4,901.21 4 .00
46*100 *TOTAL* 112,684.76 *100 65,493.51 *100
Goto: Begin this document , End this document , UVSI Home-Page
# slstbl2 - table analysis of customer master sales history file opr='$jobname - summarize sales (thisyr&lastyr) by city name & province' fili1=dat1/custmas2,rcs=256,typ=RSF filo1=$jobname.tmp,rcs=80,typ=LSTt @run opn all # begin loop to read all customer master sales history records # - crossfooting & accumulating (tabling) thisyr & lastyr totals loop get fili1,a0(256) skp> eof xft $ca1,a120(5p),12 xft $ca2,a180(5p),12 tblt1f2 a60(16),'city name;thisyr sales;lastyr sales',$ca1,$ca2 tblt2f2 a77(2),'province;thisyr sales;lastyr sales',$ca1,$ca2 skp loop # end of file - print/edit the tables to a file for: lp, cat,or vi eof tbpt1s2 filo1,'sales by city name (this yr & last yr)' tbpt2 filo1,'sales by province (this yr & last yr)' cls all eoj
Goto: Begin this document , End this document , UVSI Home-Page
Test file dat1/custmas2 cannot be viewed or printed by normal methods (vi or lp) because the records contain packed fields and there are no line-feeds at the end of each record.
If you attempt to use 'vi', you will get 'line too long' because there are no line-feeds. If you use 'lp' you will get many blank pages because of the packed field binary characters.
You can examine the file using the 'uvhd' utility. The command line must specify the filename & uvhd responds by displaying the 1st 256 bytes of the file (in vertical hex). Uvhd then prompts for the byte offset value for the next block to be displayed which will default to the next sequential block if a null entry is made. An example follows:
uvhd dat1/custmas2 - execute uvhd for file 'dat1/custmas2' ================
*** dat1/custmas2 size=11776 mdate=1994080908 today=1994080909
1 2 3 4 5 6 1234567890123456789012345678901234567890123456789012345678901234 0 118133 CAMERON LOGGING LTD 4580 JOYCE STREET POWE 3333332222444454424444444245422222233332445442555445222222225454 118133000031D52FE0CF779E70C4400000045800AF9350342554000000000F75 64 LL RIVER BC V8A3A9 ........ 4425454522222442534343222222222222222222222222222222222200000000 CC0296520000023068131900000000000000000000000000000000000000C000 128 ....A.\......................................................... 0000405000000000000000000000000000000000000000000000000000000000 0C0012C0000C0000C0000C0000C0000C0000C0000C0000C0000C0000C0000C00 192 ................................................A 0000000000000000000000000000000000000000000000004222222222222222 00C0000C0000C0000C0000C0000C0000C0000C0000C0000C1000000000000000
(size=11776) reply: null=continue, q=quit,or new offset byte#---> 3584
1 2 3 4 5 6 1234567890123456789012345678901234567890123456789012345678901234 3584 154688 TAURUS RESOURCES 1110 - 625 HOWE STREET VANC 3333332222545555254545544522222222233332223332445425554452225444 15468800004152530253F5235300000000011100D062508F75034255400061E3 3648 OUVER BC V6C2T6 604 685 8565MEL RAHAL ........ 4554522222222442534353222233323332333344425444422222222200000001 F5652000000002306632460000604068508565D5C02181C0000000000000C021 3712 (...U'...f`]..8d........g ..............)l...................... 2100528006650036900000016280000000000000260000000000000000000000 8C0357C0060D0084D0000C0070C0000C0000C0359C0000C0000C0000C0000C00 3776 ................Q...A.\........(<...............COD 860726 0000000000000001580048500000001230000000000000004442333333222222 00C0000C0000C0081C0019C0000C0068C0000C0000C0000C3F40860726000000
(size=11776) reply: null=continue, q=quit,or new offset byte#---> q
Goto: Begin this document , End this document , UVSI Home-Page
I used this job to save having to create separate versions of my invoice for minor changes such as: copy# 1 of 3, copy# 2 of 3, copy# 3 of 3, etc.
I create 1 copy of the invoice with the editor & then run this job specifying the number of copies as a user job option.
The job copies the text to a temporary print file, substituting the current copy#, issuing the print command,& repeating until the desired number of copies have been printed.
I could of course have also substituted other values such as dates, etc
This job is just 1 more example of how uvcopy can automate laborious jobs.
It is unlikely that you will have a need for this particular job, but it may give you some ideas & techniques that you can use to create similar labour saving jobs.
Since this is not a job that would be useful to you as is, no test/demo file is provided & no operating instructions are presented.
Please see the 'prtinv1' parameter file which is listed on the next page & note that there is an alternate version 'prtinv2' in the 'pf' directory but which is not listed here.
The prtinv2 job uses alternative techniques which might be more efficient if you had a large number of documents to create. Prtinv2 reads the entire invoice into memory rather than rereading the original file line by line for each copy produced.
Goto: Begin this document , End this document , UVSI Home-Page
# prtinv1 - print multiple copies of an invoice assigning copy#'s # #note - this is an example of using uvcopy to save manual editing # - I use the editor to create 1 copy of my invoice which contains # 'copy# 1 of ?' somewhere in the text # - then I run this job to print as many copies as specified by user # option 'c' & number them as shown, for example to print 3 copies: # # uvcopy prtinv1,fili1=inv/xxxxx,uop=q0c3 # ======================================= # #note - the invoice text lines are copied to a temporary file # while scanning for & substituting the desired copy # # - the temporary file is then printed via the 'sys' command # to execute the uvlist utility with desired format controls # - I could also have scanned for & replaced other patterns # with variables such as dates which could be solicited from oprtr # via the msgw instruction # uop=q1c3 fili1=?in,rcs=80,typ=LST filo1=$jobname.tmp,rcs=80,typ=LSTt @run # use loop to increment copy# & call print subrtn until total copies reached main1 add $ca1,1 increment copy# in ctr #1 bal prt1 print current copy of invoice cmn $ca1,$uopbc reached total desired ? skp< main1 eoj #--------------------------------------------------------------------------- # subrtn to print current copy of invoice prt1 opn all # begin loop to copy records until eof, scanning/replacing desired data prt2 get fili1,a0(80) get current record skp> prtx (cc set > at EOF) mvc b0(80),a0 move record to output area # scan for 'copy# 1 of ?' & substitute specified copy # & total # scn b0(80),'copy# 1 of' scan for copy# 1 pattern skp! prt5 mvn bx6(1),$ca1 sub current copy# via rgstr x + 6 mvn bx11(1),$uopbc sub total# via rgstr x + 11 prt5 put filo1,b0(80) skp prt2 prtx cls all sysv1 'uvlist $jobname.tmp h m300 | lp -o nobanner' ret
Goto: Begin this document , End this document , UVSI Home-Page
Uvsort is an easy to use utility that can accept all its parameters on the command line (an advantage when used within a script).
Uvcopy also includes a sort facility and you would use this alternative when you need more power & flexibility than available with uvsort.
With uvcopy, you could do any or all of the following:
The demo job 'sort2' will simply sort 2 files together, but code could easily be inserted into this framework to perform whatever functions you require.
uvcopy sort2 - execute the demo uvcopy sort ============
cat tf/slsdtl1 - display input file #1 (6 records) cat tf/slsdtl2 - display input file #2 (6 records) cat sort2.tmp - display the output file (12 records) which is displayed below:
ARC00000 DOODAD00 000010 COMPAQ00 GADGET01 000003 DATEX000 GADGET01 000001 DATEX000 WIDGET01 000002 DEC00000 WIDGET01 000024 DELL0000 WIDGET01 000012 EPSON000 THINGME3 000015 IBM00001 DOODOO00 000025 IBM00002 WIDGET02 000015 OMEGA000 THINGME3 000005 UNISYS01 WIDGET01 000020 UNISYS01 WIDGET02 000010
Goto: Begin this document , End this document , UVSI Home-Page
# sort2 - sort with multiple input files # - to demonstrate the sort facility of uvcopy # #note - the uvsort utility does not have the power & flexibility # of uvcopy re: multiple input files & record manipulation # - this example simply sorts 2 files together # fili1=tf/slsdtl1,rcs=80,typ=LST fili2=tf/slsdtl2,rcs=80,typ=LST filo1=$jobname.tmp,rcs=80,typ=RST @run opn all open all files sxo 80,'0(20)' open sort (sort on 1st 20 bytes) # # read file#1 & put to the sort get1 get fili1,a0(80) get a record skp> get2 (cc set > at EOF) sxp a0(80) put to the sort skp get1 repeat loop until EOF # # read file#2 & put to the sort get2 get fili2,a0(80) get a record skp> eof2 (cc set > at EOF) sxp a0(80) put to the sort skp get2 repeat loop until EOF # # now execute the sort eof2 sxs # # get records from the sort & write to output file put1 sxg b0(80) get record from the sort skp> eos (cc set > if no more recs) put filo1,b0(80) write to output file skp put1 repeat loop until end sort # # end sort - close files & end job eos cls all eoj
Goto: Begin this document , End this document , UVSI Home-Page
This job will sort/merge multiple text files together on any key field Filenames will be solicited until a null entry is made. The job is written for variable length text files, but could be modified for fixed length records if required.
uvcopy sortmf1 - key field & filenames will be solicited ==============
# sortmf1 - sort multiple text files together on any specified key field # opr='$jobname - sort multiple text files together (filenames solicited below)' opr=' - suggested inputs: tf/slsdtl1, tf/slsdtl2, & multi-copies of' fili1=xxx,rcs=256,typ=LST filo1=?$jobname.tmp,rcs=256,typ=LSTt @run msgwa1 'enter sortkey ex: "0(20ca)" sorts on 1st 20 char asc' sxo 256,$arg1 open sort (sort on 1st 20 bytes) # # begin loop to solicit filename, put to sort, until null entry made next msgwa2 'enter filename to be sort/merged (or null to end)' skp< sort mvft1 $fili1,$arg2 store filename opn fili1 # read current file & put to the sort get1 get fili1,a0(256) get a record skp> clos (cc set > at EOF) sxp a0(256) put to the sort skp get1 repeat loop until EOF # EOF - close file & return to prompt for next clos cls fili1 skp next # # now execute the sort sort sxs # # open output file, get recs form sort & write to outfile opn filo1 # get records from the sort & write to output file put1 sxg b0(256) get record from the sort skp> eos (cc set > if no more recs) put filo1,b0(256) write to output file skp put1 repeat loop until end sort # # end sort - close files & end job eos cls all eoj
Goto: Begin this document , End this document , UVSI Home-Page
Here is a demo of the uvcopy sort facility that you can run at your site. This job performs the following:
uvcopy pswsort1,fili1=/etc/passwd,filo1=pswsort1.rpt (I/O files on cmd line) ====================================================
uvcopy pswsort1 - minimum command (I/O files will default) ===============
/etc/passwd = default fili1 - null accept or reenter ? ---> <-- null accept pswsort1.rpt = default filo1 - null accept or reenter ? ---> <-- null accept EOF fili1 24 rds, 0 wrts, 0 hits, 1278 size, fname=/etc/passwd EOF filo1 0 rds, 9 wrts, 0 hits, 593 size, fname=pswsort1.rpt
Password file sorted by username date/time: 1997/09/05_10:27:51 userid user# grp# name/comment home-dir shell ==============================================================================
owen 203 100 Owen Townsend /u/owen /bin/ksh dms 204 100 Smarttext Solutions DMS /v/dms /bin/ksh uvu 201 100 UV Software /u/uv /bin/ksh uvu2 205 100 UV Software alternate /u/uvu2 /bin/ksh appsadm 202 100 uvsoftware administrator /u/appsadm /bin/ksh
Note |
|
Goto: Begin this document , End this document , UVSI Home-Page
# pswsort1 - sample/demo sort using uvcopy for sort I/O processing # - also see pf/demo/sort1 (skeleton meant for copy/rename/modify) # #usage: uvcopy pswsort1,fili1=/etc/passwd,filo1=pswsort1.rpt # ==================================================== # # - reads /etc/passwd file,& converts variable fields to fixed size fields # - drops system entries (user < 100) # - sorts on the 5th field (comment/user name field) # - on output phase: create report with field headings # fili1=?/etc/passwd,rcs=256,typ=LST filo1=?$jobname.rpt,rcs=80,typ=LSTt # # load table of headings to be dumped to output report file at begin out phase lod=h0(80) Password file sorted by username date/time: $dttm1 userid user# grp# name/comment home-dir shell ==============================================================================
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @run opn all sxo 80,'20(24)' open sort, rcsz=80, sort field 21-44 # input phase - get records,reformat, & put to the sort get1 get fili1,a0(256) get record from input file skp> eof # cnvrt variable to fixed 50 byte fields via ':' delimiters, # reformat to fit headings, drop user#s < 100, & put to the sort fix b0(50),a0(200),7,':' convert variable to fixed mvc c00(10),b0 1 - userid mvc c11(03),b100 3 - userid mvc c15(03),b150 4 - groupid mvc c20(24),b200 5 - name/comment mvc c45(20),b250 6 - home directory mvc c66(14),b300 7 - shell cmn b100(3),100 user# < 100 (system) ? skp< get1 ifso - bypass, return to get next sxp c0(80) put reformatted record to the sort skp get1 return to get next record # # end of input file - sort the created records eof sxs sort created records # sort complete - create output report from headings & sorted records wtbe filo1,h0(80),h0(80) dump headings to report file # get records from the sort & write to the output file put1 sxg g0(80) get record from sort skp> eos cc set > at end of sortrecs put filo1,g0(80) write to output file skp put1 # end sort records - close files, display report,& end job eos cls all eoj
Goto: Begin this document , End this document , UVSI Home-Page
This job demonstrates the powerful combination of the uvcopy built-in sort & the uvcopy data scanning & manipulation instructions.
required |
|
solution |
|
uvcopy NAsort2 - execute uvcopy to interpret the 'NAsort2' prmfile ==============
Owen Townsend;UV Software;4667 Hoskins Rd;North Vancouver BC Canada;V7K2R3 604-980-5434 Sid Treur;Datex Services;5436 Victoria Dr;Vancouver, BC Canada;V5P 3V8 604-321-5822 Pavel Bure;(the Russian Rocket);GM Place;Vancouver BC Canada;V4V 1X1 S. Allinson;Allinson-Ross;4250 Sherwoodtowne Blvd.;Toronto ON CANADA;L4Z 2G6 R. Dainty;Unisys Canada Inc.;2001 Sheppard Ave E;Toronto, ON Canada M2J 4Z7 J. Chretien;Prime Minister;24 Sussex Drive;Ottawa, Canada;ON K1Y 2L6
Pavel Bure;(the Russian Rocket);GM Place;Vancouver BC Canada;V4V 1X1 Owen Townsend;UV Software;4667 Hoskins Rd;North Vancouver BC Canada;V7K2R3 604-980-5434 Sid Treur;Datex Services;5436 Victoria Dr;Vancouver, BC Canada;V5P 3V8 604-321-5822 J. Chretien;Prime Minister;24 Sussex Drive;Ottawa, Canada;ON K1Y 2L6 S. Allinson;Allinson-Ross;4250 Sherwoodtowne Blvd.;Toronto ON CANADA;L4Z 2G6 R. Dainty;Unisys Canada Inc.;2001 Sheppard Ave E;Toronto, ON Canada M2J 4Z7
NOTE |
|
Goto: Begin this document , End this document , UVSI Home-Page
# NAsort2 - sort a delimited Name&Adrs file on prov/state & postal/zip code # # - input is a variable length ';' delimited text file (tf/names3) # - extracts prov/state & postal/zip, appends to the end of the record, and # puts 128 fixed length records to the sort # - sort key will be dropped off on output & the output file will be the # same type as input (variable length delimited - typ=LST) # # Jean Chretien;Prime Minister;24 Sussex Drive;Ottawa, Canada;ON K1Y 2L6 # Bill Clinton;The White House;Pennsylvania Ave;Washington DC;01234 USA # opr='sort a delimited Name&Adrs file on prov/state & postal/zip code' fili1=?tf/names3,rcs=128,typ=LST filo1=?$jobname.tmp,rcs=128,typ=LSTt @run opn all open I/O files # open the sort - fixed 128 byte records, sort key in 111-112 sxo 128,'110(12)' open the sort fixed 128 # # begin loop to get records & put to the sort - until EOF get1 get fili1,a0(128) get next record skp> eof mvc b0(110),a0 move record text to sort rec # extract prov/state & postal/zip from fields 4 & 5, and insert at 111-122 fix c0(50),a0(110),5,';' fix fields 50 bytes apart scnp c150(100),' @@ ' scan for 2 alpha chars mvc b110(2),cx151 store prov/state at col 111 scnp c150(100),'@#@ *#@#' scan for CDN postal code skp! get4 mvc b112(7),cx150 move to sort key field 2 skp get5 get4 scnp c150(100),'#####' scan for US zip code mvc b112(10),cx150 move to sort key field 2 get5 sxp b0(128) put to the sort skp get1 return to get next record # # EOF input - execute the sort eof sxs execute the sort # # retrieve records from the sort & write to the output file out1 sxg b0(128) get record from the sort skp> eos put filo1,b0(110) write record to output file skp out1 # # end of sort & record output - close files & end job eos cls all eoj
Goto: Begin this document , End this document , UVSI Home-Page
The 'uvcopy' utility includes the same sorting facility as 'uvsort' but is much more powerful & flexible implementation because you can do extensive processing both on the input phase & on the output phase.
The disadvantage is that uvcopy always requires a separate parameter file whereas uvsort can accept all its parameters on the command line.
As an example please run the 'cmreport' job which is included in the uv parameter file (uvadm/pf/cmreport).
The run command & sample output follow below & please see the prmfile file which is listed on the next page.
uvcopy cmreport ===============
customer masters by terminals - descending cust# company-name city terminals JOH00000 JOHNSON BOATING SUPPLIES TOPEKA 30- FOR00000 FORTUNE COOKIE COMPANY SAN DIEGO 107- OLD00000DOLD WAVE SURF SHOPS INC. COLUMBUS 324 KON00000 KONFLAB PLASTIC PRODUCTS. SEATTLE 128 MOR00000 MORNINGSIDE CARPENTRY. FORT WAYNE 110 EPS00000 EPSILON EQUIPMENT SUPPLY CALGARY 90 PRE00000XPRESTIGE OFFICE FURNITURE WHITEPLAIN 86 ALP00000 ALPHA ELECTRICAL CO. LTD. NEW YORK 85 GAM00000 GAMMA X-RAY TECHNOLOGY WASHINGTON 75 GIB00000 GIBRALTER LIFE INSURANCE LOS RIOS 67 BET00000 BETA SHOE MFG. INC. ATLANTA 34 INC00000 INCREMENTAL BACKUP CORP. WILBUR 16 total terms 878 *
re: cmreport prmfile listed on next page ----------------------------------------
Note that the sort instructions are marked with '**' on the right (sxo=open, sxp=put to sort, sxs=execute sort, sxg=get from sort).
Note how other instructions are used to create the report headings & totals shown above.
Goto: Begin this document , End this document , UVSI Home-Page
# cmreport - customer master report by terminals ascending or descending # - sort tf/cusmas test file by no of terminals & create a report # - give the operator a choice of sequence ascending or descending # # layout: 01-08=cust#,09=status,10-34=company-name,35-59=address,60-84=city, # 85-109=state,110-116=zip,117-126=phone,176-200=manager,229-231=terminals # opr='$jobname - customer master report by terminals ascending or descending' fili1=tf/cusmas,typ=RSF,rcs=256 # cusmas test file filo1=$jobname.tmp,typ=LSTt,rcs=80 # report output @run opn all msgw 'sort report by # of terminals - ascending/descending a/d ?' cmc $reply(1),'d' skp! asc sxo 256,'228(3pd)' # open sort packed descending ** mvf b15(50),'customer masters by terminals - descending' skp hdr1 asc sxo 256,'228(3pa)' # open sort packed descending ** mvf b15(50),'customer masters by terminals - ascending' hdr1 put filo1,b0(80) write 1st report hdr # begin loop to get records & put to sort get1 get fili1,a0(256) get current record skp> eof sxp a0(256) put to sort ** skp get1 # eof - now sort eof sxs sort the records ** # now create report - headings 2 & 3, then loop for detail lines mvf b0(40),'cust# company-name' mvf b40(35),'city terminals' putb filo1,b0(80) write report title clr b0(75),'-' underline headings putb filo1,b0(80) write underlines # use program loop to get recs form sort,format,& write report lines put1 sxg c0(256) get record from sort ** skp> eos mvc b0(34),c0 cust# & name mvc b38(20),c59 city edt b60(6),c228(3p),'zzzzz-' no of terminals putb filo1,b0(80) write report detail line add $ca1,c228(3p) accumulate no of terminals skp put1 # end of sort recs - write total line,close files,& display report eos mvc b48(12),'total terms' edt b60(8),$ca1,'zzzzz- *' edit total count putb filo1,b0(80) write report total line cls all msgw 'display/edit/print/none ? (enter: more/vi/uvlp/null)' skp< eoj mvc g0(50),$reply allow any command catb1 g0(50),'filo1' append the audit filename sysv1 g0(50) eoj eoj
Goto: Begin this document , End this document , UVSI Home-Page
12a. recovIS1 - demo job to recover ISAM files for Microfocus COBOL 12b. recovIS2 - demo job to recover ISAM files for MBP COBOL
The next 2 pages will present the operating instructions for these demonstration jobs. These jobs will use the dat1/custmas2 test/demo file which is documented in sub-section 'B' of uvtrain.doc.
Also see uvsort.doc for a command line driven method which is simpler but this uvcopy method would be more flexible if you had to add code to reformat or drop damaged records.
Data partition filename is: 'filename.dat' (by convention) Indexed partition filename is: 'filename.key' No control area at begining of data records (vs MBP ISAM files) Data records are 1 byte larger than record size loaded because a LineFeed is appended to each data record The LineFeed is converted to a x'00' if the record is deleted
Data partition filename is: 'filename.DAT' Indexed partition filename is: 'filename.KEY' 588 byte binary control area at begining of data records (Microfocus ISAM files do not have) Data records are 2 bytes larger than record size loaded because a 2 byte binary record size is prepended to each data record The record size is converted to a x'0000' if the record is deleted
1 2 3 4 5 6 1234567890123456789012345678901234567890123456789012345678901234 0 SD.......L...................................................... 5410080004000000000000000000000000000000000000000000000000000000 34F100402C000100006000000000000000000000000000000000000000000000 - - - all x'00's up to byte# 588 - - - 512 ................................................................ 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 576 ..............130140 EVERGREEN MOTORS LTD. 1815 BOWEN ROAD 0000000000000833333322224545454442445455245422222333324454425444 00000000000000130140000056527255E0DF4F230C44E0000181502F75E02F14 640 NANAIMO BC V9S1H1 604-754-5531 2222222222444444422222222224425353432222333233323333222222222222 0000000000E1E19DF00000000002306931810000604D754D5531000000000000 704 ..132588 GEECOE GENERATOR SERVICESUNIT 170 - 28 2222222222222208333333222244444424444545452545544455445233322233 000000000000000013258800007553F5075E5214F20352693535E9401700D028
Goto: Begin this document , End this document , UVSI Home-Page
The following will demonstrate the process by loading an Indexed file, pretending that the Index is corrupted,& then rebuilding the Indexed file from the data partition only.
uvcp "fili1=dat1/custmas2,rcs=128,typ=RSF,filo1=cm2,typ=ISF,isk1=0(6)"
cp cm2.dat cm2.sav
rm cm2.dat cm2.idx
uvcopy recovIS1 (see uvcopy prmfile 'recovISMF' listed below) ===============
# recovIS1 - recover an ISAM file with corrupted indices # - for Microfocus COBOL (chk & drop delete flag in last byte) # - test/demo job, see documentation in uvcopy4.doc # - based on test file dat1/custmas2 (see uvtrain.doc) # - also see the uvsort command line method in uvsort.doc opr='$jobname - recover an ISAM file with corrupted indices' fili1=cm2.sav,typ=RSF,rcs=129 # ISAM file data partition filo1=cm2,typ=ISF,rcs=128,isk1=0(6) # rebuild ISAM file on output @run opn all open files sxo 128,'0(6)' sort 128 byte recs on 1st 6 (cust#) # begin loop to get & put recs to sort until EOF get1 get fili1,a0(129) get record into area 'a' skp> eof (condition code set > at EOF) cmc a128(1),x'00' ** record deleted ? skp= get1 yes - return to get next mvc b0(128),a0 move in rec to sort put area 'b' sxp b0(128) put record to the sort skp get1 # input EOF - execute the sort eof sxs execute the sort # get sorted records until end of sort signalled by cc > out1 sxg c0(128) get record from sort skp> eos put filo1,c0(128) write record to output file skp out1 return to get next rec from sort # end sorted records - close files & end job eos cls all close files eoj end job
Goto: Begin this document , End this document , UVSI Home-Page
The following will demonstrate the process by loading an Indexed file, pretending that the Index is corrupted,& then rebuilding the Indexed file from the data partition only.
uvcp "fili1=dat1/custmas2,rcs=128,typ=RSF,filo1=cm2,typ=ISF,isk1=0(6)"
cp cm2.DAT cm2.sav1
rm cm2.DAT cm2.KEY
uvcopy recovIS2 (see uvcopy prmfile 'recovISMB' listed below) ===============
# recovIS2 - recover an ISAM file with corrupted indices # - for MBP COBOL (drop file prefix, drop 1st 2 bytes each rec) # - test/demo job, see documentation in uvcopy4.doc # - based on test file dat1/custmas2 (see uvtrain.doc) # - also see the uvsort command line method in uvsort.doc opr='$jobname - recover an ISAM file with corrupted indices' fili1=cm2.sav,typ=RSF,rcs=130 # ISAM file data partition filo1=cm2,typ=ISF,rcs=128,isk1=0(6) # rebuild ISAM file on output @run opn all open files relb fili1,588 ** set file ptr past file control area sxo 128,'0(6)' sort 128 byte recs on 1st 6 (cust#) # begin loop to get & put recs to sort until EOF get1 get fili1,a0(130) get record into area 'a' skp> eof (condition code set > at EOF) cmc a0(2),x'0000' ** record deleted ? skp= get1 yes - return to get next mvc b0(128),a2 ** shift record dropping 1st 2 bytes sxp b0(128) put record to the sort skp get1 # input EOF - execute the sort eof sxs execute the sort # get sorted records until end of sort signalled by cc > out1 sxg c0(128) get record from sort skp> eos put filo1,c0(128) write record to output file skp out1 return to get next rec from sort # end sorted records - close files & end job eos cls all close files eoj end job
Goto: Begin this document , End this document , UVSI Home-Page
Note |
|
** operating instructions ** command / prompts response ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
uvcopy tblookLE <-- execute uvcopy & prmfile tblookLE ===============
tf/datafix = default for fili1, ok/rekey ? --> null to accept input file
tf/tblookLE.tbl = default for fili2, ok ? --> null to accept table file
tblookLE.tmp = default for fili1, ok ? --> null to accept output file
Note |
|
Goto: Begin this document , End this document , UVSI Home-Page
cat tf/tblookLE.tbl <-- display the table file ===================
inv0500-inv0600 # tf/tblookLE.tbl for tblookLE demo inv2000-inv2999 # invoice# ranges to be dropped inv4000-inv5000 ~~ # end table marker '~~' in col 1 & 2
cat tf/datafix <-- display the input file ==============
13500 Steve Jobs inv1015 00012495 00000875 00000750. 14962 Steve Wosniak inv2024 00057550 00004029 00003453. 12300 Bill Gates cr8001 -0002500 -0000175 -0000150. 24595 Jim Unruh inv2273 00245000 00017150 00014700. 25669 Thomas Watson inv3234 00155000 00010850 00009300. 30144 Presper Eckert cr9202 -0013500 -0000945 -0000810.
cat tf/tblookLE.tmp <-- display the output file ===================
13500 Steve Jobs inv1015 00012495 00000875 00000750. 12300 Bill Gates cr8001 -0002500 -0000175 -0000150. 25669 Thomas Watson inv3234 00155000 00010850 00009300. 30144 Presper Eckert cr9202 -0013500 -0000945 -0000810.
Note |
|
rtb - read a table file & load into memory lok<= - lookup a table for 1st entry > than argument & backup 1 entry - an index register displacement from the low range is then used to compare to the high range
Goto: Begin this document , End this document , UVSI Home-Page
# tblookLE - drop records from a sales detail file whose invoice# falls # within any range in a table file of inv# range records # - this job is a customized variation of the self3 job which is a # general purpose job to copy any file dropping records that match to a # pre-edited table file of items whose length is entered at run time # - the general purpose job saves you from writing uvcopy instructions # but at a certain level of complexity the keyins become cumbersome & # it is then better to write a customized job to solve a unique problem # # input file: tf/datafix - sales dtl with inv# in cols 31-37 # table file: tf/tblookLE.tbl of inv#s to be dropped as follows: # inv0500-inv0600 # tf/tblookLE.tbl for tblookLE demo # inv2000-inv2999 # invoice# ranges to be dropped # inv4000-inv5000 # ~~ # end table '~~' in cols 1 & 2 # # demo command: uvcopy tblookLE # or: uvcopy tblookLE,fili1=tf/datafix,fili2=tf/tblookLE.tbl # opr='$jobname - copy a sales detail file dropping records whose inv# falls' opr=' within any range in a separately edited table file tf/tblookLE.tbl' was=m2000 # inv# table max (increase if reqd) fili1=?tf/datafix,typ=RST,rcs=a70 # input file test/demo file default fili2=?tf/tblookLE.tbl,typ=LST,rcs=80 # table file of search patterns filo1=?$jobname.tmp,typ=RST,rcs=b70 # output filename default @run opn all # at begin job - load the table of search patterns # note - 32 bytes loaded from each entry, but only 7+1+7 used in search rtb fili2,m0(32),m0(32) load table of search patterns # # begin loop getting records, searching for pattern, # - outputting matches/nonmatches - until EOF - or I/O stop counts reached loop get fili1,a0(70) get current record skp> eof lok<= m0(32),a30(7) lookup table for 1st entry at low end # < or = inv# of current record # (searches table to 1st > & backs up 1) skp! nomat cc set ! (unequal) if end tbl with no <= cmc a30(7),mx8(7) compare rec fld to high end of range skp<= match *note - rgstr x holds dsplcmnt to tbl entry & # mx8 will address the high end of range # nomatch to drop table - write out current record & return to get next nomat mvc b0(70),a0 move input record to output area # --- ----,---- note - could add instructions to modify layout put filo1,b0(70) write record to output file skp loop # match - drops matches to table but increment hit ctrs for EOF file stats match add $fi1hits,1 incrmnt hit ctr stats for infile EOF msg add $fo1hits,1 incrmnt hit ctr stats for outfile EOF msg skp loop return to get next record # # end of file or count limit reached - close files & end job eof cls all eoj
Goto: Begin this document , End this document , UVSI Home-Page
This job tests the '=>' option of the uvcopy look-up instruction.
This job uses the invoice# in cols 31-37 of the sales detail file to lookup a table of invoice#s via the lok=> instruction which finds the 1st entry that is = or > than the search argument.
The job then transfers data from the table file into the output records.
** operating instructions ** command / prompts response ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
uvcopy tblookGE <-- execute uvcopy & prmfile tblookGE ===============
uvcopy tblookGE,fili1=tf/datafix,filo1=tblookGE.tmp,fili2=tblookGE.tbl ======================================================================
Note |
|
Please see the next page which lists the input, output,& table files.
Goto: Begin this document , End this document , UVSI Home-Page
cat tf/tblookGE.tbl <-- display the table file ===================
inv1000 # tblookGE.tbl - for demo job tblookGE inv2000 # - table of invoice#s to be matched from tf/datafix file inv3000 # - used to search inv# field in cols 31-37 of tf/datafix inv4000 # - loaded into memory table at startup of job tblookGE ~~ # end of table marker '~~' in cols 1 & 2
cat tf/datafix <-- display the input file ==============
13500 Steve Jobs inv1015 00012495 00000875 00000750. 14962 Steve Wosniak inv2024 00057550 00004029 00003453. 12300 Bill Gates cr8001 -0002500 -0000175 -0000150. 24595 Jim Unruh inv2273 00245000 00017150 00014700. 25669 Thomas Watson inv3234 00155000 00010850 00009300. 30144 Presper Eckert cr9202 -0013500 -0000945 -0000810.
cat tf/tblookGE.tmp <-- display the output file =================
13500 Steve Jobs inv1015 00012495 00000875 00000750. inv2000 14962 Steve Wosniak inv2024 00057550 00004029 00003453. inv3000 12300 Bill Gates cr8001 -0002500 -0000175 -0000150. inv1000 24595 Jim Unruh inv2273 00245000 00017150 00014700. inv3000 25669 Thomas Watson inv3234 00155000 00010850 00009300. inv4000 30144 Presper Eckert cr9202 -0013500 -0000945 -0000810. inv1000
Note |
|
rtb - read a table file & load into memory lok=> - lookup a table for 1st entry = or > than the argument
Note |
|
Goto: Begin this document , End this document , UVSI Home-Page
# tblookGE - test table lookup instruction # - this job tests the lok=> option of table lookup # (see dropf3 which tests lok= & dropf4 which tests lok<=) # # - this job copies the demo file tf/datafix, looks up the table by inv# # & inserts the 1st inv# from the table file that is > record inv# # into cols 71-77 of the output record # # input file: tf/datafix - sales dtl with inv# in cols 31-37 # table file: tf/tblookGE.tbl of inv#s to be looked-up as follows: # inv1000 # tblookGE.tbl - for demo job tblookGE # inv2000 # # inv3000 # # inv4000 # # ~~~~~~~ # end of table marker '~~' in cols 1 & 2 # # demo command: uvcopy tblookGE # or: uvcopy tblookGE,fili1=tf/datafix,fili2=tf/tblookGE.tbl # opr='$jobname - copy a sales detail file looking up an invoice# table' opr=' & retrieving data to be inserted into the sales records' was=m2000 # inv# table max (increase if reqd) fili1=tf/datafix,typ=RST,rcs=a70 # input file test/demo file default fili2=tf/tblookGE.tbl,typ=LST,rcs=80 # table file of search patterns filo1=$jobname.tmp,typ=RST,rcs=b80 # output filename default #note - since this job is customized to solve 1 particular problem # (not general purpose job with keyins for rcsz, search patterns,etc) # - the leading '?' has been removed from the fil__ names # & the job runs to completion with no prompts @run opn all # at begin job - load the table of search patterns # note - 32 bytes loaded from each entry, but only 1st 7 used in search rtb fili2,m0(32),m0(32) load table of search patterns # # begin loop getting records, searching for pattern, writing output loop get fili1,a0(70) get current record skp> eof mvc b0(70),a0 move input record to output area lok=> m0(32),a30(7) lookup for 1st entry = or > rec inv# skp! put cc set ! (unequal) if end tbl with no => # # match - move inv# from table to cols 71-77 of output record # note - rgstr x holds dsplcmnt of found table entry & mx0 addresses it match mvc b70(7),mx0 move inv# from tbl to 71-77 of outrec add $fi1hits,1 incrmnt hit ctr stats for infile EOF msg add $fo1hits,1 incrmnt hit ctr stats for outfile EOF msg put put filo1,b0(80) write record to output file skp loop return to get next record # # end of file or count limit reached - close files & end job eof cls all eoj
Goto: Begin this document , End this document , UVSI Home-Page
# addup3 - calc total sales for UV Software # # sample input & output (demo with only 3 lines of data) # #CAST1:Total Invoice 3600.00 US #RBW1:Total Invoice 10,036.60 CDN #WOOD1:Total Invoice 12000.00 US # #CAST1:Total Invoice 3600.00 US 4,860.00 #RBW1:Total Invoice 10,036.60 CDN 10,036.60 #WOOD1:Total Invoice 12000.00 US 16,200.00 # EOF Total 31,096.60 # #calcs - convert US sales to CDN (multiply by 1.35) # - input from cols 24-36, insert output in cols 44-56 # - addup CDN$ & insert total line at End-Of-File # #demo: uvcopy addup3,fili1=tmp/sales1,filo1=tmp/sales2 # =============================================== # opr='$jobname - calc total sales for UV Software' fili1=?tmp/sales1,rcs=128,typ=LST filo1=?tmp/sales2,rcs=128,typ=LSTt @run opn all open files # begin loop to get, process,& output records loop1 get fili1,a0(128) get a record skp> eof (cc set > at EOF) mvc b0(128),a0 move inrec to outrec area cmc b0(80),' ' blank line ? skp= put1 # # convert any US$ to CDN, copy cols 24-36 to 44-56, mpy by 1.35 if US mvn $ca1,a24(12) capture input $sales mvn $ca2,$ca1 presume CDN$ (no mpy) scn a0(80),' US ' US (anywhere on line) skp! 2 mpy $ca2,135 calc US$ by mpy 135 div $ca2,100 & divide by 100 edt b44(12),$ca2,'zzzzz,zzz.zz-' edit to output columns add $ca3,$ca2 accumulate for EOF total put1 putb filo1,b0(128) write record to output file skp loop1 # # EOF - print grand total, close files & end job eof mvc b10(14),'EOF Total' edt b44(12),$ca3,'zzzzz,zzz.zz-' edit EOF total put filo1,b0(128) write record to output file cls all eoj
Goto: Begin this document , End this document , UVSI Home-Page
This job will convert tabs, FormFeeds,& Carriage Returns to blanks, with an option to drop blank lines. Uvlist also has options for these, but you might want to modify this job for your unique requirements.
# ctlfix1 - convert tabs,form feed, carriage return to blanks # - uvcopy prmfile for 1 file at a time # - may also use with uvcopyx script to process entire directories # #usage: uvcopy ctlfix1,fili1=infile,filo1=outfile - 1 file # #usage: uvcopyx ctlfix1 indir outdir uop=q0i7 - entire directory # ===================================== # opr='$jobname - convert tabs, FF, CR to blanks' opr='uop=q1b0 - Option default' opr=' b1 - Blank line delete' uop=q1b0 fili1=?tf/tabtest,typ=LST,rcs=a256 filo1=?$jobname.tmp,typ=LSTt,rcs=b256 @run opn all # begin loop to copy records until EOF loop get fili1,a0(256) get current record skp> eof mvc b0(256),a0 move input record to output area #--------------------------------- rep b0(256),x'09',c' ' replace any tabs with blanks rep b0(256),x'0C',c' ' replace any FF with blanks rep b0(256),x'0D',c' ' replace any CR with blanks cmn $uopbb,1 delete blank lines (optional) ?? # first b means binary, second b is option b skp< put1 ??? cmc b0(80),' ' Is this line blank ? skp= loop ?? #--------------------------------- put1 put filo1,b0(256) write record to output file skp loop # end of file - close files & end job eof cls all eoj
Goto: Begin this document , End this document , UVSI Home-Page
# printPCL5 - print a file of mixed PCL5 printer control codes & data to print # - converts pseudo escapes '!'s to true escapes x'1B' & ';'s to linefeeds # - by Owen Townsend, UV Software, Jan26/2019 # - prepare your escape sequence control file with the editor # using '!' exclamations for escapes x'1B' & ';' semi-colons for LineFeeds x'0A' # - drops any #comment lines # # uvcopy printPCL5,fili1=tf/AGMmeetingPCL5 <-- sample command # ======================================== # - reads input tf/AGMmeetingPCL5, converts pseudo escapes to true escapes, etc # - writes output to tmp/AGMmeetingPCL5 & automatically prints (default $UVLPDEST) # # ** sample input data file - $UV/tf/AGMmeetingPCL5 ** # # !E !&k2G !&l0320U !&l0000Z !&l0000O !&l0048C !(s4101T !(s0060V !(s0001P !(s0003B !(s0000S !&l0001X # ; AGM Meeting;March 03/2019 7PM;Mollie Nye House;940 Lynn Valley Rd. # ;; AGM Meeting;March 03/2019 7PM;Mollie Nye House;940 Lynn Valley Rd. # #Notes - see HP PCL5 technical reference at https://www.hp.com/ctg/Manual/bpl13210.pdf # - see concise PCL5 code reference at https://www.pclviewer.com/resources/reference/ # - sample file will print 2 meeting notices on 8 1/2 x 11 portrait # - to be cut at midpoint for 2 notices per page # - ';' inserts lineFeeds, so ';;' at begin 2nd line leaves 1 blank line between # - 3 spaces prior to ' AGM Meeting;... to center this shorter line # opr='$jobname - print file with embedded PCL5 codes (default AGMmeetingPCL5)' fili1=?tf/AGMmeetingPCL5,typ=LST,rcs=256 #default escape file for test filo1=tmp/$fili1,typ=RSF,rcs=256 #default output # @run opn all # # begin loop to read control file & convert '!'s to true escapes x'1B' # - bypassing any #comment records (usually only 1 active record) loop get fili1,a0(256) get next line skp> eof (cc set > at EOF cmc a0(1),'#' comment record ? skp= loop yes - bypass, return to get next # # replace all pseudo escapes with true escapes rep a0(256),'!',x'1B' replace escape markers with true escapes rep a0(256),';',x'0A' replace ';' semi-colons with LineFeeds scnr a0(256),!' ' scan from right for non-blank mvn $rl,$rx save length in rgstr 'l' add $rl,1 add 1 to convert dsplcmnt to length put filo1,a0($rl256) skp loop # eof cls all sysv1 'lp -onobanner $UVLPDEST $filo1' send outfile to the spooler (UNIX) eoj #
Goto: Begin this document , End this document , UVSI Home-Page
# printBIG2 - print BIG BOLD letters for posters,notices,etc # - by Owen Townsend, UV Software, Jan 26/2019 # - input data from a pre-edited text file (see printBIG1 solicits input) # - use ';' for newline, use ':' for new page # - user options for point size, vertical spacing, italics, typeface # - for HP PCL5 compatible printers # - see PCL5 code reference at https://www.pclviewer.com/resources/reference/ # printBIG1 - Alternate job to solicit data to print (vs data-file input) # # uvcopy printBIG2,fili1=tf/AGMmeeting,uop=p60x20 <-- sample command # =============================================== # - reads input tf/AGMmeeting, prepends with PCL5 codes for point size, etc # - writes output to tmp/AGMmeeting & automatically prints (default $UVLPDEST) # # ** sample input data file - $UV/tf/AGMmeeting ** # # ; AGM Meeting;March 03/2019 7PM;Mollie Nye House;940 Lynn Valley Rd. # ;; AGM Meeting;March 03/2019 7PM;Mollie Nye House;940 Lynn Valley Rd. # #Note - sample file will print 2 meeting notices on 8 1/2 x 11 portrait # - to be cut at midpoint for 2 notices per page # - ';' inserts lineFeeds, so ';;' at begin 2nd line leaves 1 blank line between # - 3 spaces prior to ' AGM Meeting;... to center this shorter line # opr='$jobname - print BIG BOLD letters posters,notices,etc (input from pre-edited text file)' opr='sample: AGM Meeting; March 03/2019 7PM; Mollie Nye House; 940 Lynn Valley Rd.' opr='uop=q1p60v48s0t4101x1l0 - option defaults' opr=' p60 - point size, default 60 points (1 point = 1/60 inch) opr=' v48 - vertical motion in 1/48", dflt = v48 (1")' opr=' s0 - style default s0=upright, s1=italics,s32=outlined' opr=' t4101 - typeface, default t4101=CG Times (see PCL manual)' opr=' x1 - number of copies, default 1' opr=' l1 - Landscape (vs Portrait l0 default)' uop=q1p60v48s0t4101x1l0 # user options fili1=?tf/AGMmeeting,typ=LST,rcs=256 filo1=tmp/$fili1,typ=RSF,rcs=256 # load table of PCL controls with defaults (will modify from uops) lod=a0(10) !E!&k2G 000 - reset & CR/LF !&l0320U 010 - left margin in DECI-POINTs (1 decipoint = 1/720 inch) !&l0000Z 020 - top margin (better to insert 1 LineFeed ';' before data) !&l0000O 030 - orientation = portrait !&l0048C 040 - vertical motion, option v48 = 1 inch !(s4101T 050 - typeface, option t4101 = CG Times !(s0060V 060 - point size 60/72 inch (1 POINT = 1/72 inch) !(s0001P 070 - proportional spacing !(s0003B 080 - BOLD !(s0001S 090 - style option i1=italics, dflt i0 (not italics) !&l0001X 100 - number of copies ~~~~~~~~~~
Goto: Begin this document , End this document , UVSI Home-Page
@run opn all open files # modify PCL control sequences from user options man02 tsb o12(1),x'01' Landscape ? skp! man06 mvc a013(4),'0000' modify left margin for Landscape mvc a023(4),'-320' modify top margin for Landscape mvc a033(4),'0001' set code for Landscape (vs Portrait) man06 mvn a043(4),$uopbv option v - vertical spacing mvn a053(4),$uopbt option t - typeface mvn a063(4),$uopbp option p - point size mvn a093(4),$uopbs option s - style (upright, italics) mvn a103(4),$uopbx option x - number of copies # # ensure vertical spacing in 1/48 at least 60% of points 72/inch mvn $ca2,$uopbp point size option mpy $ca2,60 calc 60% div $ca2,100 cmn $uopbv,$ca2 vert spacing => 60% point size ? skp> 1 mvn a43(4),$ca2 no - adjust to 60% # # squeeze control codes together, cnvrt pseudo escapes to true escapes sqz a0(200),' ' squeeze out all blanks rep a0(150),'!',x'1B' replace '!'s with true escapes scn a0(150),'~' determine length of escape sequences putt4 filo1,a0($rx150) # # begin loop to solicit data until null entry man30 get fili1,b0 get input data skp> man90 (cc set > at EOF) cmc b0(1),'#' comment ? skp= man30 yes - bypass, return to get next rep b0(200),';',x'0A' replace semicolons with linefeeds rep b0(200),':',x'0C' replace colons with formfeeds scnr b0(200),>' ' scan for right hand nonblank add $rx,1 +1 to cnvrt dsplcmnt to length put filo1,b0($rx200) write data to output file skp man30 repeat loop until null entry # # EOF - close files, send output to printer,& end job man90 cls filo1 close output file sysv1 'lp -onobanner $UVLPDEST $filo1' send outfile to the spooler (UNIX) eoj end job #
Goto: Begin this document , End this document , UVSI Home-Page