Note |
|
The jobs in SELECTjobs2 are intended for "data file" maintenance rather than "program/script/parm file" manipulations that were performed by sections such as Selectjobs, SCANjobs, REPjobs, DROPjobs,& COPYjobs.
A1. | SELECTjobs2 - File Copy & Record Selection for Data files |
vs SelectJobs for text files (programs,scripts,parms) | |
- Introduction (Game Plan) |
B1. | selectv1 - select records from a variable length text file |
that match (or dont match) 1 specified pattern | |
- search may be restricted to specified start&end column range | |
- may terminate output via stop count on input or output file | |
- these are handy jobs to create test files with desired data |
C1. | selectf1 - select records from a fixed record length file |
that match (or dont match) 1 specified pattern | |
- options for input rcsz, output rcsz, output file type, etc | |
- search may be restricted to specified start&end column range | |
- may terminate output via stop count on input or output file |
D1. | selectv2 - select records from a variable length text file that match |
(or dont match) any entry in a table of search patterns | |
- search may be restricted to specified start&end column range | |
- may terminate output via stop count on input or output file |
E1. | selectf2 - select records from a fixed record length file that match |
(or dont match) any entry in a table of search patterns | |
- options for input rcsz, output rcsz, output file type, etc | |
- search may be restricted to specified start&end column range | |
- may terminate output via stop count on input or output file |
F1. | selectf3 - select records from a fixed record length file that match |
(or dont match) any entry in a table of fixed size items | |
- searches a table of fixed size items such as invoice#s | |
for a match on an input record field at a fixed location | |
(vs selectf2 which scans the record for the table patterns) |
G0. | Listings of the uvcopy parameter files for the above jobs. |
- listed at the end of the section in the same sequence as | |
the documentation at the front of the section |
These jobs provide for fixed records sizes often required by existing application packages as well as variable length records used for text or program source files. Most of the jobs in this section are designed to select or delete records based on prompt responses & user prepared table files.
Goto: Begin this document , End this document , UVSI Home-Page
First run the jobs in this section using the demo files provided.
Note that these jobs prompt you for items such as: filenames, record sizes,search patterns,& search column ranges, etc. (just make null entries at the prompts to accept the demo defaults)
Running these jobs will probably remind you of some situations where you could have used these jobs to perform record selections, deletions, or file copying to different record sizes or file types.
If possible, try out some of these jobs on your own files.
The table driven jobs (selectv2,f2,f3) are particularly powerful & all you have to do is create the table of search patterns with your editor & then specify the table filename at the prompt (vs demo/default).
Note that the jobs up to selectf3 are entirely prompt & table driven & you do not yet have to learn to write the uvcopy instructions.
Obviously there is a point at which the prompts & keyins become more cumbersome than writing a custom prmfile to solve your particular problem.
Please see the next section which will introduce you to the uvcopy instructions & provide you with a base template job which you would copy & modify to solve your current problem.
Goto: Begin this document , End this document , UVSI Home-Page
with options to specify: - keep the matches vs dropping the matches - restrict search to a specified column range - specify record stop count based on input or output file
** operating instructions ** command / prompts response ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
uvcopy selectv1 <-- execute uvcopy & prmfile selectv1 ===============
uop=q1s0e999i999999o999999k0 user option defaults __s0e999________________ search range start column# ____e999________________ search range end column# ________i999999_________ input file stop count _______________o999999__ output file stop count ______________________k0 k0 default drop matches (k1 to keep matches) uop=q1s0e999i999999o999999k0 - null ok ? change ? --> i6 input stop count
enter the search pattern ? --> @#@ (CDN postal code pattern)
tf/names1 = default fili1, ok/enter new ? --> null to accept demo input
selectv1.tmp = default filo1, ok/enter new ? --> null to accept demo output
*** inspect input/output files ***
cat tf/names1 <--- display input file ===============
Owen Townsend UV Software Inc 5436 Victoria Dr Vancouver BC Canada V5P3V8 604-321-1024
cat tf/selectv1.tmp <--- display input file ===================
Owen Townsend UV Software Inc 5436 Victoria Dr Vancouver BC Canada <--- note: lines with postal code dropped
Goto: Begin this document , End this document , UVSI Home-Page
with options to specify: - keeping the matches vs dropping the matches - input record size & output record size - output file type (variable, fixed, or fixed with linefeed in last byte) - record stop counts based on input file or output file counts
** operating instructions ** command / prompts response ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
uvcopy selectf1 <-- execute uvcopy & prmfile selectf1 ===============
uop=q1a70b80s0e999i999999o999999k0 user option defaults __a70_________________________ input rcsz default _____b80______________________ output rcsz default ________s0e999________________ column range default ______________i999999_________ input file stop count _____________________o999999__ output file stop count ____________________________k0 k0 default drop matches (k1 to keep matches) uop=q1a70b80s0e999i999999o999999k0 - null ok or change ? --> null (accept dflts)
enter the search pattern (max 40 bytes) ? --> cr#### - drop credit notes ('cr' + any 4 numerics)
tf/datafix = default fili1, ok/rekey ? --> null to accept
selectf1.tmp = default filo1, ok/rekey ? --> null to accept
RST = typ default for filo1, ok/rekey ? --> null to accept or enter RSF or LSTt
note |
|
Goto: Begin this document , End this document , UVSI Home-Page
cat tf/datafix <--- display 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 selectf1.tmp <--- display output file ================
13500 Steve Jobs inv1015 00012495 00000875 00000750. 14962 Steve Wosniak inv2024 00057550 00004029 00003453. 24595 Jim Unruh inv2273 00245000 00017150 00014700. 25669 Thomas Watson inv3234 00155000 00010850 00009300.
Goto: Begin this document , End this document , UVSI Home-Page
with options to: - keep the matches (vs dropping the matches) - restrict search to a specified column range - specify stop count based on input or output file
** operating instructions ** command / prompts response ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
uvcopy selectv2 <-- execute uvcopy & prmfile selectv2 ===============
uop=q1s0e999i999999o999999k0 user option defaults __s0e999________________ search range start column# ____e999________________ search range end column# ________i999999_________ input file stop count _______________o999999__ output file stop count ______________________k0 k0 default drop matches (k1 to keep matches) uop=q1s0e999i999999o999999k0 - null ok or change ? --> i12 input stop count
tf/names1 = default fili1, ok/enter new ? --> null to accept demo input
tf/select2tbl = default fili2, ok/enter new ? --> null to accept demo table
selectv2.tmp = default filo1, ok/enter new ? --> null to accept demo output
note |
|
Goto: Begin this document , End this document , UVSI Home-Page
cat tf/select2tbl <--- display table file of search patterns =================
Vancouver~~~~~~~~~~~~~~~~~~~~~ # select2tbl - table file for selectv2 Toronto~~~~~~~~~~~~~~~~~~~~~~~ # for scan by table instruction (sct) Montreal~~~~~~~~~~~~~~~~~~~~~~ # 80 byte entries, search 30 (may increase) V5P 3V8~~~~~~~~~~~~~~~~~~~~~~~ # postal code for UV Software Vancouver @#@ *#@#~~~~~~~~~~~~~~~~~~~~~~ # optn 'p' activates spcl match chars Halifax~~~~~~~~~~~~~~~~~~~~~~~ # @=alpha,#=num,*=any no of prior char ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # table ended by '~~' in column 1 & 2
cat tf/names1 <--- display input file =============== (1st 12 records)
Owen Townsend UV Software Inc 5436 Victoria Dr Vancouver BC Canada V5P3V8 604-321-1024
Tony Goodson Omega Computer Services 5436 Victoria Dr Vancouver BC Canada V5P 3V8 604-321-8486
cat tf/selectv2.tmp <--- display output file ===================
Owen Townsend UV Software Inc 5436 Victoria Dr <--- note: lines with 'Vancouver' dropped <--- note: lines with any postal code dropped
Tony Goodson Omega Computer Services 5436 Victoria Dr <--- note: lines with 'Vancouver' dropped <--- note: lines with any postal code dropped
Goto: Begin this document , End this document , UVSI Home-Page
with options to: - specify input record size & output record size - keep the matches (vs dropping the matches) - restrict search to a specified column range - specify out file type (variable, fixed, or fixed with LF in last byte) - specify stop count based on input or output file
** operating instructions ** command / prompts response ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
uvcopy selectf2 <-- execute uvcopy & prmfile selectf2 ===============
uop=q1a70b80s0e999i999999o999999k0 user option defaults __a70_________________________ input rcsz default _____b80______________________ output rcsz default ________s0e999________________ column range default ______________i999999_________ input file stop count _____________________o999999__ output file stop count ____________________________k0 k0 default drop matches (k1 to keep matches) uop=q1a70b80s0e999i999999o999999k0 - null ok or change ? --> null (accept dflts)
tf/datafix = default fili1, ok/rekey ? --> null to accept input file
tf/select2tbl = default fili2, ok/rekey ? --> null to accept table file
selectf2.tmp = default filo1, ok/rekey ? --> null to accept output file
RST = typ default for filo1, ok/rekey ? --> null to accept or enter RSF or LSTt note - see test/demo files on the next page (table file, input file,& output file)
Goto: Begin this document , End this document , UVSI Home-Page
cat tf/select2tbl <--- display table file of search patterns =================
cr###~~~~~~~~~~~~~~~~~~~~~~~~~~~ tf/select2tbl - demo search table Watson~~~~~~~~~~~~~~~~~~~~~~~~~~ - for selectf2 job Mauchly~~~~~~~~~~~~~~~~~~~~~~~~~ - copies tf/datafix selecting Eckert~~~~~~~~~~~~~~~~~~~~~~~~~~ records matching any entry ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ in this table
cat tf/datafix <--- display 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 selectf2.tmp <--- display output file ================
13500 Steve Jobs inv1015 00012495 00000875 00000750. 14962 Steve Wosniak inv2024 00057550 00004029 00003453. 24595 Jim Unruh inv2273 00245000 00017150 00014700.
Goto: Begin this document , End this document , UVSI Home-Page
Similar to the selectf2 job above (which scans the record for matches) but this job looks up a table of items (such as invoice#s) for matches to a specified field or column# in the record (invoice# field).
Uses the '<' option of the uvcopy look-up instruction to search down a table for the 1st entry > than the search argument, then back up 1.
** operating instructions ** command / prompts response ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
uvcopy selectf3 <-- execute uvcopy & prmfile selectf3 ===============
uop=q1a70b80s30l7i999999o999999k0 user option defaults __a70________________________ input rcsz default _____b80_____________________ output rcsz default ________s30l7________________ search start dsplcmnt & length defaults _____________i999999_________ input file stop count ____________________o999999__ output file stop count ___________________________k0 k0 default drop matches (k1 to keep matches) uop=q1a70b80s30l7i999999o999999k0 - null ok or change ? --> null (accept dflts)
tf/datafix = default fili1, ok/rekey ? --> null to accept input file
tf/select3tbl = default fili2, ok/rekey ? --> null to accept table file
selectf3.tmp = default filo1, ok/rekey ? --> null to accept output file
RST = typ default for filo1, ok/rekey ? --> null to accept
Please see table/input/output files listed on the next page. Note that any invoice#s matching the above table have been dropped.
Goto: Begin this document , End this document , UVSI Home-Page
cat tf/select3tbl <--- display table file of search patterns =================
inv1015 # select3tbl - for demo job selectf3 inv2139 # - table of invoice#s to be dropped from tf/datafix file inv2273 # - used to search inv# field in cols 31-37 of tf/datafix inv3145 # - loaded into memory table at startup of job selectf3 ~~~~~~~ # end of table marker '~~' in col1&2
cat tf/datafix <--- display 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 selectf3.tmp <--- display output file ================
14962 Steve Wosniak inv2024 00057550 00004029 00003453. 12300 Bill Gates cr8001 -0002500 -0000175 -0000150. 25669 Thomas Watson inv3234 00155000 00010850 00009300. 30144 Presper Eckert cr9202 -0013500 -0000945 -0000810.
note |
|
Goto: Begin this document , End this document , UVSI Home-Page
Some of the uvcopy jobs are listed here at the back of the section in the same sequence as documented at the front of the section.
'*' <-- indicates listing present.
G1. | selectv1 * select records from a variable length text file |
that match (or dont match) 1 specified pattern | |
- search may be restricted to specified start & end column range | |
- may terminate output file via stop count on input or output file | |
- these are handy jobs to create test files with desired data |
G4. | selectf2 * select records from a fixed record length file that match |
(or dont match) any entry in a table of search patterns | |
- options for input rcsz, output rcsz, output file type, etc | |
- search may be restricted to specified start & end column range | |
- may terminate output file via stop count on input or output file |
Goto: Begin this document , End this document , UVSI Home-Page
# selectv1 - select records from a variable length text file # that match (or dont match) 1 specified pattern # - search may be restricted to specified start & end column range # - may terminate output file via stop count on input or output file # - this is a handy job to create small test files with desired data # opr='$jobname - select recs from a text file matching/not matching 1 pattern' opr=' - run this job with your own file or the demo file supplied' opr=' - default/demo file tf/names1 has 36 recs, max rcsz 25' opr=' - suggested pattern for demo file is "V5P" or "@#@" (any postal)' opr='uop=q1s0e999i999999o999999k0 - option defaults' opr='uop=__s0____________________ - start search column displacement' opr='uop=____e999________________ - end search column displacement' opr='uop=________i999999_________ - input file stop count' opr='uop=_______________o999999__ - output file stop count' opr='uop=______________________k0 - k1 to keep matches (vs drop default)' uop=q1s0e999i999999o999999k0 # option defaults, may change was=a256b256 # record area sizes (increase if reqd) fili1=?tf/names1,typ=LST,rcs=a256 # input file test/demo file default filo1=?$jobname.tmp,typ=LSTt,rcs=b256 # output filename default @run opn all open files msg 'search pattern for demo is "V5P" or "@#@" (any postal)' msgwn 'enter your search pattern, or the suggested for demo file' mvc d0(40),$reply save search pattern in area 'd' mvn $rn,$rx save search pattern length in rgstr n # (msgw leaves in rgstr x which is temp) # load start column displacement into rgstr s & length in rgstr l mvn $rs,$uopbs start col dsplcmnt from user option s mvn $rl,$uopbe end col dsp from option e sub $rl,$rs calc length add $rl,1 +1 to correct length skp> 1 can 'ERROR - end search col dsp <= begin search col dsp'
Goto: Begin this document , End this document , UVSI Home-Page
# begin loop getting records, searching for pattern, # - outputting matches/nonmatches - until EOF - or I/O stop counts reached loop get fili1,a0(256) get current record skp> eof scnp as0($rl256),d0($rn40) scan for match to search pattern skp= match # nomatch - default is to write nomatches # - but drop them if option k1 (keep matches & drop nomatches) nomat cmn $uopbk,0 option k0 or k1 ? skp> drop skp keep # match - default is to drop (bypass, dont write) matches # - but write them if option k1 (keep matches & drop nomatches) match add $fo1hits,1 incrmnt hit ctr stats for outfile EOF msg add $fi1hits,1 incrmnt hit ctr stats for infile EOF msg cmn $uopbk,0 option k0 or k1 ? skp> keep skp drop # common point to write out current record keep mvc b0(256),a0 move input record to output area # --- ----,---- - could add instructions here to modify layout put filo1,b0(256) write record to output file add $ca2,1 incrmnt outfile counter cmn $ca2,$uopbo out ctr = outfile stop count ? skp=> eof # # common point to bypass output of current record & test infile stop count drop add $ca1,1 increment record count cmn $ca1,$uopbi in ctr = infile stop count ? skp=> eof skp loop # # end of file or count limit reached - close files & end job eof cls all msg '- you may check I/O files via the editor or cat/type commands' eoj
Goto: Begin this document , End this document , UVSI Home-Page
# selectf2 - select records from a fixed length text file that match # (or dont match) any entry in a table of search patterns # - search may be restricted to specified start & end column range # - may terminate output file via stop count on input or output file # - this is a handy job to create small test files with desired data # # demo command: uvcopy selectf2 # or: uvcopy selectf2,fili1=tf/datafix,fili2=tf/select2tbl # # demo table: cr###~~~~~~~~~~~~~~ - any credit notes # Watson~~~~~~~~~~~~~ - any sales to Mr. Watson # ~~~~~~~~~~~~~~~~~~~ (end of table marker ~ col 1) # opr='$jobname - copy a fixed record length file selecting records that match' opr=' (or dont match) any entry in a table of search patterns' opr=' - you may run this job with the demo input file & search table' opr=' or 1st create your own search table & run with your own files' opr=' - demo/default file tf/datafix has 6 records of 70 bytes each' opr=' - demo/default table file tf/select2tbl has patterns such as:' opr=' Watson (matches in name field) & cr#### (matches any credit note)' opr=' - output file type will be solicited, choices are:' opr=' typ=RST - (default) fixed length records with LF in last byte' opr=' - recommended if last byte unused (allows editor use)' opr=' typ=LSTt - variable lth recs with LF after last nonblank' opr=' typ=RSF - fixed length recs, size by option b, no LF in last byte' opr=' ' opr='uop=q1a70b80s0e999i999999o999999k0 option defaults' opr='uop=__a70_________________________ input rcsz default' opr='uop=_____b80______________________ output rcsz default' opr='uop=________s0____________________ start search column displacement' opr='uop=__________e999________________ end search column displacement' opr='uop=______________i999999_________ input file stop count' opr='uop=____________________o999999___ output file stop count' opr='uop=____________________________k0 k1 to keep matches (drop default)' uop=q1a70b80s0e999i999999o999999k0 # option defaults, may change # was=a1024b1024m2000 # record area & table max sizes (increase if reqd) # - actual rcszs determined by options a & b fili1=?tf/datafix,typ=RST,rcs=a1024 # input file test/demo file default fili2=?tf/select2tbl,typ=LST,rcs=80 # table file of search patterns filo1=?$jobname.tmp,typ=?RST,rcs=b1024 # output filename default @run opn all # at begin job - load the table of search patterns rtb fili2,m0(80),m0(80) load table of search patterns # # store users record size options in registers for the gets & puts below mvn $ra,$uopba input rcsz to rgstr a for gets mvn $rb,$uopbb output rcsz to rgstr b for puts
Goto: Begin this document , End this document , UVSI Home-Page
# load start column displacement into rgstr s & length in rgstr l mvn $rs,$uopbs start col dsplcmnt from user option s mvn $rl,$uopbe end col dsp from option e sub $rl,$rs calc length add $rl,1 +1 to correct length skp> 1 can 'ERROR - end search col dsp <= begin search col dsp' # # begin loop getting records, searching for pattern, # - outputting matches/nonmatches - until EOF - or I/O stop counts reached loop get fili1,a0($ra1024) get current record skp> eof sctp as0($rl1024),m0(80),m0(30) scan for match to any table entry skp= match
# nomatch - default is to write nomatches # - but drop them if option k1 (keep matches & drop nomatches) nomat cmn $uopbk,0 option k0 or k1 ? skp> drop skp keep
# match - default is to drop (bypass, dont write) matches # - but write them if option k1 (keep matches & drop nomatches) match add $fi1hits,1 incrmnt hit ctr stats for infile EOF msg add $fo1hits,1 incrmnt hit ctr stats for outfile EOF msg cmn $uopbk,0 option k0 or k1 ? skp> keep skp drop
# common point to write out current record keep mvc b0($rb1024),a0 move input record to output area # --- ----,---- - could add instructions here to modify layout put filo1,b0($rb1024) write record to output file add $ca2,1 incrmnt outfile counter cmn $ca2,$uopbo out ctr = outfile stop count ? skp=> eof # # common point to bypass output of current record & test infile stop count drop add $ca1,1 increment record count cmn $ca1,$uopbi in ctr = infile stop count ? skp=> eof skp loop # # 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