UVjobs1.doc - Pre-programmed uvcopy jobs to Demo & Customize - Contents

This section documents some pre-programmed 'uvcopy jobs' that are ready to run as is without instruction modification. The uvcopy job is usually listed after the operating instructions and all jobs are available in /home/uvadm/pf/... Test/demo files are provided in subdirs dat1/... or tf/...

A1. Introduction to 'uvcopy' (interpretive data manipulation utility)
- pre-requisites to running the uvcopy test/demos
- copying test files to your homedir to run the demos
B1. toupper - convert any text file from lower case to UPPER case
- operating instructions, sample input & output files
  and the uvcopy job listing
C1. tolower - convert any text file from UPPER case to lower case
- sample COBOL program extract
- options to inhibit translation within quotes
- options to clear columns 1-6 & 73-80 (for COBOL source)
C4. uvcopy options - 26 letters a-z, often followed with binary digits
  - example: a1b2c4d7,etc
  - binary coding d7 = (d1+d2+d4)
  - compact way of coding a lot of options in a few bytes
D1. toascii - translate an EBCDIC text file to ASCII
D2.  investigate EBCDIC files with 'uvhd'
D3.  Op. Instrns. to convert demo EBCDIC file dat1/custmas0 to ASCII
D4.  extracting Name&Address fields, dropping packed decimal fields
D5.  sample conversion of an all character file dat1/nameadrs0
D7.  uvcopy job listing of 'toascii'
 ... toebcdic - translate an ASCII text file to EBCDIC
              - not shown here, same as toascii, but reversed
E1. tabfix1 - convert tabs x'09' to blanks (option 1-8, default 4)
E2. tabfix2 - convert tabs to blanks depending on a tab value option
  (solicited from operator) & the current column position.
- The tab value would be every 8 cols, or 4 cols, or whatever.
E3. tabfix3 - convert tabs to blanks depending on multiple fixed tab stops.
- tab stops solicited from operator as options a,b,c,etc
- defaults for COBOL source: a7b12c20d30e40f50g60h73
F1. uvenv - capture, sort,& display environmental variables
- can do same with unix tools (env | sort), but this is a good
  uvcopy test/demo job for table handling (evt, srt, wtb).
G1. testint2 - illustrate binary integers by initializing a counter to 1, and
  then doubling & displaying the result for 66 iterations.

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

UVjobs1.doc - Pre-programmed uvcopy jobs to Demo & Customize - Contents

H1. enterKBD2 - enter any keyboard data into a file
  - can enter data from: function keys, direction keys, escapes,
  etc, that can not be entered with the editor.
I1. enterHEX1 - convert pseudo hex codes into real hex data
  - 1st use the editor to prepare a file identifying the hex
  pseudo codes with x'____'. Then use enterHEX1 to copy to a 2nd
  file while converting the pseudo hex codes to real hex data.
J1. hexcalc1 - hex calculator, hex to decimal,& decimal to hex
  - hexcalc1 for Intel machines & hexcalc2 for RISC machines.
K1. datedemo1 - convert dates between calendar, julian,& days-since-1900
  - solicits dates & input formats,& display all output formats.
  - allows add or sub to days-since-1900 & display all 3 outputs
L1. calendar1 - create calendar from any start date to any end date
                 calendar, julian, days-since-1900, alpha-date
                 20081001  2008275   039721    3 Wed Oct 01 2008
                         -------------etc--------------
                 20081031  2008305   039751    5 Fri Oct 31 2008
M1. dirlist1 - list filenames in directory in physical sequence & accumulate
  total bytes used to be displayed at the end of the directory.
  ('ls' has no option to list in physical sequence)
N1. spread1 - convert a file of 1 item/line to multi items/line with
  options for: items/line, cols/item, space between items,
  & left margin offsets for input & output files.
- see script 'spreadA' which executes spread1,
  easier to use, just enter: spreadA directory
O1. calcGST - calculate GST,PST,NET from Total amount
- I used to calc the GST credits for tax reporting
  from VISA stmnts which list only the total sale amounts
- Examples for BC, but you could enter rates for your jurisdiction
P1. splitline1 - split large text records to multiple smaller segments
- allows lines up to 8192 bytes, could modify for larger
- option for segment size & for blank lines before/after long lines
- use before printing/emailing documents that would be truncated
Q1. countc1 - count lines of code,comments,total in 1 script
- for shell scripts, COBOL programs, uvcopy jobs, etc
- option for comment char '#' col 1, '*' col 7, etc
R1. countc1d - count lines for all files in directory
- counts lines of code,comments,totals,& Grand Total All files
- option to select files matching a specified prefix
- option for comment char '#' col 1, '*' col 7, etc

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

UVjobs1.doc - Pre-programmed uvcopy jobs to Demo & Customize - Contents

S1. table2 - Pre-Programmed General Purpose Table Summarries
- table summary reports for any file on any argument
- solicits filename & options to define displacement & length of
  table argument,& fields to be accumulated
S3. sltbl1 - custom written table summary jobs
- if requirements exceed limitations of Pre-Programmed table summary
- this example reads 64 byte sales records & builds a summary table
  of quantity & amount by product code, for dumping at EOF
T1. acum1 - pre-programmed job to accumulate any 1 field in any datafile
- might be for a hash total to prove file validity after conversions
  or to get a 2nd opinion when COBOL reports look suspicious
- prompts for file-name, file-type, field dsplcmnt, length,& type,
- option to crossfoot a number of consecutive same-size fields.
U1. cmrpt1 - customer master sales report for test file dat1/custmas1
  (used to demo both acum1 above & selectf1 below)
- report presented here, so you can verify your results
  if you run 'acum1' or 'selectf1'.
V1. selectf1 - select records depending on a field value <=> 2 specified values.
- prompts for field displacement, length, type, number, & values.
- 2 values allows you to select a range of values in any 1 field.
- option to crossfoot multi contiguous same size fields for test.

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

A1. UVjobs1.doc - Pre-programmed uvcopy jobs to Demo & Customize

what is uvcopy ?

'uvcopy' is Vancouver Utility C program for general purpose data manipulation. It is an 'interpreter' for instructions in a separate parameter file.

It is an essential part of the mainframe conversions because it can do many things not possible with the standard unix/linux utilities (such as processing packed decimal fields & handling Indexed files compatible with Micro Focus COBOL). See more about uvcopy at uvcopy1.htm.

This section 'UVjobs1' is intended as a brief introduction in volume 1. Please see the full documentation in volume2 starting with uvcopy1.htm followed by uvcopy2,3,4,5,6,7.

Here we will show you some simple 'uvcopy jobs' that you can run with test/demo files provided. This 'UVjobs1' should be studied after scripts1.htm which illustrates Korn shell scripts which could be useful to any unix/linux site.

Pre-Requisites to running uvcopy test/demos

  1. Your site administrator has installed the Vancouver Utilities. Please see the directory diagrams on the next page, showing only the subdirs relevant to running the uvcopy test/demos.

  2. Your site administrator has setup a login/homedir for you AND has setup the profiles to give you access to the Vancouver Utility programs, scripts, AND uvcopy parameter files.

  3. If you are the site administrator, please see ADMjobs.htm#Part_1 for listings of the supplied profiles & how best to set them up.

    uvadm, appsadm,& user homedirs

We recommend you setup a login/userid 'appsadm' to serve as the applications administrator for the unix/linux site. The appsadm home directory would hold various scripts, crontabs, log files, etc used in application administration.

One important purpose of appsadm is to hold the modified versions of any Vancouver Utility profiles, scripts & uvcopy jobs that you need to customize at your site.

Scripts & uvcopy jobs that are useful to all programmers & operators should be stored in /home/appsadm/sf/... or pf/... Scripts & uvcopy jobs that are useful only to individual programmers should be stored in their homedirs /home/userxx/sf/... or pf/...

This protects you from losing your customized versions when you install a future new version of Vancouver Utilities, which would overwrite your modified versions if stored in /home/uvadm/...

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

A2. UVjobs1.doc - Pre-programmed uvcopy jobs to Demo & Customize

uvcopy jobs - may copy/modify to appsadm or your homedir

 /home/uvadm        <-- Vancouver Utilities homedir
 :-----bin                 - binaries (uvcopy,uvsort,etc)
 :-----env                 - profiles supplied for your customization
 :--*3-pf                <-- uvcopy jobs Parameter Files (subdirs uvadm only)
 :     :-----adm           - administrative jobs
 :     :-----demo          - demo jobs
 :     :-----IBM           - IBM mainframe conversion jobs
 :     :-----util          - utility jobs
 :     :     :----tabfix1  <-- showing only 1 uvcopy parameter file (job)
 :     :
 :-----sf                <-- Script Files (sub-directoried for uvadm only)
 :     :-----adm           - administrative scripts
 :     :-----demo          - demo scripts
 :     :-----IBM           - IBM mainframe conversion scripts
 :     :-----util          - utility scripts
 :-----tf                <-- Test Files for demos
 :     :-----names1        - showing only 1 testfile of many
 :-----dat1              <-- more test DATA files for demos
 :     :-----custmas1      - showing only 1 testfile of many
 :-----tmp               <-- tmp subdir to receive output files
 :     :-----names1        - output files in tmp, cleared often
 /home/appsadm    <-- appsadm homedir
 :-----bin                 - binaries for site developed/modified programs
 :-----env                 - profiles modified for your site
 :--*2-pf                <-- uvcopy jobs (Parameter Files)
 :     :-----tabfix1       - copy/modify jobs to /home/appsadm/pf/...
 :     :                     if useful to multiple programmers
 :-----sf                <-- Script Files copied/modified from /home/uvadm/sf/...
 /home/userxx     <-- user homedir
 :-----sf                <-- your shell scripts
 :     :
 :--*1-pf                <-- uvcopy jobs (Parameter Files)
 :     :-----tabfix1       - copy/modify jobs to your homedir/pf/...
 :     :                     if useful only to you
 :     :
 :-----tf                <-- Test Files for demos
 :     :-----names1        - showing only 1 testfile of many
 :-----dat1              <-- more test DATA files for demos
 :     :-----custmas1      - showing only 1 testfile of many
 :-----tmp               <-- tmp subdir to receive output files
 :     :-----names1        - output files in tmp, cleared often
Note
  • *1, *2, *3 show the search-order
  • 1st your homedir, 2nd appsadm, 3rd uvadm
  • so your jobs with same names as uvadm jobs will be found 1st

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

A3. Pre-programmed uvcopy jobs to Demo & Customize

uvcopy jobs - profile required for access

Here are the relevant lines extracted from the profiles which are listed at ADMjobs.htm#1C3.

 export UV=/home/uvadm                # <-- UV homedir symbol used below
 export APPSADM=/home/appsadm         # <-- site applications administrator

PATH for C programs & scripts

 export PATH=$PATH:$HOME/bin:$HOME/sf:$APPSADM/bin:$APPSADM/sf:$RUNLIBS/sf
 export PATH=$PATH:$UV/bin:$UV/sf/adm:$UV/sf/demo:$UV/sf/util:$UV/sf/IBM

PFPATH for uvcopy jobs (parameter files)

 export PFPATH=$HOME/pf,$APPSADM/pf
 export PFPATH=$PFPATH,$UV/pf/adm,$UV/pf/demo,$UV/pf/util,$UV/pf/IBM
 Note that the search priority is #1=$HOME/pf, #2=$APPSADM/pf, #3=$UV/pf/...
 so any uvcopy jobs you copy/modify to your homedire will be found before any
 jobs with same name in $APPSADM, or $UV/adm,$UV/demo,$UV/IBM,$UVutil.

The uvcopy 'PFPATH' delimiter can be either comma ',' or colon ':'. Comas are provided for windows which uses ':' for drive designations.

setup to run uvcopy test/demo jobs


 #1. Login to your homedir

 #2a. mkdir pf        <-- make subdir for your own uvcopy jobs
      ========          - or to copy/modify jobs from /home/uvadm/pf/...

 #2b. mkdir dat1 tf   <-- make subdirs for the test/demo files
      =============

 #2c. mkdir tmp       <-- make subdir for test/demo outputs
      =========

 #3a. cp /home/uvadm/dat1/* dat1  <-- copy test/demo files to your homedir
      ==========================

 #3b. cp /home/uvadm/tf/* tf       <-- copy test/demo files to your homedir
      ======================

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

A5. Pre-programmed uvcopy jobs to Demo & Customize

running the DEMOS - starting simple

The operating instructions on the following pages show you how to run the various jobs using the test files provided in directory 'tf'. All you have to do is key the uvcopy command shown on the 1st line & make null entries to accept the default test filenames at the prompts.

You can inspect the output files produced using the editor vi/edit or display them via cat/type or print them via lp/print. These instructions will presume the operating system is UNIX, but the MS-DOS equivalents will be obvious to most users.

The default output file is usually written into the 'tmp/' subdir within your current working directory ($HOME usually). The default filename is usually the same as the input filename. You should periodically clean up with 'rm -f tmp/*'.

When you find 1 of these jobs that you would like to try running with 1 of your own files, you can simply specify the path name of your file instead of accepting the default input filename.

uvcopy job (parameter file) listings

For most jobs, the uvcopy parameter file listing will follow the operating instructions & test/demo I/O file listings. If you have the Vancouver Utilities installed, then all jobs are available in /home/uvadm/pf/... and you can inspect them with 'vi' or print them with 'lp' (or better with 'uvlp12').

Problems, Solutions,& Contributions

When you have a problem, but can not yet create your own solution, you are welcome to email me a description of the problem. I may be able to tell you where there is an existing UNIX script or uvcopy pre-programmed job, to solve the problem. If there is no existing solution, I might create a solution and Email it back to you.

Please do me (& other users) a favour

If you create a solution that you think may be useful to me or to other users, please document the solution, and send it to me for possible inclusion in a future version of the Vancouver Utility package.

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

A6. Pre-programmed uvcopy jobs to Demo & Customize

After running the Test/Demos

After running these jobs with the demo files, you can try the more relevant jobs with your own data files.

When you do this you will probably find some that don't do exactly what you want & a major advantage of these utilities is that you can easily change the interpretive instructions to accomplish your objectives.

To make changes, you may have to study the uvcopy program reference. Most users find this interpretive language easy to learn & extremely powerful. You don't have to be a programmer; uvcopy gives you the power of C or COBOL without their complexities.

The pre-programmed jobs should give you an idea of the powerful things you can do with your own data files once you have gained some proficiency with the uvcopy instruction set.

uvcopyx script to process all files in a directory

The 'uvcopyx' script is provided to execute a uvcopy job for all files in a directory while copying to a 2nd directory. After spot checking the output directory you can change (mv) its name back to the original.

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

B1. Pre-programmed uvcopy jobs to Demo & Customize

toupper - translate to UPPER case


 uvcopy toupper,fili1=tf/nameadrs1,filo1=tmp/nameadrs1
 =====================================================
 - execute uvcopy to interpret 'toupper' Parameter File of uvcopy instructions
 - specifying I/O files (fili1=... & filo1=...)

 uvcopy toupper <-- same as above (but easier), files default as shown above
 ==============

console log

 toupper - copy a text file translating lower case to UPPER case
 080325:072235:toupper: uvcopy ver=20080319 pf=/home/uvadm/pf/util/toupper
 uvcopy DISAM ext=dat LNX LL64 LF64 license=20080319V site=UV_Software
 tf/nameadrs1 = default fili01 - null accept or reenter ?      <-- enter null
 tmp/nameadrs1 = default filo01 - null accept or reenter ?     <-- enter null
 080325:072236:toupper: EOF fili01 rds=5 size=400: tf/nameadrs1
 080325:072236:toupper: EOF filo01 wrts=5 size=367: tmp/nameadrs1

sample input tf/nameadrs1 - lower case

 Owen Townsend       4667 Hoskins Rd     North Vancouver, BC Canada V5P3V8
 Gordon Campbell     1234 Government St. Victoria, BC        Canada V1P2G3
 Stephen Harper      24 Sussex Drive     Ottawa, ON          K1Y2L6 CANADA
 George Bush         1600 Pennsylvania  Washingtom, DC      00001 USA
 Bill Gates          1 Microsoft Way     Redmond, WA         USA 98052-6399

sample output tmp/nameadrs1 - UPPER case

 OWEN TOWNSEND       4667 HOSKINS RD     NORTH VANCOUVER, BC CANADA V5P3V8
 GORDON CAMPBELL     1234 GOVERNMENT ST. VICTORIA, BC        CANADA V1P2G3
 STEPHEN HARPER      24 SUSSEX DRIVE     OTTAWA, ON          K1Y2L6 CANADA
 GEORGE BUSH         1600 PENNSYLVANIA  WASHINGTOM, DC      00001 USA
 BILL GATES          1 MICROSOFT WAY     REDMOND, WA         USA 98052-6399

Most uvcopy jobs are available in /home/uvadm/pf/util/... For example, you can view or print the 'toupper' job as follows:


 vi /home/uvadm/pf/util/toupper      <-- view with the 'vi' editor
 ==============================

 lp /home/uvadm/pf/util/toupper      <-- print with unix 'lp' scheduler
 ==============================

 uvlp12 /home/uvadm/pf/util/toupper  <-- print with VU script 'uvlp12'
 ==================================    - 12 cpi with page headings

For your convenience the uvcopy job 'toupper' is listed on the next page --->

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

B2. toupper - translate any text file from lower to UPPER case

toupper - uvcopy job listing

 # toupper - uvcopy Parameter File from UVSI stored in: /home/uvadm/pf/util/
 # toupper - copy a text file translating upper case to UPPER case
 #
 #                       ** for 1 file at a time **
 #
 # uvcopy toupper,fili1=tf/names1,filo1=tmp/names1
 # ===============================================
 #                 - files shown above are the test/demo defaults
 #
 # uvcopy toupper  - you will be prompted if you omit files from command line
 # ==============    (specified with leading '?' in the uvcopy job code)
 #                 - default files are selected by null responses
 #                 - will be prompted for outfile disposition (option rop=r1)
 #                 - may enter vi,more,lp,uvlp12,etc (no need to enter filename)
 #
 opr='$jobname - copy a text file translating lower case to UPPER case'
 opr=' fili1=?tf/names1 <-- defines input file ('?' prompts new, null accept)'
 fili1=?tf/names1,typ=LST,rcs=256    # default input for test/demo
 filo1=?tmp/$fili1,typ=LSTt,rcs=256  # default output same as input
 @run
      opn   all
 loop get   fili1,a0                  # get each record into area 'a'
      skp>  eof
      mvc   b0(256),a0                # move record to output area 'b'
      tru   b0(256)                   # translate to UPPER case
 #    ---   ----,----                   (could add more processing here)
      put   filo1,b0                  # write record to output file
      skp   loop
 eof  eoj

notes

  1. 'tru' is the TRanslate to Upper instruction. 'trl' is Translate to Lower

  2. All instructions are 3 characters, anything following is an option or a condition code (such as the '>' of 'skp>').

  3. All instructions are documented in uvcopy3.htm which has an alphabetic index at the begining. File declarations are documented at uvcopy1.htm.

  4. '#' is the comment indicator & most of the pre-programmed uvcopy jobs are documented on #comment lines at the begining as shown here.

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

C1. Pre-programmed uvcopy jobs to Demo & Customize

tolower - translate to lower case

This job will translate any text file from UPPER to lower case with options to inhibit translation within single &/or double quotes, clear cols 1-6 &/or 73-80 (for COBOL).


 uvcopy pf/tolower,fili1=tf/CAR101.cbl    [,filo1=tmp/CAR200.cbl]
 =====================================
 - input file defaults to test/demo file shown above
 - do NOT specify output file, it defaults to input name in tmp/... subdir

 uvcopy pf/tolower   <-- may omit file (default as shown above)
 =================

console log

 tolower - copy a text file translating UPPER case to lower case
 uop=q1b0f0o3u0 - default options - q1=prompt, o3=inhibit trl within quotes
     q0         - inhibit uop prompt for option default change
       b1       - blank out cols 1-6 (COBOL)
       b2       - blank out cols 73-80 (COBOL)
       b3       - blank out cols 1-6 & 73-80 (COBOL)
         f1     - convert output filename to lowercase
           o1   - inhibit translate within single quotes
           o2   - inhibit translate within double quotes
           o3   - inhibit translate within both single & double quotes
             u1 - make first char of each word UPPER case
 080325:083343:tolower: uvcopy ver=20080319 pf=/home/uvadm/pf/util/tolower
 uvcopy DISAM ext=dat LNX LL64 LF64 license=20080319V site=UV_Software
 User OPtion (uop) defaults  = q1b0f0o3u0
  null to accept or re-specify (1 or more) -->                 <-- NULL entry
 tf/CAR101.cbl = default fili01 - null accept or reenter ?
 080325:083343:tolower: EOF fili01 rds=11 size=869: tf/CAR101.cbl
 080325:083343:tolower: EOF filo01 wrts=11 size=869: tmp/CAR101.cbl
 EOJ, Output File written to: tmp/CAR101.cbl
 enter command: vi,cat,more,lp,uvlp12,null -->                 <-- your choice
Note
  • see Input/Output files listed on the next page
  • next page also shows output from a 2nd test/demo
  • 2nd test would be run as follows:

rerun with options 'b3f1'


 uvcopy pf/tolower,fili1=tf/CAR101.cbl,uop=b3f1   [,filo1=tmp/car101.cbl]
 ==============================================
 - option 'b3' Blanks columns 1-6 & 73-80
 - option 'f1' translates output filename to lower case (car101 vs CAR101)

 uvcopy pf/tolower,uop=b3f1   <-- may omit file (defaults as shown above)
 ==========================

See test/demo I/O files for both runs on the next page --->

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

C2. tolower - translate to lower case

input file tf/CAR101.cbl

 000010 IDENTIFICATION DIVISION.                                         CAR100
 000020* CAR100 - TEST/DEMO MAINFRAME CONVERSION TO MICRO FOCUS COBOL    CAR100
 000030*        - CUSTOMER N&A LIST WITH REPORT HDNG & DATE VIA ACCEPT   CAR100
 000040 PROGRAM-ID. CAR100.                                              CAR100
 000080     SELECT CUSTMAS ASSIGN CUSTMAS                                CAR100
 000090            ORGANIZATION SEQUENTIAL ACCESS MODE SEQUENTIAL.       CAR100
 000140 FD  CUSTMAS RECORD CONTAINS 256 CHARACTERS.                      CAR100
 000150     01 CM1. COPY "CUSTMAS.CPY".                                  CAR100
 000220 01  PAGE-HDNGS.                                                  CAR100
 000230     05 FILLER            PIC X(40) VALUE                         CAR100
 000240        'CAR100: CUSTOMER NAME & ADDRESS LIST    '.               CAR100

output file 1st run - tmp/CAR101.cbl

 000010 identification division.                                         car100
 000020* car100 - test/demo mainframe conversion to micro focus cobol    car100
 000030*        - customer n&a list with report hdng & date via accept   car100
 000040 program-id. car100.                                              car100
 000080     select custmas assign custmas                                car100
 000090            organization sequential access mode sequential.       car100
 000140 fd  custmas record contains 256 characters.                      car100
 000150     01 cm1. copy "CUSTMAS.CPY".                                  car100
 000220 01  page-hdngs.                                                  car100
 000230     05 filler            pic x(40) value                         car100
 000240        'CAR100: CUSTOMER NAME & ADDRESS LIST    '.               car100

output file 2nd run - tmp/car101.cbl

        identification division.
       * car100 - test/demo mainframe conversion to micro focus cobol
       *        - customer n&a list with report hdng & date via accept
        program-id. car100.
            select custmas assign custmas
                   organization sequential access mode sequential.
        fd  custmas record contains 256 characters.
            01 cm1. copy "CUSTMAS.CPY".
        01  page-hdngs.
            05 filler            pic x(40) value
               'CAR100: CUSTOMER NAME & ADDRESS LIST    '.
Note
  • 1st run options default to 'b0f0o3u0'
  • 2nd run options entered as 'b3f1'

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

C3. tolower - translate to lower case

tolower - uvcopy job listing

 # tolower - uvcopy Parameter File from UVSI stored in: /home/uvadm/pf/util/
 # tolower - copy a text file translating UPPER case to lower case
 #
 # uvcopy tolower,fili1=tf/CAR101.cbl [,filo1=tmp/CAR101.cbl]
 # ==========================================================
 #                 - input file shown above is the test/demo default
 #                 - can not specify output file, defaults to input in tmp/...
 #
 # uvcopy tolower  - you will be prompted if you omit files from command line
 # ==============    (specified with leading '?' in the uvcopy job code)
 #                 - default files are selected by null responses
 #                 - will be prompted for outfile disposition (option rop=r1)
 #                 - may enter vi,more,lp,uvlp12,etc (no need to enter filename)
 #
 #                   ** for all files in a directory **
 #
 # uvcopyx tolower fild1=indir fild2=outdir uop=q0i7
 # =================================================
 #               - uvcopyx is a script to repeat 'uvcopy tolower'
 #                 for all files found in the directory
 #               - 'uop=q0i7' inhibits the option & operator msgs
 #
 opr='$jobname - copy a text file translating UPPER case to lower case'
 opr='uop=q1b0f0o3u0 - default options - q1=prompt, o3=inhibit trl within quotes'
 opr='    q0         - inhibit uop prompt for option default change'
 opr='      b1       - blank out cols 1-6 (COBOL)'
 opr='      b2       - blank out cols 73-80 (COBOL)'
 opr='      b3       - blank out cols 1-6 & 73-80 (COBOL)'
 opr='        f1     - convert output filename to lowercase'
 opr='          o1   - inhibit translate within single quotes'
 opr='          o2   - inhibit translate within double quotes'
 opr='          o3   - inhibit translate within both single & double quotes'
 opr='            u1 - make first char of each word UPPER case'
 uop=q1b0f0o3u0      # default options
 rop=r1              # causes prompt for output file disposition at EOJ
 fili1=?tf/CAR101.cbl,typ=LST,rcs=256   # default input for test/demo
 filo1=tmp/xxx,typ=LSTt,rcs=256         # outname dflts to tmp/inputbasename
 @run
        opn    fili1                   open input filename
 #

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

 # isolate input filename (drop directory), use for output filename in tmp/...
 # & test option f1 to translate to lower case
        mvu    f1(150),$fili1,x'00'    store input filename in w/s area 'f'
        scnr   f0(150),'/'             scan for right most '/'
        mvc    f200(80),fx1            isolate base filename following '/'
        mvf    $filo1,'tmp/'           setup output subdir
        cata8  $filo1,f200(80)         concat input base filename
        tsb    o6(1),x'01'             convert outfilename to lowercase ?
        skp!   1
        trl    $filo1                  convert outfilename to lowercase
        opn    filo1                   open output file
 #
 # convert uop (user option) to iop (instruction option) for trl inhibit
 # - store instrn option $iopo1 as q0/q1/q2/q3 for 'trlo1' below
 # - from user-option o0/o1/o2/o3 (see above)
 # - cant use user-optn 'q' since that is the query option for user optns
        mvc    c0(1),'q'               setup 'q' prefix for trl option
        mvn    c1(1),$uopbo            append user option 0/1/2/3 (binary)
        orc    c1(1),x'30'             convert to character for instrn optn
        mvc    $iopo1(2),c0            store for trl instrn below
        tsb    o21(1),x'01'            option u1 for first char UPPER ?
        skp!   1
        catt8  $iopo1,'f1'             append option for first char UPPER
 #
 # begin loop to get/process/output until EOF reached
 man20  get    fili1,a0(256)           get each record into area 'a'
        skp>   eof                     (cc set > at EOF)
        mvc    b0(256),a0              move record to output area 'b'
        trlo1  b0(256)                 translate to lower (see optns above)
        tsb    o2(1),x'01'             blank cols 1-6 ?
        skp!   1
        clr    b0(6),' '               blank cols 1-6
        tsb    o2(1),x'02'             blank cols 73-80 ?
        skp!   1
        clr    b72(8),' '              blank cols 73-80
 man40  put    filo1,b0(256)           write record to output file
        skp    man20                   repeat loop
 #
 # EOF - close files & end job
 eof    cls    all                     close all files
        eoj                           end job

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

C4. uvcopy Pre-Programmed jobs

uvcopy options

'uvcopy options' consist of the 26 lower case letters & each may or may not be followed by a numeric component of 1 or more digits.

In the tabfix2 job on the previous page, the user option defaults were:

                uop=q1t4

This job is using option 't' to indicate how many blanks are to be substituted for each tab (default 4)

If the operator responds 't8' the options are redisplayed:

                uop=q1t4t8

Finally the operator responds null & the options are accepted (rightmost options overriding previous options on the left)

If desired the operator could in the 1st instance reply 'q0t8' to turn off the query option 'q' (q0=off, q1=on)

uvcopy provides several set of options & the complete explanation is in the uvcopy1.doc section but briefly:

user options
  • example as above: uop=p1e1
  • assigned meanings by the writer of the prmfile
  • may be specified in the prmfile or on the command line
  • q1 option causes operator query if not on command line
run options
  • pre-assigned by the uvcopy program
  • may be specified in the prmfile or on the command line
  • example: rop=d - would put uvcopy into debug mode
    to display each instruction as it is executed & allow
    you to display areas
file options
  • specified as suffixes on the file typ function
  • example: typ=LSTt - the 't' option truncates trailing
    blanks on this file
 instruction options - may be specified on various instructions
               - see the uvcopy1.doc for a summary & see uvcopy2.doc
                 for the options on each instruction

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

D1. toascii - translate an EBCDIC file to ASCII

'toascii' will translate EBCDIC files to ASCII with options to specify I/O filenames, I/O file types, I/O record-sizes,& 2 translate areas (start byte & length).

As you know the Vancouver Utilities has comprehensive solutions for converting mainframe EBCDIC DATA files to ASCII based on the COBOL copybooks. See DATAcnv1.htm & MVSDATA.htm for the details of those advanced solutions that translate only the character fields & preserve the packed/binary fields that would be destroyed by translating the entire record.

This is a simple job that can be used to translate all character (pic x) records without the complexity of generating a conversion job based on the COBOL copybook (as described in DATAcnv1.htm or MVSDATA.doc').

'toascii' does provide options to specify 2 translate areas (start & length). This means you can protect the rest of the record from being translated, which would destroy packed/binary fields.

We will illustrate this using /home/uvadm/dat1/custmas0, an EBCDIC file of 256 byte fixed length records with character data in bytes 0-119, packed fields in bytes 120-240,& character data in 241-255 (which we will ignore). We will display the record using 'uvhd' since you can NOT use 'vi' on EBCDIC. Please see uvhd.htm if you are unfamiliar with the 'uvhd' utility.


 uvhd dat1/custmas0 r256   <-- display fixed length 256 byte records
 =======================     - uvhd option 'r' specifies record size
                      10        20        30        40        50        60
 r#        1 0123456789012345678901234567890123456789012345678901234567890123
           0 ......@@@@.........@......@...K@@@@....@.....@....@@@@@@@@@@....
             FFFFFF4444CECDCDCCD4DDEDDE4DEC44444FFFF4CDECD4DDCC4444444444DCDC
             130140000055597955504636920334B000018150266550961400000000005151
          64 ...@@@@@@@@@@..@......@@@@...`...`....@@@@@@@@@@@@@@@@@@........
             CDD4444444444CC4EFEFCF4444FFF6FFF6FFFF44444444444444444400000000
             946000000000023059218100006040754055310000000000000000000000C000
         128 .........W0....`........)X|..f3.....\.......................f...
             0000000005300016000000002570063100095000000000000000000000016000
             0C0000C0270C0540C0000C0098C0263C0444C0000C0000C0000C0000C0056C00
         192 .E|...V}.......................f.....<........f..@@@@@@@@@@@@@@@
             047000570000000088000000001800068000130000000069C444444444444444
             35C0046D0000C0023C0000C0083C0056D0012C0000C0016D3000000000000000

'uvhd' displays 256 bytes on 4 sets of 3 lines (vertical hexadecimal), characters, zones,& digits. The character line shows '.'s for characters that are unprintable in ASCII. First byte is zone 'F' & digit '1' which is a numeric '1' in EBCDIC.

All the '@' characters are x'40' EBCDIC blanks. We see '@' signs because x'40' is an '@' in ASCII.

This first display illustrates that you can NOT read EBCDIC data on ASCII systems without translation options. On the next page we will rerun uvhd with option 'a' to translate the character line to ASCII.

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

D2. toascii - translate an EBCDIC file to ASCII

investigating EBCDIC files with uvhd


 uvhd dat1/custmas0 r256a   <-- rerun uvhd adding option 'a'
 ========================     - to translate the character line to ASCII
                      10        20        30        40        50        60
 r#        1 0123456789012345678901234567890123456789012345678901234567890123
           0 130140    EVERGREEN MOTORS LTD.    1815 BOWEN ROAD          NANA
             FFFFFF4444CECDCDCCD4DDEDDE4DEC44444FFFF4CDECD4DDCC4444444444DCDC
             130140000055597955504636920334B000018150266550961400000000005151
          64 IMO          BC V9S1H1    604-754-5531                  ........
             CDD4444444444CC4EFEFCF4444FFF6FFF6FFFF44444444444444444400000000
             946000000000023059218100006040754055310000000000000000000000C000
         128 .........W.....-.........X@..f.....m*.......................f...
             0000000005300016000000002570063100095000000000000000000000016000
             0C0000C0270C0540C0000C0098C0263C0444C0000C0000C0000C0000C0056C00
         192 .E@...V'........c..............f..............f.C
             047000570000000088000000001800068000130000000069C444444444444444
             35C0046D0000C0023C0000C0083C0056D0012C0000C0016D3000000000000000

Packed Decimal fields

Note that there are 24 * 5 byte packed fields in 120-240. You can identify the end of each packed field by the sign, x'_C' or x'_D'in the last byte. For example here is the 1st 8 bytes of last segment:

         192 .E@...V'   <-- character line
             04700057   <-- zones line
             35C0046D   <-- digits line
               ^    ^   <-- '^' marks sign/end of each packed field

Translation would destroy packed fields, so we will use our options to specify translation only for 0-119 & 241-255 (see options c0d120e240f16 on the command line below).

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

D3. toascii - translate an EBCDIC file to ASCII

toascii Operating Instructions


 uvcopy toascii,fili1=dat1/custmas0,filo1=tmp/custmas0,uop=a256b256c0d120e240f16
 ===============================================================================
 - copy EBCDIC file custmas0 from dat1/... to tmp/... translating to ASCII
 uop=q1a256b256c0d256e0f0 - option defaults
       a256b256           - I/O recsize defaults
               c0         - field 1 dsplcmnt to start EBCDIC translate
                 d256     - field 1 length (defaults to entire record)
                     e0   - field 2 dsplcmnt to start EBCDIC translate
                       f0 - field 2 length (0 disables)
 080325:212204:toascii: uvcopy ver=20080319 pf=/home/uvadm/pf/util/toascii
 uvcopy DISAM ext=dat LNX LL64 LF64 license=20080319V site=UV_Software
 User OPtion (uop) defaults  = q1a256b256c0d256e0f0c0d120e240f16
  null to accept or re-specify (1 or more) -->
 dat1/custmas0 = default fili01 - null accept or reenter ?   <-- default filename
 RSF = typ default fili01 - null accept or enter new typ ?   <-- default filetype
 tmp/custmas0 = default filo01 - null accept or reenter ?
 RSF = typ default filo01 - null accept or enter new typ ?
 InRecSize (default 256) = 256, OutRecSize (default 256) = 256   <-- dflt recsize
 field #1 bgn=0,lth=120, field #2 bgn=240,lth=16 OK ? y/n ---> y <-- enter 'y'
 080325:212211:toascii: EOF fili01 rds=32 size=8192: dat1/custmas0
 080325:212211:toascii: EOF filo01 wrts=32 size=8192: tmp/custmas0

examine ASCII output - with uvhd


 uvhd dat1/custmas0 r256   <-- uvhd without option 'a' since now ASCII
 =======================
                      10        20        30        40        50        60
 r#        1 0123456789012345678901234567890123456789012345678901234567890123
           0 130140    EVERGREEN MOTORS LTD.    1815 BOWEN ROAD          NANA
             3333332222454545444244545524542222233332445442544422222222224444
             130140000056527255E0DF4F230C44E0000181502F75E02F140000000000E1E1
          64 IMO          BC V9S1H1    250-754-5531 LARRY WRENCH     ..4V|...
             4442222222222442535343222233323332333324455525544442222201357000
             9DF00000000002306931810000250D754D55310C12290725E38000000246C000
         128 .........W0....`........)X}..f3.....\.................4V}...f...
             0000000005300016000000002570063100095000000000000000013570016000
             0C0000C0270D0540C0000C0098D0263C0444C0000C0000C0000C0246D0056C00
         192 .E|...V}.......................f.....<........f.C 19950531
             0470005700000000880000000018000680001300000000694233333333222222
             35C0046D0000C0023C0000C0083C0056D0012C0000C0016D3019950531000000

You can now see that bytes 0-119 & 240-255 have been translated to ASCII and bytes 120-239 (packed fields) have been preserved unchanged.

Confirm it is ASCII by checking a few characters. For example the 1st byte '1' is x'31' (zone 3 digit 1) & the 10th byte 'E' is x'45' (zone 4 digit 5), etc.

Compare bytes 192-199 to the uvhd on the previous page for the EBCDIC file:

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

D4. toascii - translate an EBCDIC file to ASCII

Extract Name & address, dropping packed fields

Now we will rerun the job, using options to drop off the packed fields, retaining only the 1st 80 bytes of Name & Address, & changing output file type to typ=RST which inserts a LineFeed in the last byte (80) to allow us to view & print the file with the normal unix tools (vi, cat, lp, etc).


 uvcopy toascii,fili1=dat1/custmas0,filo1=tmp/custmas0,uop=a256b80c0d80
 ======================================================================
 - copy EBCDIC file custmas0 from dat1/... to tmp/... translating to ASCII
 - shortening out recsize to 80 (to drop off packed fields)
 - translating all 80 bytes
 - using output typ=RST to insert LineFeeds for vi, lp, etc

console log

 uop=q1a256b256c0d256e0f0 - option defaults
       a256b256           - I/O recsize defaults
               c0         - field 1 dsplcmnt to start EBCDIC translate
                 d256     - field 1 length (defaults to entire record)
                     e0   - field 2 dsplcmnt to start EBCDIC translate
                       f0 - field 2 length (0 disables)
 080325:214707:toascii: uvcopy ver=20080319 pf=/home/uvadm/pf/util/toascii
 uvcopy DISAM ext=dat LNX LL64 LF64 license=20080319V site=UV_Software
 User OPtion (uop) defaults  = q1a256b256c0d256e0f0a256b80c0d80
  null to accept or re-specify (1 or more) -->   <-- null (optns on cmd line)
 dat1/custmas0 = default fili01 - null accept or reenter ? <-- null defaults
 RSF = typ default fili01 - null accept or enter new typ ?
 tmp/custmas0 = default filo01 - null accept or reenter ?
 RSF = typ default filo01 - null accept or enter new typ ? RST <-- for LineFeeds
 InRecSize (default 256) = 256, OutRecSize (default 256) = 80  <-- 80 bytes out
 field #1 bgn=0,lth=80, field #2 bgn=0,lth=0 - OK ? y/n     y  <-- OK
 080325:214714:toascii: EOF fili01 rds=32 size=8192: dat1/custmas0
 080325:214714:toascii: EOF filo01 wrts=32 size=2560: tmp/custmas0

 vi tmp/custmas0   <-- view output file (ASCII 80 bytes with LineFeeds)
 ===============
 130140    EVERGREEN MOTORS LTD.    1815 BOWEN ROAD          NANAIMO          BC
 132588    GEECOE GENERATOR SERVICESUNIT 170 - 2851 SIMPSON  RICHMOND         BC
 139923    JOHNSTONE BOILER & TANKS 1250 EAST PENDER STREET  VANCOUVER        BC
 142175    LILLY ELECTRIC (1973) LTD16809 - 24TH AVENUE      SURREY           BC
 145264  D MAGRATH SUPPLIES LTD.    1939 KIRSCHNER ROAD      KELOWNA          BC
                     - - - 22 records omitted - - -
 400002    ACKLANDS LTD             945 -2ND AVE             PRINCE GEORGE    BC
 401210    COAST RANGE CONSTRUCTION 1103-207 W. HASTINGS ST  VANCOUVER        BC
 402875    HULL, DON & SONS LTD.    BOX 1297                 PRINCE GEORGE    BC
 403887    MILNER, LARRY            BOX 28 RAU ROAD R.R.8    QUESNEL          BC
 406082    PRECAM RENTALS LTD:      10116-94TH AVE           FORT ST. JOHN    BC

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

D5. toascii - translate an EBCDIC file to ASCII

toascii sample conversion of all character file

'toascii' has limited use in converting files with packed fields (since it is limited to 2 areas). It is capable of converting all character files. FTP ASCII also does this, but it inserts CR/LF which may have to be removed to match the fixed length expected by the COBOL programs.

As an example we will illustrate the toascii conversion of dat1/nameadrs0. We know the record size is 80 bytes from page 'B1'. Since 'vi' can not be used with EBCDIC files, we will show you the 1st record with 'uvhd', first with only the record size option,& then adding the 'a' option to translate the character line.


 uvhd dat1/nameadrs0 r80    <-- uvhd #1 (forgetting the 'a' option)
 =======================
                      10        20        30        40        50        60
 r#        1 0123456789012345678901234567890123456789012345678901234567890123
           0 ....@........@@@@@@@....@.......@..@@@@@.....@.........k@..@....
             DA894E9A9A8984444444FFFF4C9A989A4D844444D99A84E8989AA8964CC4C898
             6655036652554000000046670862295209400000569380515364559B02303151
          64 ..@......@@@@@@@
             884EFDFEF4444444
             4105573580000000

 uvhd dat1/nameadrs0 r80a   <-- uvhd #2 with 'a' option to translate characters
 ========================
                      10        20        30        40        50        60
 r#        1 0123456789012345678901234567890123456789012345678901234567890123
           0 Owen Townsend       4667 Hoskins Rd     North Vancouver, BC Cana
             DA894E9A9A8984444444FFFF4C9A989A4D844444D99A84E8989AA8964CC4C898
             6655036652554000000046670862295209400000569380515364559B02303151
          64 da V5P3V8
             884EFDFEF4444444
             4105573580000000

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

D6. toascii - translate EBCDIC to ASCII

toascii sample conversion of all character file


 uvcopy toascii,fili1=dat1/nameadrs0,filo1=tmp/nameadrs0,uop=a80b80
 ==================================================================
 - translate EBCDIC all char 80 byte records to ASCII in tmp subdir

console log

 uop=q1a256b256c0d256e0f0 - option defaults
       a256b256           - I/O recsize defaults
               c0         - field 1 dsplcmnt to start ASCII translate
                 d256     - field 1 length (defaults to entire record)
                     e0   - field 2 dsplcmnt to start ASCII translate
                       f0 - field 2 length (0 disables)
 080326:075440:toascii: uvcopy ver=20080319 pf=/home/uvadm/pf/util/toascii
 uvcopy DISAM ext=dat LNX LL64 LF64 license=20080319V site=UV_Software
 User OPtion (uop) defaults  = q1a256b256c0d256e0f0a80b80      <-- recsize 80
  null to accept or re-specify (1 or more) -->
 RSF = typ default fili01 - null accept or enter new typ ?
 tmp/nameadrs0 = default filo01 - null accept or reenter ?
 RSF = typ default filo01 - null accept or enter new typ ?  RST <-- for LineFeeds
 InRecSize (default 256) = 80, OutRecSize (default 256) = 80
 field #1 bgn=0,lth=256, field #2 bgn=0,lth=0 - OK ? y/n
 080326:075452:toascii: EOF fili01 rds=5 size=400: dat1/nameadrs0
 080326:075452:toascii: EOF filo01 wrts=5 size=400: tmp/nameadrs0

 uvhd dat1/nameadrs0 r80   <-- uvhd #3 (now ASCII, do not need option 'a')
 =======================
                      10        20        30        40        50        60
 r#        1 0123456789012345678901234567890123456789012345678901234567890123
           0 Owen Townsend       4667 Hoskins Rd     North Vancouver, BC Cana
             4766256767666222222233332467666725622222467762566667767224424666
             F75E04F7E35E40000000466708F3B9E302400000EF248061E3F5652C023031E1
          64 da V5P3V8      .
             6625353532222220
             410650368000000A

 cat tmp/nameadrs0     <-- can use unix utilities (cat,vi,more,lp,etc)
 =================
 Owen Townsend       4667 Hoskins Rd     North Vancouver, BC Canada V5P3V8
 Gordon Campbell     1234 Government St. Victoria, BC        Canada V1P2G3
 Stephen Harper      24 Sussex Drive     Ottawa, ON          K1Y2L6 CANADA
 George Bush         1600 Pennsylvania  Washingtom, DC      00001 USA
 Bill Gates          1 Microsoft Way     Redmond, WA         USA 98052-6399

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

D7. toascii - translate an EBCDIC file to ASCII

toascii - uvcopy job listing

 # toascii - uvcopy Parameter File from UVSI stored in: /home/uvadm/pf/util/
 # toascii - copy a text file translating from EBCDIC to ASCII
 #
 # uvcopy toascii,fili1=dat1/custmas0,filo1=tmp/custmas1
 # =====================================================
 # - copy dat1/custmas0 to tmp/custmas1, translating from EBCDIC to ASCII
 #
 # uvcopy toascii  <-- can default filenames for test/demo
 # ==============
 #
 #note - demo file 'custmas0' has 24 * 5 byte packed fields in 120-240
 #     - options c0d120 translate only 1st 120 bytes to preserve packed fields
 #     - see DATAcnv1.doc & MVSDATA.doc for more details on conversion
 #       between EBCDIC & ASCII involving packed/binary fields, etc
 #
 opr='$jobname - copy a file translating EBCDIC to ASCII'
 opr='         - enter your filenames at the prompts below or use demo files'
 opr='note - output file "typ" will be solicited below'
 opr='       RSF  - is the default output file type (fixed rcsz, no LF)'
 opr='       RST  - inserts LF in last byte (for vi/lp/etc)'
 opr='       LSTt - inserts LF after last nonblank (variable rcsz vs fixed)'
 opr='uop=q1a256b256c0d256e0f0 - option defaults'
 opr='      a256b256           - I/O recsize defaults'
 opr='              c0         - field 1 dsplcmnt to start ASCII translate'
 opr='                d256     - field 1 length (defaults to entire record)'
 opr='                    e0   - field 2 dsplcmnt to start ASCII translate'
 opr='                      f0 - field 2 length (0 disables)'
 uop=q1a256b256c0d256e0f0  # establish option defaults
 was=a4096b4096            # reserve record I/O areas 4K max
 fili1=?dat1/custmas0,rcs=4096,typ=?RSF   # default input for test/demo
 filo1=?tmp/$fili1,rcs=4096,typ=?RSF      # default output
 @run
       opn     all                     open files
       mvn     $ra,$uopba              input  rcsz option 'a' to rgstr 'a'
       mvn     $rb,$uopbb              output rcsz option 'b' to rgstr 'b'
       mvn     $rc,$uopbc              field 1 dsplcmnt to start ASCII translate
       mvn     $rd,$uopbd              field 1 length of data to be translated
       mvn     $re,$uopbe              field 2 dsplcmnt to start ASCII translate
       mvn     $rf,$uopbf              field 2 length of data to be translated
       msgv1   'InRecSize (default 256) = $ra, OutRecSize (default 256) = $rb'
       msgv1wy 'field #1 bgn=$rc,lth=$rd, field #2 bgn=$re,lth=$rf - OK ? y/n'
       skp=    loop
       can     'cancelled by operator - rerun with correct options'
 loop  get     fili1,a0($ra4096)       get into area 'a' rcsz in rgstr 'a'
       skp>    eof                     (cc set > at EOF)
       mvc     b0(4096),a0             move record to output area 'b'
       tra     bc0($rd4096)            trslt field 1 start optn c length optn d
       tra     be0($rf4096)            trslt field 2 start optn e length optn f
       put     filo1,b0($rb4096)       write to outfile, rcsz in rgstr 'b'
       skp     loop                    return to get next record
 eof   eoj

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

E1. tabfix1 - convert tabs to blanks (default 4 blanks)

tabfix1 - operating instructions


 uvcopy tabfix1,fili1=tf/tabtest1,filo1=tmp/tabtest1,uop=t4
 ==============================================================

 uvcopy tabfix1  <-- same as above, files & options default as shown
 ==============
 tabfix1 - convert tabs to blanks option t value 1-8
 uop=t4   - option defaults
     t4   - replace each tab with 4 blanks (t1-t8 allowed)
 User OPtion (uop) defaults  = q1t4
  null to accept or re-specify (1 or more) -->             <-- null accept dflt
 tf/tabtest1 = default fili01 - null accept or reenter ?   <-- null accept dflt
 tmp/tabtest1 = default filo01 - accept or reenter ?       <-- null accept dflt
 080206:120513:tabfix1: EOF fili01 rds=11 size=635: tf/tabtest1
 080206:120513:tabfix1: EOF filo01 wrts=11 size=653: tmp/tabtest1

inspect I/O files - see next page


 cat tf/tabtest1         - display input test file
 ===============         - note tab expansion when displayed

 uvhd tf/tabtest1 t      - use hexdump utility to see tabs x'09'
 ==================      - option 't' for Text files (respect LineFeeds)

 cat tmp/tabtest1        - display output test file
 ================        - note tabs converted to blanks

 uvhd tmp/tabtest1 t     - use hexdump to verify blanks x'20'
 ===================     - option 't' for Text files (respect LineFeeds)

Notes

  1. See the input/output files listed on the next page --->

  2. See the uvcopy job 'tabfix1' listed 2 pages ahead --->

  3. If you wished to convert all tabs in all files in a directory, you can use the 'uvcopyx' script to repeat tabfix1 for all files while copying from the input directory to an output directory.


 uvcopyx tabfix1 scripts tmp uop=q0i7
 ====================================

'uop=q0i7' are User OPtions to inhibit prompts & reduce console messages

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

E1a. tabfix1 - convert tabs to blanks (default 4 blanks)

tf/tabtest1 - test file for tabfix1,2,3

 # tabtest1 - test file for uvcopy jobs tabfix1,2,3 to replace tabs with blanks
 #          - no of blanks inserted depends on option 't' (t1-t8, default t4)
 # tabfix1  - inserts option t blanks (default t4) regardless of position
 # tabfix2  - inserts blanks so next field at multiple of option t (default t4)
 # tabfix3  - inserts blanks to place next field depending on tab rack
 # - 'vi' or 'lp' will expand the tabs when you examine this file
 # - the 2nd last line below has 1 tab between words & without expansion would
 #   appear as follows (using commas to represent the tabs):
 a,bb,ccc,dddd,eeeee,ffffff,ggggggg <-- see below 'commas' replaced by 'tabs'
           1         2         3         4         5
 0123456789012345678901234567890123456789012345678901234
 =======================================================
 a	bb	ccc	dddd	eeeee	ffffff	ggggggg	<-- tab x'09' delimited
 =======================================================
Note
  • line above has 1 tab x'09' between a,bb,ccc,dddd,eeeee,ffffff,ggggggg
  • unix vi,lp,etc insert no of blanks to place next field at multiple of 8

use uvhd to see tabs x'09'


 uvhd tf/tabtest1 t  <-- option 't' for text files (else 256 byte blocks)
 ==================    - I inserted '*'s below to emphasize tabs x'09's
                      10        20        30        40        50        60
      0123456789012345678901234567890123456789012345678901234567890123
      a.bb.ccc.dddd.eeeee.ffffff.ggggggg.<-- tab x'09' delimited.
      60660666066660666660666666066666660322276627233226666667660
      19229333944449555559666666977777779CDD0412087097045C9D9454A
       *  *   *    *     *      *       *

 uvcopy tabfix1    <-- run tabfix1 to expand each tab to 4 blanks (default)
 ==============      - copies all lines, but only relevant lines shown below
           1         2         3         4         5
 0123456789012345678901234567890123456789012345678901234
 =======================================================
 a    bb    ccc    dddd    eeeee    ffffff    ggggggg    <-- tab x'09' delimited
 =======================================================
Note
  • you can see that each tab has been replaced by exactly 4 blanks
  • independent of where tab is located on next line (as per unix default)
  • see tabfix2 for result similar to unix but at multiples of 4 vs 8

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

E1b. tabfix1 - convert tabs to blanks (default 4 blanks)

pf/util/tabtest1 - uvcopy job listing

 # tabfix1 - uvcopy Parameter File from UVSI stored in: /home/uvadm/pf/util/
 # tabfix1 - convert tabs to blanks (1 to 8, depending on option t)
 #
 # uvcopy tabfix1,fili1=infile,filo1=outfile,uop=t4    <-- command format
 # ================================================
 # uvcopy tabfix1,fili1=tf/tabtest1,filo1=tmp/tabtest1 <-- demo defaults
 # ===================================================
 # uvcopyx tabfix1 indir outdir uop=q0i7t4 <-- uvcopyx script repeats for
 # =======================================     all files in directory
 #
 opr='$jobname - convert tabs to blanks option t value 1-8'
 opr='uop=t4   - option defaults'
 opr='    t4   - replace each tab with 4 blanks (t1-t8 allowed)'
 uop=q1t4      #<-- option defaults
 fili1=?tf/tabtest1,typ=LST,rcs=256
 filo1=?tmp/$fili1,typ=LSTt,rcs=256
 @run
       opn   all
       mvn   $rt,$uopbt    load rgstr t with option 't' (no of blanks desired)
 #
 # 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',c0($rt8)  replace any tabs with blanks ($rt value)
 #---------------------------------
       put   filo1,b0(256)           write record to output file
       skp   loop
 # end of file - close files & end job
 eof   cls   all
       eoj
                           ** Notes **

uvcopy jobs are easily changed (or copied & renamed) if you have other conversions that you would like to perform.

For example, if you wanted to convert formfeeds to linefeeds, (replacing page skips with blank lines), you would add the following line of code where indicated in the tabfix1 parameter file.

 #---------------------------------------------------------------
       rep   b0(256),x'0C',x'0A'         replace FF with LF
 #---------------------------------------------------------------

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

E2. tabfix2 - expand tabs to blanks depending on tab value & current column

tabfix2 - operating instructions


 uvcopy tabfix2,fili1=tf/tabtest2,filo1=tmp/tabtest2,uop=t4
 ==========================================================

 uvcopy tabfix2  <-- same as above, files & options default as shown
 ==============
 tabfix2 - expand tabs to blanks depending on tab value & current col#
 option defaults: uop=q1t4 - operator option query & tab value 4
                  uop=q0t8 - inhibit query & set tab value 8
 User OPtion (uop) defaults  = q1t4
  null to accept or re-specify (1 or more) -->            <-- null accept dflt
 tf/tabtest2 = default fili01 - null accept or reenter ?  <-- null accept dflt
 tmp/tabtest2 = default filo01 - accept or reenter ?      <-- null accept dflt
 080206:134343:tabfix2: EOF fili01 rds=6 size=249: tf/tabtest2
 080206:134343:tabfix2: EOF filo01 wrts=6 size=262: tmp/tabtest2

inspect I/O files - see next page


 cat tf/tabtest2          - display input test file
 ===============          - note tab expansion when displayed

 uvhd tf/tabtest2 t       - use hexdump utility to see tabs x'09'
 ==================       - option 't' for Text files (respect LineFeeds)

 cat tmp/tabtest2         - display output test file
 ================         - note tabs converted to blanks

 uvhd tf/tabtest2 th2     - use hexdump to verify blanks x'20'
 ====================     - option 't' for Text files (respect LineFeeds)
                          - option 'h2' to force hex display

 vi /home/uvadm/pf/util/tabfix2
 ==============================

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

E2a. tabfix2 - test/demo input & output files illustrating TAB expansion

tf/tabtest2 - demo file for tabfix2

# tabtest2 - test file for tabfix1,2,3 #-->line below delimited by commas x'2C' a,bb,ccc,dddd,eeeee,ffffff,ggggggg a bb ccc dddd eeeee ffffff ggggggg #<--line above delimited by tabs x'09' # unix vi,lp,etc expands to put next field on multiple of 8

tf/tabtest2 - displayed by 'uvhd'


 uvhd tf/tabtest2 t  <-- use uvhd to see 'tab's x'09' below
 ==================    - option 't' for 'text' file (respect LineFeeds)
                       - only showing line 4 of tf/tabtest2 (listed above)
                      10        20        30        40        50        60
 r#        4 0123456789012345678901234567890123456789012345678901234567890123
         115 a.bb.ccc.dddd.eeeee.ffffff.ggggggg.
             60660666066660666660666666066666660
             1922933394444955555966666697777777A

 uvcopy tabfix2,fili1=tf/tabtest2,filo1=tmp/tabtest2,uop=t4
 ==========================================================
 uvcopy tabfix2  <-- same as above, files & options default as shown
 ==============

tabfix2 OUTPUT - tmp/tabtest2

 # tabtest2 - test file for tabfix1,2,3
 #-->line below delimited by commas x'2C'
 a,bb,ccc,dddd,eeeee,ffffff,ggggggg
 a   bb  ccc     dddd    eeeee   ffffff  ggggggg
 #<--line above delimited by tabs x'09'
 # unix vi,lp,etc expands to put next field on multiple of 8

tabfix2 OUTPUT - displayed by 'uvhd'


 uvhd tf/tabtest2 th2  <-- use uvhd to see 'tab's x'09' below
 ====================    - option 't' for 'text' file (respect LineFeeds)
                         - option 'h2' to force hex display
                         - only showing line 4 of tf/tabtest2 (listed above)
                      10        20        30        40        50        60
 r#        4 0123456789012345678901234567890123456789012345678901234567890123
         115 a   bb  ccc     dddd    eeeee   ffffff  ggggggg.
             622266226662222266662222666662226666662266666660
             10002200333000004444000055555000666666007777777A
Note
  • for tabtest2, you can see that tabs are expanded to enough blanks
  • to force the following field onto a multiple of 4
  • (vs tabfix1, that expanded each tab to 4 blanks regardless of position)

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

E3. Pre-programmed uvcopy jobs to Demo & Customize

tabfix3 - convert tabs to blanks using a 'tab-rack'

This job (tabfix3) accepts up to 26 values for fixed column tab stops. These values are entered via user options a,b,c,etc.

 The defaults (for COBOL source) are: a7b12c20d30e40f50g60h73

operating instructions


 uvcopy tabfix3,fili1=tf/tabtest3,filo1=tmp/tabtest3,uop=t4
 ==========================================================
 uvcopy tabfix3  <-- same as above, files & options default as shown
 ==============

tabfix3 - expand tabs to blanks depending on multi fixed col tab stops option defaults: uop=q1a7b12c20d30e40f50g60h73 (COBOL source)

 User OPtion (uop) defaults  = q1a7b12c20d30e40f50g60h73
  null to accept or re-specify (1 or more) -->            <-- null accept dflt
 tf/tabtest3 = default fili01 - null accept or reenter ?  <-- null accept dflt
 tmp/tabtest3 = default filo01 - accept or reenter ?      <-- null accept dflt
 080206:140725:tabfix3: EOF fili01 rds=6 size=244: tf/tabtest3
 080206:140725:tabfix3: EOF filo01 wrts=6 size=266: tmp/tabtest3

inspect I/O files - see next page


 cat tf/tabtest3          - display input test file
 ===============          - note tab expansion when displayed

 uvhd tf/tabtest3 t       - use hexdump utility to see tabs x'09'
 ==================       - option 't' for Text files (respect LineFeeds)

 cat tmp/tabtest3         - display output test file
 ================         - note tabs converted to blanks

 uvhd tf/tabtest3 th2     - use hexdump to verify blanks x'20'
 ====================     - option 't' for Text files (respect LineFeeds)
                          - option 'h2' to force hex display

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

E3a. tabfix3 - convert tabs to blanks depending on multiple fixed tab stops

tf/tabtest3 - demo file for tabfix3

# tabtest3 - test file for tabfix3 #-->line below delimited by commas x'2C' a,bb,ccc,dddd,eeeee,ffffff,ggggggg a bb ccc dddd eeeee ffffff ggggggg #<--line above delimited by tabs x'09' # tabfix3 tab-rack for COBOL (cols 7,10,20,30,40,50,60,73)

tf/tabtest3 - displayed by 'uvhd'


 uvhd tf/tabtest2 t  <-- use uvhd to see 'tab's x'09' below
 ==================    - option 't' for 'text' file (respect LineFeeds)
                       - only showing line 4 of tf/tabtest2 (listed above)
                      10        20        30        40        50        60
 r#        4 0123456789012345678901234567890123456789012345678901234567890123
         115 a.bb.ccc.dddd.eeeee.ffffff.ggggggg.
             60660666066660666660666666066666660
             1922933394444955555966666697777777A

tabfix3 OUTPUT - tmp/tabtest3

 # tabtest3 - test file for tabfix3
 #-->line below delimited by commas x'2C'
 a,bb,ccc,dddd,eeeee,ffffff,ggggggg
 a     bb   ccc     dddd      eeeee     ffffff    ggggggg
 #<--line above delimited by tabs x'09'
 # tabfix3 tab-rack for COBOL (cols 7,10,20,30,40,50,60,73)

tabfix3 OUTPUT - displayed by 'uvhd'


 uvhd tf/tabtest2 t  <-- use uvhd to see 'tab's x'09' below
 ==================    - option 't' for 'text' file (respect LineFeeds)
                       - only showing line 4 of tf/tabtest2 (listed above)
                      10        20        30        40        50        60
 r#        4 0123456789012345678901234567890123456789012345678901234567890123
         111 a     bb   ccc     dddd      eeeee     ffffff    ggggggg.
             622222662226662222266662222226666622222666666222266666660
             10000022000333000004444000000555550000066666600007777777A
note
  • you can see the tabs have been expanded to blanks for COBOL source
    default options: c7b12c20d30e40f50g60h73
    (cols 7, 12, 20, 30, 40, 50 ,60, 73)

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

F1. Pre-programmed uvcopy jobs to Demo & Customize

uvenv - capture, sort,& display environmental variables


 uvcopy uvenv     <-- execute uvcopy & prmfile uvenv
 ============         (no arguments required)
 uvenv - display UNIX environment variables=values (SORTED)
 demo powerful table handling instructions:
      evt - read environmental variables into a table
      srt - sort table in memory
      wtb - write table to a file
 080206:173823:uvenv: uvcopy ver=20080115 pf=/home/uvadm/pf/util/uvenv
 uvcopy DISAM ext=dat LNX L64 LF64 license=20080115V site=UV Software
 080206:173823:uvenv: EOF filo01 wrts=67 size=2588: tmp/uvenv
 EOJ, Output File written to: tmp/uvenv
 enter command: vi,cat,more,lp,uvlp12,null --> cat <-- display output

sample output

DBKEY=100 ENV=/u/uvadm/.kshrc FPATH=/u/uvadm/sfun HISTSIZE=500 HOME=/u/uv HUSHLOGIN=FALSE HZ=100 LOGDIR=/u/uvadm/uvu LOGNAME=uvu MAIL=/usr/spool/mail/uvu PATH=/bin:/usr/bin:.:./bin:./sf:./jcl1:/u/uvadm/bin:/u/uvadm/sf:/uvsave/bin:/u/dms/dmcs PF=/u/uvadm/pf PS1=/u/uv\> PWD=/u/uvadm SHELL=/bin/ksh TERM=ansi TZ=PST8PDT VISUAL=vi _=./bin/uvcopy

Notes

  1. sample output above was reduced from 67 lines to 20 lines

  2. see 'uvenv' listed on the next page

  3. You can do the same with unix tools (env | sort), but this is a good uvcopy test/demo job since it requires no input files & demonstrates powerful table handling instructions (evt, srt,& wtb).

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

F2. uvenv - capture, sort,& display environmental variables

uvenv - uvcopy job listing

 # uvenv  - display UNIX environment variables = values (SORTED)
 opr='$jobname - display UNIX environment variables=values (SORTED)'
 opr='demo powerful table handling instructions:'
 opr='evt - read environmental variables into a table'
 opr='srt - sort table in memory'
 opr='wtb - write table to a file'
 rop=r1  #run option prompt EOJ for report disposition (vi,cat,more,etc)
 was=a100000     # allow 200 entries of 500 bytes each = 10,000 bytes
 filo1=tmp/uvenv,rcs=512,typ=LSTt    # writes to a file for user use ?
 @run
       opn     filo1
       evtt2   a0(500),200            table all env-vars & '~' terminate
       srtb7   a0(500),a0(30),200     sort table
       wtbe    filo1,a0(500),a0(500)  dump table to file
       cls     filo1
       eoj

Notes

  1. 'evt' captures all env-vars into a table in area 'a', allowing 500 bytes per table entry & max 200 entries (total 10,000 bytes). Note area 'a' increased by 'was=a10000' (from default 1024). Option 't2' (of evtt2) marks the end of table with '~' tildes (used by 'srt' to determine EOT).

  2. 'srt' sorts the table entries. Option 'b7' removes any blank entries & marks the end of the table with tildes (for following 'wtb').

  3. 'wtb' writes the table out to filo1=tmp/uvenv. Option 'e' inhibits writing the End of Table tildes entry.

  4. 'rop=r1' (Run OPtion 'r1') causes the prompt for report disposition. See the following line on the previous page - last line of console log (prior to 'sample output').

 enter command: vi,cat,more,lp,uvlp12,null --> cat <-- display output

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

G1. Pre-programmed uvcopy jobs to Demo & Customize

testint2 - illustrate binary integers

'testint2' illustrates binary integers by initializing a counter to 1, and then entering a loop to double the number & display the result for 66 iterations.


 uvcopy testint2       <-- execute binary integer generator demo
 ===============

testint2 - test conversion from decimal to binary & back uop=c66 - default options c66 - number of cycles (64 bit limit, 19 digits)

 User OPtion (uop) defaults  = q1c66
  null to accept or re-specify (1 or more) ----->    <-- accept 66 loop default
 tmp/testint2 = default filo01 OK/reenter -->        <-- accept outfile default
 080207:072728:testint2: EOF filo01 wrts=67 size=4073: tmp/testint2

Notes

  1. See output report on the next page 'G2' -->

  2. The 'hex native' binary will be left adjusted for INTEL (little-end) machines and right adjusted for RISC (BIG-END) machines (AIX,HP,SUN).

  3. Note the '32 bit limit' at cycle# 32: 2,147,483,648 (2 GIG).

 32  00000000002147483648  0000008000000000  0000000080000000 <-- 32 bit limit

This is theinteger limit for 32 bit hardware, but the C compilers on most 32 bit machines provide 64 bit arithmetic via 'long long' integer types (software compensating for 32 bit limited hardware).

  1. Note the '64 bit limit' at cycle# 63: 04,611,686,018,427,387,904

 63  04611686018427387904  0000000000000040  4000000000000000 <-- 64 bit limit
 64  =922337203685477580x  0000000000000080  8000000000000000 <-- negative

Line 64 is a negative number because the high bit is set x'...80' if Intel, and x'80...' if RISC (AIX,HP,SUN)

  1. See the 'testint2' uvcopy coding 2 pages ahead 'G3' -->

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

G2. testint2 - illustrate binary integers

testint2 - output report

 # Date=20080207, Machine=LNX, Bits=LL64
 cycle      decimal-value  hex native        hex swapped
 01  00000000000000000001  0100000000000000  0000000000000001
 02  00000000000000000002  0200000000000000  0000000000000002
 03  00000000000000000004  0400000000000000  0000000000000004
 04  00000000000000000008  0800000000000000  0000000000000008
 05  00000000000000000016  1000000000000000  0000000000000010
 06  00000000000000000032  2000000000000000  0000000000000020
 07  00000000000000000064  4000000000000000  0000000000000040
 08  00000000000000000128  8000000000000000  0000000000000080
 09  00000000000000000256  0001000000000000  0000000000000100
 10  00000000000000000512  0002000000000000  0000000000000200
 11  00000000000000001024  0004000000000000  0000000000000400
 12  00000000000000002048  0008000000000000  0000000000000800
 13  00000000000000004096  0010000000000000  0000000000001000
 14  00000000000000008192  0020000000000000  0000000000002000
 15  00000000000000016384  0040000000000000  0000000000004000
 16  00000000000000032768  0080000000000000  0000000000008000
 17  00000000000000065536  0000010000000000  0000000000010000
 18  00000000000000131072  0000020000000000  0000000000020000
 19  00000000000000262144  0000040000000000  0000000000040000
 20  00000000000000524288  0000080000000000  0000000000080000
 21  00000000000001048576  0000100000000000  0000000000100000
 22  00000000000002097152  0000200000000000  0000000000200000
 23  00000000000004194304  0000400000000000  0000000000400000
 24  00000000000008388608  0000800000000000  0000000000800000
 25  00000000000016777216  0000000100000000  0000000001000000
 26  00000000000033554432  0000000200000000  0000000002000000
 27  00000000000067108864  0000000400000000  0000000004000000
 28  00000000000134217728  0000000800000000  0000000008000000
 29  00000000000268435456  0000001000000000  0000000010000000
 30  00000000000536870912  0000002000000000  0000000020000000
 31  00000000001073741824  0000004000000000  0000000040000000
 32  00000000002147483648  0000008000000000  0000000080000000 <-- 32 bit limit
 33  00000000004294967296  0000000001000000  0000000100000000
 34  00000000008589934592  0000000002000000  0000000200000000
 35  00000000017179869184  0000000004000000  0000000400000000
 36  00000000034359738368  0000000008000000  0000000800000000
                   - - - - 26 lines omitted - - - -
 61  01152921504606846976  0000000000000010  1000000000000000
 62  02305843009213693952  0000000000000020  2000000000000000
 63  04611686018427387904  0000000000000040  4000000000000000 <-- 64 bit limit
 64  =922337203685477580x  0000000000000080  8000000000000000 <-- negative
 65  00000000000000000000  0000000000000000  0000000000000000
Note
  • line 64 is a negative number because the high bit is set
  • x'...80' if Intel & x'80...' if RISC (AIX,HP,SUN)

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

G3. testint2 - illustrate binary integers

testint2 - uvcopy job

 # testint2 - uvcopy Parameter File from UVSI stored in: /home/uvadm/pf/adm
 # testint2 - test conversion from decimal to binary & back
 #          - 2,147,483,648 limit for 32 bits, huge for 64 bits
 #
 # uvcopy testint2,fili1=tf/intdata1,filo1=tmp/intdata1
 # ====================================================
 # uvcopy testint2          <-- same as above, files default as shown above
 # ===============
 # uvlp12 tmp/intdata2      <-- print output at 12cpi to fit 8 1/2" paper
 # ===================
 #
 # Note - output display will be different depending on machine architecture
 # BigEndMachines = HP, SUN, AIX
 # LittleEndMachines = INTEL, LINUX, DEC-ALPHA, DWIN, CWIN, UWIN, SFU
 opr='$jobname - test conversion from decimal to binary & back'
 opr='uop=c66 - default options'
 opr='    c66 - number of cycles (64 bit limit, 19 digits)'
 uop=q1c66      # default options
 rop=r1x2       # r1 = prompt for report disposition, x2 = default 'more'
 filo1=?tmp/$jobname,rcs=128,typ=LSTt
 @run
        opn    all
        mvfv3  b0(80),'# Date=$date, Machine=$machine, Bits=$longbits'
        putb   filo1,b0(80)        write info to 1st line of report
        mvfv3  b0(80),'cycle      decimal-value  hex native        hex swapped'
        putb   filo1,b0(80)        write info to 1st line of report
        mvn    $ca1,1              init accumulator
        mvn    $ca3,1              init counter for cycles option limit test
 #
 # begin loop to convert, print, double,& repeat
 man20  clr    b0(80),' '          clear output area
        mvn    b0(2),$ca3          cycle#
        mvn    b4(20),$ca1         decimal value in 20 bytes
        hxc    b26(16),$ca1        convert to hex display
        mvn    c0(8bs),$ca1        swap BigEnd/LittleEnd
        hxc    b44(16),c0(8)       convert to hex display
        cmn    $ca1,2147483648     32 bit limit ?
        skp!   1
        mvf    b61(20),'32 bit limit'
        put    filo1,b0            write output
        mpy    $ca1,2              double for next cycle
        add    $ca3,1              count cycles
        cmn    $ca3,$uopbc         test cycles limit ?
        skp<   man20
 #
 eof    cls    all
        eoj
 # rop=r1x2, r1 = prompt for report disposition, x2 = default 'more'

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

H1. Pre-programmed uvcopy jobs to Demo & Customize

enterKBD2 - enter keyboard data into a file

This job can be used to enter keyboard data into a file, that would not be allowed by the editor or by the shell. For example, if you wanted to see what values were generated by the various keys on your keyboard, you could use this job to enter them & then use the 'uvhd' hexdump utility to display the file.


 uvcopy enterKBD2        <-- execute uvcopy & prmfile 'enterKBD2'
 ================
 option defaults: uop=f0  fixed length off (variable lth LF terminated)
 option example: uop=f64 fixed length 64 bytes with LF in last byte
 uop defaults (repeats override originals) = q1f0
 null to accept or re-specify (1 or more) --> f64 <-- fixed lth output
                                                      for uvhd display
 tmp/enterKBD2 = default filo1 - null accept -->   <-- accept default filename
 enter data or "quit" --> ............  <-- enter the 12 function keys
                                          - illustrating '.'s, display varies
 enter data or "quit" --> ....          <-- direction keys (up,down,left,right)
 enter data or "quit" --> .....         <-- insert,delete,home,end,pgup,pgdn
 enter data or "quit" --> 123.,123.,    <-- 123backspace,123control-H,
                                          - see NOTEs on next page
 enter data or "quit" --> quit          <-- to end job

EOF filo1 0 rds, 3 wrts, 0 hits, 192 size, fname=tmp/enterKBD2


 uvhd tmp/enterKBD2        <-- execute uvhd to display the output file
 ==================

test/demo output

                      10        20        30        40        50        60
 r#        1 0123456789012345678901234567890123456789012345678901234567890123
           0 .[[A.[[B.[[C.[[D.[[E.[17~.[18~.[19~.[20~.[21~.[23~.[24~        .
             1554155415541554155415337153371533715337153371533715337222222220
             BBB1BBB2BBB3BBB4BBB5BB17EBB18EBB19EBB20EBB21EBB23EBB24E00000000A
          64 .[A.[B.[D.[C                                                   .
             1541541541542222222222222222222222222222222222222222222222222220
             BB1BB2BB4BB3000000000000000000000000000000000000000000000000000A
         128 .[2~.[3~.[1~.[4~.[5~.[6~                                       .
             1537153715371537153715372222222222222222222222222222222222222220
             BB2EBB3EBB1EBB4EBB5EBB6E000000000000000000000000000000000000000A
         192 12,123.,                                                       .
             3323330222222222222222222222222222222222222222222222222222222220
             12C1238C0000000000000000000000000000000000000000000000000000000A
Note
  • see next page investigation of stty erase char (backspace or control-H)

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

H2. enterKBD2 - enter keyboard data into a file

using enterKBD2 to investigate stty erase char

The 'erase/correction' key may be set via the 'stty' unix command in the user profile. Here are 2 common definitions:


 #1. stty erase '^?'     <-- '^?' (backspace key) on Red Hat Linux
     ==============        - coded in supplied profiles from UV Software

 #2. stty erase '^H'     <-- '^H' is the traditional unix backspace character.
     ==============        - control-H (the '^' carat is coded for stty command)

In Feb 2008, I had an email from a customer saying that the 'typo correction' was not working when entering search commands to uvhd. So I used 'enterKBD2' to investigate as follows:


 #1a. stty erase '^?'     <-- ensure initial 'erase' char is '^?' (backspace key)
      ===============

 #1b. uvcopy enterKBD2    <-- run enterKBD2 (use option 'f64' as on prior page)
      ================
      --> 123backspace,123^H,
      --> quit

 #1c. uvhd tmp/enterKBD2   <-- investigate output
      ==================
                      10        20        30        40        50        60
 r#        1 0123456789012345678901234567890123456789012345678901234567890123
           0 12,123.,                                                       .
             3323330222222222222222222222222222222222222222222222222222222220
             12C1238C0000000000000000000000000000000000000000000000000000000A
Note
  • the 'backspace' key did erase the '3'
  • the '^H' was entered resulting in x'08'

Re-Run with erase control-H (vs backspace)


 #2a. stty erase '^H'     <-- change 'erase' char to '^H' (control-H)
      ===============

 #2b. uvcopy enterKBD2    <-- run enterKBD2 (use option 'f64' as on prior page)
      ================
      --> 123backspace,123^H,
      --> quit

 #2c. uvhd tmp/enterKBD2   <-- investigate output
      ==================
                      10        20        30        40        50        60
 r#        1 0123456789012345678901234567890123456789012345678901234567890123
           0 123.,12,                                                       .
             3337233222222222222222222222222222222222222222222222222222222220
             123FC12C0000000000000000000000000000000000000000000000000000000A
Note
  • now the 'backspace key' was entered x'7F' above
  • and the '^H' was effective (erasing the '3' of the 2nd set 123)

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

H3. enterKBD2 - enter keyboard data into a file

echo & '>' alternative to enterKBD2 ?

'enterKBD2' is a convenient way to enter data in 64 byte lines for aesthetic display via subsequent 'uvhd' which shows the hex values of all bytes including invisible characters such as escapes (x'1B').

You might think you could enter the data with unix 'echo', redirect '>' to a file, and then display the file with 'uvhd'. BUT this does NOT work because the shell interprets many characters entered from the keyboard.

The 1st 3 lines entered on page 'H1' (function keys, arrow keys, ins/del/etc do not work. Let us try echo & '>' for the BackSpace & control-H erase keys:


 #1. echo '123BS,123^H' >tmp/erasekeys  <-- BS=BackSpace, ^H=control-H
     =================================

 #2. uvhd tmp/erasekeys         <-- display output file with uvhd
     ==================
                      10        20        30        40        50        60
 r#        1 0123456789012345678901234567890123456789012345678901234567890123
           0 12,12.

Please compare the 'echo & >' result with the 'enterKBD2' result on the previous page & note the following:

  1. When entering data from the shell, BOTH BackSpace & control-H keys are effective as erase characters.

  2. When entering data via uvcopy enterKBD2, ONLY the BackSpace key is effective (whatever key is defined by 'stty erase ...' as shown on the previous page).

  3. These tests were performed on Red Hat Linux. Results may be different on other Unix operating systems (AIX, HP, SUN, etc), and your current setting of the erase key via 'stty erase ...'.

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

H4. enterKBD2 - enter keyboard data into a file

enterKBD2 - uvcopy code listing

 # enterKBD2 - uvcopy Parameter File from UVSI stored in: /home/uvadm/pf/util/
 # enterKBD2 - enter KeyBoard Data into 64 byte Fixed-Length records
 #           - for subsequent investigation by 'uvhd' to see keyboard codes
 #             for characters not shown by shell or editors
 #           - see other versions of this job as follows:
 #
 # enterKBD1 (alternate) - output records Variable-lth with LineFeed terminators
 #*enterKBD2 (this job) - output records Fixed-lth 64 bytes (LF in last byte)
 # enterHEX1 - also see 'enterHEX1' which accepts HEX representation entry
 #
 # uvcopy enterKBD2,filo1=tmp/enterKBD2
 # ====================================
 # - will prompt for input until 'quit' is entered in 1st 4 bytes
 #
 opr='$jobname - enter KeyBoard Data to 64 byte Fixed-Lth records for later uvhd'
 filo1=?tmp/$jobname,rcs=64,typ=RST  # typ=RST puts LF in last byte
 @run
         opn    filo1                   open output file
 #
 # begin loop to prompt for data until 'quit' entered in 1st 4 bytes
 loop    msgw   'enter data or "quit" '
         mvc    b0(100),$reply          move max reply to area 'b'
         cmc    b0(4),'quit'            quit ?
         skp=   eoj
         put    filo1,b0(64)            output the data
         skp    loop                    repeat loop until quit entered
 #
 # end of job
 eoj     cls    all
         msgv1w 'enter to execute uvhd to display output file $filo1'
         sysv1  'uvhd $filo1'
         eoj

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

I1. Pre-programmed uvcopy jobs to Demo & Customize

enterHEX1 - convert pseudo hex codes to real hex data

This job will help you prepare files that require hexadecimal values that are not easily entered with the editor.

First use the editor to prepare a file using x'____' to identify the hex code strings. '____' hex digits may be any of '0123456789ABCDEF', & up to 200 bytes long, which would create 100 bytes of output.

'enterHEX1' will copy your edited file to a 2nd file while converting the pseudo codes to real hex values. You can demo this job using the test file supplied (tf/enterHEX1.dat)

demo operating instructions


 1. uvcopy enterHEX1,fili1=tf/enterHEX1.dat,filo1=enterHEX1
    ======================================================
                         - copy test file converting pseudo hex codes

 2. cat tf/enterHEX1.dat   - display the input file
    ====================
 # enterHEX1.dat - test uvcopy job 'enterHEX1' cnvrt hex pseudo codes to real hex
 #
 test#01: x"0123456789ABCDEF" --->x'0123456789ABCDEF'<---
 test#02: x"019991231F"x"020000101F"--->x'019991231F'x'020000101F'<---
 #
 #note - double quotes for illustration on left side
 #     - single quotes cause conversion on right hand side

 3. uvhd tmp/enterHEX1    - display the output file
    ==================      (using 'uvhd' to see the hex code conversions)
 r#       1           1         2         3         4         5         6
 b#       0 0123456789012345678901234567890123456789012345678901234567890123
          0 # enterHEX1.dat - test uvcopy job 'enterHEX1' cnvrt hex codes to
            2266766732667222767727766772666226676673226677726672776766266667
            303E68581E4140D045340563F090AF2073E68581703E6240858003554F03F453
         64  to real hex.#.test#01: x"0123456789ABCDEF" --->.#Eg....<---.tes
            27627666266702076772333272333333333344444422222302468ACE32220767
            04F0251C0858A3A4534301A082012345678912345620DDDE13579BDFCDDDA453
        128 t#02: x"019991231F"x"020000101"--->...#......<---
            7233327233333333342723333333332222309921000113222
            4302A08201999123162820200001012DDDE1913F2000FCDDD

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

J1. Pre-programmed uvcopy jobs to Demo & Customize

hexcalc1 - convert hex to decimal & decimal to hex

There are 2 versions, hexcalc1 for Intel machines,& hexcalc2 for RISC.


 uvcopy hexcalc1       <-- run hexcalc1 for Intel (use hexcalc2 for RISC)
 ===============

hexcalc1:990907:123531: uvcopy 9909 DISAM SCO pf=/u/uv/uvadm/pf/hexcalc1 copyright UV Software Inc. license# 19990906V UV Software Inc. hexcalc1 for Intel machines, use hexcalc2 for RISC machines

 decimal->hex,hex->decimal,ex: d4096->x1000, x1000->d4096
 enter # with prefix "d" decimal, "x" hex rep, "q" quit
 entry-----> d4096
 response--> decimal 000004096 = 00001000 in hex representation
 decimal->hex,hex->decimal,ex: d4096->x1000, x1000->d4096
 enter # with prefix "d" decimal, "x" hex rep, "q" quit
 entry-----> x1000
 response--> hex representation 00001000 = 000004096 in decimal
 decimal->hex,hex->decimal,ex: d4096->x1000, x1000->d4096
 enter # with prefix "d" decimal, "x" hex rep, "q" quit
 entry-----> q

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

J2. hexcalc1 - convert hex to decimal & decimal to hex

hexcalc1 - uvcopy job listing

 # hexcalc1 - uvcopy Parameter File from UVSI stored in: /home/uvadm/pf/util/
 # hexcalc1 - hexadecimal calculator, hex to decimal, or decimal to hex
 #          - hexcalc1 for Intel machines, use hexcalc2 for RISC machines
 #
 @run
        msg     'hexcalc1 for Intel machines, use hexcalc2 for RISC machines'
 # begin loop to solicit numbers for conversion
 man20  nop
        msg     'decimal->hex,hex->decimal,ex: d4096->x1000, x1000->d4096'
        msgwa1  'enter # with prefix "d" decimal, "x" hex rep, "q" quit'
        mvc     d0(80),$arg1          store entry & blank extra w/s
        mvc     d20(10),d1            drop prefix
        sqzr    d20(10),' '           right justify
        rep     d20(10),' ','0'       left zero fill
        cmc     d0(1),'d'             dcml to hex ?
        skp=    dtox
        cmc     d0(1),'x'             hex to dcml ?
        skp=    xtod
        cmc     d0(1),'q'             quit ?
        skp=    quit
        msg     'invalid entry, 1st char not "d" or "x"'
        skp     man20
 #
 # convert decimal to hex
 dtox   mvn     d40(4bs),d20(10)      cnvrt dcml to binary (switch Intel)
        hxc     d50(8),d40(4b)        cnvrt binary to hex rep
        mvf     d100(60),'decimal ddd = xxx in hex representation'
        repf    d100(60),'ddd',d20(10)
        repf    d100(60),'xxx',d50(8)
        msg     d100(60)             display result
        msg     ' '                  space between repeat calcs
        skp     man20
 #
 # convert hex to decimal
 xtod   chx     d30(4),d22(8)        cnvrt hex to binary
        mvn     d40(10),d30(4bs)      cnvrt binary to decimal (switch Intel)
        mvf     d200(60),'hex representation xxx = ddd in decimal'
        repf    d200(60),'xxx',d22(8)
        repf    d200(60),'ddd',d40(10)
        msg     d200(60)             display result
        msg     ' '                  space between repeat calcs
        skp     man20
 #
 quit   eoj

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

K1. Pre-programmed uvcopy jobs to Demo & Customize

datedemo1 - convert between calendar, julian,& days-since-1900

Datedemo1 is an interactive demo job to convert dates between 3 formats. (also allows add/subtract to/from days-since-1900)

  1. calendar ccyymmdd - cc will default to system date century
  2. Julian ccyyjjj - cc will default to system date century
  3. days since 1900 nnnnn - number of days since 1900

    operating instructions


 uvcopy datedemo1        - initiate interactive date conversion
 ================          (sample inputs & outputs below)
 TODAY"s date:       calendar  julian  days1900      alpha-date
 19960624            19960624  1996176   0035239   1 Mon Jun 24 1996
 ===================================================================
 c=calendar,j=julian,d=days-since-1900,+/-=add/sub to days, q=quit
 examples: c19991231,j1999365,d36524,+180,-90;
                                              enter format --> c20000101 <--

 c20000101           20000101  2000001   0036525   6 Sat Jan 01 2000
 ===================================================================
 c=calendar,j=julian,d=days-since-1900,+/-=add/sub to days, q=quit
 examples: c19991231,j1999365,d36524,+180,-90;
                                              enter format --> +180 <--

 +180                20000629  2000181   0036705   4 Thu Jun 29 2000
 ===================================================================
 c=calendar,j=julian,d=days-since-1900,+/-=add/sub to days, q=quit
 examples: c19991231,j1999365,d36524,+180,-90;
                                              enter format --> q    <--
 1 - See the 'dat' uvcopy instruction documented at uvcopy.htm.
   - You could write a uvcopy job (using the 'dat' instruction) if you
     wanted to manipulate date fields within data files.
   - You could convert formats or calculate new dates by adding or
     subtracting a number of days from existing dates.

2 - Also see DATEjobs.doc , which discusses the 'year 2000' date problem. This section documents methods of scanning for potential problems & suggests some possible solutions.

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

L1. calendar1 - create calendar from any start date to any end date

calendar1 - operating instructions

'calendar1' requires no input file & writes its output to tmp/calendar1


 uvcopy calendar1,filo1=tmp/calendar1
 ====================================

 uvcopy calendar1    <-- same as above, files default as shown
 ================
 uop=q1b19991201e19991231 - option defaults
       b19991201          - begin date default
                e19991231 -  end  date default
 User OPtion (uop) defaults  = q1b19991201e19991231
  null to accept or re-specify (1 or more) -->       <-- accept dflts
 EOF filo1 0 rds, 367 wrts, 0 hits, 17570 size, fname=tmp/calendar1
 display/edit/print/none ? (enter: more/vi/uvlp/null)
                                           --> more  <-- to display result
           ** sample output report **

calendar, julian, days-since-1900, alpha-date

 20081001  2008275   039721    3 Wed Oct 01 2008
 20081002  2008276   039722    4 Thu Oct 02 2008
 20081003  2008277   039723    5 Fri Oct 03 2008
 20081004  2008278   039724    6 Sat Oct 04 2008
 20081005  2008279   039725    0 Sun Oct 05 2008
 20081006  2008280   039726    1 Mon Oct 06 2008
 20081007  2008281   039727    2 Tue Oct 07 2008
 20081008  2008282   039728    3 Wed Oct 08 2008
 20081009  2008283   039729    4 Thu Oct 09 2008
 20081010  2008284   039730    5 Fri Oct 10 2008
 20081011  2008285   039731    6 Sat Oct 11 2008
 20081012  2008286   039732    0 Sun Oct 12 2008
 20081013  2008287   039733    1 Mon Oct 13 2008
 20081014  2008288   039734    2 Tue Oct 14 2008
 20081015  2008289   039735    3 Wed Oct 15 2008
 20081016  2008290   039736    4 Thu Oct 16 2008
 20081017  2008291   039737    5 Fri Oct 17 2008
 20081018  2008292   039738    6 Sat Oct 18 2008
 20081019  2008293   039739    0 Sun Oct 19 2008
 20081020  2008294   039740    1 Mon Oct 20 2008
 20081021  2008295   039741    2 Tue Oct 21 2008
 20081022  2008296   039742    3 Wed Oct 22 2008
 20081023  2008297   039743    4 Thu Oct 23 2008
 20081024  2008298   039744    5 Fri Oct 24 2008
 20081025  2008299   039745    6 Sat Oct 25 2008
 20081026  2008300   039746    0 Sun Oct 26 2008
 20081027  2008301   039747    1 Mon Oct 27 2008
 20081028  2008302   039748    2 Tue Oct 28 2008
 20081029  2008303   039749    3 Wed Oct 29 2008
 20081030  2008304   039750    4 Thu Oct 30 2008
 20081031  2008305   039751    5 Fri Oct 31 2008

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

L2. calendar1 - create calendar from any start date to any end date

calendar1 - print calendar from spcfd start & end dates

 # calendar1 - print a calendar from any start date to any end date (yyyymmdd)
 #           - by Owen Townsend, UV Software, orig 1999, updated 2008
 #
 # uvcopy calendar1   <-- defaults to printing calendar for current month
 # ================
 #
 # uvcopy calendar1,uop=b20081201e20081231  (options b/e = begin/end)
 # =======================================
 #
 #output:  calendar, julian, days-since-1900, alpha-date
 # 20081201  2008336   039782    1 Mon Dec 01 2008
 #                   --------- etc ---------
 # 20081231  2008366   039812    3 Wed Dec 31 2008
 #
 opr='$jobname - print a calendar from any start date to any end date (yyyymmdd)'
 opr='uop=bYYYYMM01eYYYYMM31 - defaults to current month'
 opr='    b20081201          - begin default (if run anytime in Dec 2008)'
 opr='             e20081231 -  end  default (if run anytime in Dec 2008)'
 uop=q1b00000000e00000000    # options for begin/end default to current month
 rop=r1x2  # r1=EOJ prompt report disposition(vi,more,etc), x2=more(default)
 filo1=tmp/$jobname.tmp,rcs=80,typ=LSTt
 @run
 # default begin/end dates to current month if options not spcfd
        mvc     d10(8),$date            store current yyyymmdd for begin
        mvc     d20(8),$date            store current yyyymmdd for end
        mvc     d16(2),'01'             default begin day to 01
        mvc     d26(2),'31'             default  end  day to 31
        datcn   $ca1,d10(8)             cnvt current yyyymm01 to begin day#
        datcn   $ca2,d20(8)             cnvt current yyyymm31 to end day#
        cmn     $uopbb,0                begin date spcfd ?
        skp=    man10
        datcn   $ca1,$uopbb             cnvt users begin date to begin day#
        datcn   $ca2,$uopbe             cnvt users  end  date to  end  day#
 #
 # create headings in output report file
 man10  opn     filo1
        put     filo1,'Calendar, Julian,   DaysSince1900,  Alpha-date'
        put     filo1,'==============================================='
 #
 # begin loop to create calendar lines until end date reached
 man20  datnc   b00(8),$ca1             cnvt to calendar
        datnj   b10(7),$ca1             cnvt to julian
        mvn     b20(6),$ca1             show days since 1900
        mvc     b30(17),$adate          also show alphadate byproduct
        put     filo1,b0(80)            write to output file
        add     $ca1,1                  increment day ctr
        cmn     $ca1,$ca2               reached stop day# ?
        skp<=   man20
 #
 # end date reached - close output file
 # - prompt for report disposition (caused by 'rop=r1' option above)
        cls     all
        eoj

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

M1. Pre-programmed uvcopy jobs to Demo & Customize

dirlist1 - list files in physical sequence & total bytes used

The 'ls' command has no option to list files in physical sequence & sometimes this is nice to know because many other commands process the files in physical directory sequence (such as tar, cpio, etc). This job also accumulates the total bytes used & displays this total at the end of the directory.


 uvcopy dirlist1            <-- execute uvcopy dirlist1 with no directory spcfd
 ===============              - will solicit the directory to be read

 uvcopy dirlist1,fild1=src  <-- OR may specify directory on command line
 =========================    - uvadm/src for demo because only a few lines

test/demo sample report

 uvcopy 2.21 19950911 DISAM SCO  today=19950914174413 pf=./pf/dirlist1
 copyright UV Software Inc. license# 19950911u UV Software Inc.
                               dir# 001 .
                               dir# 002 ..
 0001     6,348  cbal.c
 0002   232,007  jclunix.c
 0003    50,329  jprocx.c
 0004   481,833  uvcopy.c
 0005   159,822  uvcp.c
 0006    22,448  uvcsrun.c
 0007    27,913  uvhd.c
 0008    21,544  uvlist.c
 0009   172,190  uvsort.c
 0010    24,522  uvupsi.c
 0010  1230,766  ---------- directory totals ----------
 EOF fild1 15 rds, 0 wrts, 0 hits, 256 size, fname=src

---> try this job on 1 of your own directories


        uvcopy dirlist1,fild1=yourdirectory
        ===================================

See 'dirlist1' listed on the next page --->

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

M2. Pre-programmed uvcopy jobs to Demo & Customize

dirlist1 - list directory in physical sequence

 # dirlist1 - uvcopy Parameter File from UVSI stored in: /home/uvadm/pf/util/
 # dirlist1 - list a directory in the physical sequence of the filename entries
 #          - 4 versions of dirlist job
 # dirlist1 (this job) - writes filenames into an output file (then cat/more/vi)
 # dirlist2 - lists filenames in hexadecimal
 # dirlist3 - displays filenames on screen & pauses every 20 lines
 # dirlist4 - writes filenames into an output file (same as dirlist1 ??)
 #
 # - used to test directory access in uvcopy mar93
 #   ('ls' has no option to list in physical sequence)
 # - 'get fild1,a0' below returns the next filename in op2 area 'a'
 # - get sets condition code '<' if subdir vs ordinary file
 # - actual readdir/dirent structure (within uvcopy) as follows:
 # - stored in work area at x5100(100)
 #      000-001 - inode#
 #      002-003 - unused
 #      004-007 - offset within disk directory block
 #      008-009 - record length
 #      010-265 - filename
 #
 # - input dirname is solicited (caused by leading '?' on fild1=?xxx below)
 # - output is written to a tmp file & disposition is solicited at EOJ
 #   (caused by option rop=r1, may reply: cat, more, vi, uvlp12, etc
 #
 opr='$jobname - list filenames in directory (trailing / indicates subdir)'
 opr=' - to test system independent directory access July 93'
 rop=r1  #run option to prompt at EOJ for report disposition (vi,cat,more,etc)
 fild1=?xxx,typ=DIR,rcs=80    # '?' solicits dirname if not on command line
 filo1=tmp/$jobname,typ=LSTt,rcs=80
 @run
       opn   all
 loop  get   fild1,a0(80)             get each record into area 'a'
       skp>  eof                      cc set > if EOF
       skp=  1                        cc set > if subdir vs file
       cat   a0(80),'/'               concatenate a '/' to indicate subdir
       putb  filo1,a0(80)             write output to temp file
       skp   loop
 # end of file - close files & query oprtr for display/edit/print ?
 eof   cls   all
       eoj

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

N1. spread1 - convert a file of 1 item/line to multi items/line

Convert a file of 1 item per line to multiple items per line, with options for: items/line, cols/item, space between items,& left margin offsets for input & output files.

demo
  • convert output of 'ls' command (1 item per line) to 5 items/line,
    allowing 14 cols/item,& 1 space between.
  • some systems do not allow 'ls -x' to be printed
  • this demo will use the uvadm/sf (script files) as the input directory.

spread1 - operating instructions

  1. mkdir tmp - make directory for temporary files
  2. ls sf >tmp/sf1 - create file of 1 item/line
  3. uvcopy spread1,fili1=tmp/sf1,filo1=tmp/sf - execute spread1 =========================================
 uop = q1a0b0c14s1n5m0 - option defaults
         a0            - input offset columns to item
           b0          - output offset columns to 1st item
             c14       - columns per item
                s1     - spaces between items
                  n5   - number of items per line
 User OPtion (uop) defaults  = q1a0b0c14s1n5
  null to accept or re-specify (1 or more) -->         <-- accept defaults
                                           --> c15s1n4 <-- try other options
 EOF fili1 122 rds, 0 wrts, 0 hits, 912 size, fname=tmp/sf1
 EOF filo1 0 rds, 28 wrts, 0 hits, 1648 size, fname=tmp/sf5
 display/edit/print/none ? (enter: more/vi/uvlp/uvlp12/null)
                                           --> uvlp    <-- print report
                 ** demo output report **

 spread1: tmp/sf  options=q1a0b0c14s1n5  date=1997/11/29_08:19:49
 ===========================================================================
 allcan1        allcancel      allcmp         allcp          allcpx
 alldiff        allf1          allf2          allmv          allmvx
 allrm          allrmd         amuuz          armdataX       armrpgX
 bakarmA        bakjobA        ccc            ccdebug        ccf
           ------------------------ etc -------------------------
 uvlp20         uvlp8          uvlpd          uvlpd10        uvlpd12
 uvlpd18        uvlpd1p        uvlpx          uvlpx18        uvls1
 uvlsp          uvlspd         uvlspdp        vtocISup       vtocImk1
 vtocImk2       vtocall        weekly1        xrefA          xrefB
 xrefC
 00146 total items in tmp/sf

We do not list the uvcopy job 'spread1' here (only 46 lines of code), but we will list script 'spreadA' which makes the uvcopy job easier to run.

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

N2. spread1 - convert a file of 1 item/line to multi items/line

spreadA - script to call 'spread1' uvcopy job

 #!/bin/ksh
 # spreadA - Korn shell script from UVSI stored in: /home/uvadm/sf/util/
 # spreadA - list directory in multi-columns with options for columns & width
 #
 # - spreadA uses 'ls' to generate a tmp file, input to uvcopy job spread1
 # - uvcopy/spread1 prompts with options for no of columns & column-width
 # - report is created in tmp subdir with headings for dirname & date/time
 # - prompt for report disposition: vi, more, cat, lp, uvlp, etc (or null)
 # - report is left in subdir tmp named the same as the specified directory
 #
 echo "spreadA - list directory in multi-columns, options for columns & width"
 dir="$1"
 if [[ ! -d "$dir" ]]; then
    echo "usage: spreadA directory"
    echo "       ================="
    exit 99; fi
 #
 if [[ ! -d tmp ]]; then mkdir tmp; fi
 ls $dir >tmp/spreadA  # create file of filenames in specified directory
 #
 # create full path name of directory, to show on report (if not already)
 if [[ $dir = /* ]]; then DIR=$dir; else DIR=${PWD}/$dir; fi
 export DIR=$DIR           # export full path dirname for uvcopy job hdngs
 export JOBID=spreadA      # export JOBID (spreadA) for uvcopy job hdngs
 # use basename of directory as uvcopy job output filename in tmp
 dirfile=$(basename $dir)
 #
 uvcopy spread1,fili1=tmp/spreadA,filo1=tmp/${dirfile}.4up
 #========================================================
 exit 0

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

O1. Pre-programmed uvcopy jobs to Demo & Customize

calcGST - calculate GST,PST,NET from Total amount


 uvcopy calcGST          <-- execute uvcopy & calcGST
 ==============

calculate GST,PST,NET from Total amt GST = (total * gst%) / (1 + gst% + pst%)

enter GST%
  • 5 for BC (6 prior to Jan 2008)
    <-- enter 5 (GST% for BC)
enter PST%
  • 7 for BC
    <-- enter 7 (PST% for BC)
 enter total for GST/PST/NET calc (null to end)
 --> 112.00                                       <-- enter total sale amt
             5.00           7.00         100.00
 enter total for GST/PST/NET calc (null to end)
 --> 112,000,000.00                               <-- enter total sale amt
     5,000,000.00   7,000,000.00 100,000,000.00
 enter total for GST/PST/NET calc (null to end)
 -->                                              <-- enter null to end job

See 'calcGST' listed on the next page --->

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

O2. Pre-programmed uvcopy jobs to Demo & Customize

calcGST - calculate GST,PST,NET from Total amount

 # calcGST - calculate GST,PST,NET from Total amount
 #         - by Owen Townsend, UV Software, Feb 2008
 #
 # - I used this to calc the GST credits for tax reporting
 #   from my VISA statements which list only the total sale amounts
 # - Examples below for BC, but you could enter the %s for your jurisdiction
 #   (could also change the descriptions as desired)
 #
 # uvcopy calcGST
 # ==============
 # Initially solicits GST% & PST% (Goods & Services Tax, Provincial Sales Tax)
 # Then repeats loop to solicit total amt to calc GST,PST,NET (end on null entry)
 # - sample calcs for 6% GST & 7% PST
 # GST$ = (Total * gst%) / (1 + gst% + pst%)
 # GST$ = (total * .06) / (1 + .06 + .07)
 # GST$ = (total * .06) / 1.13
 # for Gross 113.00, GST = ((113.00 * .06) / (1.13)) = $6.00
 #                   PST = ((113.00 * .07) / (1.13)) = $7.00
 #
 #                ** demo run with console entries & displays **
 #
 # uvcopy calcGST          <-- execute uvcopy & calcGST
 # ==============
 #
 # calculate GST,PST,NET from Total amt
 # GST = (total * gst%) / (1 + gst% + pst%)
 # enter GST% - 5 for BC (6 prior to Jan 2008)
 # --> 5                                            <-- enter 5 (GST% for BC)
 # enter PST% - 7 for BC
 # --> 7                                            <-- enter 7 (PST% for BC)
 #
 # enter total for GST/PST/NET calc (null to end)
 # --> 112.00                                       <-- enter total sale amt
 #             5.00           7.00         100.00
 #
 # enter total for GST/PST/NET calc (null to end)
 # --> 112,000,000.00                               <-- enter total sale amt
 #     5,000,000.00   7,000,000.00 100,000,000.00
 #
 # enter total for GST/PST/NET calc (null to end)
 # -->                                              <-- enter null to end job
 #

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

 @run
        msg     'calculate GST,PST,NET from Total amt'
        msg     'GST = (total * gst%) / (1 + gst% + pst%)
        msga1wn 'enter GST% - 5 for BC (6 pre Jan 2008, 7 pre Jul 2006)'
        mvn     $ca1,$arg1(2)         store gst%
        msga2wn 'enter PST% - 7 for BC'
        mvn     $ca2,$arg2(2)         store pst%
 #
 # mpy gst% & pst% by 10,000 - extra dcmls for % & divide accuracy
        mvn     $ca3,$ca1             gst%
        mpy     $ca3,10000            * 10,000 for extra decimals
        mvn     $ca4,$ca2             pst%
        mpy     $ca4,10000            * 10,000 for extra decimals
 #
 # combine (1 + gst% + pst%) for later convenience
        mvn     $ca5,$ca1             gst%
        add     $ca5,$ca2             + pst%
        add     $ca5,100              + 100
 #
 # begin loop to solicit total amt, calc GST & net,& display
 loop   msgwa1 'enter total for GST/PST/NET calc (null to end)'
        skp<   eoj                    goto EOJ on null entry
        mvn    $cb1,$arg1(15)         save total entry
 #
 # calc GST
        mvn    $cb2,$cb1              total
        mpy    $cb2,$ca3              * (gst% * 10,000)
        div    $cb2,$ca5              / (100 + gst% + pst%)
        add    $cb2,5000              round up
        div    $cb2,10000             drop gst extra dcmls after rounding
 #
 # calc PST
        mvn    $cb3,$cb1              total
        mpy    $cb3,$ca4              * (pst% * 10,000)
        div    $cb3,$ca5              / (100 + pst% + pst%)
        add    $cb3,5000              round up
        div    $cb3,10000             drop pst extra dcmls after rounding
 #
 # calc NET = Total - GST - PST)
        mvn    $cb4,$cb1              total amt
        sub    $cb4,$cb2              - gst
        sub    $cb4,$cb3              - pst = net
        edt    a0(15),$cb2,'zzz,zzz,zzz.99'    edit gst$ for display
        edt    a15(15),$cb3,'zzz,zzz,zzz.99'   edit pst$ for display
        edt    a30(15),$cb4,'zzz,zzz,zzz.99'   edit net$ for display
        msg    a0(60)                 display gst$ & net$
        skp    loop                   repeat loop until null entry
 #
 eoj    eoj

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

P1. Pre-programmed uvcopy jobs to Demo & Customize

splitline1 - split long lines to multiple smaller segments

This job is useful when you need to document the output of some system command that creates long lines that would be look ugly or be truncated when printing or emailing.

Our demo file below is the output from a compile with verbose options. The 'ld' lines were over 240 bytes long & were TRUNCATED by normal printing. Note that they are split on to 4 lines of < 80 bytes in the output file below. Option 'w1' is used to split segments on the prior word boundary.

demo splitline1


 uvcopy splitline1,fili1=tf/longline1,filo1=tmp/longline1,uop=s80b3w1
 ====================================================================
 uop=q1s80b0w0 - option defaults
       s80     - segment size
          b0   - no blank line between long lines
          b1   - blank line before long lines
          b2   - blank line after  long lines
          b4   - blank line after all lines (double space)
            w0 - fixed segment size
            w1 - segment size on word boundary < segment size
 User OPtion (uop) defaults  = q1s80b0w0
  null to accept or re-specify (1 or more) --> s80b3w1 <-- enter options
 080314:124623:splitline1: EOF fili01 rds=13 size=1146: tf/longline1
 080314:124623:splitline1: EOF filo01 wrts=23 size=1156: tmp/longline1

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

P2. splitline1 - split long lines to multiple smaller segments

test/demo INPUT tf/splitline1

 --> cob -g -xvD src/hello1.c lib/uvlib1.a -obin/hello1
 cob32 -C nolist -g -xvD src/hello1.c lib/uvlib1.a -obin/hello1
 cc -c -m32 -fno-omit-frame-pointer -g src/hello1.c
 Entry points defined in module: hello1.o *main
 ld --eh-frame-hdr -melf_i386 -dynamic-linker /lib/ld-linux.so.2 -o /tmp/cobKc4Py--TRUNCATED-->
 as --32 -o /tmp/cobKc4Pyr/ldtab.o /tmp/cobKc4Pyr/ldtab.s
 ld --eh-frame-hdr -melf_i386 -dynamic-linker /lib/ld-linux.so.2 -o bin/hello1 /u--TRUNCATED-->
Note
  • the 2 'ld' lines above are over 240 bytes long
  • Above, you see only the first 80 bytes
  • Below (after splitline1), you see all data (split to 4 lines < 80 bytes)

test/demo OUTPUT tf/splitline1

--> cob -g -xvD src/hello1.c lib/uvlib1.a -obin/hello1 cob32 -C nolist -g -xvD src/hello1.c lib/uvlib1.a -obin/hello1 cc -c -m32 -fno-omit-frame-pointer -g src/hello1.c Entry points defined in module: hello1.o *main

 ld --eh-frame-hdr -melf_i386 -dynamic-linker /lib/ld-linux.so.2 -o
  /tmp/cobKc4Pyr/a.out -shared hello1.o lib/uvlib1.a -L/opt/microfocus/cobol/lib
  -lcobrts -lcobcrtn -lcobmisc -lcobstat
  -L/usr/lib/gcc/x86_64-redhat-linux/4.1.1/32 -L/lib -L/usr/lib -lgcc -lg
 as --32 -o /tmp/cobKc4Pyr/ldtab.o /tmp/cobKc4Pyr/ldtab.s
 ld --eh-frame-hdr -melf_i386 -dynamic-linker /lib/ld-linux.so.2 -o bin/hello1
  /usr/lib/crt1.o /usr/lib/crti.o
  /usr/lib/gcc/x86_64-redhat-linux/4.1.1/32/crtbegin.o -E hello1.o lib/uvlib1.a
  /tmp/cobKc4Pyr/ldtab.o -L/opt/microfocus/cobol/lib -lcobrts -lcobcrt

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

P2. splitline1 - split long lines to multiple smaller segments

splitline1 - uvcopy job listing

 # splitline1 - split large text records to multiple smaller records
 #            - allows lines up to 8192 bytes, could modify for larger
 #            - option for segment size & for blank lines before/after long lines
 #            - by Owen Townsend, UV Software, March 2008
 #
 # uvcopy splitline1,fili1=tf/longline1,filo1=tmp/longline1,uop=s80b3w1
 # ====================================================================
 #
 opr='$jobname - split large text records to multiple segments'
 opr='uop=q1s80b0w0 - option defaults'
 opr='      s80     - segment size'
 opr='         b0   - no blank line between long lines'
 opr='         b1   - blank line before long lines'
 opr='         b2   - blank line after  long lines'
 opr='         b4   - blank line after all lines (double space)'
 opr='           w0 - fixed segment size'
 opr='           w1 - segment size on word boundary < segment size'
 uop=q1s80b0w0      # option defaults
 was=a8192b8192     # increase size of area a & b from dflt 1024 to 8192
 fili1=?tf/longline1,typ=LST,rcs=8192
 filo1=?tmp/$fili1,typ=LSTt,rcs=256
 @run
        opn    all                 open files
 #
 # begin loop to get input records & split to smaller records
 man20  get    fili1,a0(8192)      get next record (terminated by LF)
        skp>   man90               (cc set > at EOF)
        mvn    $re,$rv             save input record size
        cmn    $re,$uopbs          this line > longline option ?
        skp>   man30
        put    filo1,a0            write current (short) line
        skp    man20               return to get next line
 #
 # test option to insert blank line before long lines
 man30  tsb    o2(1),x'01'         insert blank line before long lines ?
        skp!   man40
        put    filo1,' '           yes - write blank line before
 #

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

 # use inner loop to split long lines to multiple smaller segments
 man40  mvn    $ra,0               init rgstr a to step thru large rec
 man42  clr    b0(8192),' '        clear output area maxsize
        mvn    $rs,$uopbs          presume fixed segment size
        tsb    o23(1),x'01'        set segsize at prior word boundary ?
        skp!   man44
        scnr   aa0($rs8192),' '    scan from right to 1st blank
        skp!   man44
        mvn    $rs,$rx             override fixed segsize
 man44  mvc    b0($rs8192),aa0     move current in segment to out area
        put    filo1,b0($rs8192)   write current output segment
        add    $ra,$rs             up input ptr by segsize
        cmn    $ra,$re             reached end input rec ?
        skp<   man42
 #
 # end long line, all smaller segments written
 # - test option to insert blank line after long lines
 man50  tsb    o2(1),x'02'        insert blank line after long lines ?
        skp<   man60
        put    filo1,' '          yes - write blank line
 #
 # common point long line or not
 # test option to insert blank line after all lines (double space) ?
 man60  tsb    o2(1),x'04'        insert blank line after all lines ?
        skp!   man20
        put    filo1,' '           yes - write blank line
        skp    man20               return to get next line
 #
 # EOF - close files & end job
 man90  cls    all
        eoj

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

Q1. Pre-programmed uvcopy jobs to Demo & Customize

countc1 - count lines of code,comments,total in 1 script

command format & example


 uvcopy countc1,fili1=inputfile,filo1=reportfile   <-- command format
 ===============================================

 uvcopy countc1,fili1=pf/util/countc1,filo1=tmp/countc1 <-- example
 ======================================================
 - count lines for this uvcopy job

sample report

 countc1 - count lines: code, comments, total, for scripts & uvcopy jobs
 Date=2008/03/24_11:15:50  File=/home/uvadm/pf/util/countc1
 Lines of Code =     40
 Comment Lines =     17
 Total Lines   =     57
Note
  • also see 'countc1d' to count lines for ALL files in a directory
  • countc1d follows on the next page --->

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

Q2. countc1 - count lines of code,comments,total in 1 script

 # countc1 - count lines of: code, comments,& total
 #         - for shell scripts, COBOL programs, uvcopy jobs, etc
 #         - option for comment char '#' col 1, '*' col 7, etc
 #
 # uvcopy countc1,fili1=inputfile,filo1=reportfile   <-- command format
 # ===============================================
 #
 # uvcopy countc1,fili1=pf/util/countc1,filo1=tmp/countc1 <-- example
 # ======================================================   - count this job
 #
 opr='$jobname - count lines: code, comments, total, for scripts & uvcopy jobs'
 opr='uop=c0d35 - option defaults'
 opr='    c0    - column# for comment character, zero relative, 0 for scripts'
 opr='    c6    - column# 7 for COBOL'
 opr='      d35 - data value of comment character, 35 for "#"'
 opr='      d42 - data value 42 "*" for COBOL'
 uop=q1c0d35    # option defaults
 rop=r1   # option to prompt for output report disposition
 fili1=?${UV}/pf/util/countc1,rcs=512,typ=LST
 filo1=tmp/$fili1,rcs=128,typ=LSTt
 # load report table, counts will be inserted & table dumped at EOF
 lodv1=h0(100)                 # load table in area 'h'
 $jobname - count lines: code, comments, total, for scripts & uvcopy jobs
 Date=$datetime  File=$FILI1
 Lines of Code = $CA1
 Comment Lines = $CA2
 Total Lines   = $CA3
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 @run
        opn    all                    open files
        mvn    $rc,$uopbc             store col# in rgstr c for cmc instrn
        mvn    d0(1b),$uopbd          store data value for cmc instrn below
 #
 # begin loop to get lines,test #cmts & count, until EOF reached
 man20  get    fili1,a0
        skp>   man90
        add    $ca3,1                 count total lines
        cmc    ac0(1),d0(1)           comment line ?
        skp=   man28
        add    $ca1,1                 count code lines
        skp    man20
 man28  add    $ca2,1                 count code lines
        skp    man20
 #
 # EOF, edit counts & insert into report table & dump to output file
 man90  edt    g10(6),$ca1,'zz,zz9'
        edt    g20(6),$ca2,'zz,zz9'
        edt    g30(6),$ca3,'zz,zz9'
        rep    h200(60),'$CA1',g10(6)
        rep    h300(60),'$CA2',g20(6)
        rep    h400(60),'$CA3',g30(6)
        repf1  h100(80),'$FILI1',$fili1
        wtbe   filo1,h0(100),h0(100)
        cls    all
        eoj

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

R1. UVjobs1.doc - Pre-programmed uvcopy jobs to Demo & Customize

countc1d - count lines for all files in directory

'countc1d' will count lines for all files in a directory. This job is intended for scripts, COBOL, uvcopy jobs, etc. It counts lines of code, comment lines, & total lines with Grand Totals at the end of the directory.

options provided

  1. Select files matching a specified prefix
  2. Specify the comment ID character (default '#' column 1 for scripts) Could specify '*' column 7 for COBOL

    command format & example


 uvcopy countc1d,fild1=directory,filo1=reportfile[,arg1=prefix]
 ==============================================================

 uvcopy countc1d,fild1=pf/util/,filo1=tmp/countc1d,arg1=count
 ============================================================
 - count lines for all files in pf/util with prefix 'count'

sample report

 countc1d - count lines of Code,Comments,Total for scripts & uvcopy jobs
     Code  Comments     Total    Filename  prefix=count  2008/03/24_10:27:03
      165       106       271    /home/uvadm/pf/util/count1d
       96        31       127    /home/uvadm/pf/util/count1fd
      165       112       277    /home/uvadm/pf/util/count2d
       63        25        88    /home/uvadm/pf/util/countc1d
       40        18        58    /home/uvadm/pf/util/countc1
      529       292       821   * Grand Totals *

See 'countc1d' listed on the next page --->

As you can see from the report above, countc1d has 63 lines of code, 25 lines of comments,& 88 lines total.

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

R2. countc1d - count lines for all files in directory

countc1d - uvcopy job listing

 # countc1d - count lines for all files in directory
 #          - intended for shell scripts, COBOL programs, uvcopy jobs, etc
 #          - by Owen Townsend, UV Software, March 17/2008
 #
 # Counts lines of code, comments,& totals with Grand Totals at EOD
 # option to select files matching a specified prefix
 # option to specify comment ID character & column#
 # - default '#' column 1 for scripts & uvcopy jobs
 # - specify '*' column 7 for COBOL
 #
 #                    ** command format & example **
 #
 # uvcopy countc1d,fild1=directory,filo1=reportfile[,arg1=prefix]
 # ==============================================================
 #
 # uvcopy countc1d,fild1=pf/util/,filo1=tmp/countc1d,arg1=count
 # ============================================================
 # - count lines for all files in pf/util with prefix 'count'
 #
 #                        ** sample report **
 #
 # countc1d - count lines of Code,Comments,Total for scripts & uvcopy jobs
 #     Code  Comments     Total    Filename  prefix=count  2008/03/24_10:27:03
 #      165       106       271    /home/uvadm/pf/util/count1d
 #       96        31       127    /home/uvadm/pf/util/count1fd
 #      165       112       277    /home/uvadm/pf/util/count2d
 #       63        25        88    /home/uvadm/pf/util/countc1d
 #       40        18        58    /home/uvadm/pf/util/countc1
 #      529       292       821   * Grand Totals *
 #
 opr='$jobname - count lines for all files in directory (scripts,COBOL,uvcopy)'
 opr='counts lines of code, comments,& totals with Grand Totals at End Directory'
 opr='uop=c0d35 - option defaults'
 opr='    c0    - column# for comment character, zero relative, 0 for scripts'
 opr='    c6    - column# 7 for COBOL'
 opr='      d35 - data value of comment character, 35 for "#"'
 opr='      d42 - data value 42 "*" for COBOL'
 uop=q1c0d35    # option defaults
 rop=r1         # option to prompt for output report disposition
 fild1=?${UV}/pf/util,typ=DIR,rcs=80
 fili1=xxx,rcs=512,typ=LST
 filo1=tmp/$jobname,rcs=128,typ=LSTt
 #
 # load report table, counts will be inserted & table dumped at EOF
 lodv1=h0(100)
 $jobname - count lines of Code,Comments,Total for scripts & uvcopy jobs
      Code  Comments     Total    Filename  prefix=$ARG1  $datetime
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

 @run
        opn    fild1                    open directory
        opn    filo1                    open output report file
        mvn    $rc,$uopbc               store col# in rgstr c for cmc instrn
        mvn    d0(1b),$uopbd            store data value for cmc instrn below
        msgwa1c 'enter filename prefix to be counted (or null for all files)'
        mvue1  pp0(30),$arg1,' '        store prefix to end blank (save lth $rp)
        repf4  h100(90),'$ARG1',p0(30)  insert prefix in page headings
        wtbe   filo1,h0(100),h0(100)    dump page headings
 #
 # begin loop to read directory for next filename
 # - bypass if prefix match to arg1
 man10  get    fild1,a0(80)            get next record (filename) in directory
        skp>   man90                   cc set > at EOF (go close & EOJ)
        skp<   man10                   bypass subdirs (cc set >)
        cmc    a0($rp30),p0            filename prefix match ?
        skp!   man10
 # prefix match (or not specified) - create dir/file & open file
        mvc    f0(80),$fild1           directory name
        cata8  f0(80),'/'              append '/'
        cata8  f0(80),a0(30)           append filename
        mvc    $fili1,f0               store filename before open
        opn    fili1                   open file to get stats
        mvnx3  $ca1,0                  clear 3 ctrs $ca1,$ca2,$ca3
 #
 # begin loop to get lines,test #cmts & count, until EOF reached
 man20  get    fili1,b0
        skp>   man30
        add    $ca3,1                  count total lines
        cmc    bc0(1),d0(1)            comment line ?
        skp=   man28
        add    $ca1,1                  count code lines
        skp    man20
 man28  add    $ca2,1                  count code lines
        skp    man20
 #
 # EOF current file - edit counts & write line to report file
 man30  edt    c00(9),$ca1,'z,zzz,zz9'  edit count - lines of code
        edt    c10(9),$ca2,'z,zzz,zz9'  edit count - comment lines
        edt    c20(9),$ca3,'z,zzz,zz9'  edit count - total lines
        mvu    c33(50),$fili1,x'00'     current filename
        putb   filo1,c0(100)            write counts for current file
        cls    fili1                    close current file
        add    $cb1,$ca1                acum total code
        add    $cb2,$ca2                acum total comments
        add    $cb3,$ca3                acum total total
        skp    man10                    return to get next filename from dir
 #
 # EOD - print grand total line, close all files,& end job
 man90  put    filo1,' '                space before Grand Total line
        edt    c00(9),$cb1,'z,zzz,zz9'  edit GT count - lines of code
        edt    c10(9),$cb2,'z,zzz,zz9'  edit GT count - comment lines
        edt    c20(9),$cb3,'z,zzz,zz9'  edit GT count - total lines
        mvf    c32(30),'* Grand Totals *'
        put    filo1,c0(100)            write counts for current file
        cls    all
        eoj

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

S1. UVjobs1.doc - table summary reports for any file on any argument

table2 - Pre-Programmed Table Summaries

'table2' solicits the filename & options which define displacement & length of the table argument,& 1 or 2 fields to be accumulated. table2 then reads through the file & displays or prints the accumulated totals sorted & summarized to one line per unique key field value.

demo input file - 1st 3 of 20 records

            1        2         3         4         5         6
 0123456789012345678901234567890123456789012345678901234567890123
  cust# slsm#  date  invoice# product#    qty   price    amount
 130140    21 940802 IN111001  HAM001  00020+ 0000001 00000020+
 130140    21 940802 IN111001  SCR012  00021+ 0001001 00021021+
 139923    35 950802 IN111002  CHR001  00022+ 0002001 00044022+

Operating Instructions


 uvcopy table2,fili1=dat1/sales3,uop=a30b6c38d6e53f9g3r64,filo1=tmp/sales3.tbl
 =============================================================================

 uvcopy table2               <-- Try this Now
 =============                 - You only need to enter/remember this much
                               - you will be prompted for filename & options
                               - filenames default as shown above (for this demo)
 uop--> a30b6c38d6e53f9g3r64 <-- ENTER options for demo with dat1/sales3 file
        ====================
 dat1/sales3 = default fili01 accept/reenter-->     <--ENTER null to accept dflt

sample output report

 table2  2003/04/26_20:15:34  Sales Summary by Product#
 tbl#001 pg#001     -argument-            -acum#1-    %        -acum#2-    %
 line#  count    %  product               quantity
     1       2  10  BBQ001                      12   12        1,420.12   31
     2       1   5  CHR001                      22   22          440.22    9
     3       5  25  HAM001                      41   41        1,390.41   30
     4       2  10  HAX129                      10   10          600.10   13
     5       2  10  SAW051                      24-  24-         560.24-  12-
     6       1   5  SCR012                      21   21          210.21    4
     7       4  20  TAB013                      17   17           29.83-
     8       3  15  WHIP75                       1    1        1,030.01   22
            20*100   *TOTAL*                   100 *100        4,501.00 *100

Please see the rerun on the next page to better illustrate the options --->

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

S2. UVjobs.doc - table summary reports for any file on any argument

table2 - Options Illustrated


 uvcopy table2,fili1=dat1/sales3,uop=a10b2c38d6e53f9g3r64,filo1=tmp/sales3.tbl
 =============================================================================
 - May specify all filenames & options on the command line (as above)

 uvcopy table2  <-- minimum entry, prompted for files & options as follows:
 =============    - output file defaults same as input but in tmp subdir
 uop=a0b0c0d0e0f0g1p0r0 - option defaults
 uop=a0                 - argument displacement (0 rel)
 uop=  b0               - argument length
 uop=              note - may omit options c,d,e,f,p for record counts only
 uop=    c0             - acum#1 displacement (0 rel)
 uop=      d0           - acum#1 length
 uop=        e0         - acum#2 displacement (0 rel)
 uop=          f0       - acum#2 length
 uop=            g1     - edit all acums as qty (commas, no decimal)
 uop=            g2     - edit all acums as $ (commas & decimal point)
 uop=            g3     - edit acum#1 qty, acums#2-#6 $amounts
 uop=            g__    - table formats g1-g12 see uvcopy.doc tbf f1-f12
 uop=        p0         - acum-fields unpacked, "p1" packed, "p2" binary
 uop=          r8192    - input record size (max 8192)
 uop=              note - if file type LST specify r > largest possible
 uop=a30b6c38d6e53f9g3r64  <-- ENTER this for demo with dat1/sales3 file
     ====================
 product#;quantity;amount  <-- ENTER this for demo Field Headings
 ========================
 Summary of Qty & Amt by Product#  <-- ENTER this for demo Report Heading
 ================================
               <-- ENTER null at filename prompt to accept demo input
                   Notes re: input File TYPE prompts
 RSF (default) <-- Record Seqntl Fixed (recsize option r must be correct)
 LST           <-- Line Seqntl Terminated (specify r > largest possible)
 Option defaults  = q1a0b0c0d0e0f0g1p0r0
 null accept or re-specify (1 or more) --> a30b6c38d6e53f9g3r64 <--ENTER for demo
                                           ====================
 dat1/sales3 = default fili01 accept/reenter-->     <--ENTER null to accept dflt
 RSF = typ default accept or enter new typ  -->     <--ENTER null to accept dflt
 enter table hdr fieldnames separated by semicolons
 --> argument;acum1;acum2 --> product#;quantity;$amount <-- ENTER fieldnames
                              =========================
 enter Report Heading (optional)
 --> Sales Summary by Product#   <-- ENTER Report Heading
     =========================
 enter to command to view/print report --> more   <-- to display report

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

S3. UVjobs.doc - table summary reports - custom written

custom written uvcopy 'tbl' jobs

If your requirements exceed the limitations of the above Pre-Programmed general purpose job (table2), you can custom write your own uvcopy job. We will use 'sltbl1' as an example. Here are the operating instructions & I/O sample files, followed by the uvcopy job listed on the next page.

sltbl1 - Operating Instructions


 uvcopy sltbl1,fili1=dat1/sales3     <-- run the demo job
 ===============================

sample input file - 1st 3 of 20 records

           1         2         3         4         5         6
 0123456789012345678901234567890123456789012345678901234567890123
  cust# slsm#  date  invoice# product#    qty   price    amount
 130140    21 940802 IN111001  HAM001  00020+ 0000001 00000020+
 130140    21 940802 IN111001  SCR012  00021+ 0001001 00021021+
 130140    21 940802 IN111001  CHR001  00022+ 0002001 00044022+

sample output report

 sltbl1  2003/04/26_16:07:59  sales analysis by product# of quantity & amount
 tbl#001 pg#001     -argument-            -acum#1-    %        -acum#2-    %
 line#  count    %  product#             sales qty            sales amt
     1       2  10  BBQ001                      12   12        1,420.12   31
     2       1   5  CHR001                      22   22          440.22    9
     3       5  25  HAM001                      41   41        1,390.41   30
     4       2  10  HAX129                      10   10          600.10   13
     5       2  10  SAW051                      24-  24-         560.24-  12-
     6       1   5  SCR012                      21   21          210.21    4
     7       4  20  TAB013                      17   17           29.83-
     8       3  15  WHIP75                       1    1        1,030.01   22
            20*100   *TOTAL*                   100 *100        4,501.00 *100

<-- compare this custom report to the report on page 'S1' (created by the general purpose table summary job 'table2')

See custom written uvcopy job 'sltbl1' listed on next page --->

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

S4. UVjobs.doc - table summary reports - custom written

sltbl1 - custom written table summary

 fili1=?dat1/sales3,typ=RSF,rcs=64
 filo1=tmp/$jobname,typ=LSTt,rcs=80
 @run
        opn     all
 # begin loop to get & table until EOF
 man20  get     fili1,a0             get next record
        skp>    eof                  (cc set > at EOF)
        tblt1f3 a30(6),'product#; sales qty; sales amt',a38(6),a53(9)
        skp     man20                return to get next record
 #
 # EOF - dump table to report file & display report
 eof    tbpt1s2 filo1,'sales analysis by product# of quantity & amount'
        cls     all
        sysv1   'cat $filo1'
        eoj

Only 12 uvcopy instructions were required to create the report shown on the previous page. All uvcopy instructions are documented in uvcopy3.htm. In this case, the 2 most relevant (& powerful) instructions are 'tbl' & 'tbp'.


       tbl     - build table in memory
       ===
       tblt1f3 - option 't1' for table#1, t2 for table #2, etc
               - option 'f3' for format 3 (acum1=quantity, acum2=dollars/cents)

       tbp     - print table (write memory table to an output file for subsequent
       ===       viewing or printing (with vi,cat,lp,etc)
       tbpt1s2 - option 't1' to write table#1 (match table# on prior tbl)
               - option 's2' to space 2 after (FormFeed is the default)

Reasons to custom write table summary jobs

  1. May accumulate up to 6 fields + count (vs only 2 fields + count)

  2. May customize editing as required (quantity vs dollars & cents)

  3. May create up to 255 tables in 1 job (vs only 1 table in table2 GP job)

  4. Note that entries per table is limited only by available memory but you may need to increase run option 'v' rop=v8000 <-- default v8000 for 8000 tbl entries

  5. May create multi-part table arguments. For example to summarize sales by product# within each salesman, you can move slsmn# & product# together in a work area & specify the combination as the table argument.

  6. More convenient for recurring frequently run table analysis jobs. You can code all the desired headings & field displacement(lengths) in your customer written uvcopy job, so you don't have to re-enter every time you run the job. Alternatively you can write a script & code the desired headings, fields,& options on 1 long uvcopy command line.

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

T1. UVjobs1 - Pre-Programmed jobs for Data Files

acum1 - accumulate any 1 field in a datafile

'acum1' is a pre-programmed 'uvcopy job' to accumulate any 1 field in any 1 file for any use desired (might be for a hash total to prove file validity after conversions, or to get a 2nd opinion when COBOL reports look suspicious).

'acum1' will prompt for file-name, file-type, field dsplcmnt, length,& type, with an option to crossfoot a specified number of consecutive same-size fields.

We will demonstrate using test file /home/uvadm/dat1/custmas1, a customer master file with monthly sales fields for this-year & last-year. Here is the uvhd display of the 1st record:


 uvhd dat1/custmas1 r256s3   <-- run uvhd to display test file in hexadecimal
 =========================     - option 'r256' record size
                               - option 's3' space betwn 64 byte segments
                      10        20        30        40        50        60
 r#        1 0123456789012345678901234567890123456789012345678901234567890123
           0 130140    EVERGREEN MOTORS LTD.    1815 BOWEN ROAD          NANA
             3333332222454545444244545524542222233332445442544422222222224444
             130140000056527255E0DF4F230C44E0000181502F75E02F140000000000E1E1
          64 IMO          BC V9S1H1    250-754-5531 LARRY WRENCH     ..4V|...
             4442222222222442535343222233323332333324455525544442222201357000
             9DF00000000002306931810000250D754D55310C12290725E38000000246C000
         128 .........W0....`........)X}..f3.....\.................4V}...f...
             0000000005300016000000002570063100095000000000000000013570016000
             0C0000C0270D0540C0000C0098D0263C0444C0000C0000C0000C0246D0056C00
         192 .E|...V}.......................f.....<........f.C 19950531
             0470005700000000880000000018000680001300000000694233333333222222
             35C0046D0000C0023C0000C0083C0056D0012C0000C0016D3019950531000000
Note
  • 12 x 5 byte THIS-year packed fields from byte 120 to 179
  • 12 x 5 byte LAST-year packed fields from byte 180 to 239

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

T2. UVjobs1 - Pre-Programmed jobs for Data Files

acum1 - operating instructions

You could enter just 'uvcopy acum1' (#1 below) & you would be prompted for file-name, file-type, field start, length,cross-foot, type,& record-size.

Or you could enter the file-name &/or all options (#2 & #3 below). Once you understand the options, it is agood idea to enter them on the command line, which allows you to repeat the command easily from your shell history.


 #1. uvcopy acum1    <-- will prompt for filename, filetype,& all options
     ============        (field start, length, crossft, type, recsize)

 #2. uvcopy acum1,fili1=dat1/custmas1
     ================================
     - example options for dat1/custmas1 (relate uop=... to options below)

 #3. uvcopy acum1,fili1=dat1/custmas1,uop=a120b5c12d2e2f0r256
     ========================================================
     - example options for dat1/custmas1 (see options described below)
     - output report will be written to tmp/dat1_custmas1_acum1

console log (option prompts)

 acum1 - acum any field for hash total, etc
 file type options: LST(text), RSF(fixed,default), RDWz4, RDWz2, ISF, IDXf8
 uop=a0b0c1d0e0f0r0  - default options
     a0              - field dsplcmnt (zero relative)
       b0            - field length (must specify)
         c1          - cross-foot number of fields
         c12         - example for 12 months sales
            d0       - field type numeric unpacked
            d1       - field type binary
            d2       - field type packed
              e0     - edit 0 decimals
              e2     - edit 2 decimals
                f0   - ASCII file
                f1   - EBCDIC file
                  r0 - recsize if typ=RSF
 090220:195505:acum1: uvcopy ver=20090212 pf=/home/uvadm/pf/util/acum1
 uvcopy DISAM ext=dat LNX L64  license=20090212V site=UV_Software
 User OPtion (uop) defaults  = q1a0b0c1d0e0f0r0
 -->null to accept or enter/override -->

sample report from acum1

      ====================================================================
      acum1: dsplcmnt 120, length 5, occurs 12, recsize 256: dat1/custmas1
      field total-->          99,697.93  records=          32
      ====================================================================

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

T3. UVjobs1 - Pre-Programmed jobs for Data Files

 # acum1 - uvcopy Parameter File from UVSI stored in: /home/uvadm/pf/demo/
 # acum1 - accumulate any 1 field for any use desired
 #       - might be for a hash total to prove file validity after conversions
 #       - prompts for file type, field dsplcmnt, length,& type
 #       - option to crossfoot specified number of consecutive fields
 #
 # uvcopy acum1,fili1=dat1/custmas1,uop=a120b5c12d2e2f0r256
 # ========================================================
 # - example options for dat1/custmas1 (relate uop=... to options below)
 # - output report will be written to tmp/dat1_custmas1_acum1
 #
 #                        ** sample report output **
 #
 # acum1: dsplcmnt 120, length 5, occurs 12, recsize 256, dat1/custmas1
 # field total-->          99,697.93  records=          32
 #
 opr='$jobname - acum any field for hash total, etc'
 opr='file type options: LST(text), RSF(fixed,default), RDWz4, RDWz2, ISF, IDXf8'
 opr='uop=a0b0c1d0e0f0r0  - default options'
 opr='    a0              - field dsplcmnt (zero relative)'
 opr='      b0            - field length (must specify)'
 opr='        c1          - cross-foot number of fields'
 opr='        c12         - example for 12 months sales'
 opr='           d0       - field type numeric unpacked'
 opr='           d1       - field type binary'
 opr='           d2       - field type packed'
 opr='             e0     - edit 0 decimals'
 opr='             e2     - edit 2 decimals'
 opr='               f0   - ASCII file'
 opr='               f1   - EBCDIC file'
 opr='                 r0 - recsize if typ=RSF'
 uop=q1a0b0c1d0e0f0r0     # option defaults
 rop=r1x4                 # prompt for output report disposition
 was=a8192                # allow records up to 8K
 fili1=?input,rcs=8192,typ=?RSF  #<-- prompts for file name & type change
 # typ prompt reply: null=RSF, or enter: RDWz4, RDWz2, IDXf3, IDXf8, ISF
 filo1=?tmp/output,rcs=128,typ=LSTt
 @run
 # prompts for file type change, may reply
        mvn    $ra,$uopba              move dsplcmnt to rgstr 'a'
        mvn    $rb,$uopbb              move field length to rgstr 'b'
        skp<=  err1
        mvn    $rc,$uopbc              store crossfoot/occurs count in rgstr 'c'
        mvc    e0(20),'zzzzzz,zzz,zzz,zz9-'  presume 0 dcmls
        cmn    $uopbe,2                   edit 2 dcmls ?
        skp<   1
        mvc    e0(20),'zzz,zzz,zzz,zzz.z9-'
        mvn    $rr,$uopbr              set recsize from optn r for typ=RSF
        skp>   1                       test recsize spcfd ?
        mvn    $rr,8192                no - default recsize for RDWz2/z4 & IDXf8
        mvn    z224(4b),$rr            set recsize in File Control Table
        opn    fili1                   open files
        cmc    z180(3),'RSF'           fixed recsize ?
        skp!   man10
        cmn    $uopbr,0                recsize spcfd for typ=RSF ?
        skp<=  err2

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

 # create output filename as tmp/input_filename_acum
 man10  mvu    f0(80),$fili1,x'00'     move input filename to w/a
        mvc    f100(80),f0
        rep    f100(80),'/','_'        replace '/' seps with '_'
        mvf    f200(80),'tmp/'         setup output subdir
        cat    f200(80),f100(80)       concat input filename
        cata8  f200(80),'_acum1'       append _acum ID
        mvc    $filo1,f200             store outfile name for open
        opn    filo1                   open report filename
 #
 # begin loop to get/put records, accumulating spcfd field
 man20  get    fili1,a0                get a record
        skp>   man90                   (cc set > at EOF)
        add    $ca2,1                  count records
        tsb    o4(1),x'01'             binary ?
        skp=   man30
        tsb    o4(1),x'02'             packed ?
        skp=   man32
 #
 # acum numeric unpacked field - need data type 'e' if EBCDIC file
 man24  tsb    o6(1),x'01'             EBCDIC ?
        skp=   man28
        xft    $ca0,aa0($rb18),$rc     crossfoot numeric ASCII
        skp    man40
 man28  xft    $ca0,aa0($rb18ze),$rc   crossfoot numeric EBCDIC
        skp    man40
 # acum binary field
 man30  xft    $ca0,aa0($rb8b),$rc     crossfoot binary
        skp    man40
 # acum packed field
 man32  xft    $ca0,aa0($rb9p),$rc     crossfoot packed
        skp    man40
 #
 # common point to acummulate 1 or more fields crossfooted into $ca0
 man40  add    $ca1,$ca0               acum crossfooted fields
        skp    man20                   return to get next record
 #
 # EOF - print accumlated total, close files, & end job
 man90  nop
  mvfv1 b0(80),'acum1: dsplcmnt $ra, length $rb, occurs $rc, recsize $rr: $fili1'
        putb   filo1,b0                write to report file
        mvf    b0(80),'field total-->____________________ records=____________'
        edt    b14(20),$ca1,e0(20)     edit acummulated field total
        edt    b43(12),$ca2,'zzzz,zzz,zz9'  edit record count
        putb   filo1,b0                write to report file
        cls    all
        eoj
 #
 err1   can    'field length uop=b1-b15 must be specified, job cancelled'
 err2   msg    'record size uop=r... must be specified correctly for typ=RSF'
        msg    '- will default to 8192 (max) for variable length files'
        can    '- job cancelled'
 #

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

U1. UVjobs1 - Pre-Programmed jobs for Data Files

customer master sales report

This report is presented here, so you can verify yor results with the preceding 'acum1' job & the following 'selectf1' job. You can run it as follows:


 uvcopy cmrpt1,fili1-dat1/custmas1   <-- run the customer master sales report
 =================================

 cust#     customer-name              telephone    this-year <sales> last-year
 ==============================================================================
 130140    EVERGREEN MOTORS LTD.      250-754-5531   21335.56    12152.55-
 132588    GEECOE GENERATOR SERVICES  604-278-4488     434.98      640.04
 139923    JOHNSTONE BOILER & TANKS   604-320-1845      73.98      453.20
 142175    LILLY ELECTRIC (1973) LTD  604-534-9787   10761.58         .00
 145264  D MAGRATH SUPPLIES LTD.      250-843-2987        .00         .00
 147615  X O'CONNER R.V. CENTRE       604-858-4161    4478.00     8610.30
 149304    POINT GREY GOLF & COUNTRY  604-732-5572     734.37         .00
 150825    RIGGERS INDUSTRIAL         604-858-4729      75.70      173.25
 152355    SHAW, JOHN                 604-291-6261     424.48         .00
 154688    TAURUS RESOURCES           604 685 8565   18338.09      766.96
 157352  D WHYTE, W.                  604-980-5434        .00         .00
 173320  X ZENITH TRANSPORT           604-520-3979    1420.00         .00
 201120    ALLTYPE RENTAL LTD.        403-246-5274     228.01     1765.10
 204700    CASE POWER EQUIPMENT       403-538-1743    1318.41      427.54
 208060    E&L TRUCKING               403-231-7312      17.39-    1534.06
 211140  D FORD NEW HOLLAND           403-312-2760        .00         .00
 223240  X NICHOLSON CHEVROLET LTD.   403-467-4257    6148.45     3246.38
 224700    OTTO MOBILES WESTERN LTD.  403-467-3197   13959.90    24673.59
 231550    SPARROW ELECTRIC CO. LTD.  403-742-6139    5725.00     1742.59
 234300    TERRITORIAL REWIND         403-512-3948    4901.21         .00
 237286    WEBER, TOM                 403-529-7425    1000.00-     849.88
 301120  D ALBERTA GAS CHEMICALS LTD  403-952-2475        .00         .00
 306959  X 356582 ALBERTA LTD.           -   -         138.98      412.97
 308685    FOOTHILLS ELECTRIC         403-296-4856     270.33       43.41
 313720    MONITREX ENGINEERING LTD                   2256.02     2427.49
 315512    PARTS PLUS                 403-385-7134     340.52         .00
 318833    TOP NOTCH CONSTRUCTION     403-385-2965     485.25      390.89
 400002    ACKLANDS LTD               250-705-2583    1737.25     3198.49
 401210    COAST RANGE CONSTRUCTION   604 681 2626    4966.28         .00
 402875    HULL, DON & SONS LTD.      250-836-2964      44.50     1196.72
 403887  D MILNER, LARRY              250-351-9472      66.01     4432.47
 406082    PRECAM RENTALS LTD:        250-637-6351      52.46      608.06
 cmrpt1  2009/02/21_07:37:05  summary table by territory dat1/custmas1
 tbl#001 pg#001     -argument-            -acum#1-    %        -acum#2-    %
 line#  count    %  territory         thisyr sales         lastyr sales
    1       12  37  1                    58,076.74   58        1,508.80-   3-
    2        9  28  2                    31,263.59   31       34,239.14   75
    3        6  18  3                     3,491.10    3        3,274.76    7
    4        5  15  4                     6,866.50    6        9,435.74   20
            32*100   *TOTAL*             99,697.93 *100       45,440.84 *100

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

U2. customer master sales report

cmrpt1 - uvcopy job listing

 # cmrpt1 - create report from custmas1 (cust#,name,phone#,ty sales, ly sales)
 #        - with summary table by sales territory (1st digit of cust#)
 #
 # uvcopy cmprpt1,fili1=dat1/custmas1,filo1=tmp/custmas1
 # =====================================================
 #
 #                         ** sample report **
 #
 # cust#     customer-name              telephone    this-year <sales> last-year
 # =============================================================================
 # 130140    EVERGREEN MOTORS LTD.      250-754-5531   21335.56    12152.55-
 #                    - - - 30 lines omitted - - -
 # 406082    PRECAM RENTALS LTD:        250-637-6351      52.46      608.06
 #
 # cmrpt1  2009/02/21_07:24:18  summary table by territory dat1/custmas1
 # tbl#001 pg#001     -argument-            -acum#1-    %        -acum#2-    %
 # line#  count    %  territory         thisyr sales         lastyr sales
 #    1       12  37  1                    58,076.74   58        1,508.80-   3-
 #    2        9  28  2                    31,263.59   31       34,239.14   75
 #    3        6  18  3                     3,491.10    3        3,274.76    7
 #    4        5  15  4                     6,866.50    6        9,435.74   20
 #            32*100   *TOTAL*             99,697.93 *100       45,440.84 *100
 #
 opr='$jobname - create customer report with: cust#,name,tel#,ty&ly sales'
 rop=r1     # prompt for report disposition
 fili1=?dat1/custmas1,rcs=256,typ=RSF
 filo1=?tmp/$fili1,rcs=128,typ=LSTt
 @run
        opn    all
 # create report heading line
        mvf    b0(50),'cust#     customer-name              telephone'
        mvf    b50(30),'this-year <sales> last-year'
        putb   filo1,b0(128)          write report heading line
        clr    b0(78),'='             fill line with === separators
        putb   filo1,b0               write === separator line
 #
 loop   get    fili1,a0(256)
        skp>   eof
        mvf    b0(128),a0(35)         cust#,del flag,name & clear remndr of line
        mvc    b37(12),a90            telephone#
        xft    $ca1,a120(p5),12       xft ty sales
        edt    b50(11),$ca1,'z.99-'   edit ty sales total
        xft    $ca2,a180(p5),12       xft ly sales
        edt    b62(11),$ca2,'z.99-'   edit ly sales total
        put    filo1,b0(128)
 # build summary tables by city & province to be dumped at EOF
        tblt1f2 a0(1),'territory;thisyr sales;lastyr sales',$ca1,$ca2
        skp    loop
 #
 eof    put     filo1,' '
        tbpt1s2 filo1,'summary table by territory'
        cls    all
        eoj

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

V1. UVjobs1 - Pre-Programmed jobs for Data Files

selectf1 - select records depending on field value

'selectf1' is a uvcopy pre-programmed job to select records from any file depending on the value in any specified field <=> 2 specified values. Two specified values allows you to select a range of values in any 1 field. There is an option to crossfoot multi contiguous same size fields for the test value.

Here is a sample command to select sales records with this-year sales over $50.00 OR less than -50.00. Please see the preceding customer sales report on page 'U1' to verify the selections made here. Also see the record layout on page 'T1'.


 uvcopy selectf1,fili1=dat1/custmas1,uop=a120b5c12f0,arg1='>5000',arg2='|<-5000'
 ===============================================================================

console log - options prompt

 uop=a0b0c1d0e0f0r0  - default options
     a0              - field dsplcmnt (zero relative)
       b0            - field length (must specify)
         c1          - cross-foot number of fields
         c12         - example for 12 months sales
            d0       - field type numeric unpacked
            d1       - field type binary
            d2       - field type packed
                f0   - ASCII file
                f1   - EBCDIC file
                  r0 - recsize if typ=RSF
 uop=a120b5c12d2f0   - EX: field dsp 120, lth 5, packed(c2), ASCII(f0)
 arg1='>500',arg2='|<-500' <-- select recs > 5.00 OR <-5.00 in 120(5p)
 arg1='=0',arg2='_'        <-- select records with thisyr sales zero
           arg2='&/|'        - else 1st byte must be &/| AND/OR
           arg2='&/|</=/>'          2nd byte must be <=>
 note - conditions &| <=> values must be in SINGLE quotes (not doubles)
      - if entered on command line (not if entered at the prompt)
 User OPtion (uop) defaults  = q1a0b0c1d0f0r0a120b5c12d2r256
 -->null to accept or enter/override -->  <-- enter null (accept cmnd line optns)
 dat1/custmas1 = default fili01 - null accept or reenter ?
 RSF = typ default fili01 - null accept or enter new typ ?
 tmp/dat1_custmas1_sel = default filo01 - null accept or reenter ?
 RSF = typ default filo01 - null accept or enter new typ ?
 15 records selected via >50000 & |<-50000
 090221:153134:selectf1: EOF fili01 rds=32 size=8192: dat1/custmas1
 090221:153134:selectf1: EOF filo01 wrts=15 size=3840: tmp/dat1_custmas1_sel

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

V2. selectf1 - select records depending on field value

notes re command line options


 uvcopy selectf1,fili1=dat1/custmas1,uop=a120b5c12f0,arg1='>5000',arg2='|<-5000'
 ===============================================================================
  1. Options a&b 'a120b5' specify the field start byte & length.

  2. Option c 'c12' specifies any crossfooting for multi same size fields (12 for 12 months sales fields).

  3. Option 'd2' specifies packed, option 'f0' for ASCII (vs f1 for EBCDIC).

  4. arg1='>5000' specifies the value at 120(5p) must be > $50.00.

  5. arg2='|<-5000' specifies OR the value must be < -50.00

  6. arg2='&<10000' could specify AND value must be < $100.00

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

V3. selectf1 - select records depending on field value

 # selectf1 - uvcopy Parameter File from UVSI stored in: /home/uvadm/pf/util/
 # selectf1 - select records from a file depending on values in a spcfd field
 #          - select records with field value > or < than 1 or 2 specified values
 #          - option to crossfoot multi contiguous same size fields
 #
 # uvcopy selectf1         <-- will prompt filetyp, field start, length, type
 #
 # uvcopy selectf1,fili1=dat1/custmas1,uop=a120b5c12d2,arg1='>500',arg2='|<-500'
 # =============================================================================
 # - select records with this-year sales (xft 12 mths) > 5$ OR(|) < -5$
 #   (this-year sales 12 x 5 byte packed fields begining at byte 120)
 # - conditions &| <=> values in quotes
 #
 # uop=a120b5c12d2f0         <-- field dsplcmnt 120, lth 5, packed(d2), ASCII(f0)
 # arg1='>500',arg2='|<-500' <-- select recs > 5.00 OR <-5.00 in 120(5p)
 #
 # arg1='=0',arg2='_'        <-- select records with thisyr sales zero
 #                             - disable arg2 by omitting or specify '_'
 #           arg2='&/|'        - else 1st byte must be &/| AND/OR
 #           arg2='&/|</=/>'          2nd byte must be <=>
 #
 opr='$jobname - select records w field value > or < than 1 or 2 spcfd values'
 opr='- prompts for file type (RSF,RDWz4,RDWz2,LST,ISF,IDXf8)'
 opr='uop=a0b0c1d0e0f0r0  - default options'
 opr='    a0              - field dsplcmnt (zero relative)'
 opr='      b0            - field length (must specify)'
 opr='        c1          - cross-foot number of fields'
 opr='        c12         - example for 12 months sales'
 opr='           d0       - field type numeric unpacked'
 opr='           d1       - field type binary'
 opr='           d2       - field type packed'
 opr='               f0   - ASCII file'
 opr='               f1   - EBCDIC file'
 opr='                 r0 - recsize if typ=RSF'
 opr='uop=a120b5c12d2f0   - EX: field dsp 120, lth 5, packed(c2), ASCII(f0)'
 opr='arg1=">500",arg2="|<-500" <-- select recs > 5.00 OR <-5.00 in 120(5p)'
 opr='arg1="=0",arg2="_"        <-- select records with thisyr sales zero'
 opr='          arg2="&/|"        - else 1st byte must be &/| AND/OR'
 opr='          arg2="&/|</=/>"          2nd byte must be <=>'
 opr='note - conditions &| <=> values must be in SINGLE quotes (not doubles)'
 opr='     - if entered on command line (not if entered at the prompt)'
 uop=q1a0b0c1d0f0r0     # option defaults
 was=a8192b8192         # allow I/O records up to 8K
 fili1=?dat1/custmas1,typ=?RSF,rcs=8192
 filo1=?tmp/$fili1.sel,typ=?RSF,rcs=8192
 #note - output file will be: tmp/dat1_custmas1_sel

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

 @run
        mvn    $ra,$uopba              move dsplcmnt to rgstr 'a'
        mvn    $rb,$uopbb              move field length to rgstr 'b'
        skp<=  err1
        mvn    $rc,$uopbc              store crossfoot/occurs count in rgstr 'c'
        mvn    $rr,$uopbr              set recsize from optn r for typ=RSF
        skp>   1                       test recsize spcfd ?
        mvn    $rr,8192                no - default recsize for RDWz2/z4 & IDXf8
        mvn    $fili1+224(4b),$rr      set recsize in input File Control Table
        mvn    $filo1+224(4b),$rr      set recsize in outfile FCT
        opn    fili1                   open files
        cmc    z180(3),'RSF'           fixed recsize ?
        skp!   man06
        cmn    $uopbr,0                recsize spcfd for typ=RSF ?
        skp<=  err2
 #
 # create output filename as tmp/input_filename.hash
 man06  mvu    f0(80),$fili1,x'00'     move input filename to w/a
        mvc    f100(80),f0
        rep    f100(80),'/','_'        replace '/' seps with '_'
        mvf    f200(80),'tmp/'         setup output subdir
        cat    f200(80),f100(80)       concat input filename
        cata8  f200(80),'_sel'         append _sel ID
        mvc    $filo1,f200             store outfile name for open
        opn    filo1                   open report filename
 #
 # solicit arg1 & arg2 if not on command line
 man10  msga1cw 'enter arg1=<=>999...'
        mvc    c0(20),$arg1            move arg1 to w/a 'c'
        tst    c0(1),'<=>'             validate condition code
        skp!   err3
        mvn    $ca1,c1(15)             capture value
 #
 # arg2 optional, ignore if condition code not <=>
 man14  msga2cw 'enter arg2=<=>999..., ignored if condition not <=>'
        mvc    c20(20),$arg2           move arg1 to w/a 'c'
        tst    c20(1),'_ '             arg2 entered ?
        skp=   man20
        tst    c20(1),'&|'             AND or OR ?
        skp!   err4
        tst    c21(1),'<=>'            < = > ?
        skp!   err4
 man16  mvn    $ca2,c22(15)            capture value
 #
 # begin loop to get/put records, accumulating spcfd field
 man20  get    fili1,a0                get a record
        skp>   man90                   (cc set > at EOF)
        add    $ca2,1                  count records
 #
 # test field type depending option d0/d1/d2 (unpacked/binary/packed)
        tsb    o4(1),x'01'             binary ?
        skp=   man30
        tsb    o4(1),x'02'             packed ?
        skp=   man32
 #

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

 # acum numeric unpacked field - need data type 'e' if EBCDIC file
 man24  tsb    o6(1),x'01'             EBCDIC ?
        skp=   man28
        xft    $ca0,aa0($rb18),$rc     crossfoot numeric ASCII
        skp    man40
 man28  xft    $ca0,aa0($rb18ze),$rc   crossfoot numeric EBCDIC
        skp    man40
 # acum binary field
 man30  xft    $ca0,aa0($rb8b),$rc     crossfoot binary
        skp    man40
 # acum packed field
 man32  xft    $ca0,aa0($rb9p),$rc     crossfoot packed
        skp    man40
 #
 # common point - current record field stored in $ca0
 # test current record field value vs arg1 (& arg2 if spcfd)
 man40  cmn    $ca0,$ca1               this rec value <=> arg1 ?
        skp..  man50,c0(1)             skip on arg1 condition <=>
 # condition1 Not met, test for condition2 spcfd & OR ?
 man42  tst    c20(1),'_ '             condition 2 spcfd ?
        skp=   man20                   no - return to get next record
 man44  cmc    c20(1),'|'              OR ?
        skp!   man20                   no  - return to get next record
        cmn    $ca0,$ca2               yes - test condition2 ?
        skp..  man60,c21(1)            skip on arg2 condition <=>
        skp    man20                   return to get next record
 #
 # condition1 met - test condition 2 spcfd & AND/OR
 man50  tst    c20(1),'_ '             condition 2 spcfd ?
        skp=   man60                   no - goto select record
 man52  cmc    c20(1),'|'              AND/OR ?
        skp=   man60                   OR - goto select record
 #
 # test AND condition2
 man54  cmn    $ca0,$ca2               test condition2 AND ?
        skp..  man60,c21(1)            skip on arg2 condition <=>
        skp    man20                   return to get next record
 #
 # current record selected - write to output file
 man60  put    filo1,a0($rv8192)       write selected record to outfile
        add    $ca3,1                  count records selected
        skp    man20                   return to get next record
 #
 # EOF - display record count selected, close files, & end job
 man90  msgv1  '$ca3 records selected via $arg1 & $arg2'
        cls    all
        eoj
 #
 err1   can    'field length uop=b1-b15 must be specified, job cancelled'
 err2   msg    'record size uop=r... must be specified correctly for typ=RSF'
        msg    '- will default to 8192 (max) for variable length files'
        can    '- job cancelled'
 err3   can    'arg1=">5000"   <-example, arg1=1st byte <,=,>, job cancelled'
 err4   can    'arg2="|<-5000" <-EX, 1st byte &,| 2nd byte <,=,>, job cancelled'
 #

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

Visitor Counters for ThisYear and LastYear