CNVaids.doc - Contents by Part#


Part_0 - Introduction & Overview
- make new users aware of utilties available
- short examples of utilities with references to complete doc elsewhere

Part_1 - General Purpose aids & scripts, using Unix/Linux utilities
- profiles, stub_profile & common_profile make administration easier
 Scripts to rename all files in directory saving hours & keystrokes
- renameL to lower case, renameU to UPPer case,
- renameX change extension, rename+X add ext, rename-X remove ext
 Directory & file listing scripts & storage used scripts
- 'dtree' diagrams directory trees, great for documentation
 Scripts to list all files in directory with various sort options
- llm,lla,llt,lltr,lls,llsr,lln,lld,llr,llra
 Scripts to count Lines, Files,& KiloBytes optionally qualified by patterns
  1. cfl - Count Lines in 1 File
  2. cfd - Count Files,Lines,KB in 1 Directory
  3. cfdt - Totals-Only version of Count Files,Lines,& KiloBytes in a Directory
  4. cfdpf - Count Files in a Directory with a Pattern [or not] in filenames
  5. cfdpl - Count Files in a Directory with a Pattern [or not] on any line in any file
  6. cfdd - Count Files,Lines,& KB in a ALL Sub-Dirs in a Super-Directory
  7. cfddt - Count Files,Lines,& KB in a ALL Sub-Dirs in a Super-Directory Totals-Only
  8. cfddf - Count Files,Lines,KB in ALL Sub-Dirs in a Super-Dir + 1st few files
  9. cfdmm - List Directory: File#,Lines,Minsize,Maxsize,Minrec#,Maxrec#, Dir/Filename
 Recursive scripts to search directory tree for files meeting criteria:
  rmold1 - script to remove files older than specified no of days
  lsold1 - list files older than a specified number of days
  lsnew1 - list files newer than a specified number of days
  findowner - find files for a specified owner
  findgrpnw - find files with No Group Write permissions
  findgrpnwfix - find No Group Write perms & FIX
 Text file comparisons
- diff, alldiff2, alldiff2sub
removeCR - remove Carriage Returns from text files (Windows --> Unix)
insertCR - insert Carriage Returns in text files (Unix --> Windows)
 Backup scripts scheduled by cron
dd - Unix/Linux Data utility, use when you need more than 'cp'
- other Unix/Linux aids documented in ADMjobs.htm#Part_7
  (chmod_custom1 to ensure permissions OK for nightly batch runs)
 Other Unix/Linux aids documented in ADMjobs.htm#Part_8
  (FTP,SSH,PUTTY,SAMBA,who,w,df,du,wall,write,mail)
 Scripts to process all files in a directory
- allcp,allmv,allrm,allgrep,alldiff2,allcmp,allchmod,allcancel,etc
- use when number of files > max allowed by Unix/Linux (8192)
editmfp1 - edit Multi-Files containing a specified Pattern
runsed1 - apply sed script to process all files from 1 dir to a 2nd dir
runsed2 - follow-on script to use sed command saved by runsed1 in tmp/runsed1
copysub1 - collect same name files from multiple subdirs into 1 outdir
copysub2 - alternate script to copy with '*' wildcard appended
 printable1 - ensure printable characters in a text file

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

CNVaids.doc - Contents (continued)


Part_2 - General Purpose scripts calling Vancouver Utility programs
  uvlp__ - list text files at various cpi & lpi (uvlp12,uvlp14,etc)
  uvlp13LD - 132 cols x 66 lines Landscape & Duplex (on 8 1/2 x 11)
  spreadA - list all filenames in directories 4-up
  cleanup - for COBOL & JCL, clear 73-80, convert CR/LF to LF, etc
uvfix1 - copy 1 Text file to tmp/... applying uvcopy instructions
- may then inspect (with vi tmp/...) & copy back if desired
uvfixA - copy ALL Text files from 1 subdir to a 2nd subdir
  while applying uvcopy instructions
uvfix2 - copy 1 Fixed-Length file to tmp/... applying uvcopy instructions
- may then inspect (with uvhd tmp/...) & copy back if desired
uvfixB - copy ALL Fixed-Length files from 1 subdir to a 2nd subdir
  while applying uvcopy instructions
  uvcpfix1 - copy Text files changing file-type, record-size,& reformatting
  uvcpfix2 - copy Fixed-Length records changing type, size,& reformatting
  - uvcpfix1/2 simpler than uvfix_, but not as powerful
- dropbl0 - drop ALL blank lines, copy to tmp/ & back, using 'grep'
- dropbl1 - drop ALL blank lines, copy to tmp/ & back, using 'uvcp' optn b2
- dropbl2 - reduce multi blank lines to 1, using 'uvcp' option b1
- dropbl3 - drop blank lines & COBOL cmts with only '*'s & blanks ('uvcopy')
- dropbl0,1,2,3 demo

Part_3 - Cross-References (for COBOL & JCL)
xcobcopy1 - list all 'copy'books used in each program
xcobcopy2 - shows all programs using each 'copy'book
xcobcall1 - list all 'call'ed programs in each program
xcobcall2 - shows all programs 'call'ing each program
xcobfile2 - crossref all PROGRAMS using each external-file
xcobsql1 - list all SQL Includes in any 1 PROGRAM
xcobsql2 - crossref all PROGRAMS using any 1 SQL Include
xkshfile1 - list all datafiles in each JCL/ksh/script
xkshfile2 - shows all JCL/ksh/scripts using each data-file
xkshprog1 - list all programs executed in each JCL/ksh/script
xkshprog2 - shows all JCL/ksh/scripts executing each program
xkshproc1 - list all PROCs executed in each JCL/ksh/script
xkshproc2 - shows all JCL/ksh/scripts executing each PROC
xkshparm1 - list all SYSIN/PARM modules in each JCL/ksh/script
xkshparm2 - shows all JCL/ksh/scripts referencing each SYSIN/PARM
xrefall - script to run all cross-ref reports

Part_4 - Table Summaries & Statistics (JCL, logins, record-sizes, etc)
statallmvs1 - table summaries of MVS COBOL, JCL,& Korn shell scripts
statallvse1 - table summaries of VSE COBOL, JCL,& Korn shell scripts
statmvsjcl1 - table summarize programs & top-nodes in all MVS JCLs
statvsejcl1 - table summarize programs & top-nodes in all VSE JCLs
statksh1 - table summarize programs & top-nodes in all JCL/scripts
statlogin1 - create table summary of user logins by month & userid.
table2 - general purpose table summary by any argument & 2 acums
table3d - table summary via 'key-word', preceding a 'target-word'.
tblext1 - table summary counts of file extensions in a subdir
- can use on cblx/*.err to calc compile failure percentage
tblext2 - table summary counts extensions in all subdirs of superdir
recsizes1 - create summary table of record-sizes in a text file

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

CNVaids.doc - Contents (continued)


Part_5 - COBOL Aids
- See COBOL cross-references in Part_3
- statcbl1 table summarize COBOL copybooks & called programs
  (counts copybooks & called program found in all programs)
- cobfil51 COBOL files report I/O info for all files in all programs
- converting copybooks into record layouts (cobmaps)
- Micro Focus COBOL Animation (debugging)
- Micro Focus Error messages (File status & Runtime errmsgs)
- Micro Focus 'rebuild' utility.
- acucobolx1 extract data records from AcuCOBOL Indexed files

Part_6 - JCL/script Test/Debug aids
- mvsfiles5A: script to trace data files in MVS JCL
- extracts all data files from jcl2 (JCL procs expanded)
- identify origin step# & destination step#s for each file
- jobflow51: creates jobflow reports (datafile I/O step by step)
- joblog1: capture joblogs (console log for 1 job at a time)
- providing separate sets of testdata for different programmers
- scanjcl1: scan multi-line JCL statements for pattern & qualifier
- lockdemo1: file locking, queue jobs to run serially
- lockdemo2: file locking, reject 2nd attempts until 1st completes
- lockwait1 - wait until file not in use

Part_7 - Vancouver Utility Data file aids

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

CNVaids.doc - Contents (continued)


Part_8 - Over 500 Pre-Programmed jobs, here are a few of the most useful
 tabfix1  - converts tabs to a desired number of blanks (4 default).
 tabfix2  - inserts blanks so next field at multiple of option t (default t4)
 tabfix3  - inserts blanks to place next field depending on tab rack
 tolower  - translate to lower case with options to inhibit translate within
            single &/or double quotes, clear cols 1-6 &/or 73-80 (for COBOL).
 toascii  - translate EBCDIC files to ASCII with options to specify I/O
            filenames, file types, record-sizes,& record translate areas
 scand2   - scan all files in directory for patterns & qualifiers
          - very useful to identify files that match multiple criteria
          - grep is great when you only need to scan for 1 pattern
          - scand2 scans for a primary pattern qualified by 1 or 2 patterns
            on same line & qualified by 1 or 2 patterns anywhere in the file.
 scan3d   - scan all files in a directory & select records to a report file
            that lie between any 2 specified patterns (start/stop) &
            qualified by 3rd pattern that must be or must not be present
 acum1    - accumulate any 1 field in any datafile
          - hash total to prove file validity after conversions
            or to get a 2nd opinion when COBOL reports look suspicious
 cmrpt1   - customer master sales report for test file dat1/custmas1
            (used to demo both acum1 above & selectf1 below)
 selectf1 - select records depending on field value <=> 2 spcfd values.
          - prompts for field displacement,length,type,number,& values.
 scan5d   - job to scan all files in a directory, searching for exceptions.
          - specify exception conditons in a control file of patterns
            & minimum/maximum counts. Example to find COBOL programs with
            more than 1 'PROCEDURE DIVISION' or with any (> 0) 'EXEC SQL's
 splitjclproc1 - split subdir of mixed JCLs & PROCs to separate subdirs
               - used to separate emailed zip files of mixed JCLs & PROCs
               - JCL conversion requires JCLs & PROCs in separate subdirs
               - demos uvcopy ability to read directories & process files
 splitcblcpy - split subdir of mixed COBOL programs & copybooks to
               separate subdirs (required for COBOL conversions&compiles)
 verifytext - scan text files for non-printable characters
 verifylib1 - verify module types (cbp,cpy,jcl,asm) in a library &
              create script to move unwanted types to separate library
 makecopy1  - make script to copy files (JCL/scripts) from list of filenames
            - could create list with editor or via ls subdir >tmp/script
 xref2copy1 - generate script (to copy files) from a cross-reference report
            - powerful technique useful for mainframe conversion POC's
              to select subset of JCLs & all required cbls,cpys,parms,procs
            - saves many hours of research & much more accurate

Part_9 - Aids & Tips for users new to Unix/Linux
- 'vi' essentials tutorial
- good housekeeping recommendations
- working directories, sub-directories & files

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_0 CNVaids.doc JCL/COBOL/DATA Conversion/Test/Debug Aids

Introduction & Overview

This document is intended to make you aware of the many conversion, testing, & debugging aids supplied by the Vancouver Utilities. I believe you will find many of these aids essential to the success of your conversion project.

These aids were originally in several documents (JCLcnv1demo,MVSCOBOL,MVSDATA,etc). In January 2008, this separate document (CNVaids) was created to avoid the duplications in the original documents, which now have links to this document.

Many of these aids are illustrated using supplied test/demo files & you can run many of these once you have installed the Vancouver Utilities. These 'practice sessions' will help you when you start working on your own conversions of JCL, COBOL,& DATA files.

Links to other documents

The intention here is to give you a short (1 or 2 page) introduction to the various utilities available, and then give you a link to the complete documentation which could be in various other books.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_1. CNVaids.doc Vancouver Utility Conversion Aids

Unix/Linux Aids - Contents


1A1. Profiles - profiles & related files provided in /home/uvadm/env/...
- setup user appsadm & copy to /home/appsadm/env/...
 stub_profile - modify & copy to user homedirs
- rename as .bash_profile for bash, .profile for ksh
- defines RUNLIBS as testlibs for programmers OR prodlibs for operators
- defines RUNDATA as testdata for programmers OR proddata for operators
 common_profile - called by stub_profile
- defines search PATHs to libraries & data based on $RUNLIBS & $RUNDATA

1B1. aliases - 'aliases make life easier
- alias rm,mv,cp to confirm remove or overwrite y/n
- cdd & cdl to switch easily between RUNDATA & RUNLIBS

1C1. renameX - scripts to rename all files in a directory
- renameL to lower case, renameU to UPPer case,
- renameX change extension, rename+X add ext, rename-X remove ext
- save a lot of keystrokes working with many & long filenames

1D1. dtree - draw directory tree from any specified starting directory
- see demo & try it yourself

1E1. ll? - scripts to files in a directory with various options
- llm, lla, llc, llt, lltr, lls, llsr, lln, lld, llr, llra
- following 3 scripts listed with a demo showing output results
1E2. llt - list files sorted by creation date/time (newest files 1st)
1E3. llc - list files with line counts (assumes text files)
1E4. llr - list files Recursively, descending a directory tree
  listing directories & all files within each directory

1F1. scripts to count Lines, Files,& kiloBytes in directories
 optionally qualified by specified patterns
1. cfl - Count Lines in 1 File
2. cfd - Count Files,Lines,KB in 1 Directory
3. cfdt - Totals-Only version of Count Files,Lines,& KiloBytes in a Directory
4. cfdpf - Count Files in a Directory with a Pattern [or not] in filenames
5. cfdpl - Count Files in a Directory with a Pattern [or not] on any line in any file
6. cfdd - Count Files,Lines,& KB in a ALL Sub-Dirs in a Super-Directory
7. cfddt - Count Files,Lines,& KB in a ALL Sub-Dirs in a Super-Directory Totals-Only
8. cfddf - Count Files,Lines,KB in ALL Sub-Dirs in a Super-Dir + 1st few files
9. cfdmm - List Directory: File#,Lines,Minsize,Maxsize,Minrec#,Maxrec#, Dir/Filename

1F2. v12 - help screen of above scripts, extracted from uvhelp.htm
- to illustrate counting scripts
- sample outputs for each script

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

CNVaids Part 1 Contents continued


1G1. Summary pf scripts to list/copy/move/remove old/new file
rmold1 - remove files older than the sspecified number of days
- recursive, descends directory tree searching for all old files
rmold2 - lists all old files, then prompts for each old file to be removed
rmold3 - lists all old files, then prompts once to remove all old files
lsold1 - list files older than a specified number of days
lsold2 - list files created/modified within 2 specified days old
lsnew1 - list files newer than a specified number of days
lsnew2 - list files created/modified within 2 specified days

1G2. demo lsold1 & rmold1 to remove files older than 730 days (2 years)
Note
  • see these scripts listed at https://uvsoftware.ca/scripts1.htm#4H1
  • the following scripts are not listed, but may be useful to you
  • if you have Vancouver Utilities installed, see them in sf/util/...
mvold1
  • move files older than the x days to a specified directory
cpold1
  • copy files older than the x days to a specified directory
lsold1p
  • list files older than x days & filenames with a specified pattern
lsold2p
  • list files created between 2 dates with a specified pattern
lsnew1p
  • list files newer than x days & filenames with a specified pattern
cpnew1p
  • copy files newer than the x days to a specified directory

1I1. findowner - find files for a specified owner

1J1. findgrpnw - find files with No Group Write permissions
- no group write permissions could cause scripts to fail
when a group of programmers are working on a common project

1J2. findgrpnwfix - find No Group Write perms & FIX

1M1. diff - unix/linux utility to compare 2 text files
- marvelous utility, shows changes, inserts & deletes

1M2. alldiff2 - script using 'diff' to compare all files in 2 directories
- great for confirming results of mass changes to directories
  of JCL/scripts or COBOL source programs
- this script is supplied in /home/uvadm/sf/util/alldiff2
- it employs the marvelous unix/linux system 'diff' utility,
  repeating it for each pair of files found in the 2 directories.

1M3. alldiff2sub - compare all files in all sub-dirs in a pair of super-dirs

1N1. grep - powerful unix/linux tool frequently used to search for patterns
in files. For example finding all 'EXEC' program names in JCL.

1O1. removeCR - remove Carriage Returns from text files (Windows --> Unix/Linux)
- copies to tmp/... removing CRs & prompts to copy back
1O2. insertCR - insert Carriage Returns in text files (Unix/Linux --> Windows)
- copies to tmp/... removing CRs & prompts to copy back

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

CNVaids Part 1 Contents continued


1P1. Vancouver Utility backup scripts scheduled by cron

1Q1. dd - Unix/Linux Data utility, very fast, use when you do not need the
power of 'uvcopy' but need more than 'cp'.

1Q2. dd example

1R1. other Unix/Linux aids documented in ADMjobs.htm#Part_7.
(chmod_custom1 to ensure permissions OK for nightly batch runs)
Here in CNVaids.doc, we will simply list them with a brief description.

1R2. other Unix/Linux aids documented in ADMjobs.htm#Part_8.
(FTP,SSH,PUTTY,SAMBA,who,w,df,du,wall,write,mail)
Here in CNVaids.doc, we will simply list them with a brief description.

1S1. scripts to process all files in a directory
- use when number of files > max allowed by Unix/Linux (8192)
 (allcp,allmv,allrm,allgrep,alldiff,allcmp,allchmod,allcancel,etc)

1T1. editmfp1 - edit Multi-Files containing a specified Pattern
- similar to grep pattern & pipe to vi (no Quit option)
- but editmfp1 gives you an option to Quit every 5th file

1U1. runsed1 - apply sed script to process all files from 1 dir to a 2nd dir
- great for mass changes to scripts & programs
runsed2 - follow-on script to use sed command saved by runsed1 in tmp/runsed1
- in case you wish to rerun same script on other dirs

1V1. copysub1 - collect same name files from multiple subdirs into 1 outdir
- useful for data convert requiring same name for data,copybook,etc
copysub2 - alternate script to copy with '*' wildcard appended
  to allow for different extensions in different subdirs

1W1. printable1 - ensure printable characters in a text file
- copies to tmp/... converting any unprintables to '.' periods

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1A1. CNVaids: Unix/Linux Aids

'profiles' provided in /home/uvadm/env

 /home/uvadm/env      <--- profiles provided here
 :-----stub_profile      - copy/rename to .profile (ksh) or .bash_profile (bash)
 :                       - defines RUNLIBS/RUNDATA for programmers & operators
 :-----common_profile    - common profile (called by stub_profile)
 :                         defines PATH's etc using $RUNLIBS/$RUNDATA
 :-----root_profile      - profile for root, copy to /root/.bash_profile (RedHat)
 :                         to access Vancouver Utility scripts & uvcopy jobs
 :
 /home/appsadm/env    <--- setup user 'appsadm' & copy from /home/uvadm/env/*
 :-----stub_profile      - customize & copy to homedirs .profile or .bash_profile
 :-----common_profile    - common profile (called by stub_profile)

Mainframe conversion sites should setup an application administrator userid 'appsadm', copy /home/uvadm/env/* to /home/appsadm/env,& customize profiles there depending on the locations of their libraries & data.

Do NOT customize profiles in /home/uvadm/env/... because they would be overwritten when a new version of Vancouver Utilities is installed.

We recommend the concept of 'stub' & 'common' profiles. The shell profile in each user's homedir is a 'stub' that calls 'common_profile' which are stored in /home/appsadm/env/...

  1. The supplied 'stub_profile' is copied to homedirs, renamed as '.bash_profile' for bash shell (Linux) & '.profile' for Korn shell (Unix), and then modified depending on whether the user is a programmer or operator. - defines RUNLIBS as testlibs for programmers OR prodlibs for operators - defines RUNDATA as testdata for programmers OR proddata for operators

  2. 'common_profile' then defines the 'PATH's using $RUNLIBS,$COBDIR,$UV,etc For example: export PATH=$PATH:$RUNLIBS/jcls (converted JCL/scripts). Defines software superdirs (uvadm, COBDIR, ORACLE_BASE, ORACLE_HOME, etc)

  3. '$RUNDATA' determines data-file locations indirectly as follows: $RUNDATA defines the superdir housing all data-files. All JCL/scripts call a common function 'jobset51' which changes directory to $RUNDATA (cd $RUNDATA). The JCL converter inserts jobset51 at the begining of all converted JCL/scripts and then addresses all data files relative to $RUNDATA.

Note that stub profiles must call 'common_profile' using '.' (dot execution), which means the 'export's made in the common_profile will still be effective on return to the users profile.

This system is a big advantage for any site with multiple users, it means the sysadmin can update common_profile once in 1 place & those changes are effective for all users.

See more explanations at: https://www.uvsoftware.ca/admjobs.htm#1B2

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1B1. CNVaids: Unix/Linux Aids

Recommended Aliases in profiles

Here are the 'alias' commands extracted from the recommended profile which is listed at ADMjobs.htm#1C2.

 # alias UNIX commands to prompt for overwrite (highly recommended)
 # - use \rm, \mv, \cp, when you have many files & know what you are doing
 # - '\' tells UNIX to ignore the alias & use native UNIX command
 alias rm='rm -i'              # confirm removes
 alias mv='mv -i'              # confirm renames
 alias cp='cp -i'              # confirm copy overwrites
 alias l='ls -l'               # saves a lot of keystrokes
 alias cdd='cd $RUNDATA'       # quick access to data dir
 alias cdl='cd $RUNLIBS'       # quick access to libs (same as cd)
 alias cdc='cd $CNVDATA'       # quick access to data conversion superdir

The 1st 3 (rm='rm -i',etc) are recommended for unix/linux beginners & experts since it is so easy to wipe out files unintentionally. When you do have multiple files to remove (using the '*' wildcard), you can disable the prompt by preceding the command with a backslash or using option '-f'.

cd aliases to RUNDATA, RUNLIBS,& CNVDATA

These are a great convenience for Your programmers & operators, because the recommended directory design has libraries & data in different filesystems & the paths can be long & awkward if you had to key them often.

 export RUNLIBS=/p1/testlibs      #<-- defs in .profile or .bash_profile
 export RUNDATA=/p1/testdata
 export CNVDATA=/p1/cnvdata
         --- OR ---
 export RUNLIBS=/p2/prodlibs
 export RUNDATA=/p2/proddata
 export CNVDATA=/p1/cnvdata
 alias cdd='cd $RUNDATA'          #<-- defs in common_profile
 alias cdl='cd $RUNLIBS'
 alias cdc='cd $CNVDATA'

With the above aliases in your profile, you can switch between your libraries & data with 3 character commands:


 cdd     <-- change to your data files superdir
 ===
 cdl     <-- change to your library files superdir
 ===
 cdc     <-- change to your data conversion superdir
 ===

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1B2. CNVaids: Unix/Linux Aids

aliases for 'mvstest' RUNDATA & RUNLIBS

The RUNLIBS & RUNDATA above are examples for your testing & production & must be modified depending on your directory design. You will need to modify to reflect wherever you set up testing & production directories (in different file systems with possibly long awkward pathnames).

UV Software has provided test/demo files in /home/uvadm/mvstest/... and instructed you to setup user 'mvstest' & copy the demo files over there for your testing. Your profile could then define RUNLIBS & RUNDATA as follows:

 export RUNLIBS=/home/mvstest/testlibs     <-- could define like this
 export RUNDATA=/home/mvstest/testdata
 export RUNLIBS=$HOME/testlibs          <-- better like this
 export RUNDATA=$HOME/testdata            - would not matter what userid

 cdd     <-- change to mvstest data files directory
 ===

 cdl     <-- change to mvstest library files directory
 ===

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1C1. CNVaids: Unix/Linux Aids

File Rename scripts

There are many 'rename' scripts (in /home/uvadm/sf/util/...) that we have found useful in mainframe conversions. These scripts can save you a lot of manual keying. It can be very awkward renaming many long filenames.

Here are just a few of the 27 scripts available:

renameL
  • rename all filenames in a directory to lower case
renameU
  • rename all filenames in a directory to UPPER case
renameX
  • rename all files, changing 1 specified extension to an alternate
rename-X
  • remove specified extension from all files in directory
rename+X
  • add a specified extension to all files in directory

To illustrate rename scripts, assume we have just transferred mainframe COBOL programs (UPPER case filenames) to unix/linux (subdir jcl0/...), & we wish to rename them from UPPER case to lower case & add extension '.jcl'.


 #1. l jcl0    <-- list files before rename
     ======        (UPPER case, No extension)
 -rw-rw-r-- 1 mvstest  users    648 Jan 10 07:18 JAR100
 -rw-rw-r-- 1 mvstest  users    891 Jan 10 07:18 JAR120
 -rw-rw-r-- 1 mvstest  users   1053 Jan 10 07:18 JAR130
 -rw-rw-r-- 1 mvstest  users   1053 Jan 10 07:18 JAR140
 -rw-rw-r-- 1 mvstest  users   1053 Jan 10 07:18 JAR150

 #2. renameL jcl0   <-- rename to Lower case
     ============

 #3. rename+X jcl0 .jcl   <-- add extension '.jcl'
     ==================

 #4. l jcl0         <-- list files AFTER renaming
     ======             (lower case with .jcl extension)
 -rw-rw-r-- 1 mvstest  users    648 Jan 10 07:22 jar100.jcl
 -rw-rw-r-- 1 mvstest  users    891 Jan 10 07:22 jar120.jcl
 -rw-rw-r-- 1 mvstest  users   1053 Jan 10 07:22 jar130.jcl
 -rw-rw-r-- 1 mvstest  users   1053 Jan 10 07:22 jar140.jcl
 -rw-rw-r-- 1 mvstest  users   1053 Jan 10 07:22 jar150.jcl

You can see more 'rename' scripts listed at scripts1.htm and all are available at /home/uvadm/sf/util/...

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1D1. CNVaids: Unix/Linux Aids

dtree - draw directory tree

Here is a convenient script to draw directory trees. UV Software uses it for documentation & it is illustrated here in case you can wish to use it.


 dtree /home/mvstest         <-- try this (output illustrated below)
 ===================
 /home/mvstest
 :-----cnvdata
 :-----testdata
 :     :-----ap
 :     :-----ar
 :     :-----gl
 :     :-----jobctl
 :     :-----joblog
 :     :-----jobtmp
 :     :-----rpts
 :     :-----sf
 :     :-----sysout
 :     :-----tmp
 :     :-----wrk
 :-----testlibs
 :     :-----4up
 :     :-----cbl0
 :     :-----cbl1
 :     :-----cbl2
 :     :-----cbls
 :     :-----cblst
 :     :-----cblx
 :     :-----cpy0
 :     :-----cpy1
 :     :-----cpy2
 :     :-----cpys
 :     :-----Csub
 :     :-----ctl
 :     :-----errs
 :     :-----jcl0
 :     :-----jcl1
 :     :-----jcl2
 :     :-----jcl3
 :     :-----jcls
 :     :-----joblog
 :     :-----maps
 :     :-----parm0
 :     :-----parms
 :     :-----pf
 :     :-----proc0
 :     :-----procs
 :     :-----sf
 :     :-----sfun
 :     :-----tmp
 :     :-----xref

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1E1. CNVaids: Unix/Linux Aids

ll_ scripts list files with various options

llm
  • list files in a directory, pipe to more, null reply to continue
  • all these ll_ scripts pipe to more & prompt to continue
  • llm listings are sorted alphabetically (default for 'ls -l')
lla
  • same as llm with ls option 'a' for All files (include '.' hidden files)
llt
  • list files sorted by creation date/Time, NEWEST files first
lltr
  • list files sorted by creation date/Time, OLDEST files first (Reverse)
lls
  • list files sorted by file-Size, biggest files 1st
llsr
  • list files sorted by file-Size, smallest files 1st (Reverse sort)
lln
  • list files Not including a specified suffix
llr
  • list Recursively, list directories & all files in each directory
llra
  • same as llr with ls option 'a' All files including '.' hidden files
lld
  • list Directories only matching a prefix
llc
  • list files with line-Counts (assumes text files)

See many of these scripts listed in scripts.htm. In this CNVaids.doc we will list only 1 or 2 and give examples of the outputs.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1E2. CNVaids: Unix/Linux Aids

llt - list files sorted by date/time (newest 1st)

 #!/bin/ksh
 # llt - Korn shell script from UVSI stored in: /home/uvadm/sf/util/
 # llt  - list directory long in date sequence with Newest first
 #      - pipe to more (show 1 screen & wait for null entry)
 #
 #usage with '*' wildcard patterns
 # llt dir/abc*      <-- does not work (will match only 1st occurrence)
 # llt 'dir/abc*'    <-- does work (enclose patterns in single quotes)
 #
 echo "llt - list directory in date sequence with Newest files 1ST"
 if (($# > 1));then
    echo "usage: llt directory"
    echo "       ============="
    echo "example: llt 'jcls/map*'"
    echo "         ==============="
    echo "- enclose any *wildcard patterns in single quotes"
    exit 1; fi
 #
 if [[ -z "$1" ]] ; then  d="."; else d=$1; fi
 ls -lt  $d | more
 #================
 exit 0

sample use & output


 #1. Login uvadm --> /home/uvadm

 #2. llt env     <-- list files in subdir env/...
     =======       - sorted by creation date/time (newest 1st)

llt - list directory in date sequence with Newest files 1ST -rw-r--r-- 1 uvadm apps 11018 May 9 12:04 common_profile -rw-rw-r-- 1 uvadm apps 5889 Mar 10 2011 stub_profile drwxrwxr-x 2 uvadm apps 4096 Mar 10 2011 old_profiles -rw-r--r-- 1 uvadm apps 1948 Feb 4 2011 bashrc -rw-r--r-- 1 uvadm apps 1950 Feb 4 2011 kshrc -rw-r--r-- 1 uvadm apps 2831 Feb 4 2011 root_profile -rw-r--r-- 1 uvadm apps 1828 Feb 4 2011 smb.conf -rw-r--r-- 1 uvadm apps 3301 Feb 4 2011 utilities_profile

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1E3. CNVaids: Unix/Linux Aids

llc - list files with line counts

 # llc - list all filenames in directory with line counts
 #      - assuming text files with line counts
 #      - lists  with -l (list long) & pipe to more
 echo "llc - list all filenames in directory with line counts"
 if  [[ -z "$1" ]] ; then d="."; else d=$1; fi
 if [[ ! -d $d ]]; then
    echo "usage: llc directory [n]"
    echo "       ============="
    echo "- arg1 may be omitted to assume current directory"
    echo "- else arg1 must be a directory"
    echo "- arg2 may be 'n' to inhibit pipe to more & prompt to continue"
    exit 1; fi
 typeset -R8 cnti=00000000
 typeset -R8 cntt=00000000
 integer files=0
 integer page=0
 for df in $d/*
   { if [[ -f $df ]]; then
        lsl=$(ls -l $df)
        cntx=$(wc -l $df)
        cnti=${cntx%% $df}     # drop right hand filename
        echo "$cnti $lsl"
        ((files+=1))
        ((cntt+=cnti))
        ((page+=1))            # incrmnt line count for page
        if ((page>23)) && [[ "$2" != n* ]]; then
           echo "-- enter to continue"; read reply
           if [[ "$reply" == q* ]]; then exit 1; fi
           page=0
        fi
     else
        echo "         --- bypass directory: $df"
     fi
   }
 echo "$cntt total lines in $files files in subdir $d"
 exit 0

llc - list with line counts - sample output


 llc env    <-- list files in uvadm/env/... with line counts
 =======
 llc - list all filenames in directory with line counts
       38 -rw-r--r-- 1 uvadm apps 1948 Feb  4  2011 env/bashrc
      193 -rw-r--r-- 1 uvadm apps 11018 May  9 12:04 env/common_profile
       38 -rw-r--r-- 1 uvadm apps 1950 Feb  4  2011 env/kshrc
          --- bypass directory: env/old_profiles
       49 -rw-r--r-- 1 uvadm apps 2831 Feb  4  2011 env/root_profile
      118 -rw-rw-r-- 1 uvadm apps 5889 Mar 10  2011 env/stub_profile
       56 -rw-r--r-- 1 uvadm apps 3301 Feb  4  2011 env/utilities_profile
     1767 total lines in 17 files in subdir env

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1E4. CNVaids: Unix/Linux Aids

llr - list Recursively all dirs & all files

'llr' is convenient to examine multi-level directories. For example the 'sf' (Script Files) in uvadm contains 3 subdirs. llr will list the 4 top level directories 1st & then all files in each of the subdirs.

The following example will list only the 1st 2 files in each subdir (since there are over 700 scripts in the 4 subdirs).


 #1. Login uvadm --> /home/uvadm

 #2. llt sf
     ======

llr - list directory with long & Recursive options & pipe to more sf: drwxrwxr-x 2 uvadm apps 4096 Oct 4 09:07 adm drwxrwxr-x 2 uvadm apps 4096 Sep 1 11:50 demo drwxrwxr-x 2 uvadm apps 4096 Oct 11 12:02 IBM drwxrwxr-x 2 uvadm apps 12288 Oct 13 14:00 util

 sf/adm:
 total 532
 -rwxrwxr-x 1 uvadm apps 1797 Mar 14  2011 aliases
 -rwxrwxr-x 1 uvadm apps 1448 Mar 14  2011 backupBN1
         --- omit all except 1st & last 2 ---
 -rwxrwxr-x 1 uvadm apps  799 Mar 14  2011 wipeold5
 -rwxrwxr-x 1 uvadm apps  404 Mar 14  2011 wmi
 sf/demo:
 total 292
 -rwxrwxr-x 1 uvadm apps  463 Mar 14  2011 alarm1
 -rwxrwxr-x 1 uvadm apps  836 Mar 14  2011 ccmysql
         --- omit all except 1st & last 2 ---
 -rwxrwxr-x 1 uvadm apps 1168 Mar 14  2011 wipetmp9
 -rwxrwxr-x 1 uvadm apps  460 Sep  1 11:50 zipVUdemofiles
 sf/IBM:
 total 780
 -rwxrwxr-x 1 uvadm apps  1700 Mar 14  2011 aliasMC
 -rwxrwxr-x 1 uvadm apps   748 Mar 14  2011 cblerrlst1
         --- omit all except 1st & last 2 ---
 -rwxrwxr-x 1 uvadm apps  1983 Mar 14  2011 xref2cpA
 -rwxrwxr-x 1 uvadm apps   734 Mar 14  2011 zipsql1
 sf/util:
 total 1420
 -rwxrwxr-x 1 uvadm apps 1929 May 14 15:42 acum1
 -rwxrwxr-x 1 uvadm apps  900 Mar 14  2011 allcancel
         --- omit all except 1st & last 2 ---
 -rwxrwxr-x 1 uvadm apps 2621 Mar 14  2011 xvseprog2
 -rwxrwxr-x 1 uvadm apps 2294 Mar 14  2011 xvsesli1

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1F1. Counting Files, Lines,& KB in Directories

scripts to count Lines,Files,& KB in Directories

  1. cfl - Count Lines in 1 File
  2. cfd - Count Files,Lines,KB in 1 Directory
  3. cfdt - Totals-Only version of Count Files,Lines,& KiloBytes in a Directory
  4. cfdpf - Count Files in a Directory with a Pattern [or not] in filenames
  5. cfdpl - Count Files in a Directory with a Pattern [or not] on any line in any file
  6. cfdd - Count Files,Lines,& KB in a ALL Sub-Dirs in a Super-Directory
  7. cfddt - Count Files,Lines,& KB in a ALL Sub-Dirs in a Super-Directory Totals-Only
  8. cfddf - Count Files,Lines,KB in ALL Sub-Dirs in a Super-Dir + 1st few files
  9. cfdmm - List Directory: File#,Lines,Minsize,Maxsize,Minrec#,Maxrec#, Dir/Filename

    setup to demo 9 cfd... scripts


 #0a. Login userxx ---> /home/userxx
 #0b. mkdir demo             <-- make demo/ dir in your homedir
 #0c. cp -r $UV/demo/* demo  <-- copy demo dirs/files to your demo/... dir
 #0d. cd demo                <--- change into the demo/directory

1. cfl - Count Lines & KB in 1 File


 #1. cfl $UV/src/uvcopy.c  <-- count lines in 1 file (uvcopy source program)
     ====================
      cfl /home/userxx/src/uvcopy.c - count lines in 1 file
       24400 lines,   1072 KB in /home/userxx/src/uvcopy.c
      Report left in --> /home/userxx/demo/rpts/_home_userxx_src_uvcopy.c_cfl

2. cfd - Count Files,lines,KB in 1 directory


 #2. cfd dat1   <-- Count Files,Lines,& KiloBytes in the dat1/ directory
     ========
      cfd dat1 - Count Files,Lines,KB in Directory
      File#    Lines      KB  Directory/Filename 20190726:1027
           1     335      32  dat1/CanadaMPs
           2      13       4  dat1/CanadaProvinces
           3       8       4  dat1/nameadrs1
           4     305      28  dat1/UScities
           5     539      40  dat1/UScongress
           6      50       4  dat1/USstates
      ******    1250     112  *Totals* in Directory /home/userxx/demo/dat1
                               Report left in --> /home/userxx/demo/rpts/dat1_cfd

3. cfdt - Count Files,lines,KB in 1 directory (Totals-Only)


 #3. cfdt dat1   <-- Count Files,Lines,& KiloBytes in dat1/... Totals-Only
     =========
      cfdt dat1 - Count Files,Lines,& KB in Directory - Totals-Only
       Files   Lines      KB  Directory/Filename 20190726:1027
           6    1250     112  *Totals-Only* in Directory /home/userxx/demo/dat1
                               Report left in --> /home/userxx/demo/rpts/dat1_cfdt

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1F2. Counting Files,Lines,& KB in directories

4. cfdpf - Count Files,Lines,KB in Dir with/without Pattern in filenames


 #4. cfdpf dat1 'Canada*'   <-- Count Files,Lines,KB for filenames begining with 'Canada'
     ====================
      cfdpf dat1 Canada* - Count Files,Lines,KB in Directory with Pattern [not] in filenames
      File#    Lines      KB  Directory/Filename 20190726:1027
           1     335      32  dat1/CanadaMPs
           2      13       4  dat1/CanadaProvinces
      ******     348      36  *Totals* in dat1 with pattern "Canada*"
                               Report left in --> /home/userxx/demo/rpts/dat1_cfdpf_Canada_

** 5. cfdpl - Count Files,Lines,KB with/without Pattern any line any file in dir **


 #5. cfdpl dat1 'Washington'   <-- Count Files,Lines,KB with 'Washington' on any line in any file
     =======================
      cfdpl dat1 Washington - Count Files,Lines,KB in Directory with Pattern [not] on any line in file
      File#    Lines      KB  Directory/Filename 20190726:1027
           1     305      28  dat1/UScities
           2      50       4  dat1/USstates
      ******     355      32  *Totals* in /home/userxx/demo/dat1 with  pattern "Washington"
                               Report left in --> /home/userxx/demo/rpts/dat1_cfdpl_Washington

6. cfdd - count Files,Lines,& KB in all subdirs of a superdir


 #6. cfdd $UV/sf    <-- Count Files,Lines,& KB in all Sub-Dirs of $UV/sf/...
     ===========
      cfdd  /home/userxx/sf - Count Files,Lines,& KB in SubDirs of SuperDir
        Dir#   Files   Lines      KB  SubDir/ParentDirectory  20190726:1027
           1     227    6502     944  /home/userxx/sf/adm
           2      86    2501     352  /home/userxx/sf/demo
           3     308   17102    1436  /home/userxx/sf/IBM
           4     541   21323    2248  /home/userxx/sf/util
      ******    1162   47428    4980  *Totals* for SubDirs of SuperDir /home/userxx/sf/...
                                       Report left in --> /home/userxx/demo/rpts/_home_userxx_sf_cfdd

7. cfddt - count Files,Lines,& KB all subdirs of superdir (Totals-Only)


 #7. cfddt $UV/sf   <-- Count Files,Lines,& KB in all Sub-Dirs of $UV/sf/... Totals-Only
     ============
      cfddt /home/userxx/sf - Count Files,Lines,KB in SubDirs of Super-Dir - Totals-Only
        Dirs    Files   Lines      KB  SubDir/ParentDir 20190726:1027
           4     1162   47428    4980  *Totals* for SubDirs of SuperDir /home/userxx/sf/...
                                        Report left in --> /home/userxx/demo/rpts/_home_userxx_sf_cfddt

8. cfddf - Count Files,Lines,KB in SubDirs of Super-Dir + 1st few files

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1F3. Counting Files,Lines,& KB in directories


 #8. cfddf backup 2   <-- cfddf - for all Sub-Dirs in backup Dir + 1st 2 files of each subddir
     ==============
      cfddf backup 2 - Count Files,Lines,KB in SubDirs of SuperDir + 1st few files
        Dir#   Files   Lines      KB  SubDir/ParentDirectory  20190726:1027
           1       8    1299     268  backup/archive
                   1    1299      28  backup/archive/CanadaMPs.csv
                   2    1299       4  backup/archive/ftpsall
           2       6    1250     116  backup/dat1
                   1    1250      32  backup/dat1/CanadaMPs
                   2    1250       4  backup/dat1/CAprovinces
           3      24     211     108  backup/dat2
                   1     211       4  backup/dat2/accents1
                   2     211       4  backup/dat2/accents2
      ******      38    2760     492  *Totals* for SubDirs of SuperDir /home/userxx/demo/backup/...
                                       Report left in --> /home/userxx/demo/rpts/backup_cfddf

9. cfdmm - list directory: File#,Lines,Minsize,Maxsize,Minrec#,Maxrec#


 #9. cfdmm dat1   <-- report Files,Lines,KB, Min/Max RecSize & RecNumbers in directory dat1/...
     ==========
      cfdmm dat1 - list File#,Lines,Minsize,Maxsize,Minrec#,Maxrec#,Dir/Filename
       File#   Lines      KB MinRsiz MaxRsiz MinRnum MaxRnum  Directory/FileName
           1     335      32      95      95       1     335  dat1/CanadaMPs
           2      13       4      14      34      13       5  dat1/CanadaProvinces
           3       8       4      70      75       6       7  dat1/nameadrs1
           4     305      28      75      82       2       1  dat1/UScities
           5     539      40      71      74       2     422  dat1/UScongress
           6      50       4      13      23      15      40  dat1/USstates
           6    1250     112      13      95                  *Totals* in dat1
                                Report left in --> /home/userxx/demo/rpts/dat1_cfdmm

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1F4. Counting files in directories

scripts to Count Lines & Files in directories

You can see the actual scripts listed in https://uvsoftware.htm/scripts1.htm. The following "+" links will go to scripts1.htm.

When you want to see a script coding, it is best to 'right-click' on the desired link & open in 'new-tab'. Then you will not get lost in scripts1.htm without an easy way back.


5A1+ v12 - help screen of scripts
- to count Lines, Files,& KiloBytes in directories
- optionally qualified by specified patterns
- sample outputs for each script

5B1+ cfl - Count Lines in 1 File

5C1+ cfd - Count Files,Lines,KB in 1 Directory

5D1+ cfdt - Totals-Only version of Count Files,Lines,& KiloBytes in a Directory

5E1+ cfdpf - Count Files in a Directory with a Pattern [or not] in filenames

5F1+ cfdpl - Count Files in a Directory with a Pattern [or not] on any line in any file

5G1+ cfdd - Count Files,Lines,& KB in a ALL Sub-Dirs in a Super-Directory

5H1+ cfddt - Count Files,Lines,& KB in a ALL Sub-Dirs in a Super-Directory Totals-Only

5I1+ cfddf - Count Files,Lines,KB in ALL Sub-Dirs in a Super-Dir + 1st few files

5J1+ cfdmm - List Directory: File#,Lines,Minsize,Maxsize,Minrec#,Maxrec#, Dir/Filename

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1G1. CNVaids: Unix/Linux Aids

scripts to list/copy/move/remove old/new files

These scripts are recursive, they process an entire directory tree, descending all levels, looking for files older/newer than a specified no of days.

lsold1
  • list files older than a specified number of days
lsold2
  • list files created/modified within 2 specified days old
lsnew1
  • list files newer than a specified number of days
lsnew2
  • list files created/modified within 2 specified days
rmold1
  • remove files older than the sspecified number of days
  • recursive, descends directory tree searching for all old files
  • can 1st list,move,or copy old files with lsold1,rmold1,mvold1
  • alrternates rmold2,rmold3 to prompt before removal
rmold2
  • lists all old files, then prompts for each old file to be removed
rmold3
  • lists all old files, then prompts once to remove all old files
Note
Note
  • the following scripts are not listed, but may be useful to you
  • if you have Vancouver Utilities installed, see them in sf/util/...
mvold1
  • move files older than the x days to a specified directory
cpold1
  • copy files older than the x days to a specified directory
lsold1p
  • list files older than x days & filenames with a specified pattern
lsold2p
  • list files created between 2 dates with a specified pattern
lsnew1p
  • list files newer than x days & filenames with a specified pattern
cpnew1p
  • copy files newer than the x days to a specified directory

help screens

You can see a help screen for each script, by entering the script-name only, without its required arguments (omit the directory & no of days).

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1G2. CNVaids: Unix/Linux Aids

demo lsold1 & rmold1

Given
  • data directory with file creations dates 2010,2011,2012,& 2013
Required
  • Remove any files created more than 2 years ago (730 days)

 #1 l data    <-- list data directory to see file creation dates
 =========
 -rw-rw-r-- 1 berks apps 186208 Mar 22  2013 abilitydeletesfixa
 -rw-rw-r-- 1 berks apps   2081 Dec 26  2012 berkscodes
 -rw-rw-r-- 1 berks apps    980 Sep  8  2010 empnomagmed100_100908
 -rw-rw-r-- 1 berks apps    193 Sep 14  2010 empnotice_091310
 -rw-rw-r-- 1 berks apps    205 Sep 26  2011 networkgetin
 -rw-rw-r-- 1 berks apps    180 Nov 11 09:53 othperscomptime
 -rw-r--r-- 1 berks apps  26584 Nov 24  2010 securedsite.PDF
 -rw-rw-r-- 1 berks apps    139 Sep 26  2011 sharepointnotes
 -rw-rw-r-- 1 berks apps     84 Jun 19  2013 todo

 #2. lsold1 data 730   <-- see which files will be removed
     ===============
 -rw-rw-r-- 1 berks apps 193 Sep 14  2010 data/empnotice_091310
 -rw-rw-r-- 1 berks apps 139 Sep 26  2011 data/sharepointnotes
 -rw-r--r-- 1 berks apps 26584 Nov 24  2010 data/securedsite.PDF
 -rw-rw-r-- 1 berks apps 980 Sep  8  2010 data/empnomagmed100_100908
 -rw-rw-r-- 1 berks apps 205 Sep 26  2011 data/networkgetin

 #3. rmold1 data +730 -f  <-- remove files older than 730 days (2 years)
     ===================      '-f' option Forces removal with no prompt
                              '-i' option would prompt to remove each file

 #4. l data      <-- list to see files remaining
     ======
 -rw-rw-r-- 1 berks apps 186208 Mar 22  2013 abilitydeletesfixa
 -rw-rw-r-- 1 berks apps   2081 Dec 26  2012 berkscodes
 -rw-rw-r-- 1 berks apps    180 Nov 11 09:53 othperscomptime
 -rw-rw-r-- 1 berks apps     84 Jun 19  2013 todo
Note

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1I1. CNVaids: Unix/Linux Aids

findowner - find files for a specified owner

 #!/bin/ksh
 # findowner - find files owned by specified user
 #
 if [[ -d "$1" && -n "$2" ]]; then :
    else echo "usage: findowner directory username"
         echo "       ============================"
         echo "example: findowner /u2/apps/data root"
         echo "         ============================"
         echo " - list files owned by root (& change manually to appsadm ?)"
         echo " - arg1 must be a directory, arg2 must be a useraccountname"
         echo " "
         echo "example2: findowner . root"
         echo "          ================"
         echo " - use '.' if you are above the subdirs to be searched"
         exit 1; fi
 #
 find $1 -user $2 -print
 #======================
 # - find all files owned by spcfd user & list (for manual change?)
 exit 0

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1J1. CNVaids: Unix/Linux Aids

findgrpnw - find files with No Group Write permissions

Note
  • no group write permissions could cause scripts to fail when a group
    of programmers are working on a common project
  • could be a serious problem when scripts are scheduled by cron
 #!/bin/ksh
 # findgrpnw - find files without group write permission
 #
 if [[ ! -d "$1" ]]; then
    echo "usage: findgrpnw directory"
    echo "       ==================="
    echo "example: findgrpnw /u2/apps/data"
    echo "         ======================="
    echo " - list files without group write permission"
    echo " - arg1 must be a directory, will serach all files beneath"
    echo " "
    echo "example2: findgrpnw . "
    echo "          ============"
    echo " - use '.' if you are above the subdirs to be searched"
    exit 1; fi
 #
 find $1 ! -perm /g+w -exec ls -l {} \;
 #=====================================
 # - find all files without group write permission (for manual change?)
 exit 0

1J2. findgrpnwfix find No Group Write perms & FIX

 #!/bin/ksh
 # findgrpnwfix - find files without group write permission & add group write
 #
 if [[ ! -d "$1" ]]; then
    echo "usage: findgrpnwfix directory"
    echo "       ======================"
    echo "example: findgrpnwfix /u2/apps/data"
    echo "         =========================="
    echo " - find files without group write permission & fix"
    echo " - arg1 must be a directory, will serach all files beneath"
    echo " "
    echo "example2: findgrpnwfix . "
    echo "          ==============="
    echo " - use '.' if you are above the subdirs to be searched"
    exit 1; fi
 #
 find $1 ! -perm /g+w -exec chmod g+w {} \;
 #=========================================
 # - find all files without group write permission & add group write perm
 exit 0

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1M1. CNVaids: Unix/Linux Aids

diff & alldiff2 - invaluable

The Unix 'diff' utility is fantastic whenever you want to see the difference between any 2 text files (programs,copybooks,scripts,etc).

We will illustrate the 'diff' for a COBOL program BEFORE & AFTER conversion. The COBOL converter reads input from subdir 'cbl1' & writes output to 'cbl2'.


 diff -b cbl1/car100.cbl cbl2/car100.cbl
 =======================================
 8,10c8,10
 <            select custmas assign custmas
 <                   organization sequential access mode sequential.
 <            select nalist assign nalist
 ---
 >            select custmas assign EXTERNAL custmas
 >                   organization RECORD sequential access mode sequential.
 >            select nalist assign EXTERNAL nalist
 25a26
 >        01   jobid      pic  x(8).
 28a30,31
 >            display "JOBID" upon environment-name
 >            accept jobid from environment-value.
 34c37
 <            stop run.
 ---
 >            stop run returning 0.
Note
  • Specify the old file 1st & the new file 2nd, then:
  • '<' indicates the old version
  • '>' indicates the new version
  • the Line#s & Changes/Adds/Deletes required to the old version
    to make it the same as the new version

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1M2. CNVaids: Unix/Linux Aids

alldiff2 script

The 'alldiff2' script (supplied with Vancouver Utilities) makes the unix 'diff' command even more powerful - it repeats the unix 'diff' utitity on each pair of files in 2 directories. This is great when you are make mass changes to directories - save a copy of the original, do the mass change, & run alldiff2 to confirm (changes as intended & no unintended changes).

COBOL conversion is a good example. Before each tool enhancement and re-conversion, I save the current output directory as cbls.old, then after re-conversion, I run alldiff2 to confirm changes as intended.


 #1. vi pf/IBM/cnvMF5          - modify the conversion tool (or your program)

 #2. mv cbls cbls.old          - change name of outdir (contains old versions)

 #3. mkdir cbls                - make a new directory to receive new output

 #4. uvcopy cnvMF5 ...         - reconvert COBOL programs with modified
                                 tool &/or search/replace tables

 #5. alldiff2 cbls.old cbls    <-- run alldiff to create differences report
     ======================      - in tmp/cbls.dif

 #5b. vi tmp/cbls.dif          <-- inspect difference report
      ===============

See 'alldiff2' script listed on page www.uvsoftware.ca/scripts1.htm#4A1

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1M3. CNVaids: Unix/Linux Aids

alldiff2sub - compare all files in all subdirs in 2 superdirs

Also note the 'alldiff2sub' script to compare all files in all sub-dirs in a pair of super-dirs. I use this after an on-site visit where I modify my Vancouver Utilities (several subdirs in /home/uvadm/...). On return to my home office computer I do following (need root for #1 & #2)


 #1a. login root
 #1b. cd /home

 #2a. mv uvadm uvadm.old
 #2b. mkdir uvadm tmp
 #2c. chown uvadm:apps uvadm

 #3a. Login uvadm --> /home/uvadm
 #3b. copy uvadm.zip from conversion site to my home computer
 #3c. unzip uvadm.zip

 #4a. cd /home
 #4b. alldiff2sub uvadm.old uvadm
      ===========================

 #4c. vi tmp/*        <-- inpsect differences reports

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1N1. CNVaids: Unix/Linux Aids

grep - search for patterns in files

'grep' is a powerful unix/linux tool that programmers frequently use to search for patterns in files. For example if you wanted to find all the 'EXEC' program names used in the JCL, you might use the following command:

example - grep for EXEC in all JCL


 grep ' EXEC ' jcl1/* >tmp/grepx
 ===============================

grep results

 jcl1/jar100.jcl:3://STEP010  EXEC PGM=CAR100
 jcl1/jar110.jcl:9://STEP010  EXEC PGM=CAR100
 jcl1/jar120.jcl:3://STEP010  EXEC PGM=CAR120,PARM=2002
 jcl1/jar130.jcl:5://STEP010  EXEC PGM=CAR120,PARM=2003
 jcl1/jar140.jcl:5://STEP020  EXEC PGM=CAR120,PARM=2004
 jcl1/jar150.jcl:5://STEP010  EXEC PGM=CAR150
 jcl1/jar155.jcl:4://STEP020  EXEC PGM=CAR150
 jcl1/jar200.jcl:12://STEP020  EXEC PGM=CAR100,COND=(4,LT,STEP010),PARM=2003
 jcl1/jar200.jcl:20://*STEP030  EXEC PGM=SORT,REGION=2048K
 jcl1/jgl300.jcl:5://STEP010  EXEC PGM=IEBGENER
 jcl1/jgl300.jcl:9://STEP020  EXEC PGM=IDCAMS,COND=(4,LT,STEP010)
 jcl1/jgl320.jcl:6://STEP010  EXEC PGM=IEBGENER
 jcl1/jgl320.jcl:11://STEP020  EXEC PGM=IDCAMS,COND=(4,LT,STEP010)
 jcl1/jgl330.jcl:4://STEP010  EXEC PGM=IEBGENER
 jcl1/jgl330.jcl:10://STEP020  EXEC PGM=IDCAMS,COND=(8,LT,STEP010)
 If our objective is to get a concise list of programs used in all JCL
 - grep for 'EXEC' does a poor job, because of varying step# & PARMs

Please see 'grepsum1' on page '8R1', which will sort the 'grep' search results & drop duplicates depending on options that allow you to specify the sort field by column range or by word occurrence numbers.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1O1. CNVaids: Unix/Linux Aids

removeCR - remove Carriage Returns from text files

 #!/bin/ksh
 # removeCR - Korn shell script from UVSI stored in: /home/uvadm/sf/util/
 # removeCR - remove CR's Carriage Returns x'0D'
 #          - by copy to tmp/... & prompt to copy back
 echo "removeCR - copy a file to tmp/... removing CRs, prompt to copy back"
 echo "insertCR - alternate script to insert Carriage Returns"
 df="$1";
 if [[ -f "$df" && -d tmp ]]; then :
 else echo "usage: removeCR subdir/file"
      echo "       ===================="
      echo " - arg1 must be a text file (with LFs & CRs)"
      echo " - current working directory must also contain a tmp/ subdir"
      echo " - will copy to tmp/ removing CRs & prompt to copy back"
      echo " - also see insertCR to insert CR's (create CR/LF)"
      exit 1; fi
 f=$(basename $df)
 tr -d '\r' <$df >tmp/$f
 #======================
 linesin=$(wc -l $df); sizein=$(du -bs $df);
 linesout=$(wc -l tmp/$f); sizeout=$(du -b tmp/$f);
 echo "input  lines & bytes:    $linesin $sizein"
 echo "output lines & bytes:    $linesout $sizeout"
 until [[ "$reply" = "y" || "$reply" = "n" ]]
    do echo "copy back overwriting original y/n ?"; read reply; done
 if [[ "$reply" = "y" ]]; then
    cp tmp/$f $df; echo "copied back to $df"; ls -l $df
 else echo "copy back aborted"; fi
 exit 0

demo removeCR


 #1. Login uvadm --> /home/uvadm

 #2. uvhd dat1/sales4 t  <-- display demo file with CR & LF termiantors
 ======================    - option 't' for Text files with LFs
                           - will show uvhd display for 1st record only
 rec#=1 rsize=64 fptr=0 fsize=576 rcount=9
                  10        20        30        40        50        60
 r#    1 0123456789012345678901234567890123456789012345678901234567890123
       0 21 130140    960802 IN111001  HAM001  000010 0001000 000010000..
         3323333332222333333244333333224443332233333323333333233333333300
         210130140000096080209E1110010081D00100000010000010000000010000DA
Note
  • see Carriage Return x'0D' in byte 62
  • see Line Feed x'0A' in byte 63

 #3. removeCR dat1/sales4   <-- run script to remove CR's
     ====================
     --> copy back overwriting original y/n ?
     --> n <-- reply n to not change demo file

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1O2. CNVaids: Unix/Linux Aids

insertCR - insert Carriage Returns in text files

 #!/bin/ksh
 # insertCR - Korn shell script from UVSI stored in: /home/uvadm/sf/util/
 # insertCR - insert CR's Carriage Returns x'0D' in a text file
 #          - by copy to tmp/... inserting CRs & prompt to copy back
 echo "insertCR - copy a file to tmp/ inserting CRs & prompt to copy back"
 echo "removeCR - alternate script to remove Carriage Returns"
 df="$1";
 if [[ -f "$df" && -d tmp ]]; then :
 else echo "usage: insertCR subdir/file"
      echo "       ===================="
      echo " - arg1 must be a text file (with LFs)"
      echo " - current working directory must also contain a tmp/ subdir"
      echo " - will copy to tmp/... inserting CRs & prompt to copy back"
      echo " - also see removeCR to remove CRs"
      exit 1; fi
 f=$(basename $df)
 sed 's/$/\r/' <$df >tmp/$f
 #=========================
 linesin=$(wc -l $df); sizein=$(du -bs $df);
 linesout=$(wc -l tmp/$f); sizeout=$(du -b tmp/$f);
 echo "input  lines & bytes:    $linesin $sizein"
 echo "output lines & bytes:    $linesout $sizeout"
 until [[ "$reply" = "y" || "$reply" = "n" ]]
    do echo "copy back overwriting original y/n ?"; read reply; done
 if [[ "$reply" = "y" ]]; then
    cp tmp/$f $df; echo "copied back to $df"; ls -l $df
 else echo "copy back aborted"; fi
 exit 0

demo insertCR


 #1. Login uvadm --> /home/uvadm

 #2. uvhd dat1/sales5 t  <-- display demo file with only LF terminators
 ======================    - option 't' for Text files with LFs
                           - will show uvhd display for 1st record only
 rec#=1 rsize=45 fptr=0 fsize=405 rcount=9
                  10        20        30        40        50        60
 r#    1 0123456789012345678901234567890123456789012345678901234567890123
       0 130140    44 960802 IN111001  HAM010  000010.
         333333222233233333324433333322444333223333330
         130140000044096080209E1110010081D01000000010A
Note
  • see Line Feed x'0A' in byte 44
  • will insert Carriage Return x'0D' in byte 44, shifting LF to 45

 #3. insertCR dat1/sales5   <-- run script to insert CR's
     ====================
     --> copy back overwriting original y/n ?
     --> n <-- reply n to not change demo file

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1P1. CNVaids: Unix/Linux Aids

Vancouver Utility Backups & crontabs

  1. This system takes advantage of the massive inexpensive disc systems now available to maintain zip file backups on-disc for the last 40 days, the last 15 end of month backups,& the last 7 end of year backups.

  2. Backups automatically scheduled by 'cron'

  3. Two days backup on-disc, unzipped, instantly available for file recovery.

  4. Zipped file of nightly backups maintained on-disc for 40 days, 1st of month zip file maintained on-disc for 15 months, & 1st of year zip file maintanined on-disc for 7 years.

  5. Zip file names have embedded date & time to eliminate confusion. For example, the 3 nightly zip files used in the backup examples are: proddata_yymmdd_HHMM.zip, prodlibs_yymmdd_HHMM.zip, homedirs_yymmdd_HHMM.zip.

  6. This backup system is intended application files (production data, libraries, & home dirs), that may need quick restore. Most sites will already have backups for the entire system, but those probably do not provide the quick restore possible with these smaller targeted ondisc backup files.

  7. Nightly zip files backed up to tape by cron & tapes cycled over 31 days. For smaller sites with single tape units, I suggest you simply label 31 tapes with numbers 1 to 31. Each morning the operator changes tapes & inserts the tape# for today's day of month, with no need to write anything.

  8. The nightly backup tapes can be stored onsite in fireproof vault. The end of month tape should be taken offsite & new tape inserted in rotation, progressing thru the 31 tapes, so tapes are reused maximum 31 times.

  9. Directories & devices defined in 1 place (/home/appsadm/env/common_defines), to make it easier, to install backup scripts at new sites & to make changes, when directories or tape devices change.

  10. This is achieved by having all scripts '.' dot-execute the 'appsadm profile' & 'common_defines' which define the symbols ($PRODDATA, $PRODLIBS, $BACKUP, $TAPERWD, $TAPENRW), which are used thruout the scripts. Please see the profiles listed begining on page https://www.uvsoftware.ca/admjobs.htm#1B1.

  11. Executing the backups under cron means the console logs will be 'mailed' to the crontab owner, which is 'appsadm', so the site administrator can investigate any errors.

  12. These scripts use zip/unzip for Linux, but Unix users may have to change these to gzip/gunzip or to tar+compress/uncompress/untar.

See details & examples at https://www.uvsoftware.ca/admjobs.htm#Part_4

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1Q1. CNVaids: Unix/Linux Aids

dd - Unix/Linux Data utility

The 'dd' utility is very fast and should be used when you do not need the extensive data manipulation provided by 'uvcopy', but need more than provided by 'cp'. We will illustrate a few of the basic 'dd' commands here (see the man page for others).

if=InputFile
  • specify Input Filename
of=OutputFile
  • specify Output Filename
bs=BlockSize
  • specify BlockSize (bytes)
count=blocks
  • number of blocks to be copied
skip=blocks
  • number of blocks to be skipped
conv=ascii
  • translate from EBCDIC to ASCII

notes

  1. The dd 'BlockSize' is not related to any logical 'RecordSize' in mainframe type files (such as customer masters & sales transactions).

  2. BlockSize defaults to 512. You should specify at least 4k for faster file copies. Very large BlockSizes might be slower if the disc file contained bad tracks requiring multiple read retries.

  3. If you are copying mainframe type files, to create smaller test files, specify BlockSize as a multiple of RecordSize, so your application programs will not fail on a partial record at EOF.

    dd example #1 - create a smaller test file

Assume we have a very large file (data/ar.customer.master record-size 256), and we wish to create a smaller test file (tmp/custmas1 with 10,000 records).


 dd if=data/ar.customer.master of=tmp/custmas1 bs=25600 count=100
 ================================================================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1Q2. dd - Unix/Linux Data utility

dd example #2 - translate EBCDIC to ASCII


 dd if=data/ar.sales.items of=tmp/sales1 conv=ascii
 ==================================================
  1. You can use dd 'conv=ascii' to translate EBCDIC files to ASCII, if you are certain there are no packed/binary fields, which would be destroyed if translated.

  2. If there are packed/binary fields, see www.uvsoftware.ca/datacnv1.htm which documents methods to translate the character fields, preserving packed/binary fields. Conversion jobs are generated automatically from the COBOL copybook record layouts.

  3. Usually do not need dd translate, since if you know there are no packed/ binary fields, you can simply FTP from mainframe in text mode, which performs EBCDIC to ASCII translate automatically.

    script 'dd2ascii' to translate all files in subdir

We provide a script 'dd2ascii' to copy/translate all files from 1 subdir to a 2nd subdir (which is checked by the script to ensure initially empty).

For example, assume subdir jcl0/ has 500 mainframe JCLs in EBCDIC:


 #1. mv jcl0 jcl0E         <-- rename subdir
     =============

 #2. mkdir jcl0            <-- remake new empty subdir
     ==========

 #3. dd2ascii jcl0E jcl0   <-- copy/translate all JCLs from jcl0E to jcl0
     ===================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1R1. CNVaids: Unix/Linux Aids

Unix/Linux aids documented in ADMjobs.doc Part 7

There are several other Unix/Linux aids documented in ADMjobs.htm#Part_7 and ADMjob.htm#Part_8. Here in CNVaids.doc, we will simply list them with a brief description.

 ADMjobs.htm#7B1 - chmod1 script to fix permissions on all subdirs & files
                     within a super directory.
                   - might use to ensure nightly batch jobs do not fail due
                     to bad files created by FTP or programmers using root
                     and forgetting to fix perms for batch jobs.
 ADMjobs.htm#7B1 - chmod_custom1 suggested script to run under 'root' cron
                     prior to nightly batch run by 'appsadm' cron
                   - too dangerous to run batch jobs under root

1R2. Unix/Linux aids documented in ADMjobs.doc Part 8

ADMjobs.htm#8D1 FTP - transfer files between my computers, sample session

ADMjobs.htm#8E1 SSH - Secure SHell (telnet replace) login to remote computer

ADMjobs.htm#8F1 PUTTY - SSH Terminal Emulator for Windows (free download from www.chiark.greenend.org.uk)

ADMjobs.htm#8G1 SAMBA - Linux file-server for Windows, sample config file

ADMjobs.htm#8J1 show info about other users (who,w,finger,last,lastlog)

ADMjobs.htm#8J2 Sample outputs from: who, w,& finger

ADMjobs.htm#8L1 System info commands (df, du, free, uname)

ADMjobs.htm#8M1 Killing hung-up jobs (ps & kill demo)

ADMjobs.htm#8N1 Messaging (wall, write, mail)

ADMjobs.htm#8O1 TOP - Unix/Linux system performance analysis tool

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1S1. CNVaids: Unix/Linux Aids

scripts to process ALL files in directory

Unix/Linux systems have a limit (usually 8,192) on the number of files that may be processed by various utiltiies (cp,mv,rm,grep,cmp,chmod,etc).

Vancouver Utilities provide scripts to allow unlimited number of files for various commands. You can see all of them by 'ls /home/sf/*/all*', but here are some of the most useful & the listing for 1 of them.

allcp
  • copy all files from 1 directory to a 2nd directory
allmv
  • move all files from 1 directory to a 2nd directory
allrm
  • remove all files from a directory
allgrep
  • search all files in a directory for a specified pattern
allchmod
  • change prmissions on all files in a directory
alldiff
  • compare all files in 2 directories (for text files)
allcmp
  • compare all files in 2 directories
    (for files with packed/binary fields &/or no LineFeeds)

allcp - copy all files from 1 directory to a 2nd

 #!/bin/ksh
 # allcp - Korn shell script from UVSI stored in: /home/uvadm/sf/util/
 # allcp - script to copy all files from 1 directory to a 2nd directory
 #       - use if no of files greater than allowed by UNIX shell (8192)
 #         (when you get errmsg "arg list too long")
 #       - also provides audit trail with file-counts
 #
 if [ -d "$1" -a -d $2 ]; then :
 else echo "usage: allcp dir1 dir2"
      echo "       ==============="
      echo " - arg1 & arg2 must be directories"
 exit 1; fi
 x=0;
 for i in $1/*
 do
   f=${i##*/}
   let x=x+1
   echo "copy file# $x - $1/$f "
   cp -i $1/$f $2/$f
 done
 echo "total $x files copied from $1 to $2"
 exit

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1T1. CNVaids: Unix/Linux Aids

editmfp1 - edit Multi-Files containing specified Pattern

'editmfp1' grep's all files in a directory and executes 'vi' for any files that contain a specified pattern. For example following will vi any uvcopy jobs in pf/util/... that contain 'acum'.


 editmfp1 pf/util acum  <-- vi files in pf/util/... containing 'acum'
 =====================    - enter ':q' to quit current file & proceed to next
                          - may enter 'Q' every 5th file to Quit

 grep -l acum pf/util/*  | vi  <-- usual method of grep'ing & vi'ing
 ============================    - option -l outputs filename only

'grep' & pipe to 'vi' has a problem - if there are dozens of matches, you cannot quit until you get to the end of the filename list, or kill your session from another login screen. 'editmfp1' prompts you every 5th file to Quit or continue.

 #!/bin/ksh
 # editmfp1 - edit Multi-files containing a specified Pattern
 #          - by Owen Townsend, UV Software, feb03/2013
 #
 echo "editmfp1 - edit Multi-files containing a specified Pattern"
 d="$1"; p="$2";
 if [[ -d "$d" && -n "$p" ]]; then :
    else echo "usage: editmfp1 directory pattern"
         echo "       =========================="
         echo "examfple: editmfp1 in1fix 'E#'"
         echo "          ===================="
         echo "- arg1 must be a directory, arg2 must be specified"
         echo "Enter :q for next file (not :n)"
         echo "- prompt every 5th file to allow quit before all files edited"
         exit 99; fi
 integer tf=0 ef=0 ef1=0;
 #
 for df in $d/*
   { ((tf++))            # count Total Files
     grep -q $p $df      # grep -q no output, set status 0 if pattern found
     if [[ $? -eq 0 ]];
        then vi $df      # edit files with match to pattern
             ((ef++)); ef1=$((ef%5))
             if [[ $ef1 == 0 ]]; then
                print "\nenter null to edit file# $ef OR 'Q' to Quit\n"
                read reply
                if [[ "$reply" == "Q" ]]; then exit 9; fi
             fi
     fi
   }
 echo "End editmfp1 - $ef files selected of $tf total files in directory"
 exit 0

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1U1. scripts to manipulate text files

'sed' & scripts runsed1/runsed2

'sed' is a powerful unix data manipulation utility. See documentation in the 'man' pages. Here we will illustrate only the 's' substitute commnad.


 Given - demo COBOL programs supplied in /home/uvadm/mf/cbls/...
 =====
 Required - Change all 'record sequential' to 'line sequential'
 ======== - for 1 program using 'sed' directly
          - then for all programs using script 'runsed1' (which calls sed)
Note
  • you might want to do this when converting mainframe COBOL to unix
  • so you can use unix utilities (vi,more,lp,etc) which need Line-Feeds
  • only possible if your data files do not have packed fields

 #1.  Login yourself --> /home/userxx
 #2.  mkdir tmp cbl1 cbl2         <-- make tmp subdirs if not already existing
 #2a. rm -f tmp/* cbl1/* cbl2/*  <-- or clear if existing
 #3.  cp $UV/mf/cbls/car200.cbl cbl1/  <-- copy demo program for sed
 #3a. cp $UV/mf/cbls/cgl200.cbl cbl1/  <-- copy 2nd program for runsed1

sed command to change 1 file at a time


 #4. s '/record sequential/line sequential/' cbl1/car200.cbl >cbl2/car200.cbl
     ========================================================================

 #5. diff cbl1/car200.cbl cbl2/car200.cbl  <-- confirm changes
     ====================================
      11c11
      <                   organization record sequential
      >                   organization line sequential

runsed1 script to change all files in directory


 #6. runsed1 cbl1 cbl2   <-- specify input/output directories
     =================     - will prompt for sed commands

 #6a. --> s /record sequential/line sequential/   <-- enter sed comamnd
          =====================================
 #6b. --> ^D             <-- enter control-D to end sed command entry

 #7. alldiff2 cbl1 cbl2
     ==================
      11c11
      <                   organization record sequential
      >                   organization line sequential
      diff file# 2 - cbl1/... vs cbl2/car200.cbl
      14c14
      <                   organization record sequential
      >                   organization line sequential
      diff file# 13 - cbl1/... vs cbl2/cgl200.cbl
      2 different of 29 files compared cbl1 to cbl2

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1U2. scripts to manipulate text files

runsed2 to re-run runsed1 commands

runsed1 saves the commands entered in tmp/runsed1, so if you needed to modify & re-run, you could:


 #8. vi tmp/runsed1      <-- modify sed commands saved by last runsed1
     ==============

 #9. runsed2 cbl1 cbl2 tmp/runsed1  <-- rerun (modified) sed commands
     =============================

'runsed2' could be very useful when you have a lot of sed commands. You might need to change several field-names in old mainframe COBOL, that are 'reserved words' in unix COBOL, for example:

sed 's /row/row1/' sed 's /col/col1/' sed 's /name/name1/' sed 's /cycle/cycle1/' sed 's /range/range1/' sed 's /printer/printer1/'

Vancouver Utilities includes an alternative way to mass change COBOL. Pre-programmed uvcopy job 'cobrep2' https://uvsoftware.ca/cobscan.htm#E2 has some advantages:

  1. would not change words on COBOL comments '*' column 7

  2. provides an audit trail showing modified lines

See the 'man' pages for 'sed' documentation, see a short help screen for 'runsed1' by entering command only with no arguments. See 'runsed1' script listed at https://uvsoftware.ca/scripts1.htm#6B1

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1V1. CNVaids: Unix/Linux Aids

copysub1 - collect same name files from multiple subdirs

 #!/bin/ksh
 # copysub1 - Korn shell script from UVSI stored in: /home/uvadm/sf/util/
 # copysub1 - collect same name files from multiple subdirs into 1 outdir
 #          - by Owen Townsend, UV Software, Oct17/2013
 # copysub1 - this script copies exact filename specified
 # copysub2 <-- alternate script to copy with '*' wildcard appended
 #              to allow for different extensions in different subdirs
 #
 # Renames filex by apending '_' + subdirname, for example:
 # Given: cnvdata/cpys/filex, cnvdata/maps/filex, cnvdata/pfx1/filex
 # 1. cd ...above... cnvdata/...
 # 2. mkdir tmp1
 # 3. copysub1 filex cnvdata tmp1
 #    ===========================
 # 4. ls tmp1 --> tmp1/filex_cpys, tmp1/filex_maps, tmp1/filex_pfx1
 #
 # Useful for collecting data conversion files from multi subdirs in cnvdata/...
 # - since same filename used in multi subdirs
 # - output files identified by subdir-name appended
 # - then might zip files & send to clients as 1 archive
 #
 echo "collect same name files from multiple subdirs into 1 outdir"
 echo "- rename/append subdirs: filex_subdir1, filex_subdir2, etc"
 f="$1"; d1="$2"; d2="$3";
 if [[ -d "$2" && -d "$3" ]]; then :
 else echo "usage: copysub1 filex superdir outdir"
      echo "       =============================="
      echo " - arg1 must be a filename"
      echo " - arg2 & arg3 must be directories"
      exit 1; fi
 x=0;
 for d1sd in $d1/*
  { sd=$(basename $d1sd)
    if [[ -f $d1/$sd/$f ]]; then
       sdf=${f}_$sd
       cp $d1/$sd/$f $d2/$sdf
       let x=x+1
       echo "copy file# $x $d1/$sd/$f to $d2/$sdf"
    fi
  }
 echo "total $x files copied from $d1/.../$f to $d2/..."
 exit

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1W1. CNVaids: Unix/Linux Aids

printable1 - ensure printable characters

 #!/bin/ksh
 # printable1 - Korn shell script from UVSI stored in: /home/uvadm/sf/util/
 # printable1 - script to ensure printable characters in a text file
 #            - copies to tmp/... converting any unprintables to '.' periods
 #
 # Also see uvcopy jobs printable1
 #            - same name, but in $UV/pf/util/... vs $UV/sf/util/...
 # printable1 - same function using a uvcopy job (vs shell script 'tr')
 # printable2 - alternate for fixed record length files w/o LineFeeds
 #            - not possible to process fixed length records with tr script
 #
 echo "printable1 - ensure printable characters in a text file"
 echo "           - copies to tmp/... converting any unprintables to '.' periods"
 echo "printable2 - alternate for fixed record length files w/o LineFeeds"
 df="$1"
 if [[ -f "$df" && -d tmp ]]; then :
    else echo "usage: printable1 filename"
         echo "       ==================="
         echo "example: printable1 dat1/citytax1a"
         echo "         ========================="
         echo " - arg1 must be a file"
         echo " - must be a tmp/ subdir in current working dir"
         exit 1; fi
 #
 f=$(basename $df)
 tr -c '[:print:]\012' '.' <$df >tmp/$f
 #=====================================
 echo "$df copied to tmp/... converting unprintables to '.' periods"
 echo "more tmp/$f  <-- enter to display file with more"; read reply
 more tmp/$f
 #==========
 exit 0
 #

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1X1. CNVaids: Unix/Linux Aids

tblext1 - table summary counts by file extensions

'tblext1' is fully documented at '4F1', but briefly mentioned here because it is related to the 'cfx' & 'cfdx' scripts that count files by extensions.

If you have FTP'd mixed mainframe modules into a unix directory, you might want to know the breakdown by module type.


 uvcopy tblext1,fild1=ftpdir  <-- count all files in ftpdir by .extension
 ===========================
 - will write table summary to tmp/ftpddir

sample report

 tblext1  2006/04/16_20:58:01  table summary of extensions/counts in directory
 tbl#001 pg#001     -argument-            -acum#1-    %
 line#  count    %  file extension           count
     1      37  13  .CBL                        37   13
     2       8   2  .CPY                         8    2
     3     212  75  .CTL                       212   75
     4      21   7  .JCL                        21    7
     5       1   0  .zip                         1    0
           279*100   *TOTAL*                   279 *100

1F6. cl - Count Lines in a file

 # cl - Count Lines in directory
 if [[ ! -f "$1" ]]; then
    echo "usage: cl file"
    echo "       ======="
    exit 9; fi
 wc -l $1
 #=======

'cl' is a really simple script, but an obvious companion to 'cf'


 #1. cl doc/CNVaids.doc   <-- Count Lines in "this documentation"
     ==================
     --> 8,389 <-- result

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_2. CNVaids.doc Vancouver Utility Conversion Aids

Vancouver Utility Aids - Contents


2A1. uvlp__ - 'uvlp' scripts to list files at various chars per inch
- 'uvlp12' is most popular (12 chars/inch, 60 lines/page)
- uvlp12D prints Duplex at 12 cpi, uvlp12L prints Landscape
- all the 'uvlp' scripts call the 'uvlist' utility C program
  which provides page headings with filename, date last modified,
  date listed, userID, line#,& page#.
- No more wondering where a listing came from & when it was made.
- see uvlist.htm for more about 'uvlist', the 'uvlp' scripts &
  the many options (cpi,lpi,spacing,portrait,landscape,etc)

2A2. uvlp13LD - script to list mainframe reports on PCL5 laser printers
- 132 columns x 66 lines on 8 1/2 x 11 Landscape (13 cpi, 9 lpi)

2B1. listall1 - very useful for printing all contents of a directory which
  contains many small files.
- does not page break between files, just leaves a space.
- ideal for 'parms' subdir of control cards (SORT FIELDS, etc).

2C1. spreadA - list all filenames in a directory 4-up. Convenient for listing
the hundreds of JCLs,scripts,& COBOL programs in the conversion.

2D1. cleanup - source code maintenance utility (for JCL, COBOL, etc).
- many options to translate, clear columns, gang constants, etc
- see demo for COBOL with options explained

2G0. uvfix1,A,2,B - scripts make it easy to apply powerful uvcopy instructions
  to perform whatever data file manipulation required without
  having to write the uvcopy job framework (file I/O, etc)
2G1. uvfix1 - copy 1 Text file to tmp/... applying uvcopy instructions
- may then inspect (with vi tmp/...) & copy back if desired
2H1. uvfixA - copy ALL Text files from 1 subdir to a 2nd subdir
  while applying uvcopy instructions
- may then inspect (with vi subdir2/*) & change name to subdir1
2I1. uvfix2 - copy 1 Fixed-Length file to tmp/... applying uvcopy instructions
- may then inspect (with uvhd tmp/...) & copy back if desired
2J1. uvfixB - copy ALL Fixed-Length files from 1 subdir to a 2nd subdir
  while applying uvcopy instructions
- may then inspect (with uvhd subdir2/...) & change name to subdir1

2K1. uvcpfix1 - copy 1 Text file to tmp/... applying 'uvcp' instructions
- may then inspect (with vi tmp/...) & copy back if desired
- simpler than uvfix1/uvcopy when changing file types only
2K2. uvcpfix2 - copy 1 Fixed-Length file to tmp/... applying 'uvcp' instructions
- may then inspect (with vi tmp/...) & copy back if desired
- option to output text (typ=LSTt) vs default typ=RSF (Fixed Length)

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Vancouver Utility Aids - Part2 Contents continued


2L1. dropbl0,1,2,3,4 demo
dropbl0 - drop ALL blank lines, copy to tmp/ & back, using 'grep'
dropbl1 - drop ALL blank lines, copy to tmp/ & back, using 'uvcp' optn b2
dropbl2 - reduce multi blank lines to 1, using 'uvcp' option b1
dropbl3 - drop blank lines & COBOL cmts with only '*'s & blanks ('uvcopy')

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2A1. CNVaids: Vancouver Utility Aids

'uvlp__' scripts for Laser printers

The 'uvlp' scripts (uvlp12, uvlp14, uvlp12D, uvlp12L, etc) all call the 'uvlist' text file list utility to provide page headings with filename, date last modified, date listed, userID, line#,& page#.

It is vital to Identify the various listings you make & when you made them. There are few things more frustrating than picking up some important listing & not knowing what the source filename is & when it was created.

You don't use uvlist directly but rather via 1 of the many scripts provided that specify the desired options & pipe the output to the desired printer. The printer is identified by an environmental variable in your profile


 export UVLPDEST="-dlp0"  <-- modify profile with your printer -d destination
 =======================

We will illustrate 'uvlp12' which lists at 12 cpi & leaves margins for three hole punched paper.

When testing & debugging your JCL, you might want to list out the original MVS JCL (from jcl2) & the corresponding script (from jcl3). For example:


 uvlp12 jcl2/jar200.jcl     <-- list JCL with PROCs expanded
 ======================

 uvlp12 jcl3/jar200.ksh     <-- list Korn shell script (converted JCL)
 ======================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2A2. CNVaids: Vancouver Utility Aids

Listing ALL files in a directory

You might want to list all JCL & all scripts. It might save you time in the long run. The listings give you a place to plan your changes, write your changes,& track your progress.

I suggest you use 3 hole punched paper & mount the listings in 3 ring binders. The 'uvlpd12' script will list all files in any directory leaving enough margin for the 3 hole punches.

I suggest we only need to list jcl2 (JCL with PROCs expanded) & jcl3 (converted Korn shell scripts). Don't list jcl3 (converted scripts) until you have tested a few jobs, in case improvements & re conversions are required. Of course you can try this now using the supplied test/demo JCLs which are very few.


 uvlpd12 jcl2        - list all original mainframe JCL (PROCs expanded)
 ============

 uvlpd12 jcl3        - list all scripts (converted from JCL)
 ============

list 1st page only of all files in directory

'uvlpd1p' will list the 1st page only of all files in a directory, or of all files matching a specified suffix. This is useful after COBOL compiles, which leave .err reports in subdir cblx/...err. The .err reports could be long, but we usually only need to correct the 1st error & the rest go away.


 mfcblA all cbls cblx cpys  <-- compile all cbls/... to cblx/...
 =========================    - leaving any .err reports in cblx/prgmxx.err

 uvlpd1p cblx .err   <-- print 1st page of all files in cblx/ with '.err' suffix
 =================

See many more 'uvlp__' scripts in uvlist.htm.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2A2. CNVaids: Vancouver Utility Aids

uvlp13LD - print Mainframe reports on Unix/Linux

 #!/bin/ksh
 # uvlp13LD - print Landscape DUPLEX at 13 cpi horizontal & 9 lpi vertical
 #            (135 chars wide & 66 lines down on 8 1/2 x 11 Landscape)
 #          - for mainframe reports migrated to Unix/Linux systems
 #          - pg hdngs with: filename, mod-date, today-date, page#s
 #          - for HP laserjet PCL5 printers & compatibles
 #          - by Owen Townsend - UV Software Inc - Jan 2001
 #
 #usage: uvlp13LD filename [group1] [group2]  <-- may override default options
 #       ===================================
 #
 # - 1 of several: uvlp12,uvlp14,uvlp16,uvlp12L,uvlp14L,uvlp12D,uvlp14LD,etc
 # - these scripts invokes uvlist & pipe to the spooler
 # - see uvlist.doc for many group1(file) & group2(laser printer) options
 # - these scripts convert group2 options into HP PCL5 escape sequences
 # - scriptnames reflect commonly used uvlist options, for example:
 # grp1: p66   = 66 lines per page
 #       h      = could add option 'h' to inhibit uvlist page headings
 #                (if reports already have page headings)
 # grp2: a2     - letter size paper
 #       d1    = duplex
 #       c13   = 13 cpi = 135 chars across on 11 inch wide
 #       v5.2  = vertical spacing 5.2/48" (9 lines/inch)
 #       o1    = Landscape orientation (see o3 below for holes other side)
 #       j-200 = front long edge margin offset - neg right, pos left *excetion*
 #       k-200 = back  long edge margin offset - neg right, pos left *exception*
 #       m050  = front short edge margin offset - neg up, pos down
 #       n-100 = back  short edge margin offset - neg down, pos up *exception*
 #
 # .profile should specify environmental variables for 'lp', for example:
 # export UVLPDEST="-dlp0"       #<-- destination 'lp0' ("-dLPT1" for SFU)
 # export UVLPDEST=""            #<-- null to use lpadmin default
 # export UVLPOPTN="-onobanner"  #<-- 'nobanner' option for lp
 # export UVLPOPTN=""            #<-- null disable for Windows SFU
 if [ ! -f "$1" ]; then echo "ERROR - $1 is not a file"; exit 1; fi
 #
 uvlist $1 p66$2 a2o1d1p80j-200k-200m050n-100c13v=5.2,$3 | lp $UVLPOPTN $UVLPDEST
 #===============================================================================
 uvln=$(basename $0)
 linesf=$(wc -l $1); lines=${linesf% *}
 echo "$uvln printing $1 on $UVLPDEST, lines=$lines"
 exit 0

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2B1. CNVaids: Vancouver Utility Aids

listall1 - List All (small) Files in Directory

'listall1' is very useful for printing all contents of a directory which contains many small files, because it does not page break between files (just leaves a space). 'listall1' is ideal for listing the 'parms' subdir which contains control cards (SORT FIELDS, etc).

listall1 - sample command & output


 listall1 parms    - list all files in directory (space only between files)
 ==============

file# 1 - parms/ikjdemo1 DSN SYSTEM(DB2P) RUN PROGRAM(IKJPROG1) PLAN(IKJPROG1) LIB('MEPP.WXS91.LOADLIB') END

file# 2 - parms/pap100s1 SORT FIELDS=(78,2,CH,A,61,15,CH,A,11,25,CH,A)

file# 3 - parms/pgl200s1 SORT FIELDS=(1,8,CH,A,69,12,CH,A)

file# 4 - parms/ppy200s2 SORT FIELDS=(1,19,CH,A,75,6,CH,A)

See 'listall1' at /home/uvadm/sf/util/listall1

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2C1. CNVaids: Vancouver Utility Aids

spreadA - list files 4-up for doc & control

To create 4-up module name listings, use the 'spreadA' UV script:

spreadA - Operating Instructions


 #1. mkdir 4up         - make output dir if not already existing
     =========

 #2. spreadA cbls      - create 4-up listing of all COBOL programs
     ============      - prompts for report disposition
 spread1 - convert a file of 1 item/line to multi items/line
 uop = q1a0b0c14s1n5   - 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) -->
 End of Job, Output has been written to: 4up/cbls
 enter command: vi,cat,more,lp,uvlp12,etc (or null) --> uvlp12 <-- enter cmd

spreadA - sample report


 $jobname: 4up/cobs  options=q1a0b0c14s1n5  date=2004/04/05_14:46:04
 ===========================================================================
 ars010.cbl     ars020.cbl     ars030.cbl     ars040.cbl     dms001.cbl
 dms002.cbl     dms010.cbl     dms020.cbl     dms030.cbl     dms031.cbl
 dms040.cbl     dms041.cbl     dms110.cbl     dms200.cbl     dms210.cbl
 dms211.cbl     dms212.cbl     dms213.cbl     dms214.cbl     dms250.cbl
 dms260.cbl     dms310.cbl     dms311.cbl     dms312.cbl     dms313.cbl
 dms314.cbl     pas100.bat     pas100.cbl     pas110.cbl
 00029 total items in 4up/cobs

 #3. uvlp12 4up/cbls     - OR print report from 4up subdir
     ===============       if print command not entered at prompt above

See 'spreadA' script listed at script.htm#28A or /home/uvadm/sf/util/spreadA. 'spreadA' script calls uvcopy job 'spread1' from /home/uvadm/pf/util/spread1.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2C2. CNVaids: Vancouver Utility Aids

spreadA - list files 4-up for doc & control

If you are begining a mainframe conversion, I strongly suggest you run the 4-up reports for all files transferred from the mainframe. These will be a big help in controlling your conversion project. You might use the 4-up reports in conjunction with the cross-reference reports in Part_3.


 #0. mkdir 4up       - make output dir if not already existing
     =========

 #1. spreadA cbl0    - create 4-up listing of all COBOL program names
     ============      (transferred from mainframe, not yet converted)

 #2. spreadA cpy0    - create 4-up listing of all CopyBook names
     ============

 #3. spreadA jcl0    - create 4-up listing of all JCL names
     ============

 #4. spreadA proc0   - create 4-up listing of all PROC names
     =============

 #5. spreadA parm0   - create 4-up listing of all SYSIN/PARM modules
     =============
Note
  • spreadA prompts for report disposition
  • reply 'uvlp12' to print immediately
  • OR, you could reply null & print all reports in 4up/... as folows

 #6. uvlpd12 4up    <-- print all reports in subdir 4up/...
     ===========
Note
  • after conversion, you might print converted results as follows
  • mainframe files stored in '0' subdirs (cbl0,cpy0,jcl0,proc0,parm0)
  • converted files stored in 's' subdirs (cbls,cpys,jcls,procs,parms)

 #1a. spreadA cbls    - create 4-up listing of all COBOL program names
      ============      (after conversion)

 #2a. spreadA cpys    - create 4-up listing of all CopyBook names
      ============

 #3a. spreadA jcls    - create 4-up listing of all JCL/script names
      ============      (Korn shell scripts)

 #4a. spreadA procs   - create 4-up listing of all PROCs
      =============   - N/A, 1 time expansion into JCL/scripts during conversion

 #5a. spreadA parms   - create 4-up listing of all SYSIN/PARM modules
      =============   - some modules may be inserted into JCL during conversion

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2D1. CNVaids: Vancouver Utility Aids

cleanup - source code maintenance utility

'cleanup' is a uvcopy job to copy source code (COBOL,JCL,etc) with many options (translate, clear columns, gang constants, modify copbooknames, etc).


 uvcopy cleanup   <-- minimum entry, will prompt for options & filenames
 ==============
 uop=a0b0c0d0e0f0g0j0k0n0p0r0s0t0v1w0x0y0z0 - dflt options (copy no chg)
     a1                 - inhibit changes to lines with "*" col 1 (asmblr)
     a2                 - squeeze lines with "*" col1 to 1 blank btwn words
     a4                 - concatenate lines with nonblank in col 72
       b1               - drop all blank lines
       b2               - drop lines blank in cols 2-128 (ignore col 1)
       b4               - convert blank lines to * col 7 (for COBOL)
       b8               - inhibit drop of x"1A" col 1 DOS EOF markers
         c1             - translate COBOL copy BOOKNAMES to lower case
         c2             - translate COBOL copy booknames to UPPER case
         c4             - change "/INCLUDE cpybknm" to "copy cpybkname."
           d1           - convert double quotes to singles
           d2           - convert single quotes to doubles
             e1         - enclose COBOL copy "booknames" in double quotes
             e2         - append copybook names with ".cpy" (in programs)
             e4         - enclose sql include "filenames" in double quotes
             e8         - append sql filenames with ".cpy" (in programs)
               f1       - insert #!/bin/ksh & drop any existing (ID on #!/)
               f2       - insert VSE // JOB jobname (jobname from filename)
                 g1     - sequence number columns 73-80 incrementing by 1
                 g2     - sequence number columns 73-80 incrementing by 10
                 g4     - gang program name in 73-80 (any .ext removed)
                 g8     - clear columns 73-128 to blanks
                   j1   - translate call subrtn names to lower case
                   j2   - translate call subrtn NAMES to UPPER case
                     k1 - enclose call subrtn names in double quotes
                   l1   - inhibit changes to lines with "*" col 7 (COBOL)
                   l2   - if period/quote beyond col 72 squeeze left
                   l4   - clear cols 73-80 only if all digits
                   l8   - split files with multiple COBOL programs
                 n1     - translate output filename to lowercase
                 n2     - translate output filename to UPPERcase
                 n4     - remove any existing extension on output filename
                 n8     - inhibit default translate $*? to _ in filename
               p1       - convert " picture " to " pic "
             r1         - remove any : colons from columns 1-71
           s1           - sequence# in columns 1-6 incrementing by 1
           s2           - sequence# in columns 1-6 incrementing by 10
           s4           - copy to cols 1-6 from cols 73-78
           s8           - clear columns 1-6 to blanks
         t1             - translate text to lower (except in quotes)
         t2             - translate text to UPPER
       v1               - cnvrt tabs to blanks (v2 = 2 blanks, etc)
     w1                 - drop lines with " PAGE " anywhere in 80-128
     w2                 - drop lines with "MEMBER NAME" anywhere in 1-80
     w4                 - drop lines " CBL LIB, STA, SXR" cols 1-8 line 1
   x#                   - shift left  #columns (x6 shifts 7-128 to 1-122)
   y#                   - shift right #columns (y6 shifts 1-122 to 7-128)
 z1                     - inhibit changes to lines with "#" col 1 (scripts)

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2D2. CNVaids: Vancouver Utility Aids

cleanup demo - for COBOL programs


 uvcopy cleanup   <-- minimum entry, will prompt for filenames & options
 ==============

 uvcopy cleanup,fili1=cbl0/CAR200.cbl,filo1=cbl1/car200.cbl,uop=c5e15g8j1k1l1n1s8t1
 ==============================================================================

Or we can enter filenames & options on the command line as above, Or we could enter just the filenames,& be prompted for options as below:

 User OPtion (uop) defaults  = q1a0b0c0d0e0f0g0j0k0n0p0r0s0t0v1w0x0
  null to accept or re-specify (1 or more) --> c5e15g8j1k1l1n1s8t1 <--- NOTE

cleanup demo - sample INPUT

 000010 IDENTIFICATION DIVISION.                                         CAR200
 000020 PROGRAM-ID. CAR200.                                              CAR200
 000030 ENVIRONMENT DIVISION.                                            CAR200
 000040 INPUT-OUTPUT SECTION.                                            CAR200
 000050 FILE-CONTROL.                                                    CAR200
 000060     SELECT SALEDTL ASSIGN SALEDTL                                CAR200
 000070            ORGANIZATION SEQUENTIAL ACCESS MODE SEQUENTIAL.       CAR200
 000080 DATA  DIVISION.                                                  CAR200
 000090 FILE SECTION.                                                    CAR200
 000100 FD  SALEDTL RECORD CONTAINS 64 CHARACTERS.                       CAR200
 000110     01 SALEREC. COPY SALEDTL.                                    CAR200

cleanup demo - sample OUTPUT

        identification division.
        program-id. car200.
        environment division.
        input-output section.
        file-control.
            select saledtl assign saledtl
                   organization sequential access mode sequential.
        data  division.
        file section.
        fd  saledtl record contains 64 characters.
            01 salerec. copy "saledtl.cpy".

Note the effect above of the options entered: ---> c1g8s8t1e3 (here are explanations from the previous page)

         c1             - translate COBOL copy BOOKNAMES to lower case
             e1         - enclose COBOL copy "booknames" in double quotes
             e2         - append copybook names with ".cpy" (in programs)
                 g8     - clear columns 73-128 to blanks
           s8           - clear columns 1-6 to blanks
         t1             - translate text to lower (except in quotes)

Note that options are 'binary', hence we enter 'e3' to select both e1 & e2. The input COPY SALEDTL (no quotes) is changed to "saledtl.cpy" (in double quotes & extension .cpy added). Also translated to lower case due to option 'c1'.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2G0. CNVaids: Vancouver Utility Aids

uvfix scripts & uvcopy jobs

If you can't perform your desired data file manipulation using unix 'sed', you can do anything you can imagine with the 'uvcopy' utlity.

'uvcopy' can do many things not possible with the standard unix/linux utilities such as 'sed' - processing 'packed decimal fields', handling 'Indexed files', & 'field addressing by column#' (common in mainframe utilities, but not in unix utilities).

The interpretive nature of uvcopy makes it easy to learn & to use. If you have a mainframe backgound, you may already be familiar with the uvcopy instruction formats since they are patterned after the IBM 360 assembler, but interpretive - no compile required, just edit & execute with the uvcopy interpreter.

uvcopy has over 90 instructions and about half of these are pwerful subfunctions. For example 'fix' will convert delimited files with any specified delimiter (tab, comma, pipe, etc) to fixed formats. 'fix' is very useful to convert the tab or csv delimited files from Excel spread- sheets to fixed format files required by COBOL applications. The 'var' instruction (opposite of 'fix') will convert fixed-formats to delimited formats for importing into spread-sheets or database tables.

uvfix scripts - easy way to use uvcopy

The 'uvfix' scripts make it easy to employ the powerful uvcopy instructions without having to program the uvcopy framework (file I/O, etc). You only need to enter the uvcopy instructions desired when prompted. See https://www.uvsoftware.ca/uvcopy3.htm for the 90 instructions available.

There are 4 'uvfix_' scripts (in /home/uvadm/sf/util/...) that call 4 'uvfix_' uvcopy jobs (from /home/uvadm/pf/util/...). The scripts make the command line as simple as possible - specify only the input file-name & record-size if fixed. The output files are written to the tmp/... subdir (in your current dir) where you can inspect & then copy back overwriting the input file if desired.

uvfix1
  • copy 1 Text file to tmp/... applying uvcopy instructions
  • may then inspect (with vi tmp/...) & copy back if desired
uvfixA
  • copy ALL Text files from 1 subdir to a 2nd subdir
    while applying uvcopy instructions
  • may then inspect (with vi subdir2/*) & change name to subdir1
uvfix2
  • copy 1 Fixed-Length file to tmp/... applying uvcopy instructions
  • may then inspect (with uvhd tmp/...) & copy back if desired
uvfixB
  • copy ALL Fixed-Length files from 1 subdir to a 2nd subdir
    while applying uvcopy instructions
  • may then inspect (with uvhd subdir2/...) & change name to subdir1

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2G1. uvfix scripts & uvcopy jobs

demo uvfix1,A,2,B

Here are some demos used to illustrate the 4 uvfix_ scripts available. You can run these demos from /home/uvadm/ using the demo files provided in /home/uvadm/dat1/...


 #0. Login uvadm --> /home/uvadm
 #0a. Or Login yourself if you are in same group as uvadm
 #0b. cd /home/uvadm

uvfix1 ex#1 - modify 1 text file with 'mvc'


 Given - text file /home/uvadm/dat1/names1
 ===== - multiple sets of 5 line Names & Addresses
       - 1st 5 records shown below

 #1. more dat1/names1      <-- investigate Input file
     ================
      Owen Townsend
      UV Software
      4667 Hoskins Rd
      North Vancouver BC Canada
      V7K2R3

 Required - replicate the records for 3 up label printing
 ======== - see desired output below following #4. ...

 #2. uvfix1 dat1/names1  <-- run uvfix1 & enter instructions
     ==================      at the prompts as follows:
     uop=q1n99r8192 - user option defaults
           n99      - output record count limit (high# copies to EOF)
              r8192 - recsize ONLY for Fixed-Length OUTPUT records if desired
                    - for Fixed-Length, reply RSF/RST at prompt (default text typ=LSTt)
                    - for Text files: accept default recsize & default typ=LSTt
     User OPtion (uop) defaults  = q1r8192n999999

 #2a. -->null accept or override -->  <-- null entry to accept defaults
 #2b. -->LST = default file type -->  <-- null accept typ=LST

 #3. Enter Instructions or '.' to process
     ===================================
 #3a. mvc b27(25),a0    <-- move(copy) cols 1-25 to 28-53"
 #3b. mvc b56(25),a0    <-- move(copy) cols 1-25 to 56-71"
 #3c. .                 <-- enter '.' to end instrns & execute job"

 #4. more tmp/names1    <-- inspect output file
     ===============      - 1st 5 records as follows:
     Owen Townsend              Owen Townsend                Owen Townsend
     UV Software                UV Software                  UV Software
     4667 Hoskins Rd            4667 Hoskins Rd              4667 Hoskins Rd
     North Vancouver BC Canada  North Vancouver BC Canada    North Vancouver BC Canada
     V7K2R3                     V7K2R3                       V7K2R3

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2G2. uvfix scripts & uvcopy jobs

uvfix1 ex#2 - convert Tab-delimited file to Fixed-format


 Given - tab delimited file of Employer-Codes, User-Names,& Email Addresses
 ===== - from Excel spreadsheet, saved as 'Tab_Delimited',& transferred to Unix
       - see uvhd display of 1st 4 records (field header & 1st 3 data records)
       - note tabs show as '.'s & x'09's in uvhd vertical hexadecimal display
required
  • convert to the Fixed-Format shown below

 uvhd /home/owen/dat1/payemails t
 ================================
 rec#=1 rsize=37 fptr=0 fsize=121 rcount=4
                   10        20        30        40        50        60
 r#     1 0123456789012345678901234567890123456789012345678901234567890123
        0 PayrollService.Username.EmailAddress.
          5677666567766605767666604666646676770
          0192FCC352693595352E1D595D19C1442533A
 rec#=2 rsize=32 fptr=37 fsize=121 rcount=4
                   10        20        30        40        50        60
 r#     2 0123456789012345678901234567890123456789012345678901234567890123
       37 acupay.Sheila.Sheila@acupay.com.   <-- '.'s are Tabs or LineFeeds
          66776705666660566666466776726660   <-- Tabs x'09' (vertical hex)
          13501993859C193859C10135019E3FDA   <-- LF's x'0A' (vertical hex)
 rec#=3 rsize=28 fptr=69 fsize=121 rcount=4
                      10        20        30        40        50        60
 r#     3 0123456789012345678901234567890123456789012345678901234567890123
       69 adcomp.Jack.Jack@adcomp.com.
          6666670466604666466666726660
          143FD09A13B9A13B0143FD0E3FDA
 rec#=4 rsize=24 fptr=97 fsize=121 rcount=4
                      10        20        30        40        50        60
 r#     4 0123456789012345678901234567890123456789012345678901234567890123
       97 adp.Linda.Linda@adp.com.
          667046666046666466726660
          1409C9E419C9E410140E3FDA

Fixed-Format created by uvfix1 from tab-delimited

 payrollservice      username            emailaddress
 acupay              sheila              sheila@acupay.com
 adcomp              jack                jack@adcomp.com
 adp                 linda               linda@adp.com

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

uvfix1 ex#2 (continued) Tab-delimited to Fixed-format


 #0.  Login uvadm --> /home/uvadm
 #0a. Or Login yourself if you are in same group as uvadm
 #0b. cd /home/uvadm

 #1. uvhd dat1/payemails t    <-- use uvhd to investigate file
     =====================      - option 't' (Text file, with tab delimiters)

 #2. uvfix1 dat1/payemails    <-- run uvfix, specify input file only
     =====================      - output file will be tmp/payemails
 #2a. -->      <-- prompt for options, reply null
 #2b. --> LSTt <-- prompt for output file type, reply null accept LSTt default
      --> reply to instruction prompts as follows:

 #3.      reply to instruction prompts as follows:
          ========================================
 #3a. --> fix c100(100),a0(80),3,x'09' <-- convert to fixed fields 100 apart
                                - copies from area 'a' to c100,c200,c300
 #3b. --> mvc b00(20),c100    <-- store Employer-Code in cols 1-20
 #3c. --> mvc b20(20),c200    <-- store User-Name in cols 21-40
 #3d. --> mvc b40(60),c300    <-- store Email-SAddress in cols 41-100
 #3e. --> trl b0(100)         <-- ensure all lower-case
 #3f. --> .                   <-- '.' ends input instrns, executes,
          ===========              & writes output to tmp/payemails

 #5. vi tmp/payemails         <-- inspect output
     ================

 #6. cp tmp/payemails dat1/   <-- copyback overwriting original
     ======================     - or change name as desired

Notes

  1. See all uvcopy instructions documented at www.uvsoftware.ca/uvcopy3.htm

  2. uvfix1 prompts for instructions until you ennter '.' to end input.

  3. uvfix1 executes as follows:

3a. Reads each record into area 'a' & copies to area 'b' for possible output (In example above, we fix to area 'c' & then move to area 'b' for output).

3b. Executes stored instructions on each record.

3c. Writes record from area 'b', would write to output file unchanged if you entered no instructions (just entered '.' to end instruction input).

  1. If you wanted to inhibit output, you would enter 'ret<' instruction, which returns with condition code <, which inhibits the ussual write. You would precede with some compare for something & skip 1 (over the ret<) if you want to output the record (ret= is automatic at end your instructions).

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2H1. uvfix scripts & uvcopy jobs

uvfixA - modify ALL Text files in subdir


 Given - directory of COBOL programs /home/uvadm/mf/cbls
 =====

 Required - copy/modify all mf/cbls/* to tmp2/...
 ======== - clear cols 1-6 & sequence# in cols 1-4
          - translate to lower case (except in quotes)

 #0. Login uvadm --> /home/uvadm
 #0a. Or Login yourself if you are in same group as uvadm
 #0b. cd /home/uvadm

 #1. mkdir tmp2          <-- make outpur subdir
 #1a. rm -f tmp2/*         - or clear all files if tmp2 already exists

 #2. uvfixA mf/cbls tmp2 LSTt [options] <-- indir outdir type [options]
     ==================================   - options default OK for this job
      uop=q1r8192n99999 - user option defaults
            r8192       - output reccsize for fixed length records typ=RSF/RST
                        - for text files: accept default recsize & default typ=LSTt
                n999999 - output record count limit (high# copies to EOF)
      User OPtion (uop) defaults  = q1r8192n999999

 #2a. -->null to accept or enter/override -->   <-- null reply, no options required
 #2b. -->did you create outdir (dflt tmp) --> y <-- reply 'y' to continue

 #3.      reply to instruction prompts as follows:
          ========================================
 #3a. --> clr    b0(6),' '   <-- enter instrn to clear cols 1-6
 #3b. --> add    $ca1,1      <-- increment line counter
 #3c. --> mvn    b0(4),$ca1  <-- insert seuw=ence# in cols 1-4
 #3d. --> trlq3  b0(80)      <-- translate to lower case (except in quotes)
 #3e. --> .                  <-- enter '.' to end keyins & execute

sample output - 1st 8 lines of 1st program

 0001   identification division.
 0002  * car200 - test mainframe conversion to micro focus cobol
 0003  *        - vancouver utilities from www.uvsoftware.ca
 0004  *        - list sales details with customer name from custmas
 0005   program-id. car200.
 0006   environment division.
 0007   input-output section.
 0008   file-control.

^^^^ <-- sequence# gnerated by #3b & #3c above

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2I1. uvfix scripts & uvcopy jobs

uvfix2 - modify 1 Fixed-length file


 Given    - dat1/custmas1 with 12 mths sales 5 bytes packed for thisyear & lastyear
 =====    - thisyear sales (12*5=60 bytes) in bytes 120-179 & lastyear in 180-239

 Required - move this year sales to last year & clear thisyear
 ========

 #1. uvhd dat1/custmas1    <-- investigate Input file
     ================== note - thisyr sales 12 * 5 bytes packed start at 120
                             - lastyr sales 12 * 5 bytes packed start at 180
 rec#=1 rsize=256 fptr=0 fsize=8192 rcount=32
                   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}.......
          0000000005300016000000002570063100095000000000000000013570000000
          0C0000C0270D0540C0000C0098D0263C0444C0000C0000C0000C0246D0000C00
      192 .E|...V}.......................f.....<........f.C 19950531
          0470005700000000880000000018000680001300000000694233333333222222
          35C0046D0000C0023C0000C0083C0056D0012C0000C0016D3019950531000000

 #2. uvfix2 dat1/custmas1 r256  <-- run script, specify input file,& option
     =========================    - 'r256' for input record-size
                                  - also used for out recsize if option s0
      uop=q1n99r0s0      - user option defaults
            n99          - output record limit (n99 means all records)
               r0        - Input Record size must be specified
               r8192     - max record-size 8192
                    s0   - Output Recsize defaulted from Input recsize if s0
                    s80  - may specify a value to override the default from in recsize
      User OPtion (uop) defaults  = q1n99r0s0r256

 #2a. -->null accept or override -->  <-- null reply (options on command line)
 #2b. -->RSF = default file type -->  <-- null accept typ=RSF

 #3.      reply to instruction prompts as follows:
          ========================================
 #3a. --> mvc    b180(60),a120      <-- move thisyear sales to lastyear sales
 #3b. --> mvnx12 b120(5p),0         <-- clear 12 thisyear sales to 5 bytes packed 0
 #3c. --> .                         <-- enter '.' end instructions & execute

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

uvfix2 - move thisyear to last & clear thisyear


 #4. Check output file with uvhd

 #4a. uvhd tmp/custmas1  <-- investigate Output file
      =================    - thisyr sales 12*5 bytes packed 120-179 now all 0
                           - lastyr sales 12*5 bytes packed 180-239
                             now moved from 120-179 (same as 120-179 above Input)
 rec#=1 rsize=256 fptr=0 fsize=8192 rcount=32
                   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     ........
          4442222222222442535343222233323332333324455525544442222200000000
          9DF00000000002306931810000250D754D55310C12290725E38000000000C000
      128 ......................................................4V|.......
          0000000000000000000000000000000000000000000000000000013570000000
          0C0000C0000C0000C0000C0000C0000C0000C0000C0000C0000C0246C0000C00
      192 .....W0....`........)X}..f3.....\...............C 19950531
          0000053000160000000025700631000950000000000000004233333333222222
          00C0270D0540C0000C0098D0263C0444C0000C0000C0000C3019950531000000

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2J1. uvfix scripts & uvcopy jobs

uvfixB - modify ALL Fixed-Length files in subdir


 Given    - directory of sales files with 6 digit dates yymmdd in cols 14-15
 =====    - Y2K demo convert 6 digit dates to 8 digits

 Required - convert to 8 digit date ccyymmdd, shifting cols 14-62 to 16-64
 ======== - insert cc as '20' if yy < 50 (1950) or '19' if yy > 50

 #1. mkdir tmp1 tmp2          <-- make subdirs for demo
 #1a. rm -f tmp1/* tmp2/*       - or clear if already existing

 #2. cp dat1/[123] tmp1/      <-- copy sales1,2,3 from dat1/... to tmp1/...

 #3. uvhd dat1/tmp1 r64       <-- investigate Input, must use uvhd (no LineFeeds)
     ==================         - see sample Input records for uvfix2 above
                                - note 6 digit date in bytes 13-18 (cols 14-19)
 rec#=1 rsize=64 fptr=0 fsize=1280 rcount=20
                   10        20        30        40        50        60
 r#     1 0123456789012345678901234567890123456789012345678901234567890123
        0 130140    21 940802 IN111001  HAM001  00002{ 0000001 00000002{
          3333332222332333333244333333224443332233333723333333233333333722
          130140000021094080209E1110010081D0010000002B00000001000000002B00
 rec#=20 rsize=64 fptr=1216 fsize=1280 rcount=20
                   10        20        30        40        50        60
 r#    20 0123456789012345678901234567890123456789012345678901234567890123
     1216 406082    65 020816 IN441     VAR200  00001R 0009001 00017101R
          3333332222332333333244333222225453332233333523333333233333333522
          406082000065002081609E441000006122000000001200009001000017101200

 #4. uvfixB tmp1 tmp2 RSF r64s66  <-- run script, specify I/O subdirs,& options
     ===========================      for in recsize & out recsize
      uop=q1r0s0n99     - user option defaults
            r0          - must specify input recsize
            r8192       - max record-size 8192
                 s0     - Output Recsize defaulted from Input recsize if s0
                 s80    - may specify value to override default from in recsize
                    n99 - output record limit (n99 means all records)
      User OPtion (uop) defaults  = q1r0n999999r64s66

 #4a. -->null accept or override -->  <-- null reply (options on command line)
 #4b. -->RSF = default file type -->  <-- null accept typ=RSF
 #4c. -->did you create outdir   --> y <-- reply 'y' to continue

 #5.      reply to instruction prompts as follows:
          ========================================
 #5a. --> ins  b13(51),'20'    <-- assume 2000+
 #5b. --> cmc  a13(2),'50'     <-- 1951-1999 ?
 #5c. --> skp< 1
 #5d. --> mvc  b13(2),'19'     <-- yes - change '20' to '19'
 #5e. --> .                    <-- enter '.' to end keyins & execute

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

uvfixB (cont) - Y2K demo check 1st output file


 #6. uvhd dat1/sales1 r64l66  <-- investigate Ouput, must use uvhd (no LineFeeds)
     =======================    - showing only 1st & last records below:
 rec#=1 rsize=66 fptr=0 fsize=1320 rcount=20
                   10        20        30        40        50        60
 r#     1 012345678901234567890123456789012345678901234567890123456789012345
        0 130140    21 19940802 IN111001  HAM001  00002{ 0000001 00000002{
          333333222233233333333244333333224443332233333723333333233333333722
          13014000002101994080209E1110010081D0010000002B00000001000000002B00
 rec#=20 rsize=66 fptr=1254 fsize=1320 rcount=20
                   10        20        30        40        50        60
 r#    20 012345678901234567890123456789012345678901234567890123456789012345
     1254 406082    65 20020816 IN441     VAR200  00001R 0009001 00017101R
          333333222233233333333244333222225453332233333523333333233333333522
          40608200006502002081609E441000006122000000001200009001000017101200
                       ^^ - Note century inserted 19/20 depending ><1950

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2K1. CNVaids: Data File Aids

uvcpfix1 - modify a text file with uvcp

'uvcpfix1' (using uvcp) is not as powerful as 'uvfix1' (using uvcopy), but is slightly simpler when changing file types only (text to Fixed-Length).


 Given - dat1/products text file of variable length records
 =====   (Line-Feed x'0A' following last non-blank)

 Required - convert to fixed-length 64 bytes
 ======== - store current date in cols 51-58
          - use fixed length typ 'RST' which inserts LF in last byte
          - OK if COBOL program does not use that byte (best of both worlds)
          - advantages of text files (use of vi,more,etc)
            but still fixed length for COBOL programs

 #1. more dat1/products    <-- display input file
     ==================
         CHR015   LAWN CHAIR
         HAM010   CLAW HAMMER
         SAW011   HAND SAW

 #2. uvcpfix1 dat1/products 64 RST 'mvc=50(8):20140201'
     ==================================================
     - 'uvcpfix1' script much easier to enter than 'uvcp' equivalent (below)

 #2a. uvcp "fili1=dat1/products,rcs=4096,typ=LST,filo1=tmp/products,rcs=64,typ=RST\
      ,mvc=50(8):20140201"
      =============================================================================
      - equivalent 'uvcp' command (longer, more complex entry)
Note
  • uvcpfix1 is often simpler than this example which demos 'mvc'
  • often we only want to change the file type from text to fixed
  • in which case the above example would be:

      uvcpfix1 dat1/products 64 RST
      =============================
      - simplest use of 'uvcpfix1' script

 #3. more tmp/products    <-- display output file (in subdir tmp/...)
     =================      - would then move elsewhere ?
         CHR015   LAWN CHAIR                               20140201
         HAM010   CLAW HAMMER                              20140201
         SAW011   HAND SAW                                 20140201
Note
  • We can not see the Line-Feeds with more (or vi, cat, head, etc)
  • see next page for confirmation with uvhd

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

confirm LineFeeds with uvhd


 #4. uvhd /home/uvadm/dat1/products t   <-- check LF's in text input file
     ================================     - CR's also present, will be removed
                  10        20        30        40        50        60
 r#    1 0123456789012345678901234567890123456789012345678901234567890123
       0 CHR015   LAWN CHAIR..
         445333222445424444500
         382015000C17E038192DA
 rec#=1 rsize=21 fptr=0 fsize=169 rcount=9

 #5. uvhd /home/uvadm/tmp/products r64  <-- check LF's created in last byte
     =================================      of 64 byte records by typ=RST
              10        20        30        40        50        60
 r#    1 0123456789012345678901234567890123456789012345678901234567890123
       0 CHR015   LAWN CHAIR                               20140201     .
         4453332224454244445222222222222222222222222222222233333333222220
         382015000C17E03819200000000000000000000000000000002014020100000A
 rec#=1 rsize=64 fptr=0 fsize=576 rcount=9

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2K2. CNVaids: Vancouver Utility Aids

uvcpfix2 - modify 1 Fixed-length file


 Given    - dat1/custmas1 customer master record
 =====    - cust#, cust-name, address, city, prov, postal, tel#,& contact

 Required - create a telephone list with selected fields:
 ======== - cust#, cust-name, telephone#, contact

 #1. uvhd dat1/custmas1    <-- investigate Input file
     ==================      - need uvhd since packed fields & no linefeeds
                             - here is 1st record only
 rec#=1 rsize=256 fptr=0 fsize=8192 rcount=32
                   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}.......
          0000000005300016000000002570063100095000000000000000013570000000
          0C0000C0270D0540C0000C0098D0263C0444C0000C0000C0000C0246D0000C00
      192 .E|...V}.......................f.....<........f.C 19950531
          0470005700000000880000000018000680001300000000694233333333222222
          35C0046D0000C0023C0000C0083C0056D0012C0000C0016D3019950531000000

 #2. uvcpfix2 dat1/custmas1 r256 65 LSTt 'mvc=35(30)90'
     ==================================================

 #3. more tmp/custmas1    <-- display output file (in tmp/...)
     =================
      130140    EVERGREEN MOTORS LTD.    250-754-5531 LARRY WRENCH
      139923    JOHNSTONE BOILER & TANKS 604-320-1845 GEORGE BROWN
      154689    FRANKLIN RESOUCES        604-666-5489 RON BENNETT
      201120    ALLTYPE RENTAL LTD.      403-246-5274 LARRY ZOLF
      204700    CASE POWER EQUIPMENT     403-538-1743 JOHN JENSEN

 #4. cp tmp/custmas1 dat1/custelephones
     ==================================
     - copy/rename as desired where desired

equivalent 'uvcp' command


 #2a. uvcp "fili1=dat1/custmas1,rcs=r256,typ=RSF,filo1=tmp/custmas1,rcs=65,typ=LSTt\
      ,mvc=35(30)90"
      ==============================================================================
Note
  • using the 'uvcpfix2' script is much easier than using 'uvcp' directly
  • often simpler than this example which demos moving fields
  • often you simply want to change file types & record sizes

See scripts uvcpfix1 & uvcpfix2 listed at uvcp.htm#U3 & uvcp.htm#U4

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2L1. CNVaids: Vancouver Utility Aids

dropbl0,1,2,3 demo

Here we will illustrate 4 scripts to drop blank lines in text files. See the scripts listed at https://uvsoftware.ca/scripts1.htm#6H0 - 6H4

dropbl0
  • drop ALL blank lines, copy to tmp/ & back, using 'grep'
dropbl1
  • drop ALL blank lines, copy to tmp/ & back, using 'uvcp' optn b2
dropbl2
  • reduce multi blank lines to 1, using 'uvcp' option b1
dropbl3
  • drop blank lines & COBOL cmts with only '*'s & blanks ('uvcopy')
Note
  • these scripts copy to tmp/.., for inspection & copy back

 #1. Login yourself --> /home/userxx
 #2. mkdir dat1 tmp     <-- make subdirs in your homedir
 #2a. rm tmp/*          <-- or remove tmp/* files if subdirs already existing

 #3. copy demo files from /home/uvadm/dat1 to your $HOME/dat1
     - renaming so we can test the 4 dropbl scripts with no conflicts

 #3a. cp /home/uvadm/dat1/testdropbl dat1/testdropbl0
      ===============================================
      - could copy as above, but better to use $UV as below
        (in case Vancouver Utilities not installed in usual /home/uvadm)

 #3a. cp $UV/dat1/testdropbl dat1/testdropbl0  # to test dropbl0
 #3b. cp $UV/dat1/testdropbl dat1/testdropbl1  # to test dropbl1
 #3c. cp $UV/dat1/testdropbl dat1/testdropbl2  # to test dropbl2
 #3d. cp $UV/dat1/testdropbl dat1/testdropbl3  # to test dropbl3

 #4a. dropbl0 dat1/testdropbl0  <-- drop all blank lines (sed)
      ========================
 #4b. dropbl1 dat1/testdropbl1  <-- drop all blank lines (uvcp option b2)
      ========================
 #4c. dropbl2 dat1/testdropbl2  <-- reduce multi-blank lines to 1 uvcp option b1
      ========================
 #4d. dropbl3 dat1/testdropbl3 c1 <-- drop COBOL blank '*' comments (uvcopy)
      ===========================     as well as blank lines

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

dat1/testdropbl demo INPUT file

 # testdropbl - test scripts to drop blank lines
 #            - see scripts dropbl0, dropbl1, dropbl2, dropbl3

# dropbl0 - uses 'sed' to drop all blank lines

# dropbl1 - uses 'uvcp' option 'b2' to drop all blank lines

# dropbl2 - uses 'uvcp' option 'b1' to reduce multi blank lines to 1

# dropbl3 - uses 'uvcopy' to drop all blank lines & all '*' COBOL comments

# begin test drop COBOL '*' comment blank lines (uvcopy) *

OUTPUT file tmp/testdropbl0 & 1 (same)

 # testdropbl - test scripts to drop blank lines
 #            - see scripts dropbl0, dropbl1, dropbl2, dropbl3
 # dropbl0 - uses 'sed' to drop all blank lines
 # dropbl1 - uses 'uvcp' option 'b2' to drop all blank lines
 # dropbl2 - uses 'uvcp' option 'b1' to reduce multi blank lines to 1
 # dropbl3 - uses 'uvcopy' to drop all blank lines & all '*' COBOL comments
 # begin test drop COBOL '*' comment blank lines (uvcopy)
       *

OUTPUT file tmp/testdropbl2

 # testdropbl - test scripts to drop blank lines
 #            - see scripts dropbl0, dropbl1, dropbl2, dropbl3

# dropbl0 - uses 'sed' to drop all blank lines

# dropbl1 - uses 'uvcp' option 'b2' to drop all blank lines

# dropbl2 - uses 'uvcp' option 'b1' to reduce multi blank lines to 1

# dropbl3 - uses 'uvcopy' to drop all blank lines & all '*' COBOL comments

# begin test drop COBOL '*' comment blank lines (uvcopy) *

OUTPUT file tmp/testdropbl3

 # testdropbl - test scripts to drop blank lines
 #            - see scripts dropbl0, dropbl1, dropbl2, dropbl3
 # dropbl0 - uses 'sed' to drop all blank lines
 # dropbl1 - uses 'uvcp' option 'b2' to drop all blank lines
 # dropbl2 - uses 'uvcp' option 'b1' to reduce multi blank lines to 1
 # dropbl3 - uses 'uvcopy' to drop all blank lines & all '*' COBOL comments
 # begin test drop COBOL '*' comment blank lines (uvcopy)

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_3. CNVaids.doc Vancouver Utility Conversion Aids

Part 3 Cross-Refs for COBOL & JCL - Contents


3A1. Cross-References for COBOL programs/copybooks & JCL/scripts
summary of all cross-refs available

3B1. Operating Instructions to generate ALL Cross-Ref reports
xrefall - script leaves all reports in subdir xref/...

3B2. Operating Instructions to generate any 1 Cross-Ref report
xcobcopy2 - sample Op. Instrns. for COBOL copybooks

COBOL Cross-Ref sample reports


3C1. xcobcopy1 - list all COPYBOOKS in any 1 PROGRAM
3C1. xcobcopy2 - crossref all PROGRAMS using any 1 COPYBOOK
3C2. xcobcall1 - list of all CALLED-PROGRAMs in each PROGRAM
3C2. xcobcall2 - crossref all PROGRAMS calling any 1 CALLED-PROGRAM
3C3. xcobfile2 - crossref all PROGRAMS using each external-file
3C4. xcobsql1 - list all SQL Includes in any 1 PROGRAM
3C4. xcobsql2 - crossref all PROGRAMS using any 1 SQL Include

JCL Cross-Ref sample reports


3D1. xkshfile1 - list all DATAFILES used in any 1 ksh SCRIPT
3D2. xkshfile2 - crossref show all ksh SCRIPTs using any 1 DATAFILE
3E1. xkshprog1 - list all PROGRAMs executed in any 1 ksh SCRIPT
3E2. xkshprog2 - crossref show all ksh SCRIPTS executing any 1 PROGRAM
3F1. xkshproc1 - list all PROCs executed in each JCL/ksh/script
3F2. xkshproc2 - shows all JCL/ksh/scripts executing each PROC
3G1. xkshparm1 - list all SYSIN/PARM modules in each JCL/ksh/script
3G2. xkshparm2 - shows all JCL/ksh/scripts referencing each SYSIN/PARM

5C1. cobfil51 - COBOL Files Report (related report in Part 5)
(not exactly a cross-reference, but a very useful report)
- information extracted from all COBOL programs in directory
- filenames, Input/Output, Org, Access, record size, copybook
- all programmers should have a copy before starting test/debug

6A1. mvsfiles5A - script to trace data files in MVS JCL
(not exactly a cross-reference, but a very useful report)
- extracts all data files from subdir jcl2 (JCL procs expanded)
- identify originating step# & destination step#s for each file

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3A1. CNVaids.doc Vancouver Utility Conversion Aids

Cross References for COBOL & JCL/scripts

These cross-reference reports will be invaluable during testing & debugging. Before you start test/debug, run these reports & house in 3-ring binders (with indexed tabs) for instant accessibility when needed.

Cross-Ref Reports Available

xcobcall1
  • list of all CALLED-PROGRAMs in each PROGRAM
xcobcall2
  • crossref all PROGRAMS calling any 1 CALLED-PROGRAM
xcobcopy1
  • list all COPYBOOKS in any 1 PROGRAM
xcobcopy2
  • crossref all PROGRAMS copying any 1 COPYBOOK
xcobfile2
  • crossref all PROGRAMS using each external-file
xcobsql1
  • list all SQL Includes in any 1 PROGRAM
xcobsql2
  • crossref all PROGRAMS using any 1 SQL Include
xkshfile1
  • list all DATAFILES used in any 1 ksh SCRIPT
xkshfile2
  • crossref show all ksh SCRIPTs using any 1 DATAFILE
xkshprog1
  • list all PROGRAMs executed in any 1 ksh SCRIPT
xkshprog2
  • crossref show all ksh SCRIPTS executing any 1 PROGRAM
xkshproc1
  • list all PROCs executed in each JCL/ksh/script
xkshproc2
  • shows all JCL/ksh/scripts executing each PROC
xkshparm1
  • list all SYSIN/PARM modules in each JCL/ksh/script
xkshparm2
  • shows all JCL/ksh/scripts referencing each SYSIN/PARM
xmvsfile1
  • list all DSN filenames in any 1 MVS JCL
xmvsfile2
  • crossref show all JOBnames using any 1 DSN datafile
xmvsprog1
  • list all EXEC/PGM names in any 1 MVS JCL
xmvsprog2
  • crossref all MVS JOBnames for any 1 EXEC/PGM name
xmvsproc1
  • list all PROCs executed in each MVS JCL
xmvsproc2
  • shows all MVS JCL executing each PROC
xvsefile1
  • list all DSN filenames in any 1 VSE JCL
xvsefile2
  • crossref show all JOBnames using any 1 DSN datafile
xvseprog1
  • list all EXEC/PGM names in any 1 VSE JCL
xvseprog2
  • crossref all VSE JOBnames for any 1 EXEC/PGM name

The 4 'xksh' reports provide the same info as the 4 'xmvs' or 4 'xvse' reports.

The 'xksh' reports are generated from the 'jcl3' directory of converted scripts, whereas the 'xmvs' & 'xvse' reports are generated from the 'jcl2' directory of JCLs before conversion. The 'xksh' reports will be more relevant after test/debug since they can then be run using the 'jcls' directory of tested & debugged scripts.

more Cross-References

See XREFjobs.htm for more detailed descriptions of these cross-references including listings of some of the scripts (xrefall, xcobcopy2, etc).

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3B1. CNVaids: Cross-References for COBOL & JCL/scripts

Operating Instructions

The easiest way to run the cross-references is to run script 'xrefall' which generates all 'xcob' & all 'xksh' COBOL & JCL/script cross-references.

generating ALL Cross-Refs reports


 #1. xrefall cbls jcl3 ksh    <-- crossref COBOL & ksh scripts
     =====================

 #1a. xrefall cbls jcl2 mvs   <-- alternative for unconverted MVS JCL
      =====================

 #1b. xrefall cbls jcl2 vse   <-- alternative for unconverted VSE JCL
      =====================

 #2.  uvlpd12 xref            <-- print all files in the directory
      ============
  1. All cross-reference scripts leave the output reports in subdir xref/...

  2. arg3 on the xrefall command could be 'mvs' or 'vse' to crossreference unconverted MVS JCLs. arg2 would then have to be 'jcl2' to match.

  3. arg3 could be 'ksh' to crossref the converted Korn shell scripts. arg2 should then be 'jcl3' the output subdir for the JCL converter.

  4. If you are just starting to test/debug, arg2 must be 'jcl3' NOT 'jcls' Only 'jcl3' has ALL converted scripts, since we copy to 'jcls' 'one at a time' before starting debug of each jcl/script. After you have completed your conversion you would of course use 'jcls'.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3B2. CNVaids: Cross-References for COBOL & JCL/scripts

Op. Instrns. - Cross-Ref 1 at a time

We will use 'xcobcopy2' (COBOL copybook crossref) to illustrate the Op. Instrns. for 1 cross-ref report at a time (vs ALL shown above).


 xcobcopy2 directory options  <-- command format
 ===========================

 xcobcopy2 cbls [a16b16c4e1]  <-- cross-ref copybooks for prgms in cbls/...
 ===========================    - option defaults shown (described below)
 uop=q1a16b12c5e0d0j0l0s2w1 - option defaults
       a16                  - column to align references
          b12               - columns for fixed word horizontal spacing
          b30               - max cols, indicates variable (blank between)
             c5             - count max words per line (c5*b12=60+a16 = 76)
               e1           - bypass "*" col 7 & blank ". " (COBOL)
               e2           - target word must be enclosed in "quotes"
                 d1         - cnvrt "/" to " " (directory/filename)
                 d2         - cnvrt "_" to " " (printer class codes)
                 d4         - cnvrt "." to " " (drop extensions)
                 d8         - cnvrt "()" to " " (drop parens)
                   j1       - MVS JCL (bypasses //* cmts)
                   j2       - VSE JCL (bypasses * or /* cmts)
                   j4       - Korn shell scripts (bypasses # col1)
                     l1     - translate to lower case (keywords lower)
                       s2   - space2 (space1 in multiline groups)
                         w1 - target-word offset, to word after key-word
 User OPtion (uop) defaults  = q1a16b16c4e0d0j0l0s2w1a16b16c4e3l1
  null to accept or re-specify (1 or more) -->
 080405:105049:xref2: sort phase complete, used 64 megabytes, sort output begin
 080405:105049:xref2: EOF fili01 rds=38 size=1963: tmp/grep1
 080405:105049:xref2: EOF filo01 wrts=16 size=526: tmp/xcobcopy2a
 chkcopy2 - *flag missing copybooks on COBOL cross-reference report
 080405:105049:chkcopy2: EOF fili01 rds=16 size=526: tmp/xcobcopy2a
 080405:105049:chkcopy2: EOF fili02 rds=6 size=74: tmp/cpys2
 080405:105049:chkcopy2: EOF filo01 wrts=16 size=536: xref/xcobcopy2
 report generated = xref/xcobcopy2
  - use uvlp12,uvlp14,uvlp16 to laser print at 12,14,16 cpi
 enter command (vi,cat,more,uvlp12,uvlp14,uvlp16,etc)  ----> more <--

sample report

 xcobcopy2 ** crossref all PROGRAMS using each COPYBOOK **
 Keyword=copy:include  Exclude=unix Include=.cpy  page#  1
 Directory=/home/mvstest/testlibs/cbls Options=q1a16b16c4e0d0j0l0s2w1a16b16c4e3l1
 =======================================================2008/04/05_10:50:49
  custmas.cpy      car100.cbl      car120.cbl      car130.cbl      car140.cbl
  ____________6    car150.cbl      car200.cbl
 *paymas.cpy       cpy100.cbl
  saledtl.cpy_2    car150.cbl      car200.cbl

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3C1. CNVaids: Cross-References for COBOL

COBOL Cross-Ref Sample Reports

These sample reports are based on the supplied test/demo JCL & COBOL programs. We will illustrate: xcobcopy1/2, xcobcall1/2, xcobfile2, xcobsql1/2, xkshfile1/2, xkshprog1/2.

xcobcopy1 - list all COPYBOOKS in any 1 PROGRAM


 xcobcopy1 cbls  <-- run separately (or xrefall, create all rpts in xref/...)
 ==============
 xcobcopy1 ** list all COPYBOOKS in each PROGRAM **
 Keyword=copy:include  Exclude=unix Include=.cpy  page#  1
 Directory=/home/mvstest/testlibs/cbls
 Options=q1a16b16c4e0d0j0l0s2w1a16b16c4e3l1q0i7
 =======================================================2008/04/05_11:46:21
 car100.cbl       custmas.cpy
 car120.cbl       custmas.cpy
 car130.cbl       custmas.cpy
 car140.cbl       custmas.cpy
 car150.cbl_2     custmas.cpy     saledtl.cpy
 car200.cbl_4     custmas.cpy     saledtl.cpy     sdline.cpy      stline.cpy
 cpy100.cbl       paymas.cpy

xcobcopy2 - crossref all PROGRAMS using any 1 COPYBOOK


 xcobcopy2 cbls  <-- run separately (or xrefall, create all rpts in xref/...)
 ==============
 xcobcopy2 ** crossref all PROGRAMS using each COPYBOOK **
 Keyword=copy:include  Exclude=unix Include=.cpy  page#  1
 Directory=/home/mvstest/testlibs/cbls Options=q1a16b16c4e0d0j0l0s2w1a16b16c4e3l1q0i7
 =======================================================2008/04/05_11:46:21
  custmas.cpy      car100.cbl      car120.cbl      car130.cbl      car140.cbl
  ____________6    car150.cbl      car200.cbl
 *paymas.cpy       cpy100.cbl
  saledtl.cpy_2    car150.cbl      car200.cbl
  sdline.cpy       car200.cbl
  stline.cpy       car200.cbl
Note
  • the '*' above indicates missing copybooks
  • this crossref script runs an additional uvcopy job
  • to check existence of the copybook in the 'cpys' subdir

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3C2. CNVaids: Cross-References for COBOL

xcobcall1 - list of all Called-Programs in each Program


 xcobcall1 cbls  <-- run separately (or xrefall, create all rpts in xref/...)
 ==============
 Keyword=call  Exclude= Include=  page#  1
 Directory=/home/mvstest/cbls
 Options=q1a16b16c4e0d0j0l0s2w1a16b16c4e1q0i7
 =======================================================2005/03/17_15:15:51
 car130.cbl       getparm
 car140.cbl       getparm

xcobcall2 - crossref all Programs calling any 1 Called-Program


 xcobcall2 cbls  <-- run separately (or xrefall, create all rpts in xref/...)
 ==============
 Keyword=call  Exclude= Include=  page#  1
 Directory=/home/mvstest/cbls
 Options=q1a16b16c4e0d0j0l0s2w1a16b16c4e1q0i7
 =======================================================2005/03/17_15:15:51
 *getparm_2        car130.cbl      car140.cbl
Note
  • the '*' above indicates missing called programs
  • this crossref script runs an additional uvcopy job
  • to check existence of the called program in the 'cbls' subdir

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3C3. CNVaids: Cross-References for COBOL

xcobfile2 - cross-ref programs using each filename


 xcobfile2 cbls  <-- run separately (or xrefall, create all rpts in xref/...)
 ==============
 xcobfile2 ** crossref all PROGRAMS using each external-file **
 Keyword=external  Exclude= Include=  page#  1
 Directory=/home/mvstest/cbls Options=q1a16b16c4e0d0j0l0s2w1a16b16c4e1l1
 =======================================================2007/06/10_19:19:39
 acctmas          cgl100.cbl
 actlist          cgl100.cbl
 custmas          car100.cbl      car120.cbl      car130.cbl      car140.cbl
 ________7        car150.cbl      car200.cbl      testunix1.cbl
 custmas1         car101.cbl
 glmsnew          cgl200.cbl
 glmsold          cgl200.cbl
 gltrans          cgl200.cbl
 nalist           car100.cbl      car101.cbl      car120.cbl      car130.cbl
 _______7         car140.cbl      car150.cbl      cpy100.cbl
 paymas           cpy100.cbl
 saledtl          car200.cbl
 salelst          car200.cbl

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3C4. CNVaids: Cross-References for COBOL

xcobsql1 list all SQL Includes in any 1 Program


 xcobsql1 cbls  <-- run separately (or xrefall, create all rpts in xref/...)
 =============
 xcobsql1 ** list all SQL-INCLUDES in each PROGRAM **
 Keyword=sql include  Exclude=~~ Include=~~  page#  1
 Directory=/home5/efunds2/testlibs/cbls
 Options=q1a16b16c4e0d0j0l0s2w1a16b16c4e1l1w2
 =======================================================2008/04/05_15:50:52
 avf00800.cbl_4   sqlca.cpy       tdbns04.cpy     tdbns05.cpy     tdbrf14.cpy
 avf01000.cbl_2   sqlca.cpy       tdbdw19.cpy
 avf01300.cbl_2   sqlca.cpy       tdbrf14.cpy
 avf01400.cbl_2   sqlca.cpy       tdbrf14.cpy
 avf50000.cbl_2   sqlca.cpy       tdbrf01.cpy
 avf50200.cbl_4   sqlca.cpy       tdbrf01.cpy     tdbrf06.cpy     tdlrf01.cpy
 avf50300.cbl_2   sqlca.cpy       tdbrf01.cpy

xcobsql2 crossref all Programs using any 1 SQL Include


 xcobsql2 cbls  <-- run separately (or xrefall, create all rpts in xref/...)
 =============
 xcobsql2 ** crossref all PROGRAMS using each SQL-INCLUDE **
 Keyword=sql include  Exclude=~~ Include=~~  page#  1
 Directory=/home5/efunds2/testlibs/cbls Options=q1a16b16c4e0d0j0l0s2w1a16b16c4e1l1w2
 =======================================================2008/04/05_15:51:05
  actbp.cpy_4      dbasrb26.cbl    dbasrb27.cbl    dbasrb31.cbl    dbasrb32.cbl

actbpsum.cpy_2 dbasrb26.cbl dbasrb27.cbl

  actgbp.cpy_4     dbasrb26.cbl    dbasrb27.cbl    dbasrb31.cbl    dbasrb32.cbl
  actsmd.cpy_3     dbasrb30.cbl    dbasrb31.cbl    dbasrb32.cbl
  actsum.cpy_2     dbasrb26.cbl    dbasrb27.cbl
  bpsmd.cpy_3      dbasrb30.cbl    dbasrb31.cbl    dbasrb32.cbl
  cpy077.cpy       dba00300.cbl    nas20500.cbl    nas21200.cbl    nas21300.cbl
  __________       nas23500.cbl    nas24700.cbl    nas24800.cbl    nas24900.cbl
  ___________9     pdw20300.cbl
  cpy078.cpy       pdw20300.cbl

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3D1. CNVaids: Cross-References for JCL/scripts

xkshfile1 - list all DATAFILES used in any 1 ksh SCRIPT


 xkshfile1 jcl3  <-- run separately (or xrefall, create all rpts in xref/...)
 ==============
 xkshfile1 ** list all DATAFILES used in any 1 ksh SCRIPT **
 Keyword=exportfile:exportgen  Exclude=autoload Include=  page#  1
 Directory=/home/mvstest/jcl3
 Options=q1a16b16c4e0d0j0l0s2w1a16b50c1j4w2q0i7
 =======================================================2005/03/08_09:05:02
 ikjeft01.ksh     $DW/mxplib/ikjdemo1
 jar100.ksh       data/ar.customer.master
 ___________2     data/ar.customer.namelist
 jar200.ksh       $DW/${JOBID}_tempsls_2
 __________       data/ar.customer.master.indexed
 __________       data/ar.sales.items
 ___________5     data/ar.sales.list
 jgl100.ksh       data/gl.account.acntlist_
 ___________2     data/gl.account.master_
 jgl200.ksh       $DW/${JOBID}_tempglt_2
 __________       data/gl.account.master__2
 __________       data/gl.account.trans
 ___________6     data/gl.ctlcdlib/pgl200s1
 jgl300.ksh       $DW/${JOBID}_tempglm_2
 ___________4     data/gl.account.master__2
 jgl320.ksh       $DW/${JOBID}_tempglm_2
 ___________4     data/gl.account.master__2
 jgl400.ksh       $DW/${JOBID}_tempglm_2
 ___________4     data/gl.account.master__2
 jgl420.ksh       $DW/${JOBID}_tempglm_2
 ___________4     data/gl.account.master__2
 jgl500.ksh       data/gl.account.acntlist_
 ___________2     data/gl.account.export
 jpy200.ksh       $DW/${JOBID}_temptc_2
 __________       py/ctlcdlib/ppy200s1
 __________       py/payroll.master_
 __________       py/time.cards
 ___________6     py/timecard.edit_
 splitsl1.ksh     data/ar.sales.items
 ____________     work/sales.group1
 _____________3   work/sales.group2

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3D2. CNVaids: Cross-References for JCL/scripts

xkshfile2 - crossref all ksh SCRIPTs using any 1 DATAFILE


 xkshfile2 jcl3  <-- run separately (or xrefall, create all rpts in xref/...)
 ==============
 xkshfile2 ** crossref to show all ksh SCRIPTs using any 1 DATAFILE **
 Keyword=exportfile:exportgen  Exclude=autoload Include=  page#  1
 Directory=/home/mvstest/jcl3
 Options=q1a16b16c4e0d0j0l0s2w1a40b16c3j4w2q0i7
 =======================================================2005/03/08_09:05:03
 $DW/${JOBID}_tempglm                     jgl300.ksh_2    jgl320.ksh_2    jgl400.ksh_2
 _____________________8                   jgl420.ksh_2
 $DW/${JOBID}_tempglt_2                   jgl200.ksh_2
 $DW/${JOBID}_tempsls_2                   jar200.ksh_2
 $DW/${JOBID}_temptc_2                    jpy200.ksh_2
 $DW/mxplib/ikjdemo1                      ikjeft01.ksh
 data/ar.customer.master                  jar100.ksh
 data/ar.customer.master.indexed          jar200.ksh
 data/ar.customer.namelist                jar100.ksh
 data/ar.sales.items_2                    jar200.ksh      splitsl1.ksh
 data/ar.sales.list                       jar200.ksh
 data/gl.account.acntlist__2              jgl100.ksh      jgl500.ksh
 data/gl.account.export                   jgl500.ksh
 data/gl.account.master_                  jgl100.ksh      jgl200.ksh_2    jgl300.ksh_2
 ___________________11                    jgl320.ksh_2    jgl400.ksh_2    jgl420.ksh_2
 data/gl.account.trans                    jgl200.ksh
 data/gl.ctlcdlib/pgl200s1                jgl200.ksh
 py/ctlcdlib/ppy200s1                     jpy200.ksh
 py/payroll.master_                       jpy200.ksh
 py/time.cards                            jpy200.ksh
 py/timecard.edit_                        jpy200.ksh
 work/sales.group1                        splitsl1.ksh
 work/sales.group2                        splitsl1.ksh

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3E1. CNVaids: Cross-References for JCL/scripts

xkshprog1 - list all PROGRAMs executed in any 1 ksh SCRIPT


 xkshprog1 jcl3  <-- run separately (or xrefall, create all rpts in xref/...)
 ==============
 xkshprog1 ** list all PROGRAMs executed in any 1 ksh SCRIPT **
 Keyword=PROGID  Exclude= Include=  page#  1
 Directory=/home/mvstest/jcl3
 Options=q1a16b16c4e0d0j0l0s2w1a16b16c4j4q0i7
 =======================================================2005/03/08_09:05:03
 ikjeft01.ksh     ikjeft01
 jar100.ksh       car100
 jar200.ksh_2     car200          sort
 jar300.ksh       car300
 jgl100.ksh       cgl100
 jgl200.ksh_2     cgl200          sort
 jgl300.ksh_2     idcams          iebgener
 jgl320.ksh_2     idcams          iebgener
 jgl360.ksh       idcams
 jgl400.ksh_2     cobol1          cobol2
 jgl420.ksh_2     cobol1          cobol2
 jgl500.ksh       iefbr14
 jpy200.ksh_2     cpy200          sort
 splitsl1.ksh     sort

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3E2. CNVaids: Cross-References for JCL/scripts

xkshprog2 - crossref all ksh SCRIPTS executing any 1 PROGRAM


 xkshprog2 jcl3  <-- run separately (or xrefall, create all rpts in xref/...)
 ==============
 xkshprog2 ** crossref to show all ksh SCRIPTS executing any 1 PROGRAM **
 Keyword=PROGID  Exclude= Include=  page#  1
 Directory=/home/mvstest/jcl3
 Options=q1a16b16c4e0d0j0l0s2w1a16b16c4j4q0i7
 =======================================================2005/03/08_09:05:03
  car100           jar100.ksh
  car200           jar200.ksh
  car300           jar300.ksh
  cgl100           jgl100.ksh
  cgl200           jgl200.ksh
  cobol1_2         jgl400.ksh      jgl420.ksh
  cobol2_2         jgl400.ksh      jgl420.ksh
  cpy200           jpy200.ksh
 *idcams_3         jgl300.ksh      jgl320.ksh      jgl360.ksh
 *iebgener_2       jgl300.ksh      jgl320.ksh
 *iefbr14          jgl500.ksh
 *ikjeft01         ikjeft01.ksh
 *sort_4           jar200.ksh      jgl200.ksh      jpy200.ksh      splitsl1.ksh
Note
  • the '*' above indicates missing programs
  • this crossref script runs an additional uvcopy job
  • to check existence of the programs in the 'cbls' subdir
  • of course the mainframe utilities will not be found there

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3F1. CNVaids: Cross-References for JCL/scripts

xkshproc1 - list all PROCs executed in any 1 ksh SCRIPT


 xkshproc1 jcl3  <-- run separately (or xrefall, create all rpts in xref/...)
 ==============
 xkshproc1 ** crossref all MVS JOBnames for each EXEC PROCname **
 Keyword=EXEC  Exclude=PGM Include=call  page#  1
 Directory=/home/mvstest/testlibs/jcl3
 Options=q1a16b16c4e0d0j0l0s2w1a16b16c4w1q0i7
 =======================================================2009/05/08_15:57:05
 jgl100.ksh       PGL100
 jgl200.ksh       PGL200
 jpy200.ksh_3     PPY200          PPY299          PPY300

3F2. xkshproc2 - crossref ksh SCRIPTS executing any 1 PROC


 xkshproc2 jcl3  <-- run separately (or xrefall, create all rpts in xref/...)
 ==============
  xkshproc2 ** crossref all MVS JOBnames for each EXEC PROCname **
  Keyword=EXEC  Exclude=PGM Include=call  page#  1
  Directory=/home/mvstest/testlibs/jcl3 Options=q1a16b16c4e0d0j0l0s2w1a16b16c4w1q0i7
  =======================================================2009/05/08_15:57:05
  PGL100           jgl100.ksh
  PGL200           jgl200.ksh
  PPY200           jpy200.ksh
 *PPY299           jpy200.ksh
  PPY300           jpy200.ksh

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3G1. CNVaids: Cross-References for JCL/scripts

xkshparm1 - list all SYSIN/PARMs referenced in any 1 ksh SCRIPT


 xkshparm1 jcl3  <-- run separately (or xrefall, create all rpts in xref/...)
 ==============
 xkshparm1 ** crossref to show all ksh SCRIPTS referencing each PARM **
 Keyword=parms  Exclude=~~ Include=exportfile  page#  1
 Directory=/home/mvstest/testlibs/jcl3
 Options=q1a16b16c4e0d0j0l0s2w1a16b16c4d1j4l1w1q0i7
 =======================================================2009/05/08_15:57:05
 iebcopy.ksh      products
 ikjeft01.ksh     ikjdemo1
 jgl200.ksh       pgl200s1
 jgl910.ksh       pgl200s1
 jpy200.ksh       ppy200s1
 jpy910.ksh       pgl200s1

3G2. xkshparm2 - crossref ksh SCRIPTS executing any 1 PARM


 xkshparm2 jcl3  <-- run separately (or xrefall, create all rpts in xref/...)
 ==============
  xkshparm2 ** crossref to show all ksh SCRIPTS referencing each PARM **
  Keyword=parms  Exclude=~~ Include=exportfile  page#  1
  Directory=/home/mvstest/testlibs/jcl3 Options=q1a16b16c4e0d0j0l0s2w1a16b16c4d1j4l1w1q0i7
  =======================================================2009/05/08_15:57:05
  ikjdemo1         ikjeft01.ksh
  pgl200s1_3       jgl200.ksh      jgl910.ksh      jpy910.ksh
 *ppy200s1         jpy200.ksh
  products         iebcopy.ksh

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_4. CNVaids.doc Vancouver Utility Conversion Aids

Table Summaries & Statistics - Contents


4A1. statallmvs1 - table summaries of COBOL, MVS JCL,& Korn shell scripts
statallvse1 - table summaries of COBOL, VSE JCL,& Korn shell scripts
- Korn shell scripts running multiple uvcopy jobs (below)

4B1. statmvsjcl1 - table summarize (gather statistics from) mainframe MVS JCL
- count references in all JCL in directory for each:
program, PROC, top-node, SYSIN/parm module,& DSN/filename

4B1. statvsejcl1 - similar report for VSE vs MVS (reports not shown)

4B2. statksh1 - table summarize (get stats for) converted Korn shell scripts
- count references in all Korn shell scripts for each:
  program, top-node, exportfile/gen, parm module,& filename
- similar info as statmvsjcl1, but from converted scripts (vs JCL)

4B3. statcbl1 - table summarize (gather statistics) for COBOL programs
- count refs to each copybook, called program,& file ORG type

4C1. statlogin1 - should appeal to Unix/Linux system administrators.
- reads system file /var/log/messages and creates table summary
report of user logins by month & userid.

4D1. table2 - uvcopy table summary by any desired argument
- for any file of fixed length records
- specify table arguments & acum fields by displacement & length
- see sample table summary of sales qty & amount by product#

4D3. table2 script - easier way to run 'uvcopy table2' (fewer keystrokes)

4D4. table3d - allows you to specify a 'key-word', preceding a 'target-word'.
- job searches all lines of all files in the directory
- report shows 1 line for each target-word with counts & '%'s

4E1. recsizes1 - create summary table of record-sizes in a text file
- demo uvcopy to table analyze any item with very little code

4F1. tblext1 - create table summary counts of file extensions in a subdir
  (.cbl, .cpy, .jcl, .ctl, etc)
- can use on cblx/*.err to calc compile failure percentage
  (.cbl, .idy, .int, .err)

4F2. tblext2 - table summary of extensions in all subdirs of a superdir
- prior job (tblext1) reads filenames from only 1 directory

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

4A1. CNVaids: Table Summaries & Statistics

statallmvs1/statallvse1 - table stats from JCL/scripts

Script 'statallmvs1' runs several uvcopy jobs to create table summaries by analyzing all files in jcl2 (MVS JCL), jcl3 (converted JCL/scripts), & cbls (converted COBOL). 'statallvse1' is the same,but for VSE JCL.


4B1. uvcopy statmvsjcl1 - table summarize (statistics) from mainframe JCL
- count refs to each program, PROC, & top-node used in all JCLs

4B2. uvcopy statksh1 - table summarize (stats) for converted Korn shell scripts
- count refs to each program, PROC, & top-node used in Ksh scripts

4B3. uvcopy statcbl1 - table summarize (gather statistics) for COBOL programs
- count refs to each copybook, called program,& file ORG type
Note
  • original mainframe JCL is in jcl0/... BUT we run reports from jcl2/...
  • because jcl2/... has all PROCs expanded
  • just before conversion to Korn shell scripts in jcl3/...

statallmvs1/statallvse1 - Operating Instructions


 #1. cdl   <-- change to libraries superdir (/home/mvstest/testlibs for demo)
     ===     - or your Libraries

 #2. mkdir stats   <-- make subdir to receive report (if not existing)
     ===========

 #3. statallmvs1 all  <-- script to run uvcopy jobs statcbl1,statmvsjcl2,statksh1
     ===============

 #3a. statallvse1 all <-- same, but for VSE JCL
      ===============

 #4a. vi stats/jcl2_pgms        <-- see sample reports on page '4B1'
 #4b. vi stats/jcl2_procs
 #4c. vi stats/jcl2_topnodes
 #4d. vi stats/jcl2_parms         - (module) names from DSNs
 #4e. vi stats/jcl2_filenames     - full DSN names (may be very long)

 #5a. vi stats/jcl3_pgms        <-- see sample report on page '4B2'
 #5b. vi stats/jcl3_topnodes
 #5c. vi stats/jcl3_exportfiles
 #5d. vi stats/jcl2_parms         - (module) names from DSNs
 #5e. vi stats/jcl2_filenames     - full DSN names (may be very long)

 #6a. vi stats/cbls_calledpgms  <-- see sample reports on page '4B3'
 #6b. vi stats/cbls_copybooks
 #6c. vi stats/cbls_ORGtypes

The following sample reports were run for the supplied set of test/demo JCL & COBOL programs in /home/uvadm/mvstest/testlibs/...

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

4B1. CNVaids: Table Summaries & Statistics

statmvsjcl1 - mainframe JCL stat report samples


 uvcopy statmvsjcl1 <-- create stats of: JCL programs, procs,& Top-Nodes
 ==================
 statmvsjcl1  2009/05/01_11:15:22  Summary table of EXEC PGMs in jcl2 jcl2/jobtest2.jcl
 tbl#001 pg#001     -argument-
 line#  count    %  EXEC PGM
    1       25  36  ALLCOBOL(3+digits)
    2        4   5  FTP
    3       13  18  IDCAMS
    4        1   1  IEBCOPY
    5       10  14  IEBGENER
    6        5   7  IEFBR14
    7        1   1  IKJEFT01
    8        2   2  ISRSUPC
    9        1   1  MAILTOLN
   10        7  10  SORT
            69*100   *TOTAL*
 statmvsjcl1  2009/05/01_11:15:22  Summary table of EXEC PROCs in jcl2 jcl2/jobtest2.jcl
 tbl#002 pg#001     -argument-
 line#  count    %  EXEC PROC
    1        1  25  PGL100
    2        1  25  PGL200
    3        1  25  PPY200
    4        1  25  PPY300
             4*100   *TOTAL*
 statmvsjcl1  2009/05/01_11:15:22  Summary table of DSN Top-Nodes in jcl2 jcl2/jobtest2.jcl
 tbl#003 pg#001     -argument-
 line#  count    %  Top-Node
    1       29  18  &&(ALLTempFiles)
    2       35  22  AR
    3       65  41  GL
    4       14   8  PY
    5        7   4  PYTEST
    6        2   1  RPTS
    7        3   1  WRK
    8        1   0  WRK(IKJDEMO1)
           156*100   *TOTAL*

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

MVS JCL statistics tables continued

 statmvsjcl1  2009/07/13_19:57:42  Summary table of DSN (parms) in jcl2 jcl2/jobtest2.jcl
 tbl#004 pg#001     -argument-
 line#  count    %  (parm-name)
    1        1  16  IKJDEMO1
    2        3  50  PGL200S1
    3        1  16  PPY200S1
    4        1  16  PRODUCTS
             6*100   *TOTAL*
Note
  • (sysins) or (parms) above extracted from DSN(modules) listed below
  • several filenames omitted from table below to fit on this page
 statmvsjcl1  2009/07/13_19:57:42  Summary table of DSN filenames in jcl2 jcl2/jobtest2.jcl
 tbl#005 pg#001     -argument-
 line#  count    %  DSN/filename
    1       16   9  &&TEMPGLM
    5        2   1  &&TEMPTC
    6        1   0  AR.ACCOUNT.MASTER
    7       11   6  AR.CUSTOMER.MASTER
    8        2   1  AR.CUSTOMER.MASTER.INDEXED
    9        2   1  AR.CUSTOMER.NAMEADRS.LIST100
   14        1   0  AR.PARMLIB(PRODUCTS)
   15        2   1  AR.SALES$TRAN#WEEK
   16        4   2  AR.SALES.ITEMS
   19        2   1  AR.SALES.LIST
   20        1   0  AR.SALES.PRODUCTS
   21        1   0  AR.TRAN&MONTH.SALES
   22        1   0  GL.ACCOUNT.ACNTLIST
   23        1   0  GL.ACCOUNT.ACNTLIST(+1)
   24        1   0  GL.ACCOUNT.EXPORT
   25        1   0  GL.ACCOUNT.MASTER
   26       16   9  GL.ACCOUNT.MASTER(+1)
   27        1   0  GL.ACCOUNT.MASTER(+2)
   28        1   0  GL.ACCOUNT.MASTER(+3)
   29        1   0  GL.ACCOUNT.MASTER(-1)
   30        1   0  GL.ACCOUNT.MASTER(-2)
   33       22  13  GL.ACCOUNT.MASTER(0)
   34        4   2  GL.ACCOUNT.TRAN1
   35        1   0  GL.ACCOUNT.TRANS
   36        5   3  GL.ACCOUNT.TRANS(+1)
   39        6   3  GL.ACCOUNT.TRANS(0)
   41        3   1  GL.PARMS(PGL200S1)
   42        1   0  PY.PARMS(PPY200S1)
   43        4   2  PY.PAYROLL.MASTER
   44        1   0  PY.PAYROLL.MASTER2
   46        1   0  PY.TIME.&DAY
   47        1   0  PY.TIME.&DAY.&MONTH.&YEAR
   56        2   1  RPTS.CUSTOMER.NAMES
   57        1   0  WRK(IKJDEMO1)
   60        1   0  WRK.SALES.GROUP2
           161*100   *TOTAL*

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

4B2. CNVaids: Table Summaries & Statistics

statksh1 - converted JCL/script statistics


 uvcopy statksh1 <-- create stats of: Korn shell Programs, PROCs,& Top-Nodes
 ===============
 statksh1  2009/05/01_11:14:42  Summary table of PROGIDs in jcl3 jcl3/ikjeft01.ksh
 tbl#001 pg#001     -argument-
 line#  count    %  PROGID
    1       26  37  ALLCOBOL(3+digits)
    2        4   5  ftp
    3       13  18  idcams
    4        1   1  iebcopy
    5       10  14  iebgener
    6        5   7  iefbr14
    7        2   2  isrsupc
    8        1   1  mailtoln
    9        7  10  sort
            69*100   *TOTAL*
 statksh1  2009/05/01_11:14:42  Summary topnode/subdirs in jcl3 jcl3/ikjeft01.ksh
 tbl#003 pg#001     -argument-
 line#  count    %  topnode/
    1        4   1   $INPUT1
    2       28  13   $JGDG/
    3       34  16   $JTMP/
    4        1   0   $PARMFILE
    5        6   2   $RUNLIBS/
    6       12   5   $SYOT/
    7       27  12   $SYSIN
    8       34  16   ar/
    9       41  19   gl/
   10        9   4   misc/
   11       11   5   py/
   12        2   0   rpts/
           209*100   *TOTAL*
 statksh1  2009/05/01_11:14:42  Summary exportfile/exportgen subdirs in jcl3 jcl3/ikjeft01.ksh
 tbl#002 pg#001     -argument-
 line#  count    %  exportfile/gen subdir/
   - - - exportfiles omitted, exportgen... shown - - -
   12       27  12  exportgen0 gl/
   13        1   0  exportgen0 py/
   14       26  12  exportgen1 $JGDG/
   15        1   0  exportgen2 $JGDG/
   16        1   0  exportgen3 $JGDG/
   17        3   1  exportgenall gl/
   18        1   0  exportgenall py/
   19        2   0  exportgenp gl/
           209*100   *TOTAL*
Note
  • Korn shell statistics tables 4 & 5 (parms & filenames) omitted
  • same as for JCL tables 4 & 5 listed on previous page

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

4B3. CNVaids: Table Summaries & Statistics

statcbl11 - COBOL stat report samples


 uvcopy statcbl1 <-- create stats: COBOL copybooks, called-programs,& ORG types
 ===============
 statcbl1  2009/05/01_11:15:02  Summary of copybooks in cbls cbls/cgl100.cbl
 tbl#001 pg#001     -argument-
 line#  count    %  copybook
    1        6  17  custmas.cpy
    2        1   2  paymas.cpy
    3        2   5  saledtl.cpy
    4        1   2  sdline.cpy
    5        1   2  stline.cpy
    6       12  34  unixproc1.cpy
    7       12  34  unixwork1.cpy
            35*100   *TOTAL*
 statcbl1  2009/05/01_11:15:02  Summary of called programs in cbls cbls/cgl100.cbl
 tbl#002 pg#001     -argument-
 line#  count    %  called program
    1        2 100  getparm
             2*100   *TOTAL*
 statcbl1  2009/05/01_11:15:02  Summary of ORGANIZATION types in cbls cbls/cgl100.cbl
 tbl#003 pg#001     -argument-
 line#  count    %  organization
    1        2   8  indexed
    2        9  39  line sequential
    3       12  52  record sequential
            23*100   *TOTAL*
Note
  • the 'statcbl1' reports are also documented in Part_5 (COBOL aids)
  • duplicated here since part of the 'statallmvs1/statallvse1' scripts

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

4C1. CNVaids: Table Summaries & Statistics

statlogin1 - table summary user logins by month & userid

'statlogin1' should appeal to Unix/Linux system administrators. It reads a system file (/var/log/messages) and creates a table summary report of user logins by month & userid. Here are a few lines of the input file, followed by a sample report.

sample input /var/log/messages

 Oct 23 06:11:51 uvsoft3 login[16341]: session opened for user laval4 by LOGIN(uid=0)
 Oct 23 06:11:51 uvsoft3  -- laval4[16341]: LOGIN ON tty5 BY laval4
 Oct 23 06:13:08 uvsoft3 ftpd[16342]: FTP LOGIN FROM 192.168.0.2, uvsoft2.uvsoft.ca (laval4)
 Oct 23 07:15:00 uvsoft3 login[16341]: session closed for user laval4
 Oct 23 07:15:23 uvsoft3 login[16516]: authentication failure; logname=LOGIN uid=0 euid=0 tty=tty5 ruser= rhost=  user=mvstest
 Oct 23 07:15:33 uvsoft3 login[16516]: session opened for user mvstest by LOGIN(uid=0)
 Oct 23 07:15:33 uvsoft3  -- mvstest[16516]: LOGIN ON tty5 BY mvstest
 Oct 23 21:00:42 uvsoft3 shutdown: shutting down for system halt

sample output report

 statlogin1  2007/11/26_21:24:24  logins by month & userid
 tbl#001 pg#001     -argument-
 line#  count    %  mth login
     1      13   5  Nov efunds2
     2      13   5  Nov laval4
     3      23  10  Nov mvstest
     4      27  12  Nov root
     5      26  11  Nov uvadm
     6      26  11  Nov uvbak
     7       8   3  Oct efunds2
     8       7   3  Oct laval4
     9      10   4  Oct mvstest
    10      11   4  Oct root
           222*100   *TOTAL*

This uvcopy job scans for 'session opened', then scans for ' user ', extracts the following word (userid),& uses the userid & month as the table argument

See 'statlogin1' job listed at https://www.uvsoftware.ca/tablejobs.htm#J1. To scan for desired data & build table above requires only 21 lines of code. The job is 87 lines total because we include 66 lines of comments for operating instructions & a samples of input & output.

Using this job as an example, you should be able to write other jobs to table summarize other items that interest you from this file or other system files.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

4D2. CNVaids: Table Summaries & Statistics

statlogin1 - uvcopy coding

 # statlogin1 - table summary of user logins by month & userid
 #            - based on /var/log/messages
 #            - by Owen Townsend, UV Software, Nov 26/2007
 #
 # uvcopy statlogin1,fili1=/var/log/messages,filo1=stats/login.rpt1
 # ================================================================
 # uvcopy statlogin1   <-- same & easier (files default as shown above)
 # =================
 #
 rop=r1    # option to prompt for report disposition at EOJ
 fili1=/var/log/messages,typ=LST,rcs=256
 filo1=stats/login.rpt1,typ=LSTt,rcs=128
 @run
        opn     all
 #
 # begin loop to get & process messages lines until EOF
 man20  get     fili1,a0              get next line of messages
        skp>    man90                 (cc set > at EOF)
        sqzc1   a0(256),' '           ensure only 1 blank between words
 #
 # scan for 'session opened' & 'user' login
 # table user logins by month & by month+day
        scn     a0(100),' session opened '
        skp!    man20
        scn     a0(100),' user '
        skp!    man20
        clr     b0(500),' '           clear workarea
        mvu     b0(25),ax6,' '        store user login until ending blank
        mvc     b100(3),a0            store mth (1st 3 bytes)
        mvc     b104(25),b0           follow with userid
        tblt1f4 b100(32),'mth login'
        skp     man20                return to get next line
 #
 # EOF - dump tables, close files, prompt for report view (rop=r1), end job
 man90  tbpt1   filo1,'logins by month & userid'
        cls     all
        eoj
Note
  • this uvcopy job is stored at /home/uvadm/pf/demo/statlogin1
  • please see the sample report & explanations on the previous page

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

4D1. CNVaids: Table Summaries & Statistics

table2 - Table Summaries for Fixed Length Fields

'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. You might use this to verify suspicious totals from COBOL programs.

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

cd testdata
  • change into testdata dir (with subdirs ar & tmp)

 uvcopy table2,fili1=dat1/sales3,uop=a30b6c38d6e53f9g3r64
 ========================================================
 uvcopy table2               <-- Try this Now
 =============                 - You only need to enter/remember this much
                               - you will be prompted for filename & options
                               - output filename will be tmp/sales1.tbl
 uop--> a30b6c38d6e53f9g3r64 <-- ENTER options for demo
        ====================   - can enter just 'a30b6r64' for counts by product#

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 doc End this doc Index this doc Contents this library UVSI Home-Page

4D2. CNVaids: Table Summaries & Statistics

table2 - OPTIONS (for Fixed Field files)


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

 uvcopy table2     - minimum entry, will be prompted for file & options
 =============     - will be prompted for options
                   - output filename same as input, in tmp subdir with .tbl ext
                     (in this case - tmp/sales3.tbl)

table2 demo - console display

 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 sales1 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
                                           ====
 <-- See the sample report listed on the previous page

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

4D3. CNVaids: Table Summaries & Statistics

table2 script, easier than uvcopy table2 directly

In addition to the 'table2 uvcopy job', we provide a 'table2 script' which is easier to run (fewer keystrokes) & easier to code in a larger script. For example, here is the uvcopy command used on the previous page, followed by the script equivalent:


 uvcopy table2,fili1=dat1/sales3,uop=a30b6c38d6e53f9r64
 ======================================================
 - using uvcopy table2 job directly

 table2 dat1/sales3 a30b6c38d6e53f9r64
 =====================================
 - using script 'table2' to call 'uvcopy table2' requires fewer keystorkes

 table2 dat1/sales3 a30b6r64
 ===========================
 - simpler example to just count by product# (offset=30 length=6)
   omitting acumulation by quantity (offset=38 lth=6) & amount (offset=53 lth=9)

Script table2 calls uvcopy job table2, which will prompt for any omitted values For example, here are console displays & prompts to count sales by product#


 table2 dat1/sales3 a30b6r64
 ===========================

User OPtion (uop) defaults = q1a0b0c0d0e0f0g0n0p0r0a30b6r64 -->null to accept or enter/override --> <-- null reply accepts a30b6r64

option d acum field#1 lth unspecified, OK just count y/n --> <-- null OK

enter report title (optional) --> <-- null yo omit titel

RSF = typ default fili01 accept or enter new typ --> <-- null accept RSF

Output File written to: tmp/sales3_tbl_product Enter: more,print,uvlpr12,edit,null --> more <-- enter 'more' to display report

 table2 - table summary of counts & values by any argument
 table2  2013/06/04_10:53:44
 tbl#0001  tblo1t1 n0($rn32)
 line#     count  %    1strec#  product
     1         2  10        10  BBQ001
     2         1   5         3  CHR001
     3         5  25         1  HAM001
     4         2  10         7  HAX129
     5         2  10        11  SAW051
     6         1   5         2  SCR012
     7         4  20         4  TAB013
     8         3  15         8  WHIP75
              20*100             *TOTAL*

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

4D4. CNVaids: Table Summaries & Statistics

table3d - table summary for text files (JCL,COBOL,etc)

'table3d' is a more useful than 'table2' for JCL/script & COBOL conversions because it is designed to process entire directories of files (vs 'table2' which processes only fixed length data files & only 1 at a time).

'table3d' allows you to specify a 'key-word', preceding a 'target-word'. The job searches all lines of all files in the directory & the report shows one line for each target-word with the counts & percentages of the total line. Some examples of possible reports might be:

  1. count occurrences in JCL of each program-name (using EXEC as the keyword)
  2. count occurrences in COBOL of each copybook (using 'copy' as the keyword)
  3. count occurrences in JCL of High Level Qualifiers (using DSN as the keyword)

Note that the 'cross-reference' reports XREFjobs.htm provide for the 1st 2 above, so we use #3 as our example. High Level Qualifier refers to the top-node in DSN filenames which becomes the sub-directory in the converted scripts. A few samples of 'DSN's from our test files might be:

       //CUSTMAS  DD DSN=AR.CUSTOMER.MASTER.INDEXED,DISP=SHR
       //SORTIN   DD DSN=GL.ACCOUNT.TRANS,DISP=SHR
       //SORTOUT  DD DSN=&&TEMPSLS,DISP=(NEW,PASS),...

Op. Instrns to create top-node summary table


 uvcopy table3d,fild1=jcl0,arg1=DSN,arg2=.,arg4=.=
 =================================================

sample report - summary of HLQs in all JCL

 Job: table3d Dir: jcl0 Keyword(s): DSN
 Qual1: .  Qual2:   Blanked: =. Userops: q1c0f0l0k0m0p1w1
 table3d  2007/09/08_16:11:24  Counts by Targetword following specified Keyword
 tbl#001 pg#001     -argument-
 line#  count    %  target-word
     1      27  28   AR
     2       1   1   ARTEST
     3       1   1   FTP
     4      52  54   GL
     5       1   1   GLTEST
     6       1   1   MXP
     7       4   4   PY
     8       4   4   PYTEST
     9       2   2   RPTS
            93*100   *TOTAL*

Do you see how you can run table3d to summarize other components of JCL or COBOL by choosing appropriate keywords, targetwords,& options. See more explanations at: TABLEjobs.htm#E1.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

4E1. CNVaids: Table Summaries & Statistics

record-size summary

'recsizes1' is a uvcopy utility job that will read any text file & create a summary table of all different record-sizes found in the file - based on LineFeed terminators x'0A' (or CR+LF x'0D0A').

The uvcopy job may be found at /home/uvadm/pf/util/recsizes1 & is listed below. Note the operating instructions & sample report as #comments within the listing. You can run the job using the supplied test file /home/uvadm/dat1/customers.

 # recsizes1 - create summary table of record-sizes in a text file
 #           - by Owen Townsend, June 6, 2007
 #
 # uvcopy recsizes1,fili1=dat1/customers,filo1=tmp/custrecsizes
 # ============================================================
 #
 #                   ** sample report **
 #
 # recsizes1  2007/06/07_13:54:02  summary of record-sizes in: dat1/customers
 # tbl#001 pg#001     -argument-
 # line#  count    %  record-size
 #     1       1   3  0079
 #     2      10  31  0086
 #     3       2   6  0098
 #     4      19  59  0102
 #            32*100   *TOTAL*
 #
 rop=r1x2      # option r1=display outfile at EOJ, x2=more (default command)
 was=a8192     # increase area 'a' to allow recsizes up to 8192 bytes
 fili1=?infile,rcs=8192,typ=LST
 filo1=?recsizesummary,rcs=128,typ=LSTt
 @run
         opn     all
 # begin loop to get records & table record-size, until EOF
 # - 'get' instrn stores binary recsize in rgstr 'z' ($rz)
 # - use 'mvn' to convert binary $rz to 4 numerics for table argument
 man20   get     fili1,a0(8192)         get next record
         skp>    man80
         mvn     c0(4),$rz              store recsize in digits
         tblt1   c0(4),'record-size'    build table of record-sizes
         skp     man20                  return to get next record
 # EOF - dump table to outfile, close files & end job
 man80   tbpt1v1 filo1,'summary of record-sizes in: $fili1'
         cls     all
         eoj

This job illustrates the powerful 'tbl' instruction of uvcopy. 'tbl' builds a table in memory based on a specified argument. It creates a new table entry on the 1st occurrence of any given argument & increments a counter on subsequent occurrences. Optionally you can specify up to 6 accumulators. At EOF, you use the 'tbp' instruction to dump the table to a file for printing.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

4F1. CNVaids: Table Summaries & Statistics

tblext1 - table summary counts by file extensions

uvcopy job 'tblext1' will create table summary counts of file extensions in a directory (.CBL .CPY .JCL .PROC .CTL .zip etc).

sample report

 tblext1  2006/04/16_20:58:01  table summary of extensions/counts in directory
 tbl#001 pg#001     -argument-            -acum#1-    %
 line#  count    %  file extension           count
     1      37  13  .CBL                        37   13
     2       8   2  .CPY                         8    2
     3     212  75  .CTL                       212   75
     4      21   7  .JCL                        21    7
     5       1   0  .zip                         1    0
           279*100   *TOTAL*                   279 *100

Operating Instructions

Assume we have just FTP'd a mixture of mainframe files to subdir 'ftp' on our unix system & we wish to know counts by file extension.


 uvcopy tblext1,fild1=ftp[,filo1=rpts/ftp.ext]
 =============================================
 - no need to specify output file, it defaults as shown
 - to subdir tmp with filename=indirname.ext (tmp/ftp.ext in this case)

tblext1 to calc compile failure %

'tblext1' is handly to calculate the COBOL compile failure percentage. The 'mfcblA' script compiles all programs in cbls/* & writes output to cblx/... Clean compiles write .cbl, .idy,& .int, But failures write only a .err file


 mfcblA all     <-- compile all programs from cbls/* to cblx/...
 ==========

 uvcopy tblext1,fild1=cblx  <-- table summarize (dflt output in rpts/cblx.ext)
 =========================
 tblext1  2009/08/30_17:55:34  table summary of extensions/counts in directory
 tbl#001 pg#001     -argument-            -acum#1-    %
 line#  count    %  file extension           count
    1       12  31  .cbl                        12   31
    2        2   5  .err                         2    5
    3       12  31  .idy                        12   31
    4       12  31  .int                        12   31
            38*100   *TOTAL*                    38 *100

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

4F2. CNVaids: Table Summaries & Statistics

tblext2 - summarize .ext's in all subdirs of a superdir

 # tblext2 - table summary of file extensions in all subdirs of a superdir
 #          - by Owen Townsend, September 2009
 # tblext1 - (prior job) reads filenames from only 1 directory
 #*tblext2 - (this job)  reads filenames from all subdirs of a superdir
 #
 # uvcopy tblext2,fild1=mainframefiles[,filo2=rpts/mainframefiles.ext]
 # ====================================================================
 # - no need to specify output file, it defaults as shown
 #
 opr='$jobname - table summary of filename extensions in a directory'
 rop=r2  #run option to prompt at EOJ for report disposition (vi,cat,more,etc)
 fild1=?xxx,typ=DIR,rcs=256    # '?' solicits dirname if not on command line
 fili1=xxxx,typ=LST,rcs=256
 filo2=rpts/dirname.ext,typ=LSTt,rcs=80
 @run
 # create output filename in rpts subdir with same name as input subdir + .ext
        opn     fild1                    ensure directory present
        mvu     f1(80),$fild1,x'00'      move input dir path to w/s
        scnr    f0(80),'/'               scan for rightmost '/'
        mvc     f100(60),fx1             isolate input base subdir
        mvc     f200(5),'rpts/'          setup rpts/ subdir
        cat     f200(60),fx1(60)         concat basedir for rpts/filename
        cata8   f200(60),'.ext'          concat suffix & nullterminate
        mvft1   $filo2,f200(60)          store outfile name
        sys     'if test -d rpts || mkdir rpts'  make rpts/ if not present
        opn     filo2                    open output rpts/file
 #
 # capture all filenames from all subdirs into a tmp/file for readback
 man10  sysv1   'find $fild1 -print -type f >tmp/tblext2'
        mvft1   $fili1(60),'tmp/tblext2'
        opn     fili1                    open file of filenames
 #
 # begin loop to read filenames & build table by suffix til EOF
 man20  get     fili1,a0(256)            get each record into area 'a'
        skp>    man90                    cc set > if EOF
        mvf     b0(80),'none'            in case no extension found
        scnr    a0(80),'.'               scan for rightmost '.'
        skp!    man30                    '.' found ?
        mvc     b0(80),ax0               yes - store the .xxx for tbl
 man30  tblt1f1 b0(16),'file extension;count',1
        skp     man20                    repeat loop until end of dir
 #
 # EOD - dump table to outfile & query oprtr for display/edit/print ?
 man90  tbpt1s1 filo2,'table summary of extensions/counts in directory'
        cls     all
        eoj

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_5. CNVaids.doc Vancouver Utility Conversion Aids

COBOL aids - Contents


5A1. Cross-Refs for COBOL copybooks & called programs
- see all cross-refs in 'Part_3' (COBOL & JCL)

5B1. 'statallmvs1' creates table summaries from all converted COBOL programs in
the cbls/... subdir. and also creates table summaries for mainframe MVS JCL
in jcl2/... and converted scripts in jcl3/... (already shown in Part_4).
'statallvse1' is the same,but for VSE JCL.

5B2. statcbl1 - table summarize mainframe COBOL copybooks & called programs
- counts each copybook & called program found in all programs

5C1. cobfil51 - COBOL Files Report
- information extracted from all COBOL programs in directory
- filenames, Input/Output, Org, Access, record size, copybook
- all programmers should have a copy before starting test/debug

5C1. cobfiles5A - COBOL files report (alternate script with additional tasks)
- cpyrcs1 job gets record-size from copybook/maps
- loads COBOL info Indexed file for use by jobflow reports

5D1. cobmap1 - create record layouts from COBOL copybooks
- another of the favorite tools in Vancouver Utilities
- short demo here, fully documented in COBaids1.htm.
- also see 'uvhdcob' at '7B1' & 'uvhdc2' at '7B4'
  which show datafile field contents beside copybooknames

5E1. Animation - essential for debugging MicroFocus COBOL programs
- animation illustrated for Server Express under Unix/Linux
- also illustrated for Net Express under SFU/UWIN/CYGWIN/Windows
- This discussion shows you how our JCL/script conversion
makes it easy for you to turn animation on & off.
- Animation is fully documented in the MicroFocus manuals

5F1. Micro Focus COBOL 'file status' error codes
- 2 byte codes 00-49, excluding 1st byte '9'
- codes extracted from Micro Focus website:

5F2. Micro Focus COBOL 'run time' error codes
- 1st byte character '9' x'39'
- 2nd byte binary x'00'- x'FF' (decimal 000-255)

5F3. Micro Focus COBOL 'run time' error messages
- 1st line only of full text error messages on the web site

https://supportline.microfocus.com/Documentation/books/sx40sp1/smpubb.htm

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

CNVaids Contents - continued


5G1. splitcblcpy1 - split mixed directories of COBOL programs & copybooks
to separate subdirs required by COBOL conversion & compile
- see job listed on page '8N1'

5H1. rebuild - Micro Focus utility to rebuild Indexed files.

5I1. acucobolx1 - extract data records from AcuCOBOL Indexed files

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

5A1. CNVaids: COBOL aids, cobfiles, cobmaps, Animation, etc

COBOL Cross-References

xcobcall1
  • COBOL calls -----> list of all 'call's in each program
xcobcall2
  • COBOL calls -----> crossref shows all programs calling each program
xcobcopy1
  • COBOL copybooks--> list of all copybooks in each program
xcobcopy2
  • COBOL copybooks--> crossref shows all programs using each copybook
Note
  • see COBOL & JCL cross-refs in 'Part_3' (COBOL & JCL)
  • see more details & script listings in XREFjobs.htm

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

5B1. CNVaids: COBOL aids, cobfiles, cobmaps, Animation, etc

statallmvs1/statallvse1 - table stats from JCL/scripts


5B1. 'statallmvs1' runs several uvcopy jobs to create table summaries by
analyzing all files in jcl2 (MVS JCL), jcl3 (converted JCL/scripts),
& cbls (converted COBOL). 'statallvse1' is the same,but for VSE JCL.
The JCL reports have already been shown in Part_4.

5B2. statcbl1 - table summarize (gather statistics) for COBOL programs
- count refs to each copybook, called program,& file ORG type

4B1. statmvsjcl1 - table summarize (gather statistics from) mainframe JCL
- count refs to each program, PROC, & top-node used in all JCLs

4B2. statksh1 - table summarize (get stats for) converted Korn shell scripts
- count refs to each program, PROC, & top-node used in Ksh scripts

statallmvs1/statallvse1 - Operating Instructions


 #1. cdl   <-- change to libraries superdir (/home/mvstest/testlibs for demo)
     ===     - or your Libraries

 #2. mkdir stats   <-- make subdir to receive report (if not existing)
     ===========

 #3. statallmvs1 all  <-- script to run uvcopy jobs statcbl1,statmvsjcl2,statksh1
     ===============

 #3a. statallvse1 all <-- same, but for VSE JCL
      ===============

 #4a. vi stats/cbls_calledpgms  <-- see sample reports on page '5B2'
 #4b. vi stats/cbls_copybooks
 #4c. vi stats/cbls_ORGtypes

 #4d. vi stats/jcl2_pgms        <-- see sample reports on page '4B1'
 #4e. vi stats/jcl2_procs
 #4f. vi stats/jcl2_topnodes

 #4g. vi stats/jcl3_pgms        <-- see sample report on page '4B2'
 #4h. vi stats/jcl3_topnodes
 #4i. vi stats/jcl3_exportfiles

The following sample reports were run for the supplied set of test/demo JCL & COBOL programs in /home/uvadm/mvstest/testlibs/...

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

5B2. CNVaids: Table Summaries & Statistics

statcbl11 - COBOL stat report samples


 uvcopy statcbl1 <-- create stats: COBOL copybooks, called-programs,& ORG types
 ===============
 statcbl1  2009/05/01_11:15:02  Summary of copybooks in cbls cbls/cgl100.cbl
 tbl#001 pg#001     -argument-
 line#  count    %  copybook
    1        6  17  custmas.cpy
    2        1   2  paymas.cpy
    3        2   5  saledtl.cpy
    4        1   2  sdline.cpy
    5        1   2  stline.cpy
    6       12  34  unixproc1.cpy
    7       12  34  unixwork1.cpy
            35*100   *TOTAL*
 statcbl1  2009/05/01_11:15:02  Summary of called programs in cbls cbls/cgl100.cbl
 tbl#002 pg#001     -argument-
 line#  count    %  called program
    1        2 100  getparm
             2*100   *TOTAL*
 statcbl1  2009/05/01_11:15:02  Summary of ORGANIZATION types in cbls cbls/cgl100.cbl
 tbl#003 pg#001     -argument-
 line#  count    %  organization
    1        2   8  indexed
    2        9  39  line sequential
    3       12  52  record sequential
            23*100   *TOTAL*
Note
  • the 'statcbl1' reports are also documented in Part_4 (JCL aids)
  • since part of the 'statallmvs1/statallvse1' scripts

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

5C1. CNVaids: COBOL aids, cobfiles, cobmaps, Animation, etc

COBOL Files Report

For each file used in each program, this report shows:

  1. external name from the 'select' stmnt (to match DDname in JCL)
  2. Organization & Access Method
  3. Open mode - Input, Output, Extend, Input-Output
  4. Record-size
  5. Copybook name (if any)
  6. internal name from the 'select' stmnt

See sample report on the next page '5C2' --->

All programmers should have a copy of this report before they begin testing & debugging. It supplies instant answers to questions about file inputs & outputs, access methods, record sizes, copybooks, etc.

cobfil51 vs cobfiles5A

You could create the report with just 'cobfil51', but 'cobfiles5A' is strongly recommended, because it generates Indexed files of COBOL file info that is used by cobfil51 & also by the 'jobflow' reports.


 #1.  uvcopy cobfil51,fild1=cbls[,filo2=xref/cobfiles.rpt]
      ====================================================

 #1a. uvcopy cobfil51   <-- easy alternative (files default as shown above)
      ===============

 #2a. vi xref/cobfiles.rpt       <-- view the COBOL files report
      ====================

 #2b. uvlp12 xref/cobfiles.rpt   <-- list the COBOL files report
      ========================       see sample report on the next page -->

cobfiles5A - recommended alternative


 #1. cobfiles5A cbls cpys maps <-- generate xref/cobfil51a & load xref/cobfil51I
     =========================   - run now if not already run on page '5C1'

 #2. uvlp12 xref/cobfiles.rpt   <-- list the COBOL files report
     ========================       see sample report on the next page -->

The jobflow reports (page '6B1') require Indexed files xref/cobfil51I to merge COBOL file info with the JCL/script info.

'cobfiles5A' is a handy script to both generate the cobfiles report & load the Indexed file that will be required by jobflow51 & jobflow5A.

See the 'cobfiles5A' script listed at XREFjobs.htm#3X1

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

5C2. CNVaids: COBOL aids, cobfiles, cobmaps, Animation, etc

sample COBOL files report

 cobfil51  ** COBOL Files Report ** Dir=cbls  2009/08/30_17:47:40
 progname.cbl DDname       OAM   open recsz  copybook.cpy  FDname / Key    lines
 ============================================se=in=up=de=========================
 car100.cbl   custmas      SS    I      256  custmas.cpy   custmas
 car100.cbl   nalist       L     O      120                nalist
                                                                              52
 car101.cbl   custmas1     SS    I      256                custmas1
 car101.cbl   nalist       L     O       90                nalist
                                                                              41
 car120.cbl   custmas      SS    I      256  custmas.cpy   custmas
 car120.cbl   nalist       L     O       90                nalist
                                                                              71
 car130.cbl   custmas      SS    I      256  custmas.cpy   custmas
 car130.cbl   nalist       L     O       90                nalist
                                                                              65
 car140.cbl   custmas      SS    I      256  custmas.cpy   custmas
 car140.cbl   nalist       L     O       90                nalist
                                                                              62
 car150.cbl   custmas      SS    I      256  custmas.cpy   custmas
 car150.cbl   nalist       L     O      120                nalist
                                                                              60
 car200.cbl   saledtl      SS    I       64  saledtl.cpy   saledtl
 car200.cbl   custmas      IR    I      256  custmas.cpy   custmas
 car200.cbl          key->                                    cm-cust
 car200.cbl   salelst      L     O      120  sdline.cpy    salelst
                                                                              65
 car300.cbl     -NoFiles-                                                     34
 cgl100.cbl   acctmas      SS    I       80                acctmas
 cgl100.cbl   actlist      L     O      120                actlist
                                                                              53
 cgl200.cbl   glmsold      SS    I       80                glmsold
 cgl200.cbl   glmsnew      SS    O       80                glmsnew
 cgl200.cbl   gltrans      SS    I       80                gltrans
                                                                              61
 cpy100.cbl   paymas       SS    I      256  paymas.cpy    paymas
 cpy100.cbl   nalist       L     O      120                nalist
                                                                              46
 sqlora1.cbl  cust1in      LS    I       80                cust1
 sqlora1.cbl  exec_sql                       cust1             I01
                                                                             110
 sqlora2.cbl  cust1out     LS    O       80                cust1
 sqlora2.cbl  exec_sql                       sqlca.cpy
 sqlora2.cbl  exec_sql                       cust1         S01
                                                                             112
 testunix1.cblcustmas      IS    I      256                custmas
 testunix1.cbl       key->                                    custnum
                                                                              76
 Total programs = 14, total files = 25

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

5D1. CNVaids: COBOL aids, cobfiles, cobmaps, Animation, etc

'cobmap1' - generate record layouts from COBOL copybooks

'cobmap1' generates record layouts from your COBOL copybooks. It copies the copybook to another file (we call it a 'cobmap'), calculating & appending field start, end,& length onto the right side of each field definition. This information is essential to verify data records, specify SORT FIELD locations, etc.

Try the following demo, using demo copybook cpys/custmas.cpy as input, and generating the cobmap output in maps/custmas. Note that 'cobmap1' is a 'uvcopy job', a file of instructions that requires the 'uvcopy' interpreter. 'uvcopy' finds the instruction file via 'PFPATH' which is defined in the profile. 'cobmap1' is found in /home/uvadm/pf/util/cobmap1.

cobmap1 Operating Instructions


 uvcopy cobmap1,fili1=cpys/custmas.cpy,filo1=maps/custmas
 ========================================================

Output cobmap - maps/custmas

 cobmap1  start-end bytes for cobol record fields    200310101805  pg# 0001
 cpys/custmas.cpy                                  RCSZ=00256  bgn  end  lth typ
 * custmas - cobol copy book for customer.master file mvsjcl
      10 cm-num           pic  9(6).                          0000 0005  006 n  6
      10 cm-delete        pic  x(4).                          0006 0009  004
      10 cm-name          pic  x(25).                         0010 0034  025
      10 cm-adrs          pic  x(25).                         0035 0059  025
      10 cm-city          pic  x(16).                         0060 0075  016
      10 filler001        pic  x.                             0076 0076  001
      10 cm-prov          pic  x(2).                          0077 0078  002
      10 filler002        pic  x.                             0079 0079  001
      10 cm-postal        pic  x(10).                         0080 0089  010
      10 cm-phone         pic  x(12).                         0090 0101  012
      10 cm-contact       pic  x(18).                         0102 0119  018
      10 cm-thisyr-sales  pic  s9(7)v99 comp-3 occurs 12.     0120 0124  005pns 9
      10 cm-lastyr-sales  pic  s9(7)v99 comp-3 occurs 12.     0180 0184  005pns 9
      10 filler003        pic  x(16).                         0240 0255  016
 *RCSZ=00256                                                       0256

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

5D2. CNVaids: COBOL aids, cobfiles, cobmaps, Animation, etc

generating 'cobmap's for ALL copybooks in directory

The Operating Instructions are actually simpler to generate 'cobmap's for all copybooks in the directory. Try the following:


 uvcopyx cobmap1 cpys maps uop=q0i7p0
 ====================================

'uvcopyx' is a script that re-runs the 'uvcopy' interpreter using the 'cobmap1' instructions on each file found in the input directory 'cpys', and writes the corresponding output to the output directory 'maps' with the same name as input.


 vi maps/*        <-- examine all outputs
 =========

See more about cobmap1 at COBaids.htm#A1

Also see 'uvhdcob' at '7B1' & 'uvhdc2' at '7B4', which show data-file field contents beside copybook-names.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

5E1. CNVaids: COBOL aids, cobfiles, cobmaps, Animation, etc

Animating MicroFocus COBOL on Unix/Linux

This assumes you have converted the JCL as shown at JCLcnv1demo.htm#Part_3 & that you have converted & compiled the programs as shown at MVSCOBOL.htm#1R3 & also shown in JCLcnv1demo.htm#Part_3. We will illustrate using test/demo program /home/mvstest/cbls/car100.cbl' & test/demo jcl/script /home/mvstest/jcls/jar100.ksh'. Relevant directories are:

cbls
  • cobol source programs
    'car100.cbl' is the program to be animated
cblx
  • compiled programs
    'car100.int' is the compiled program
  • compiling for animation will add 'car100.idy' & 'car100.cbl'
    (the mfcbl1 & mfcblA scripts now always compile for animation)
  • any errors will be collected in 'car100.err'
jcls
  • converted scripts to execute the demo COBOL programs
    'jar100.ksh' will execute the 'car100' program
  • The program is executed about line #40 as follows:
    'cobrun $ANIM $RLX/car100'

ANIMATION operating instructions


 #1.  export ANIM=+A    - set switch (environmental variable) for animation
      ==============      $ANIM is otherwise null in 'cobrun $ANIM $RLX/car100'

 #1a. export COBSW=+A   <-- use COBSW for Windows SFU/Cygwin/Uwin & Net Express
      ===============       (vs ANIM for unix/linux scripts on Server Express)

 #2.  jar100.ksh        - run the job (will now ANIMATE)
      ==========

 #3.  export ANIM=""    - reset the Animation switch (to run normally)
      =============

Note that the converted scripts execute the COBOL programs as follows:


 cobrun $ANIM $RLX/car100    <-- sample COBOL execution in JCL/script
 =======================

advantages of this animation method

Whenever you need to animate a program, all you have to do is set the animation switch on via 'export ANIM=+A', debug the program, & then set the animation switch off via 'export ANIM=-A'.

The mfcbl1 & mfcblA scripts always compile with the animation option '-A' & always copies the source .cbl from source directory (cbls) to the executable directory (cblx) as is required for animation.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

5F1. CNVaids: COBOL aids, cobfiles, cobmaps, Animation, etc

Micro Focus COBOL - File Status Codes


 https://supportline.microfocus.com/Documentation/books/sx40sp1/smpubb.htm
 ========================================================================

00 Successful completion

02 Indexed files only. One of two possibilities: For a READ statement, the key value for the current key is equal to the value of that same key in the next record in the current key of reference. For a WRITE or REWRITE statement, the record just written created a duplicate key value for at least one alternate record key for which duplicates are allowed.

04 Length of the record being processed does not conform to the fixed file attributes for that file.

05 The referenced optional file is not present at the time the OPEN statement is executed. (see '35' for non-optional file)

07 Sequential files only. For an OPEN or CLOSE statement with the REEL/UNIT phrase the referenced file is a non-reel/unit medium.

10 No next logical record exists. You have reached the end of the file.

14 Relative files only. The number of significant digits in the relative record number is larger than the size of the relative key data item described for that file.

21 Sequentially accessed files only. Indicates a sequence error. The ascending key requirements of successive record key values has been violated, or, the prime record key value has been changed by a COBOL program between successful execution of a READ statement and execution of the next REWRITE statement for that file.

22 Indexed and relative files only. Indicates a duplicate key condition. Attempt has been made to store a record that would create a duplicate key in the indexed or relative file OR a duplicate alternate record key that does not allow duplicates.

23 Indicates no record found. An attempt has been made to access a record, identified by a key, and that record does not exist in the file. Alternatively a START or READ operation has been tried on an optional input file that is not present.

24 Relative and indexed files only. Indicates a boundary violation arising from one of the following conditions: an attempt is made to write beyond the externally defined boundaries of a file; a sequential WRITE operation has been tried on a relative file, but the number of significant digits in the relative record number is larger than the size of the relative key data item described for the file.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Micro Focus COBOL - File Status Codes (continued)

30 The I/O statement was unsuccessfully executed as the result of a boundary violation for a sequential file or as the result of an I/O error, such as a data check parity error, or a transmission error.

34 The I/O statement failed because of a boundary violation. This condition indicates that an attempt has been made to write beyond the externally defined boundaries of a sequential file.

35 OPEN operation with the I-O, INPUT, or EXTEND phrases has been tried on a non-OPTIONAL file that is not present.

37 OPEN operation has been tried on a file which does not support the open mode specified in the OPEN statement.

38 OPEN operation has been tried on a file previously closed with a lock.

39 Conflict has been detected between the fixed file attributes and the attributes specified for that file in the program.

41 OPEN operation has been tried on file already opened.

42 CLOSE operation has been tried on file already closed.

43 Files in sequential access mode. The last I/O statement executed for the file, before the execution of a DELETE or REWRITE statement, was not a READ statement.

44 Boundary violation exists. Possible violations are: * An attempt has been made to WRITE or REWRITE a record that is larger than the largest, or smaller than the smallest record allowed by the RECORD IS VARYING clause of the associated file. * An attempt has been made to REWRITE a record to a file, and the record is not the same size as the record being replaced.

46 Sequential READ operation has been tried on a file open in the INPUT or I-O mode but no valid next record has been established.

47 READ or START operation has been tried on a file not opened INPUT or I-O.

48 WRITE operation has been tried on a file not opened in the OUTPUT, I-O, or EXTEND mode, or on a file open I-O in the sequential access mode.

49 DELETE or REWRITE operation has been tried on a file that is not opened I-O.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

5F2. CNVaids: COBOL Aids

Micro Focus COBOL - Run-time Error Codes

'Run-Time' error codes have 1st byte '9' & 2nd byte is a binary code that must be converted from binary to decimal. You can then look up the meaning on the Micro Focus COBOL website.

These messages are output by the run-time system (RTS), and so can be produced while you are compiling, debugging, or running your program. When you select an error message number, its text and severity is listed, along with an explanation of the error or problem that caused the message, and advice on how to prevent the error.

Goto the Web-Site & Click the error number you require details about:

   	001 	002 	003 	004 	005 	006 	007 	008 	009
 010 	011 	012 	013 	014 	015 	016 	017 	018 	019
 020 	021 	022 	023 	024 	025 	026 	027 	028 	029
 030 	031 	032 	033 	034 	035 	036 	037 	038 	039
 040 	041 	042 	043 	044 	045 	  	047 	048 	
   	  	  	  	  	055 	  	  	  	
   	  	  	  	  	065 	066 	067 	068 	069
 070 	071 	072 	073 	074 	075 	076 	077 	078 	079
 080 	081 	082 	  	  	  	086 	  	  	
   	  	  	  	  	  	  	  	  	099
 100 	101 	102 	103 	104 	105 	106 	107 	108 	109
 110 	111 	112 	  	114 	115 	116 	117 	118 	119
 120 	121 	122 	123 	124 	125 	126 	127 	  	129
   	  	  	  	  	135 	136 	137 	138 	139
   	141 	142 	143 	144 	  	146 	147 	148 	149
   	151 	152 	153 	154 	155 	156 	157 	158 	159
 160 	161 	162 	163 	164 	165 	166 	167 	168 	169
 170 	171 	  	173 	174 	175 	176 	177 	  	179
 180 	181 	182 	183 	184 	185 	186 	187 	188 	189
 190 	191 	192 	193 	194 	195 	196 	197 	198 	199
 200 	201 	  	203 	  	205 	206 	207 	208 	209
 210 	211 	212 	213 	214 	215 	216 	217 	218 	219
 220 	221 	222 	223 	224 	225 	226 	227 	228 	229
   	231 	  	  	  	235 	236 	237 	238 	239
 240 	241 	242 	243 	  	  	  	  	  	249
 250 	251 	252 	253 	254 	  	  	  	  	

Goto the Web-Site & Click the error number you require details about:


 https://supportline.microfocus.com/Documentation/books/sx40sp1/smpubb.htm
 ========================================================================

Mainframe COBOL programs did not expect binary & will display garbage for the 2nd byte. Note that the VU conversions insert copybooks 'unixwork1.cpy' & 'unixproc1.cpy'. unixproc1 contains a subrtn to display the binary codes. BUT, you have to insert 'perform mf-display-filestat-eoj' wherever the COBOL program tests file status.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

5F3. CNVaids: COBOL Aids

Micro Focus COBOL - Run-time Error Messages

Note
  • Here is 'FIRST LINE ONLY' of full text error messages on the web site
  • goto web site adrs above to get full text & recoveries
 001 Insufficient buffer space (Recoverable)
 002 File not open when access attempted (Recoverable)
 003 Serial mode error (Recoverable)
 004 Illegal file name (Recoverable)
 005 Illegal device specification (Recoverable)
 006 Attempt to write to a file opened for INPUT (Recoverable)
 007 Disk space exhausted (Fatal)
 008 Attempt to input from a file opened for OUTPUT (Recoverable)
 009 Directory not found (Recoverable)
 010 File name not supplied (Recoverable)
 011 Process limit reached (Fatal)
 012 Attempt to open a file which is already open (Recoverable)
 013 File not found (Recoverable)
 014 Too many files open simultaneously (Recoverable)
 015 Too many indexed files open (Recoverable)
 016 Too many device files open (Recoverable)
 017 Record error: probably zero length (Recoverable)
 018 Read part record error: EOF before EOR or file open in wrong mode (Recover-
 019 Rewrite error: open mode or access mode wrong (Recoverable)
 020 Device or resource busy (Recoverable)
 021 File is a directory (Fatal)
 022 Illegal or impossible access mode for OPEN (Recoverable)
 023 Illegal or impossible access mode for CLOSE (Recoverable)
 024 Disk input-output error (Recoverable)
 025 Operating system data error (Fatal)
 026 Block I-O error (Fatal)
 027 Device not available (Recoverable)
 028 No space on device (Fatal)
 029 Attempt to delete open file (Recoverable)
 030 File system is read-only (Recoverable)
 031 Not owner of file (Recoverable)
 032 Too many indexed files, or no such process (Recoverable)
 033 Physical I-O error (Fatal)
 034 Incorrect mode or file descriptor (Recoverable)
 035 Attempt to access a file with incorrect permission (Recoverable)
 036 File already exists (Recoverable)
 037 File access denied (Fatal)
 038 Disk not compatible (Fatal)
 039 File not compatible (Fatal)
 040 National Language initialization not set up correctly (Fatal)
 041 Corrupt index file (Recoverable)
 042 Attempt to write on broken pipe (Recoverable)
 043 File information missing for indexed file (Fatal)
 044 Attempt to OPEN an NLS file in a non-NLS program (Fatal)
 045 Attempt to OPEN an NLS file using incompatible language definition (Fatal)
 047 Indexed structure overflow (Fatal)
 048 Attempt to divide by zero (Fatal)
 055 Routine table overflow (Fatal)
 065 File locked (Recoverable)
 066 Attempt to add duplicate record key to indexed file (Fatal)
 067 Indexed file not open (Recoverable)
 068 Record locked (Recoverable)
 069 Illegal argument to isam module (Fatal)
 070 Too many indexed files open (Recoverable)
 070 Too many indexed files open (Recoverable)
 071 Bad indexed file format (Fatal)
 072 End of indexed file (Fatal)
 073 No record found in indexed file (Fatal)
 074 No current record in indexed file (Fatal)
 075 Indexed data file name too long (Fatal)
 076 Can't create lock file in /isam directory (Fatal)
 077 Internal ISAM module error (Fatal)
 078 Illegal key description in indexed file (Fatal)
 079 COBCONFIG syntax error (Fatal)
 080 Can't convert to/from Unicode codeset (Fatal)
 081 Key already exists in indexed file (Fatal)
 082 CALL convention not supported (Fatal)
 086 Remote file system failure (Fatal)
 099 Illegal operation in SORT/MERGE module (Fatal)
 100 Invalid file operation (Fatal)
 101 Illegal operation on an indexed file (Fatal)
 102 Sequential file with non-integral number of records (Fatal)
 103 Parameter cannot be passed BY VALUE (Fatal)
 104 Null file name used in a file operation (Fatal)
 105 Memory allocation error (Fatal)
 106 Dictionary error (Fatal)
 107 Operation not implemented in this run-time system (Fatal)
 108 Failure to initialize data division (Fatal)
 109 Invalid checksum in run-time system (Recoverable)
 110 Generated code not supported by this RTS (Fatal)
 111 Incompatible Class Library and Run-Time Environment versions (Fatal)
 112 Unable to locate/access the required security key (Recoverable)
 114 Attempt to access item beyond bounds of memory (Fatal)
 115 Unexpected signal (Fatal)
 116 Cannot allocate memory (Fatal)
 117 Bad collating sequence (Fatal)
 118 Symbol not found (Fatal)
 119 Symbol redefined (Fatal)
 120 Symbol string table of zero size (Fatal)
 121 Symbol is not in TEXT section (Fatal)
 122 Coblongjmp() called below level of cobsavenv() (Fatal)
 123 Unknown relocation type (Fatal)
 124 Communication failure during I/O request to the central file handler
 125 All locks/ current transactions canceled due to exceeding time limit
 126 Record size exceeds system limit (Fatal)
 127 coblongjmp() called from a different thread to cobsetjmp() (Fatal)
 129 Attempt to access record zero of relative file (Recoverable)
 135 File not found (Recoverable)
 136 Corrupt or invalid executable file (Fatal)
 137 Illegal device specification - not mass storage
 138 File closed with lock - cannot be opened (Recoverable)
 139 Record length or key data inconsistency (Recoverable)
 141 File already open - cannot be opened (Recoverable)
 142 File not open - cannot be closed (Recoverable)
 143 Rewrite/delete in sequential mode not preceded by successful read (Recover-
 144 Boundary violation (Recoverable)
 146 No current record defined for sequential read (Recoverable)
 147 Wrong open mode or access mode for read/start (Recoverable)
 148 Wrong open mode or access mode for write (Recoverable)
 149 Wrong open mode or access mode for rewrite/delete (Recoverable)
 151 Random read on sequential file (Recoverable)
 152 REWRITE on file not opened I-O (Recoverable)
 153 Subscript out of range (Fatal)
 154 PERFORM nested too deeply (Fatal)
 155 Illegal command line (Fatal)
 156 Too many parentheses in compute statement (Fatal)
 157 Not enough program memory: object file too large to load (Recoverable)
 158 Attempt to REWRITE to a line-sequential file (Recoverable)
 159 Malformed line-sequential file (Recoverable)
 160 Overlay loading error (Recoverable)
 161 Illegal intermediate code (Fatal)
 162 Arithmetic overflow or underflow (Fatal)
 163 Illegal character in numeric field (Fatal)
 164 Run-Time subprogram not found (Fatal)
 165 Version number incompatibility (Fatal)
 166 Recursive COBOL CALL is illegal (Fatal)
 167 Too many USING items (Fatal)
 168 Stack overflow (Fatal)
 169 Illegal configuration information (Fatal)
 170 System program not found (Fatal)
 171 Japanese operations illegal with this RTS (Fatal)
 173 Called program file not found in drive/directory (Fatal)
 174 Imported file not found (Fatal)
 175 Attempt to run intermediate code program which had severe errors (Fatal)
 176 Illegal intersegment reference (Fatal)
 177 Attempt to cancel program failed (Fatal)
 179 Error during chain (program not found) (Fatal)
 180 End-of-file marker error (Fatal)
 181 Invalid parameter error (Fatal)
 182 Console input or console output open in wrong direction (Fatal)
 183 Attempt to open line sequential file for I-O (Fatal)
 184 ACCEPT/DISPLAY I-O error (Fatal)
 185 File malformed (Recoverable)
 186 Attempt to open stdin, stdout or stderr with incorrect mode (Recoverable)
 187 Run-time system not found on $COBDIR path (Fatal)
 188 Filename too large (Fatal)
 189 Intermediate code load error (Fatal)
 190 Too many arguments to CALL (Fatal)
 191 Terminal type not defined (Fatal)
 192 Required terminal capability description missing (Fatal)
 193 Error in variable length count (Fatal)
 194 File size too large (Fatal)
 195 DELETE/REWRITE not preceded by a read (Fatal)
 196 Record number too large in relative or indexed file (Fatal)
 197 Screen handling system initialization error (Fatal)
 198 Load failure (Fatal)
 199 Operating System error code lies outside expected range (Fatal)
 200 Run-time system internal logic error (Fatal)
 201 I-O error in paging system (Fatal)
 203 CALL parameter not supplied (Fatal)
 205 Invalid mainframe pointer value (Fatal)
 206 Reading unwritten data from memory (Fatal)
 207 Machine does not exist (Recoverable)
 208 Error in multi-user system (Fatal)
 209 Network communication error (Recoverable)
 210 File is closed with lock (Fatal)
 211 Program not executable by Run-Time System (Fatal)
 212 Run-Time System version incompatible with object-oriented program (Fatal)
 213 Too many locks (Recoverable)
 214 GO TO has not been ALTERed (Fatal)
 215 Cannot ANIMATE a program running COMMUNICATIONS (Fatal)
 216 Cannot initialize the named communications device (Fatal)
 217 Incompatible host for native code file (Fatal)
 218 Malformed MULTIPLE REEL/UNIT file (Fatal)
 219 Operating system shared file limit exceeded (Recoverable)
 220 Attempt to execute more than one SORT or MERGE simultaneously (Fatal)
 221 Internal sort error (Fatal)
 222 Merge files out of sequence (Fatal)
 223 NLS language expansion error (Fatal)
 224 External Language Initialization failure
 225 Dynamic load error - program component missing (Fatal)
 226 EXTERNAL file definition inconsistent
 227 EXTERNAL data definition inconsistent (Fatal)
 228 Could not allocate memory for EXTERNAL item (Fatal)
 229 SORT/MERGE module does not support EXTERNAL using/giving files (Recover-
 231 GENERATE encountered before corresponding INITIATE in report (Fatal)
 235 Error in animator communications channel (Fatal)
 236 Animated program has terminated unexpectedly (Fatal)
 237 Unable to initialize animated process (Fatal)
 238 STOP RUN encountered during GNT animation (Informational)
 239 Shared run-time system initialization failure (Informational)
 240 Object reference not valid (Fatal)
 241 Cannot instantiate an abstract class (Fatal)
 242 Could not resolve DoesNotUnderstand message (Fatal)
 243 Class could not be loaded (Fatal)
 249 Process killed (signal-number) (Fatal)
 250 Not enough mainframe address space to load or run the program (Fatal)
 251 Attempt to load AMODE(24) program when current setting is AMODE(31) only
 252 Memory corruption detected (Fatal)
 253 Cannot load file - unsupported format (Fatal)
 254 Keyboard interrupt to ANIMATOR during ACCEPT (Fatal)

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

5H1. CNVaids: COBOL Aids

rebuild - Micro Focus utility

'rebuild' is a Micro Focus utility to rebuild Indexed files. Please the Micro Focus web site for the documentation, which was lacking a good example of rebuilding an indexed file using only the data partition.

For this demo, we will use /home/uvadm/dat1/cust1.fix (3 records listed below). These are 80 byte records with LineFeed in column 80. As a Micro Focus IDXFORMAT1 (CISAM) file the logical record-size is 79 & the LineFeed is the record control byte - LineFeed x'A0' for active records & null x'00' for deleted records.

 130140 EVERGREEN MOTORS       1815 BOWEN ROAD        NANAIMO          BC
 139923 JOHNSTONE BOILER       1250 EAST PENDER       VANCOUVER        BC
 150825 RIGGERS INDUSTRIAL     960 - 6TH AVENUE       HOPE             BC

rebuilding .idx from only .dat


 #1. Login as yourself --> /home/userxx
     =====

 #2. mkdir tmp1 tmp2    <-- make subdirs for I/O files
     ===============

 #3. cp /home/uvadm/dat1/cust1.fix tmp1/cust1
     ========================================
     - copy demo file to your homedir renaming as 'cust1' (no extension)

 #4. rebuild tmp1/cust1,tmp2/cust1 -r:79 -o:LSEQ,IND -t:CISAM -k:1,6 -i
     ==================================================================

This will create an Indexed file (tmp/cust1.dat & tmp/cust1.idx), logical recsize=79, 1 extra byte added for record delete control byte (so physical record size will be 80 bytes), key in 1st 6 bytes.

Note
  • we specified the input file type as 'LSEQ' (Line SEQuential) meaning
    records are terminated by a LineFeed (or CISAM delete control byte)
  • If we specify input as 'SEQ' we must specify recsize as 80
    which would cause output physical record size to be 81
    which would not match the file we wish to rebuild.

 #4a. rebuild tmp1/cust1.fix,tmp2/cust1 -r:80 -o:SEQ,IND -t:CISAM -k:1,6 -i
      =====================================================================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

5H2. CNVaids: COBOL Aids

IDXNAMETYPE2 for .dat & .idx

In the example above, rebuild input was tmp1/cust1 & the output was tmp2/cust1.dat (data partition) & tmp2/cust1.idx (index partition). The data partition is named 'cust1.dat' because we specified 'IDXNAMETYP=2' in the 'extfh.cfg' file which is defined by 'export EXTFH=extfh.cfg' in our profile. See the extfh.cfg file listed at VSECOBOL.htm#5D2.

If we did not specify IDXNAMETYP=2, then the output data partition would be just 'cust1', which is the same as the input filename & threfore could not be in the same directory. We strongly recommend IDXNAMETYP=2.

uvcp alternative to rebuild

Here is the 'uvcp' equivalent of the 'rebuild' example above.


 uvcp "fili1=tmp1/cust1,typ=RSF,rcs=80,filo1=tmp2/cust1,typ=ISF,rcs=79,isk=0(6)"
 ===============================================================================

'uvcp' provides more flexibility on I/O record sizes & file types. If records have packed or binary data, you cannot specify type as LSEQ for rebuild.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

5I1. COBOL Aids

acucobolx1 - extract data from AcuCOBOL files

'acucobolx1' is a uvcopy job to extract data from AcuCOBOL Indexed files to sequential files. AcuCOBOL Indexed files have 2 parts(files) (data & index). The indexed part has the same name as the data part + suffix of '.vix'. We can ignore the index part, but might want to sort the output on the key field to ensure sequenced on key field.

By default the extracted records will be the same length as in the indexed file, which is usually 1 fixed length for all records, but could be variable. If the data records are all character, we recommend using option 'l1' (uop=l1), to append LineFeeds on extracted data records, to allow use of unix/windows editors & printers. Do not use uop=l1 if file has any binary data x'00's etc.

We will demo 'acucobolx1' using sample data file 'acucobol1', provided in the Vancouver Utilities home directory. You can investigate with 'uvhd' as follows:

 cd /home/uvadm            <-- change to Vancouver Utilities home dir

 uvhd dat1/acucobol1 r512  <-- investigate with uvhd utility
 ========================    - display 512 byte blocks
 rec#=1 rsize=512 fptr=0 fsize=1024 rcount=2
                  10        20        30        40        50        60
 r#    1 0123456789012345678901234567890123456789012345678901234567890123
       0 ...........................F...........................:.......:
         11110000000000C00000C00000C400000000000000000000D000000300000003
         02490401010100E00000E00000D6000020000000000005000000003A0000003A
 Note - showing only 1st 64 bytes of 1st 512 byte block (no useful data)
      - acucobolx1 bypasses 1st block to 2nd block where data begins
 rec#=2 rsize=512 fptr=512 fsize=1024 rcount=2
                  10        20        30        40        50        60
 r#    2 0123456789012345678901234567890123456789012345678901234567890123
     512 .7.7....01000ROYAL BANK OF CANADA                              .
         0303000033333545442444424424444442222222222222222222222222222220
         07070000010002F91C021EB0F6031E1410000000000000000000000000000000
      64 7.7....01005CANADIAN BANK OF COMMERCE                         .7
         3030000333334444444424444244244444544222222222222222222222222203
         70700010100531E1491E021EB0F603FDD5235000000000000000000000000007
     128 .7....01010BANK OF MONTREAL                                  .7.
         0300003333344442442444554442222222222222222222222222222222222030
         0700020101021EB0F60DFE4251C0000000000000000000000000000000000070
     192 7....01015BANK OF NOVA SCOTIA                               ....
         3000033333444424424454254454422222222222222222222222222222220000
         700030101521EB0F60EF61033F49100000000000000000000000000000000000
 Note - bytes 252-511 null filled & not shown, only 4 data records in sample
 Data records begin after 1st 512 bytes (file header)
 - record header in 1st 8 bytes of each record (will be dropped in output)
 - records size in 1st 2 bytes (binary) of 8 byte record header
 - in this sample, record data size is x'0037' = 3*16+7 = 55 bytes
 Data blocks are always 512 bytes & last block in file null filled
 - only 4 records in this sample file, so bytes 252-511 null filled

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

5I2. acucobolx1 - extract data from AcuCOBOL files

demo acucobolx1 with sample file


 uvcopy acucobolx1,fili1=dat1/acucobol1,filo1=tmp/acucobol1,uop=l1
 =================================================================
 - execute command to extract data records
 - User OPtion 'l1' (uop=l1) to append a line-feed on each record
   (to allow use of text editors on output file)
 - use option l1 only for files with all character data (no binary)

 uvhd tmp/acucobol1      <-- investigate output file to deterime recsize
 ===================        - uvhd defaults to 256 byte blocks

 uvhd tmp/acucobol1 r56  <-- recsize is 56 for this sample file (55+1LF)
 =======================
 uvhd tmp/acucobol1 t    <-- can use option 't' (text file, stop on LF)
 =====================

 more tmp/acucobol1      <-- can use more,cat,vi,lp,etc if Linefeed option
 ===================
      01000ROYAL BANK OF CANADA
      01005CANADIAN BANK OF COMMERCE
      01010BANK OF MONTREAL
      01015BANK OF NOVA SCOTIA
       .... showing only 1st 4 records from input block #3 above

 uvsort "fili1=tmp/acucobol1,rcs=56,typ=RST,filo1=tmp/acucobol1s,typ=LSTt,key1=0(5)"
 ===================================================================================
 - might sort output on key field (1st 5 bytes here)
   since Indexed file records might reuse deleted space & be out of sequence
 - these extracted records will be 55 bytes +1 for Linefeed (uop=l1)
 - input typ=RST for 55+1LF,
 - output typ=LSTt will remove the trailing blanks (LF after last nonblank)
   omit typ=LSTt if you want sorted records all 56 bytes
 - Do not use uop=l1 (add linefeeds) if file has any binary data x'00's etc
   would use 'typ=RSF' & exact rec-size (55 in this case)

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

5I3. acucobolx1 - extract data from AcuCOBOL files

Here is the source listing for the 'acucobolx1' utility, which would be at /home/uvadm/pf/util/acucobolx1 after normal install of Vancouver Utilities.

 # acucobolx1 - extract data from AcuCOBOL Indexed file to a sequential file
 #            - by Owen Townsend, UV Software, May 20/2013
 #            - see doc at www.uvsoftware.ca/cnvaids.htm#5I1
 #              & following demo using sample file dat1/acucobolx1
 #
 # uvcopy acucobolx1,fili1=dat1/acucobol1,filo1=tmp/acucobol1
 # ==========================================================
 # - extract data from sample AcuCOBOL Indexed file to a sequential file
 #
 # AcuCOBOL Indexed files have 2 parts(files) (data & index)
 # - indexed part has same name as data part + .vix suffix
 # - can ignore index part, and sort output on key field to correct sequence
 # - can use option 'l1' (uop=l1) to append LineFeed on extracted data records
 #   so you can use unix/linux/windows editors & printers
 # - do not use uop=l1 (add linefeeds) if file has any binary data x'00's etc
 #
 opr='$jobname - extract data records from AcuCOBOL Indexed file'
 opr='uop=q1l0 - option defaults'
 opr='      l1 - append line-feed after each data record'
 opr='      l0 - no line-feed, write size specified in 1st 2 bytes'
 uop=q1l0      # option defaults
 fili1=?dat1/acucobol1,typ=RSF,rcs=512
 filo1=?tmp/acucobol1,typ=RSF,rcs=512
 @run
        opn    all                  open files
        get    fili1,h0(512)        get file Header (ignored)
        skp>   man90                (cc set > if EOF)
 #
 # begin loop to get each data record & write to output file
 # - with rec-size coded in binary in 1st 2 bytes of 8 byte record header
 man20  get    fili1,a0(8)          get Record header
        skp>   man90                (cc set > if EOF)
        mvn    $ra,a0(2bs)          load recsize into rgstr 'a'
        skp<=  man90                EOF assumed if recsize <= 0
        mvn    $rb,$ra              move insize to rgstr 'b'
        clr    b0(512),' '          init record data read area all blanks
        get    fili1,b0($rb512)     get rec-data in area b (size in $rb)
        skp>   man90                (cc set > if EOF)
        add    $ca1,1               count records
 #
 # write output data record, append line-feed if option l1
 man30  cmn    $uopbl,1             option to append line-feed ?
        skp<   man34
        mvc    bb0(1),x'0A'         append line-feed after data lth
        add    $rb,1                +1 record size for LF
 man34  put    filo1,b0($rb512)     write output record (size in $rb)
        skp    man20                return to get next record
 #
 # EOF - close files & end job
 man90  cls    all
        eoj

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_6. CNVaids.doc Vancouver Utility Conversion Aids

JCL/script Test/Debug Aids - Contents


6A1. mvsfiles5A - script to trace data files in MVS JCL
- extracts all data files from subdir jcl2 (JCL procs expanded)
- identify originating step# & destination step#s for each file

6B1. jobflow51 - JCL data files with COBOL file information inserted
- jobname,progname,LFD,org,access,I/O,rcsz,copybook,datafilename
- illustrates data file usage in multi-step jobs
- invaluable aid to debugging converted JCL
- short demo here, fully documented in XREFjobs.htm#Part5.

6B2. jobflow5A - generate jobflow reports for ALL JCL/scripts (too big)
jobflow51 - generate jobflow report for 1 JCL/script
- regen as needed during test/debug to reflect changes

6C1. joblog1 - run a JCL/script & capture a log file (via tee)
- names the log file by dropping the .ksh & appending .log
- writes the logfile into subdir 'joblog' in the current directory
  (creates it if not present)

6D1. separate datafiles - supplied profiles make it easy for programmers
to have their own set of testdata

6E1. lastgenr - display latest generation of a file without having to go look.
- you can run from anywhere, without keying long pathnames.

6F1. getEtime - script to display 'job times' for last run of any JOBNAME
- retrieves jobtimes file written by last run of any JCL/script
- demos how to retrieve data fields into environmental variables

6G1. splitjclproc1 - split mixed directories of JCL & PROCs to separate subdirs
required for JCL conversion to Korn shell scritps
- see job listed on page '8M1'

6H1. scanjcl1 - scan multi-line JCL statements for pattern & qualifier
- promts for patterns if not specified on ,arg1=... & arg2=...
- writes report to tmp/directory_pattern
- matching multi-line stmts squeezed onto 1 line with line#
- preceded by JOBNAME if 1st match in JCL
- option m0 to omit detail lines & report matching filenames only

6I1. lockdemo1 - file locking, queue jobs to run serially
- code to insert at begining of JCL/scripts to ensure multiple
instances of the same job will be queued to run serially.

6I2. lockdemo2 - file locking, reject 2nd attempts until 1st instance completes

6J1. lockwait1 - wait until file not in use

6K1. Vancouver Utilities file lock tests for uvcopy,uvcp,uvsort,etc
- just 1 test shown of many in separate document uvlocks.htm

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6A1. CNVaids: JCL/script Test/Debug Aids

mvsfiles5A - data file trace in MVS JCL

Scripts 'mvsfiles51/mvsfiles5A' create a "data file trace" report from subdir jcl2 (MVS JCLs with procs expanded). The most useful report is 'xmvs/mvsfiles5' which '*' flags the INPUT files actually needed to run any 1 job or all jobs in subdir jcl2/*. This report eliminates duplicates & intermediate files (outputs for later inputs) & identifies the essential files required to be be transfered from the mainframe.

Script 'mvsfiles51' creates the 'essential files' report for 1 job at a time (vs all jobs in jcl2/...). Run this script before you attempt to debug each JCL/script to determine if you have all INPUT files required for a particular job. For this demo, we have run the script based on 2 jobs (cgl100.jcl & cgl230.jcl)

Here in CNVaids.doc, we will present a sample report, see more documentation at https://uvsoftware.ca/jclcnv2real.htm#1P1 - 1P4.

xmvs/mvsfiles5 - Essential Input files

  mvsfiles5 - Insert '*' Flags beside Esential Input files - 2013/12/26 10:26:28
  Jobname Step  Program  DDname   MOD Gen Rcsz pb  From To * <-----DSNname------>
  ===============================================================================
 jgl100   001   CGL100   ACTLIST  NCD- +1  133               GL.ACCOUNT.ACNTLIST_
 jgl230   003   CGL100   ACTLIST  MKD- +1  133               GL.ACCOUNT.ACNTLIST_
 jgl100   001   CGL100   ACCTMAS  S     0 0128 p           * GL.ACCOUNT.MASTER_
 jgl230   002   CGL200   GLMSOLD  O     0 0128 p       003   GL.ACCOUNT.MASTER_
 jgl230   002   CGL200   GLMSNEW  NCD- +1   80         003   GL.ACCOUNT.MASTER_
 jgl230   003   CGL100   ACCTMAS  S     0 0128 p   002       GL.ACCOUNT.MASTER_
 jgl230   001   SORT     SORTIN   O                        * GL.ACCOUNT.TRAN1
 jgl230   001   SORT     SORTOUT  NCD- +1   80         002   GL.ACCOUNT.TRANS_
 jgl230   002   CGL200   GLTRANS  O  - +1 0080     001       GL.ACCOUNT.TRANS_
  Note '*' files are essential Input files, only these '*' files will appear on:
   - next report xmvs/mvsfiles6 summary of essential files (1 line/file)
   - the script  xmvs/mvsfiles7 to copy files from $CNVDATA/d2asc to $RUNLIBS/data

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6A2. CNVaids: JCL/script Test/Debug Aids

notes re 'mvsfiles5' report

  1. 'mvsfiles5' (listed above) has been sorted by filename (right side), so you can see all jobs using each file. Note the '*' marking essential input files.

  2. These jobs trace the data files thru each step of all jobs showing the 'FROM' origin step & the 'TO' destination step of the data files. This should help you identify the orignal input files required to test the job & distinguish them from the various inter-step files.

  3. 'MOD' codes are the 1st letters from DISP=(New,Keep,Delete), etc. 'Gen' codes are taken from GDG file suffixes (0), (+1), etc, which are replaced by the trailing underscore on the filenames.

  4. 'Rcsz' (record-size) is taken from LRECL on output files or RECSIZE in IEBGENER or IDCAMS. The JCL converter assumes input recsize same as output recsize on SORTs. You need to fix if a SORT changes recsize via OUTREC, etc.

  5. Also note other information useful when debugging JCL/scripts - such as RECORD-SIZE & the 'p' flag (Packed fields present indicator).

  6. 'mvsfiles6' (listed later below) is the final report. It drops filename duplicates, temporary &&files, inter-step files,& inter-job files.

  7. Detection of inter-job files might not be perfect, because it assumes that the jobs are run in sequence by jobname. 'mvsfiles5' above shows the files sorted by filename(major) & jobname(minor). If the 1st line of a filename group is a 'N'ew file, then the entire group is '-' flagged for deletion. and the result is 'mvsfiles6' shown below.

  8. The report will be perfect if using the 'mvsfiles51' script (1 job at a time) vs 'mvsfiles5A' (all jobs in jcl2/...). Of course ssome of the '*' files could be coming from prior jobs & not need to FTP'd from the mainframe.

This (in CNVaids.doc) is the short description of 'mvsfiles5A/mvsfiles51'. See full documentation at https://uvsoftware.ca/jclcnv2real.htm#1P1 - 1P4.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6B1. CNVaids: JCL/script Test/Debug Aids

Job-Flow reports

The 'JobFlow' reports are your guide to testing & debugging. They show you the programs & datafiles used in each step of each JCL/script. I recommend you print these out before you start your testing & debugging.

The JObFlow reports extract the essential info about each datafile in each step. The file info from the COBOL program is inserted onto the matching info from the JCL. The following items are shown for each file in each step.

  1. JCL Job Step# & Program name
  2. JCL DDname (matching COBOL external name)
  3. COBOL Organization & Access Methods
  4. COBOL Open mode - Input, Output, Extend, Input-Output
  5. COBOL Record-size
  6. COBOL Copybook name (if any)
  7. JCL DSNname (physical filename)

    JobFlow sample report

 jclfil53  ** JobFlow Report I/O files info **  20100329 page#0001
 stp# progname.cbl DDname  genf  OAM   open recsz  copybook.cpy  data-file-name
 ==============================================================================
 jar200.ksh
 0010 sort.cbl     sortin                                        data/ar.sales.items
                   sortout                                       $JTMP/__tempsls
 0010 uvsort       fili1=typ=RSF,rcs=64,       64                $SORTIN
                                                                 data/ar.sales.items
                   filo1=typ=RSF,rcs=64,       64                $SORTOUT
                                                                 $JTMP/__tempsls
                   keys=(30,6,c,a,0,6,c,a),del1=10(2c):65,del1=10(2c):85"
 0020 car200.cbl   sysout                                        $SYOT/${JOBID2}_${JSTEP}_${PROGID}
                   saledtl       SS_   I___    64  saledtl.cpy   $JTMP/%sales.sortfile
                   custmas       IR_   I___   256  custmas.cpy   data/ar.customer.master.indexed
                   sys035        S__   O___   120  sdline.cpy    $RPTS/salesrpt_E_car200_${JSTEP}_01
                   sysin                                         $JTMP/${JSTEP}_${PROGID}

JCL/script 'jar200.ksh' is a 2 step job with a SORT & a COBOL program with 4 data files. See jar200.ksh listed at JCLcnv1demo.htm#2C1.

The JobFlow reports are listed by 'uvlp12L' which allow for 120 characters wide on 8 1/2 x 11 Landscape. We have removed the JCL/script name from the left & scrunched up to fit this documentation.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6B2. XREFjobs.doc - COBOL files & JCL JobFlow reports

Op. Instrns to generate JobFlow Reports

Script 'jobflow5A' generates ALL jobflow reports. You must have run 'cobfiles5A' to load an Indexed file for lookup by jobflow5A to include COBOL file information on the jobflow report. You would not print ALL job flow reports because of high volume & subject to change as you test/debug.

I recommend you use 'jobflow51' to generate & print the jobflow report for any 1 JCL/script. Regen & reprint any time you make significant changes to during testing & debugging.

Note
  • You must run 'cobfiles5A' (page '5C1') before jobflow5A or jobflow51
  • cobfiles5A generates indexed files of COBOL info used by jobflow5A/51

jobflow5A - generate All jobflow reports


 #1. cobfiles5A cbls cpys maps <-- generate xref/cobfil51a & load xref/cobfil51I
     =========================   - run now if not already run on page '5C1'

 #2. jobflow5A jcl3            <-- generate All JobFlow Reports
     ==============              - recommend alternative jobflow51 (1 at a time)

 #3. uvlpd12L jobflow          <-- would print ALL reports in subdir jobflow/...
     ================            - Do *NOT* print ALL JobFlow reports

You probably do NOT want to print all jobflow reports, since the reports would be very long & many could go out of date before you use them. It is better to print the individual jobflow report just before you intend to start test/debug for each JCL/script.

You can re-generate the report for any 1 JCL/script using script 'jobflow51' (regenerate when ever you substantially modify the JCL/script).

jobflow51 - generate jobflow report for 1 JCL/script


 #1. jobflow51 jcls/jar200.ksh   <-- generate JobFlow report for 1 job only
     =========================

 #2. uvlp12L jobflow/jar200.io   <-- print jobflow report for 1 JCL only
     =========================       (120 chars wide 8 1/2 x 11 Landscape)

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6C1. CNVaids: JCL/script Test/Debug Aids

joblog1,2,3 - capture logs via 'tee'

Console logging is highly recommended (especially for production) since it captures everything that happens on the screen, including operator commands & replies to prompts. See console logging in ADMjobs.htm#Part_6.

But until you get console logging activated, you could use the joblog scripts to capture the console log for 1 job at a time.

These scripts are better for the programmers, because they capture the log for just the job being tested, and it is immediately available for inspection.

The console logging system ADMjobs.htm#Part_6 is better for production where you want to capture all commands & outputs for the entire batch shift.

example using joblog1


 #1. cdd                 <-- change to $TESTDATA superdir

 #2. joblog1 jar100.ksh  <-- use joblog1 to run script jar100.ksh
     ==================      & capture console log in joblog/jar100.log

 #3. uvlp12 joblog/jar100.log  <-- print the log
     ========================

These scripts capture the JCL/script screen displays into a file using the unix/linux 'tee' command. The log filename is created by dropping the '.ksh' extension from the jobname & then appending '.log'.

You can see 'joblog1' listed at ADMjobs.htm#6S1. You can see all scripts in /home/uvadm/sf/IBM/...

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6D1. CNVaids: JCL/script Test/Debug Aids

setup 'testdata' in Your homedir ?

If you have multiple programmers, you could setup testdata superdirs in homedirs of various programmers to prevent update conflicts.

Please see the profiles described on page '1A1' to understand this tip.

 /p1
 :-----testdata            <-- RUNDATA=$TESTDATA=/p1/testdata
 :     :-----ar                - top-node subdirs for datafiles
 :     :-----gl                - OR all datafiles in 1 subdir (mstr below)
 :     :-----py
 :     :-----joblog            - joblog1 script stores .log files here
 :     :-----jobtmp            - job temporary files
 :     :-----mstr              - master files
 :     :-----rpts              - reports
 :     :-----sysout            - COBOL DISPLAY upon SYSLST reports
 :     :-----tape              - tape files reassigned to disc by JCL converter
 :     :-----tmp               - misc temp files & sort work files
 :     :-----wrk               - work files (inter-step)

Here is how 'userx' might setup his own testdata superdir, copy all data files, & modify his profile to use the private version of testdata.

  1. Login ---> /home/userx


 #2. mkdir testdata            <-- make private testdata superdir
     ==============

 #3. cp -r $TESTDATA testdata  <-- copy all files from shared testdata
     ========================

 #4. vi .bash_profile          <-- edit profile to modify $TESTDATA
     ================
     export TESTLIBS=$TESTLIBS
     export TESTDATA=$TESTDATA       <-- existing definitions in profile
     export CNVDATA=$CNVDATA
     export TESTLIBS=$TESTLIBS
     export TESTDATA=$HOME/testdata     <-- change ONLY TESTDATA def
     export CNVDATA=$CNVDATA

 #5a. exit              <-- logoff

 #5b. Login             <-- log back on to activate new TESTDATA definition

 #6a. echo $TESTDATA    <-- verify change effective

 #6b. cdd               <-- alias cdd should not take you to $HOME/testdata

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6E1. CNVaids: JCL/script Test/Debug Aids

lastgenr - display last generation file

'lastgenr' is a handy script to tell you the latest generation of a file, without having to go look. You can run from anywhere, without keying long pathnames.

'lastgenr' changes to $RUNDATA, so you must enter the filename relative to $RUNDATA, which usually would include 1 level of directory. For these mvstest/demos, RUNDATA=/home/mvstest/testdata, and the 'dtree' is as follows: ('dtree' is a script provided with the Vancouver Utilities that you may find convenient for your own documentation).


 dtree /home/mvstest/testdata   <-- create 'dtree' report
 ============================
 /home/mvstest
 :-----testdata
 :     :-----ar
 :     :     :-----customer.master
 :     :-----gl
 :     :     :-----account.master_000001
 :     :     :-----account.master_000002
 :     :     :-----account.master_000003
Note
  • 'dtree' reports only directories (not files)
  • I have inserted the filenames into the dtree report

Sample Op Instrns - display latest gen file


 lastgenr data/gl.account.master_    <-- sample command for lastgenr
 ================================

 031018:100923: gfile=data/gl.account.master_000003    <-- resulting display
 ==================================================

Rules for using lastgenr

  1. Must enter filename relative to $RUNDATA (usually 1 level of subdir)

  2. Must append an '_' underscore (convention for generation files)

    Alternate script 'lastgenf'

'lastgenf' is similar, except it does not change to $RUNDATA. This allows you to display latest generation of any file, not just those in $RUNDATA, but you must enter the full pathname or relative pathname from your location.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6F1. CNVaids: JCL/script Test/Debug Aids

getEtime - display 'job times' for last run of any JCL/script

'getEtime' is a script to display 'job times' for last run of any JCL/script that has been converted by the Vancouver Utility methods. It retrieves the data fields from the jobtimes file written by last run of the named JCL/script.

This script demonstrates how to retrieve data fields into environmental variables.

 # getEtime - get Elapsed time from jobtmp file & display
 #          - by Owen Townsend, Feb 26/06
 # Demos how to get data fields from a file into environmental variables
 #
 # JCL/scripts converted by Vancouver Utilities write elapsed time
 # into a file $RUNDATA/jobtmp/$JOBID2 in the following format:
 #
 # 060226:165203:JAR100: Begin=16:52:03 End=16:52:03 Elapsed=00:00:00
 # ==================================================================
 #
 #usage: getEtime JOBNAME
 #       ================
 #
 JTF=$RUNDATA/jobtmp/$1/jobtimes
 #
 if [[ ! -f $JTF ]]; then
    echo "usage: getEtime JOBNAME   <-- arg1 must be JOBID (in caps)"
    echo "       ================"
    echo "example: getEtime JAR100"
    echo "         ==============="
    exit 1; fi
 #
 # open file, read 4 data fields into 4 variables, & close file
 exec 3< $JTF                              # open file descriptor #3
 read -u3 jobstamp jobbgn jobend jobtime   # read fields into variables
 exec 3<&-                                 # close file
 echo "$jobstamp $jobbgn $jobend $jobtime" # display variables
 #
 #Note - above 4 lines could be replaced with just 'cat $JTF'
 # - but this script demos how to capture data file fields into env-vars
 # - to give you flexibility in how you use the data fields
 exit 0

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6G1. uvcopy pre-programmed jobs to aid JCL conversions

splitjclproc1 - split mixed JCLs & PROCs to separate subdirs

The mainframe JCL conversion requires JCLs & PROCs in separate subdirs. If they were in the same library, you can use this job to separate.


 uvcopy splitjclproc1,fili1=jclproc0/xxx,filo2=jcl0/xxx,fild3=proc0
 ==================================================================
 - 1 file at a time

 uvcopyxd3 splitjclproc1 jclproc0 jcl0 proc0 uop=q0i7
 ====================================================
 - use script uvcopyxd3 to process all files in directory

procedure & logic

  1. Store input files in subdir jclproc0/...

  2. This job will copy jclproc0/... files to jcl0 searching for ' PROC ' on // but not //* line

  3. If found, write reaminder of the file to the 3rd directory using the NAME from //NAME PROC ... line

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6H1. CNVaids: JCL/script Test/Debug Aids

scanjcl1 - scan multi-line JCL for pattern & qualifier

'scanjcl1' will scan a directory of JCL for a specified pattern & qualifier on any line of possible multi-line comma-continued JCL statements. Pattern & qualifier may be specified on command line arg1=...,arg2=... or at prompts if arg1/arg2 not coded on comamnd line.

ex#1
  • scan all JCLs in jcl2/* for 'RECFM=V' on //SORTOUT DD DSN=...
  • will promt for patterns if not specified on ,arg1=... & arg2=...
  • writes report to tmp/directory_pattern (tmp/jcl2_RECFM=V in this case)
  • matching multi-line stmts squeezed onto 1 line with line#
  • JCL jobname listed after detail line matches (so total can be included)

 uvcopy scanjcl1,fild1=jcl2,arg1=RECFM=V,arg2=SORTOUT
 ====================================================
 - scan all JCLs in jcl2/* for 'RECFM=V' qualified by 'SORTOUT'
   pattern & qualifier anywhere on any 1 multi-line ,comma continued stmt
 - SAMPLE REPORT as follows:
 scanjcl1 - scan directory of JCL for a specified pattern on JCL=...
 Dir: jcl2 pattern1: RECFM=V qualifier: SORTOUT optns: q1m99999 2013/02/24_17:47:41
 ================================================================================
 0038 //SORTOUT DD DSN=N00P.EDI810.SORTED.INVOICES, DCB=(RECFM=VB,LRECL=246,BLKSIZE=0)
 0059 //SORTOUT DD DSN=N00P.EDI810.SORTED.NSCADR, DCB=(RECFM=VB,LRECL=246,BLKSIZE=0)
 0080 //SORTOUT DD DSN=N00P.EDI810.SORTED.NSCACR, DCB=(RECFM=VB,LRECL=246,BLKSIZE=0)
 0003 jcl2/p300027d.jcl

0089 //SORTOUT DD DSN=N00P.DPGM063.BOFA.DAYACT.COPY, DCB=(RECFM=VB,LRECL=246,BLKSIZE=0) 0001 jcl2/p300042d.jcl

0077 //SORTOUT DD DSN=N00P.ORACLE.OUT820.BKUP(+1), DCB=(RECFM=VB,LRECL=726,BLKSIZE=0) 0144 //SORTOUT DD DSN=N00P.DPGM074.EDI820.SORT, DCB=(RECFM=VB,LRECL=246,BLKSIZE=0) 0002 jcl2/p300044d.jcl ** End Dir jcl2, with 55 files, 3 with 6 matches

ex#2 - arg3 option scan 1 file (vs all in dir)


 uvcopy scanjcl1,fild1=jcl2,arg1=RECFM=V,arg2=SORTOUT,arg3=p300044d.jcl
 ======================================================================
 - may specify arg3=... to scan 1 file (vs all in directory)
 - SAMPLE REPORT as follows:
 scanjcl1 - scan directory of JCL for a specified pattern on JCL=...
 Dir: jcl2 pattern1: RECFM=V qualifier: SORTOUT optns: q1m9999 2013/02/24_17:47:41
 ================================================================================
 0077 //SORTOUT DD DSN=N00P.ORACLE.OUT820.BKUP(+1), DCB=(RECFM=VB,LRECL=726,BLKSIZE=0)
 0144 //SORTOUT DD DSN=N00P.DPGM074.EDI820.SORT, DCB=(RECFM=VB,LRECL=246,BLKSIZE=0)
 0002 jcl2/p300044d.jcl
 ** End Dir jcl2, with 55 files, 3 with 6 matches

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6H2. CNVaids: JCL/script Test/Debug Aids

ex#3 - option m0 to report filenames & match counts only


 uvcopy scanjcl1,fild1=jcl2,arg1=RECFM=V,arg2=SORTOUT,uop=m0
 ===========================================================
 ex#3 - option m0 to report matching filenames & match counts only
      - SAMPLE REPORT as follows:
 scanjcl1 - scan directory of JCL for a specified pattern on JCL=...
 Dir: jcl2 pattern1: RECFM=V qualifier: SORTOUT optns: q1m0 2013/02/24_17:50:00
 ================================================================================
 0003 jcl2/p300027d.jcl
 0001 jcl2/p300042d.jcl
 0002 jcl2/p300044d.jcl
 ** End Dir jcl2, with 55 files, 3 with 6 matches
 Note - could use option 'm' to limit number of matching statements shown
     - 'uop=m1' would show only 1st matching stmt for each file with matches

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6I1. CNVaids: JCL/script Test/Debug Aids

lockdemo1 - file locking, queue jobs to run serially

Here is some code you can insert at the begining of your JCL/scripts to ensure that multiple instances of the same job will be queued to run serially. Also see alternate lockdemo2 which will reject 2nd attempts to run a job until the 1st instance completes.

 #!/bin/bash
 # lockdemo1 - demo file locking, by Owen Townsend, UV Software, March23/2013
 #           - run under bash or sh, flock gives bad file descriptor in ksh
 # lockdemo1 - demo how to queue multiple instances of 1 job that must run alone
 # lockdemo2 - also see alternate demo to reject attempts to rerun until 1st ends
 #           - demo as follows:
 # 1. mkdir locks OR rm -f locks/*  <-- clear locks/... for clean demo
 #    ============================
 # 2. lockdemo1 &  <-- 1st run in background (or run on alternate login/screen)
 #    ===========
 # 3. lockdemo1    <-- then foreground, 2nd run lock waits for 1st run to end
 #    =========
 jobname=$(basename $0)  # get name of this script for use as locks/lockfilename
 exec 9> locks/$jobname
 echo "$jobname PID $$ $(date +%y%m%d_%H%M%S)" >locks/$jobname.$(date +%y%m%d_%H%M%S)
 flock -x 9;
 echo "$jobname Begin PID $$ $(date +%y%m%d_%H%M%S)"
 sleep 15
 # sleep 15 for demo, could do critical processing here that must run 1 at a time
 # - could insert above code at begin existing JCL/script application
 echo "$jobname END PID $$ $(date +%y%m%d_%H%M%S)"
 exit 0

console log from demo


 --> lockdemo1 &   <-- run#1 in background - OR run on another terminal
     ===========                           - to simplify console displays
 [1] 4486
 --> lockdemo1     <-- run#2 in foreground
     =========
 lockdemo1 Begin PID 4486 130324_095529
 lockdemo1 END PID 4486 130324_095539     <-- 1st lockdemo1 & ends
 lockdemo1 Begin PID 4493 130324_095539   <-- 2nd lockdemo1 waits until 1st ends
 lockdemo1 END PID 4493 130324_095549
 [1]+  Done                    lockdemo1

 --> ls -l locks   <-- list files created in locks/...
     ===========
 -rw-r--r-- 1 uvtest  apps   0 Mar 24 09:57 lockdemo1
 -rw-r--r-- 1 uvtest  apps  33 Mar 24 09:57 lockdemo1.130324_095529
 -rw-r--r-- 1 uvtest  apps  33 Mar 24 09:57 lockdemo1.130324_095533
Note
  • the 3rd line of code 'echo "$jobname PID $$ $(date ...' is optional
    to provide a log of when the jobs are executed
  • these date/time stamped files might be removed after 7 days using
    the 'rmold1' script documented on page '1G1'

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6I2. CNVaids: JCL/script Test/Debug Aids

lockdemo2 - file locking, reject 2nd attempts until 1st ends

Here is some code you can insert at the begining of your JCL/scripts to ensure 2nd attempts to run a job will be rejected, until the 1st instance completes. Also see the previous lockdemo1 that ensures multiple instances of the same job will be queued to run serially.

 #!/bin/bash
 # lockdemo2 - demo file locking, by Owen Townsend, UV Software, March23/2013
 #           - run under bash or sh, flock gives bad file descriptor in ksh
 # lockdemo2 - demo how to reject attempts to rerun a job until 1st instance ends
 # lockdemo1 - alternate demo queue multiple instances of job that must run alone
 #           - demo as follows:
 # 1. mkdir locks OR rm -f locks/*  <-- clear locks/... for clean demo
 #    ============================
 # 2. lockdemo2 &  <-- 1st run in background (or run on alternate login/screen)
 #    ===========
 # 3. lockdemo2    <-- then foreground, 2nd run lock waits for 1st run to end
 #    =========
 jobname=$(basename $0)  # get name of this script for use as locks/lockfilename
 exec 9> locks/$jobname
 echo "$jobname PID $$ $(date +%y%m%d_%H%M%S)" >locks/$jobname.$(date +%y%m%d_%H%M%S)
 #
 if flock -n -x 9; then :    # do nothing if no filelock
 else echo "$jobname PID $$ rejected, prior instance already running"
      exit 99
 fi
 echo "$jobname Begin PID $$ $(date +%y%m%d_%H%M%S)"
 sleep 15
 # sleep 15 for demo, could do critical processing here that must run 1 at a time
 # - could insert above code at begin existing JCL/script application
 echo "$jobname END PID $$ $(date +%y%m%d_%H%M%S)"
 exit 0

console log from demo


 --> lockdemo2 &   <-- run#1 in background
     ===========
 [1] 5001
 lockdemo2 Begin PID 5001 130324_103700
 --> lockdemo2     <-- run#2 in foreground
     =========
 lockdemo2 PID 5008 rejected, prior instance already running
 lockdemo2 END PID 5001 130324_103710
 [1]+  Done                    lockdemo2
 --> lockdemo2     <-- run#3 (after run#1 completes)
     =========
 lockdemo2 Begin PID 5028 130324_103727
 lockdemo2 END PID 5028 130324_103737

 --> ls -l locks   <-- list files created in locks/...
     ===========     - output omitted, similar to prior page

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6J1. CNVaids: JCL/script Test/Debug Aids

lockwait1 - wait until file not in use

Prior lockdemo1/2 use 'flock' to set & test for file locks in the same script. 'lockwait1' will demo how you might test a locked file in a separate script. It can not use 'flock' which requires the 'file descriptor#' which can not be easily be determined in a separate script using only the filename. But we can use 'fuser' which determines if a file is 'in use' by anotehr process.

 #!/bin/bash
 # lockwait1 - demo wait on file in use by Owen Townsend, UV Software, Mar23/2013
 #           - 'fuser' will determine if specified file is in use by any process
 #           - sleep 10 seconds & retry until file is not in use
 #           - can add the code below to your JCL/script to wait on any file
 #             that must be closed before proceeding (could be a lock file)
 #           - could demo this code using the lockdemo1 job as follows
 #
 # 1. lockdemo1 &   <-- creates locks/lockdemo1 & holds lock for 15 seconds
 #    ===========
 # 2. lockwait1 locks/lockdemo1  <-- waits until locks/lockdemo1 no longer in use
 #    =========================    - then execute whatever code you might want
 #
 jobname=$(basename $0)  # get name of this script for use as locks/lockfilename
 file="$1"
 if [[ ! -f "$file" ]]; then
    echo "usage: lockwait1 filename"
    echo "       =================="
    echo "example: lockwait1 locks/lockdemo1"
    echo "         ========================="
    echo " - arg1 must be a filename"
    exit 99; fi
 #
 fuser $file >/dev/null 2>&1      # initial test for file in use
 status=$?                        # capture status 0 in use, 1 not in use
 until [[ $status -ne 0 ]]        # until file not in use
   do echo "$jobname waiting 10 seconds to retry file in use: $file"
      sleep 10
      fuser $file >/dev/null 2>&1 # test for file in use
      status=$?                   # capture status
   done
 echo "$jobname ended $(date +%y%m%d_%H%M%S), file not in use: $file"
 exit 0

console log from demo


 --> lockdemo1 &                <-- run #1 lockdemo1 to create lock file
     ===========
 [1] 5623
 lockdemo1 Begin PID 5623 130328_111102
 --> lockwait1 locks/lockdemo1  <-- run #2 lockwait1 to wait on lock file
     =========================
 lockwait1 waiting 10 seconds to retry file in use: locks/lockdemo1
 lockdemo1 END PID 5623 130328_111117
 lockwait1 ended 130328_111126, file not in use: locks/lockdemo1
 [1]+  Done                    lockdemo1

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

6K1. CNVaids: JCL/script Test/Debug Aids

Note
  • the Vancouver Utilities (uvcopy,uvcp,uvsort) also support file locking
  • see separate document uvlocks.htm
  • here is 1 page of many from that document ('uvlocks.htm#C1')

test# C1 - UV SEQ INPUT vs UV SEQ INPUT


 Screen1: uvcopy waitSS1,fili1=dat1/fileS1,typ=RSFl0h0,filo1=dat2/fileS1
          =====================***********==============================
          uvcopy waitSS1  <-- can omit ,fili1=... defaults as shown above

 Screen2: uvcopy waitSS2,fili1=dat1/fileS1,typ=RSFl0h1,filo1=dat2/fileS1
          =====================***********==============================
          uvcopy waitSS2  <-- can omit ,fili1=... defaults as shown above
                            - option 'h1' waits/retries every 10 seconds

 Screen2a: uvcp fili1=dat1/fileS1,typ=RSFl0h1,rcs=40,filo1=dat2/fileS2
           ===========***********=====================================
           - Alternate 'uvcp' (or 'uvsort') vs 'uvcopy'
           - option 'h1' waits/retries every 10 seconds

 Screen2b: uvcp fili1=dat1/fileS1,typ=RSFl0h0,rcs=40,filo1=dat2/fileS2
           ===========***********=====================================
           - option 'h0' no wait, immediately rejected

UV lock options: l0=RD/WRlock, l1=RDlock, l8=NOlock, h0=NOwait, h1=wait

              |<-------------------- UV SEQ INPUT ------------------------>
     job1     |                    job2 lock options                      |
 lock options |   l0h0  |   l0h1  |   l1h0  |   l1h1  |   l8h0  |   l8h1  |
 ==========================================================================
       |      |         |         |         |         |         |         |
       | l0   |lock fail|  waits  |lock fail|  waits  |   runs  |   runs  |
       |      |         |         |         |         |         |         |
       |-------------------------------------------------------------------
  UV   |      |         |         |         |         |         |         |
 SEQ   | l1   |lock fail|   waits |   runs  |   runs  |   runs  |   runs  |
 INPUT |      |         |         |         |         |         |         |
       |-------------------------------------------------------------------
       |      |         |         |         |         |         |         |
       | l8   |   runs  |    runs |   runs  |   runs  |   runs  |   runs  |
       |      |         |         |         |         |         |         |

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_7. CNVaids.doc Vancouver Utility Conversion Aids

Data File Aids - Contents


7A1. uvhd - file browse/search utility for mainframe type files that do
  not have LineFeeds & may contain Packed/Binary data
- the all time favorite tool in Vancouver Utilities
- short demo here, fully documented in uvhd.htm.

7B1. uvhdcob - similar to uvhd, but also shows the COBOL copybook fieldnames
  beside the data contents. Excellent for verifying data
  conversions. You can see at a glance any mismatches between
  the actual data fields & the COBOL field definitions.
- short demo here, fully documented in uvhdcob.htm.

7B2. uvhdcob v - command to verify character, numeric,& packed data fields

7B4. uvhdc2 - script for easier use of uvhdcob
- using uvhdcob directly requires both datafilename & copybookname
- uvhdc2 saves having to specify or know the copybookname
- short demo here, fully documented in uvhdcob.htm.

7C1. uvcp - data file manipulation utility
- convert file types (text, fixed, variable, indexed, Micro Focus)
- example given to correct files FTP'd from mainframe
  (drop off CR/LF added by FTP to ASCII to match COBOL fixed length)

7E1. listrec2 - list fixed length records in 100 byte segments with scale
- any unprintable characters will be translated to periods
- record length must be supplied since no LineFeeds present

7E2. listhex2 - list fixed length records in 100 byte segments with scale
- same as listrec2, but list records in vertical hexadecimal

7F1. listall1 - list subdir of multiple short files (such as parms subdir)
- multi files on 1 page saves a lot of paper

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part 7. CNVaids.doc Vancouver Utility Conversion Aids

Data File Aids - Contents (continued)


7G1. CMPjobs - Data File Comparisons for mainframe type files
- fixed length, variable length,& Indexed files
- originally for Y2K, now enhanced for mainframe conversions

7G4. uvcmp1all - script to compare ALL files in 2 directories, for example:
- comparing re-converted EBCDIC files to original mainframe
files to verify conversions

7H1. gentest1 - Generate test data files
- based on COBOL copybooks

7I1. vtocr1 - create VTOC report for files converted from mainframe
- provides record counts, indexed keys, etc
  (information not displayed by the usual unix/linux tools)
- see sample report & operating instructions in MVSDATA.htm

7J1. uvsort - provides most SYNCSORT features at a much lower price
- up to 60 input files & 20 output files
- selects, deletes, reformats
- options to drop duplicate keys, select duplicate keys, etc
- unique option to start a new output file on key break

7K1. uvlist - to list text files (scripts, programs, etc)
- as a filter to remove control codes, multi-blanks, etc

7L1. uxcp - convert mainframe EBCDIC variable length (RDW format)
to ASCII variable length Indexed file for Micro Focus COBOL

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7A1. CNVaids: Data File Aids

uvhd - display DATA files in Vertical Hexadecimal

Use 'uvhd' to investigate mainframe type files that do not have linefeeds & cannot be displayed or printed by the usual UNIX utilities (vi, lp, etc). 'uvhd' will display records consecutively if you keep pressing enter. You can jump to & display any record in the file by entering the record#. You can search for desired records via specified search patterns anywhere in the record of restricted to specified columns.


 #1. Login uvadm --> /home/uvadm

 #2. uvhd dat1/custmas1 r256  <-- run uvhd specifying filename & recsize
     =======================    - displays 1st record & waits for command
 r#       1           1         2         3         4         5         6
 b#       0 0123456789012345678901234567890123456789012345678901234567890123
          0 130140    EVERGREEN MOTORS LTD.    1815 BOWEN ROAD          NANA
            3333332222454545444244545524542222233332445442544422222222224444
            130140000056527255E0DF4F230C44E0000181502F75E02F140000000000E1E1
         64 IMO          BC V9S1H1    604-754-5531                  ........
            4442222222222442535343222233323332333322222222222222222200000000
            9DF00000000002306931810000604D754D55310000000000000000000000C000
        128 .........W0....`........)X|..f3.....\.......................f...
            0000000005300016000000002570063100095000000000000000000000016000
            0C0000C0270C0540C0000C0098C0263C0444C0000C0000C0000C0000C0056C00
        192 ...............................f.....<........f.C
            0000008900000000880000000018000680001300000000694222222222222222
            00C0026C0000C0023C0000C0083C0056D0012C0000C0016D3000000000000000

data/ar.customer.master fsz=8192 rsz=256 recs=32 current=1 null=next,r#=rec,b#=byte,+/-recs,s=search,u=update,p=print,w=write ,q=quit,?=help -->


 #1. null entry   <-- display next consecutive record
     ==========

 #2. 9999         <-- display record #9999 (or goto EOF)

 #3. -1           <-- backup 1 to see last record
 See uvhd.htm in volume 2 of UVdoc for description of other commands
 - search, update, print, write (select records for test files).

The 'i' (immediate print) command is valuable to document data problems and assign to programmers for correction.


 i9f3          <-- iprint next 9 records, 3 records per form(page)
 ====

See much more at uvhd.htm

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7B1. CNVaids: Data File Aids

uvhdcob - display data file fields with COBOL fieldnames

uvhdcob displays data file field contents beside the copybook fieldnames. The command repertoire is similar to the previously discussed 'uvhd' (browse,search,update,print,write,drop,check-sequence).

See complete documentation at uvhdcob.htm. Here is a brief demo including the 'v' verify command, which is very useful for conversions.

Before you can run uvhdcob for a particular file, you must have run 'cobmap1' to convert the copybook for that file to the corresponding 'cobmap'. Page '5D2' shows you how to do this quickly & easily for all copybooks.

uvhdcob - sample display


 #1. cd /home/uvadm   <-- change to uvadm for test files
     ==============

 #2. uvhdcob dat1/custmas1 mf/maps/custmas1  <-- try this now
     ======================================
 file=testdata/data/ar.customer.master lastmod=20030926:0856
 record#=1 totalrecs=32 recsize=256 filesize=8192 fileptr=0
 cobmap=maps/custmas today=20031018:1117
 rec#       1 fieldname occurs  bgn end typ<------ data (hex if typ=p/b) ----->
 001 ar-custno                    0   5 n  130140
 002 ar-delete                    6   9
 003 ar-name                     10  34    EVERGREEN MOTORS LTD.
 004 ar-adrs                     35  59    1815 BOWEN ROAD
 005 ar-city                     60  75    NANAIMO
 006 filler001                   76  76
 007 ar-prov                     77  78    BC
 008 filler002                   79  79
 009 ar-postal                   80  89    V9S1H1
 010 ar-phone                    90 101    250-754-5531
 011 ar-contact                 102 119    LARRY WRENCH
 012 ar-thisyr-sales       012  120 124pns 001234567C
 013 ar-lastyr-sales       012  180 184pns 001234567D
 014 filler003                  240 255    C 19950531
 rec#=1 of 32,null=next,r#=rec,s=search,u=update,p=print,i=iprint,w=write
 ,t=tally,c=chkseq,e=exit to uvhd,q=quit,?=help --> q

'v' verify data command

The 'v' command will verify character, numeric,& packed data fields. Verify searches the file for unprintable characters in pic x fields & invalid digits or signs in unpacked or packed numeric fields.

We have provided a doctored version of dat1/custmas1 to test/demo uvhdcob. dat1/cm1_testuvhdcob has been updated (using uvhdcob) to create errors in record#s 10 & 20.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7B2. uvhdcob 'verify' test/demo

test/demo verify command


 uvhdcob dat1/cm1_testuvhdcob mf/maps/custmas1  <-- run on test/demo file
 =============================================
  - uvhdcob displays 1st record (not shown here) & prompts for command

--> v <-- search & Verify character,numeric,& packed fields

response to search/verify command

 rec#      10 fieldname occurs  bgn end typ<------ data (hex if typ=p/b) ----->
 001 cm-num                       0   5 n  15468X      313534363858      <-BadN
 002 cm-delete                    6   9
 003 cm-name                     10  34    TAURUS RESOURCES
 004 cm-adrs                     35  59    1110 - 625 HOWE STREET
 005 cm-city                     60  75    VANCOUVER
 006 filler001                   76  76
 007 cm-prov                     77  78    B.          42EE              <-BadC
 008 filler002                   79  79
 009 cm-postal                   80  89    V6C2T6
 010 cm-phone                    90 101    604 685 8565
 011 cm-contact                 102 119    MEL RAHAL
 012 cm-thisyr-sales       012  120 124pns EE0123456C            <-- Bad Packed
 013 cm-lastyr-sales       012  180 184pns 000000000C
 014 filler003                  240 255    C 19980331
      v --> 10 recs verified, 4 ERRs found in rec# 10, 1st at byte# 0
      2 packed & 1 numeric bad signs/digits, 1 unprintables in char fields

--> vv <-- continue Verify

 rec#      20 fieldname occurs  bgn end typ<------ data (hex if typ=p/b) ----->
 001 cm-num                       0   5 n  2343XX      323334335858      <-BadN
 002 cm-delete                    6   9
 003 cm-name                     10  34    TERRITORIAL REWIND
 004 cm-adrs                     35  59    BOX 1648
 005 cm-city                     60  75    WHITEHORSE
 006 filler001                   76  76
 007 cm-prov                     77  78    YK
 008 filler002                   79  79
 009 cm-postal                   80  89    Y1A...      593141EEEEEE      <-BadC
 010 cm-phone                    90 101    403-512-3948
 011 cm-contact                 102 119
 012 cm-thisyr-sales       012  120 124pns 000000000C
 013 cm-lastyr-sales       012  180 184pns 1E2E3E4E5E            <-- Bad Packed
 014 filler003                  240 255      20021130
      vv --> 10 recs verified, 10 ERRs found in rec# 20, 1st at byte# 0
      5 packed & 2 numeric bad signs/digits, 3 unprintables in char fields

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7B3. uvhdcob 'verify' test/demo

Notes re uvhdcob Verify

  1. We created intentional errors in records #10 & #20 of dat1/cm1_testuvhdcob.

  2. Note flags on right hand side '<-BadN', '<-BadC', '<-- Bad Packed'

  3. cm-num '15468X' flagged because 'X' is non-numeric. Hex representation x'313534363858' is shown in case of unprintables.

  4. cm-prov 'B.' is shown in hex as x'42EE' (the '.' is actually x'EE').

  5. cm-thisyr-sales is shown as x'EE0123456C' (1st 2 digits x'EE' invalid).

  6. packed fields are always shown in hex (valid of invalid).

  7. uvhdcob shows only the 1st field of occurs. You could verify all occurs fields using 'genverify1' which generates a uvcoy job to verify all numeric & packed fields using the 'vnf' instruction.

creating BAD data

In case you are interested, here are the 'update' commands we used to create the BAD data for the 'verify' command test/demo. We will omit the uvhdcob displays.


 #1. uvhdcob dat1/cm1_testuvhdcob mf/maps/custmas1 u <-- option 'u' for update
     ===============================================

 #2. --> 10              <-- goto record# 10

 #3a. --> u 5(1),'X'     <-- create non-numeric data in numeric field (cust#)
 #3b. --> u 78(1),x'EE'  <-- create unprintable data in character field (prov)
 #3b. --> u 120(1),x'EE' <-- create invalid digits in packed field (thisyr sales)

 #3. --> 20                      <-- goto record# 20

 #4a. --> u 5(2),'XX'            <-- create non-num data in numeric field (cust#)
 #4b. --> u 83(3),x'EEEEEE'      <-- create unprintables in char field (province)
 #4b. --> u 180(5),x'1E2E3E4E5E' <-- create BAD data in packed field (lastyr sls)

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7B4. CNVaids: Data File Aids

uvhdc2 - script for easier use of uvhdcob

uvhdcob requires you to specify both the path to the data-file & the path to the 'cobmap'. This could be awkward since data & copybookmaps are usually in different file systems. The 'uvhdc2' script is provided to solve this problem. See the setup required in uvhdcob.htm. Once we have the control file setup, you only need to specify your data file name (no path names & you can run from anywhere).


 uvhdc2 data/ar.customer.master  <-- script 'uvhdc2' run 'uvhdcob' from anywhere
 ==============================    - without having to specify the copybook name

To appreciate the advantage, here is the equivalent 'uvhdcob', assuming you are in $RUNDATA & running the test/demo system provided, where RUNDATA=/home/mvstest/testdata & RUNLIBS=/home/mvstest/testlibs.


 uvhdcob data/ar.customer.master $RUNLIBS/maps/custmas
 =====================================================

This will get even worse, when you setup your own conversion Testing & Production systems. For example assuming your RUNLIBS & RUNDATA in your profile are:


 export RUNLIBS=/p2/prodlibs
 ===========================
 export RUNDATA=/p2/proddata
 ===========================

Then the uvhdcob command could be specified as follows:


 uvhdcob /p2/proddata/data/ar.customer.master /p2/prodlibs/maps/custmas
 ======================================================================

Of course you could shorten it by using your RUNLIBS & RUNDATA symbols:


 uvhdcob $RUNDATA/data/ar.customer.master $RUNLIBS/maps/custmas
 ==============================================================

But using the 'uvhdc2' script is the shortest:


 uvhdc2 data/ar.customer.master
 ==============================

See the complete setup required for 'uvhdc2' in uvhdcob.htm#H1.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7C1. CNVaids: Data File Aids

using uvcp to convert 'text' to 'fixed'

You may need to convert text files to fixed if the data is input for a COBOL program expecting fixed length records (with no LineFeed terminators). Text records are terminated by LineFeeds LF=x'0A' or CarriageReturn+LineFeed CR+LF=x'0D0A'. Text records may vary in length since trailing blanks are usually omitted & the LineFeed inserted after the last nonblank. Text files on unix systems need only the LineFeed, but files from windows or mainframes may have both CR & LF. For our example we will show both.

sample text file dat1/products

 BBQ010   BAR-B-Q
 CHR015   LAWN CHAIR
 HAM010   CLAW HAMMER
 HAM020   BALL PEEN HAMMER

 uvhd dat1/products h2t   <-- uvhd with 'h2' option to see the LineFeeds
 ======================       (option 't' tells uvhd to end records on x'0A')
                  10        20        30        40        50        60
 r#    1 0123456789012345678901234567890123456789012345678901234567890123
       0 BBQ010   BAR-B-Q..  <-- LineFeed shows as '.' on character line
         445333222445242500  <-- note: zones & digits CR+LF=x'0D'+x'0A'
         221010000212D2D1DA
              - - - showing only 1st & 4th records to save space - - -
                  10        20        30        40        50        60
 r#    4 0123456789012345678901234567890123456789012345678901234567890123
      61 HAM020   BALL PEEN HAMMER..
         444333222444425444244444500
         81D02000021CC0055E081DD52DA

 uvcp "fili1=dat1/products,typ=LST,rcs=256,filo1=tmp/products,typ=RSF,rcs=80"
 ============================================================================
 - convert text file to fixed length 80 byte records with no CR/LF terminators

 uvhd tmp/products h2r80   <-- uvhd with option h2 for hex display
 =======================     - option r80 for fixed record-size
                  10        20        30        40        50        60
 r#    1 0123456789012345678901234567890123456789012345678901234567890123
       0 BBQ010   BAR-B-Q
         4453332224452425222222222222222222222222222222222222222222222222
         221010000212D2D1000000000000000000000000000000000000000000000000
      64
         2222222222222222
         0000000000000000
              - - - showing only 1st & 4th records to save space - - -
 r#    4 0123456789012345678901234567890123456789012345678901234567890123
     240 HAM020   BALL PEEN HAMMER
         4443332224444254442444445222222222222222222222222222222222222222
         81D02000021CC0055E081DD52000000000000000000000000000000000000000
      64
         2222222222222222
         0000000000000000

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7C2. CNVaids: Data File Aids

Notes re uvcp on page above


 uvcp "fili1=dat1/products,typ=LST,rcs=256,filo1=tmp/products,typ=RSF,rcs=80"
 ============================================================================
 - convert text file to fixed length 80 byte records with no CR/LF terminators
  1. Text record 'typ=LST' (Line Sequential Terminated)

  2. Fixed record 'typ=RSF' (Record Sequential Fixed)

  3. For text files (typ=LST), allow extra length (rcs=256 in this example) to ensure the terminating LineFeed will be found within the area assigned (to avoid record splitting).

  4. Or could use 'typ=RST' (Record Sequential Terminated) puts a LineFeed into the last byte of a fixed record size. A good idea if the last byte is not part of a data field, allows you to use editor on fixed files.

    common problem when files FTP'd from mainframe

If you FTP files from the mainframe in text mode, FTP translates to ASCII and appends CR+LF on the end of each record, as shown below using our 'customers' demo file. These records were fixed length 102 bytes on the mainframe with no LineFeeds. Here are the 1st 2 records shown by uvhd using option 'h2' for vertical hexadecimal display & option 't' to tell uvhd to look for LineFeeds x'0A' to terminate records.


 uvhd dat1/customers h2t   <-- uvhd display in hex using LF terminators
 =======================
                      10        20        30        40        50        60
 r#        1 0123456789012345678901234567890123456789012345678901234567890123
           0 130140    EVERGREEN MOTORS LTD.    1815 BOWEN ROAD          NANA
             3333332222454545444244545524542222233332445442544422222222224444
             130140000056527255E0DF4F230C44E0000181502F75E02F140000000000E1E1
          64 IMO          BC V9S1H1    604-754-5531..
             4442222222222442535343222233323332333300
             9DF00000000002306931810000604D754D5531DA
                      10        20        30        40        50        60
 r#        2 0123456789012345678901234567890123456789012345678901234567890123
         104 132588    GEECOE GENERATOR SERVICE UNIT 170 - 2851 SIMPSON  RICH
             3333332222444444244445454525455444254452333222333325445544225444
             13258800007553F5075E5214F20352693505E9401700D02851039D03FE002938
          64 MOND         BC V6X2R2    604-278-4488..
             4444222222222442535353222233323332333300
             DFE40000000002306682220000604D278D4488DA

The problem is that the COBOL program on unix expects fixed 102 byte records so we need to drop off the extra 2 bytes (CR+LF) appended by FTP.

Please see the solution (via uvcp) on the next page --->

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7C3. CNVaids: Data File Aids

uvcp to drop CR/LF (convert text to fixed)


 uvcp "fili1=dat1/customers,typ=LST,rcs=256,filo1=tmp/customers,typ=RSF,rcs=102"
 ===============================================================================
 - drop off CR/LF (created by FTP) & force output recsize = 102

 uvhd tmp/customers h2r102   <-- uvhd with options h2=hex, r102=record-size
 ==========================
                      10        20        30        40        50        60
 r#        1 0123456789012345678901234567890123456789012345678901234567890123
           0 130140    EVERGREEN MOTORS LTD.    1815 BOWEN ROAD          NANA
             3333332222454545444244545524542222233332445442544422222222224444
             130140000056527255E0DF4F230C44E0000181502F75E02F140000000000E1E1
          64 IMO          BC V9S1H1    604-754-5531
             44422222222224425353432222333233323333
             9DF00000000002306931810000604D754D5531
                      10        20        30        40        50        60
 r#        2 0123456789012345678901234567890123456789012345678901234567890123
         102 132588    GEECOE GENERATOR SERVICE UNIT 170 - 2851 SIMPSON  RICH
             3333332222444444244445454525455444254452333222333325445544225444
             13258800007553F5075E5214F20352693505E9401700D02851039D03FE002938
          64 MOND         BC V6X2R2    604-278-4488
             44442222222224425353532222333233323333
             DFE40000000002306682220000604D278D4488

Above we used uvcp to restore the record size to agree with the COBOL program.

Alternative - modify the COBOL program

We might consider changing the COBOL program to accept a text type file vs fixed length. Change ORGANIZATION in the SELECT clause as shown below:

     ORGANIZATION RECORD SEQUENTIAL
     ORGANIZATION LINE SEQUENTIAL
  1. You can only do this if there are NO packed or binary fields in the records.

  2. You would have to change the ORGANIZATION in all programs that read the file (see the cross reference reports in XREFjobs.htm)

  3. An advantage is that you could then view the file using the 'vi' editor

  4. A disadvantage is that processing would be somewhat slower, but this would be insignificant unless you had huge files.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7C4. CNVaids: Data File Aids

using 'uvcp' to convert 'fixed' to 'text'

Fixed length records without LineFeeds cannot be viewed or printed with the usual unix/linux utilities (vi,more,lp,etc). To these utilties, the file appears as 1 long line. Try the following:


 #0. cd /home/uvadm     <-- easy access to dat/... test/demo files
     ==============

 #1. vi dat1/sales1     <-- try vi on a file w/o LineFeeds
     ==============
     - the screen will be filled with data, but records are not distinct.
     - and 'vi' will display --> noEOL, 1 Line, 1280 Chars

 #2. uvhd dat1/sales1   <-- try uvhd
     ================
                      10        20        30        40        50        60
 r#        1 0123456789012345678901234567890123456789012345678901234567890123
           0 130140    21 940802 IN111001  HAM001  00002{ 0000001 00000002{
             3333332222332333333244333333224443332233333723333333233333333722
             130140000021094080209E1110010081D0010000002B00000001000000002B00
          64 130140    21 940802 IN111001  SCR012  00002A 0001001 00002102A
             3333332222332333333244333333225453332233333423333333233333333422
             130140000021094080209E111001003320120000002100001001000002102100
         128 139923    35 950802 IN111002  CHR001  00002B 0002001 00004402B
             3333332222332333333244333333224453332233333423333333233333333422
             139923000035095080209E111002003820010000002200002001000004402200

 #3. uvcp "fili1=dat1/sales1,typ=RSF,rcs=64,filo1=tmp/sales1,typ=LSTt"
     =================================================================
     - use uvcp to convert file type from RSF (Record Seqntl Fixed)
     - to LSTt (Line Seqntl Terminated)
     - option 't' inserts the LF after the last nonblank

 #4. vi tmp/sales1        <-- use vi to view the converted file (typ=LST)
     =============
     130140    21 940802 IN111001  HAM001  00002{ 0000001 00000002{
     130140    21 940802 IN111001  SCR012  00002A 0001001 00002102A
     139923    35 950802 IN111002  CHR001  00002B 0002001 00004402B
Note
  • we are showing only the 1st 3 of 20 records
  • vi does not show the LineFeeds (use uvhd if you wish to see them)

See complete doc for uvcp at uvcp.htm

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7E1. CNVaids: Data File Aids

listrec2 - list fixed length records

'listrec2' will list fixed length records in 100 byte segments with scale. Replace any unprintable characters with periods ('.'s). We will demo listrec2 & show the output report, using test/demo file custmas1 256 bytes with packed.


 cd /home/uvadm        <-- change to the uvadm home directory
 ==============

 uvcopy listrec2,fili1=dat1/custmas1,uop=r256m2  <-- execute listrec2
 ==============================================
 - option 'r256' = Recsize, option 'm2' max recs listed = 2
 - we also entered options below at prompt (redundant)

console log

 uop=q1r256l000m03s2t0 - option defaults
       r256            - recsize default 256 (max 8000, add 1 if Indexed)
           l000        - List size 000 defaults to record-size
           l100        - List size 100 would List FIRST 100 ONLY
                       - use "uvlp12L" Landscape 12cpi to print 100/line
               m3      - list 10 records Max & end job
               m99     - probably would not want to list high numbers
                       - "rop=c99" same (Run OPtion vs User OPtion)
                       - "rop=b99" could be used to Bypass records
                  s2   - space 2 (leave 1 blank line between records)
                  s1   - space 1 (no space between records)
                    t1 - Translate from EBCDIC to ASCII
 uop=q0r256l000m3s2t0 # default: list 10 256 byte recs (3 lines 100,100,56)
 140225:154916:listrec2: uvcopy ver=20140222 pf=/home/uvadm/pf/util/listrec2
 uvcopy LNX H64 license=20140222_99V_930601 site=UV_Software
 User OPtion (uop) defaults  = q1r256l000m3s2t0r256
 -->null to accept or enter/override --> r256m2 <-- enter options
 tmp/custmas1.lst = default filo01 - null accept or reenter ?
 140225:154918:listrec2: EOF fili01 rds=3 size=8192: dat1/custmas1
 140225:154918:listrec2: EOF filo01 wrts=19 size=1177: tmp/custmas1.lst
 EOJ, Output File written to: tmp/custmas1.lst
 enter command: more,print,uvlpr12,edit,null --> more <-- to view report

sample output report

 listrec2 - list (100 bytes/line) file=dat1/custmas1 2014/02/25_15:49:16
 rec#:rcsz          1         2         3         4         5         6         7         8         9        10
           1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
 0001:0000 130140    EVERGREEN MOTORS LTD.    1815 BOWEN ROAD          NANAIMO          BC V9S1H1    250-754-55
      0100 31 LARRY WRENCH     ..4V|............W0....`........)X}..f3.....\.................4V}........E|...V}
      0200 .......................f.....<........f.C 19950531
      0256
 0002:0000 132588    GEECOE GENERATOR SERVICESUNIT 170 - 2851 SIMPSON  RICHMOND         BC V6X2R2    604-278-44
      0100 88 HARRY LIGHT      ...h....8\........U\.............hl........p....#....%<........6.........G......
      0200 ...........................B.<..........A 20030430
      0256

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7E2. CNVaids: Data File Aids

listhex2 - list fixed length records in hexadecimal

'listhex2' will list fixed length records in 100 byte segments with scale. Same as 'listrec2', but lists in vertical hexadecimal, showing 3 lines per 100 byte segment (characters, zones, digits).

We will demo listhex2 & show the output report, using test/demo file: /home/uvadm/dat1/citytax1a - 128 byte records with packed field in 88-96.


 cd /home/uvadm        <-- change to the uvadm home directory
 ==============

 uvcopy listhex2,fili1=dat1/custmas1,uop=r256m1  <-- execute listhex2
 ==============================================
 - option 'r256' = Recsize, option 'm1' = Max recs to list
 - we also entered options below at prompt, redundant since on command line
 uop=q1r256l000m05s1t0 - option defaults
       r256            - recsize default 256 (max 8000, add 1 if Indexed)
           l000        - List size 000 defaults to record-size
           l100        - List size 100 would List FIRST 100 ONLY
               m05     - list 05 records Max (default) & end job
               m99     - probably would not want to list high numbers
                  s1   - space 1 (no space between records)
                  s2   - space 2 (leave 1 blank line between records)
                    t1 - Translate char-line from EBCDIC to ASCII
 uop=q0r950l100m20s2t1 Ex: Recsize 950, List 100, Max 20, Space 2, Translt
 uop=q0r256l000m05s1t0 <-- defaults
 140225:160958:listhex2: uvcopy ver=20140222 pf=/home/uvadm/pf/util/listhex2
 uvcopy LNX H64 license=20140222_99V_930601 site=UV_Software
 User OPtion (uop) defaults  = q1r256l000m05s1t0r256m1
 -->null to accept or enter/override --> r256m1 <-- enter options
 tmp/custmas1.hex = default filo01 - null accept or reenter ?
 140225:160959:listhex2: EOF fili01 rds=1 size=8192: dat1/custmas1
 140225:160959:listhex2: EOF filo01 wrts=13 size=1116: tmp/custmas1.hex
 EOJ, Output File written to: tmp/custmas1.hex
 enter command: vi,cat,more,lp,uvlp12,null --> more <-- to view report

sample output report

 listhex2 - list Vertical Hexadecimal file=dat1/custmas1 2014/02/25_16:09:58
                1         2         3         4         5         6         7         8         9        10
 seq#  1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
 00001 130140    EVERGREEN MOTORS LTD.    1815 BOWEN ROAD          NANAIMO          BC V9S1H1    250-754-55
       3333332222454545444244545524542222233332445442544422222222224444444222222222244253534322223332333233
       130140000056527255E0DF4F230C44E0000181502F75E02F140000000000E1E19DF00000000002306931810000250D754D55
       31 LARRY WRENCH     ..4V|............W0....`........)X}..f3.....\.................4V}........E|...V}
       3324455525544442222201357000000000000530001600000000257006310009500000000000000001357000000004700057
       310C12290725E38000000246C0000C0000C0270D0540C0000C0098D0263C0444C0000C0000C0000C0246D0000C0035C0046D
       .......................f.....<........f.C 19950531
       00000000880000000018000680001300000000694233333333222222
       0000C0023C0000C0083C0056D0012C0000C0016D3019950531000000

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7F1. CNVaids: Data File Aids

listall1 - list subdir of multiple short files

'listall1' is a script to list a subdir of multiple short files. A great example is the 'parms' subdir commonly used by MVS COBOL shops to hold parameter files such as SORT keys, IKJEFT01 parms, etc.

You might list parms with 'uvlpd12' (see uvlist.htm#F1) which lists all files in a directory, but each file starts on a new page. For directories of short files (like parms/...), 'listall1' will save a lot of paper.

listall1 demo - list all parm files


 #1. cd /home/uvadm/mvstest/testlibs <-- cd to JCL convert dir with parms subdir
     ===============================

 #2. listall1 parms    <-- call script to list multiple short files
     ==============      - creates report in tmp/parms

 #3. uvlp12 tmp/parms  <-- print report
     ================

FILE# 1 - parms/ikjdemo1 DSN SYSTEM(DB2P) RUN PROGRAM(CAR100) PLAN(IKJPROG1) LIB('MEPP.WXS91.LOADLIB') PARMS('parmsdata added on IKJEFT01 demo Aug28/07') END 4 lines printed of 4 total lines in file

FILE# 2 - parms/parm200s SORT FIELDS=(31,6,CH,A,1,6,CH,A) OMIT COND=((11,2,CH,EQ,C'65'),OR,(COND=(11,2,CH,EQ,C'85')) 2 lines printed of 2 total lines in file

FILE# 3 - parms/pgl200s1 SORT FIELDS=(1,8,CH,A,69,12,CH,A) 1 lines printed of 1 total lines in file

FILE# 4 - parms/products BBQ010 BAR-B-Q CHR015 LAWN CHAIR HAM010 CLAW HAMMER HAM020 BALL PEEN HAMMER HAM035 JACK HAMMER SAW011 HAND SAW SAW012 RIP SAW SAW051 POWER SAW TAB012 LAWN TABLE 9 lines printed of 9 total lines in file

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7F2. CNVaids: Data File Aids

listall1 - script to list subdir of short files

 # listall1 - list ALL files in a directory (of multiple small files)
 #          - without page break between files (just space)
 #          - this script (listall1) calls uvcopy job 'listall1'
 # listall2 - similar script, different options re lines/file
 #          - prompts for command to view/print reports (vs rop=r1 ?)
 #
 echo "list multiple small files"
 d1="$1"
 if [[ ! -d "$d1" ]]; then
    echo "usage:   listall1 directory [m50] [.xxx] <-- arg1 must be a directory"
    echo "         ================= - arg2 may specify max lines/file deflt 50"
    echo "                           - arg3 may qualify files to list"
    echo "example: listall1 cblx m15 .err <--list .err files in cblx 15 linesmax"
    echo "         ===================="
    exit 1; fi
 #
 d2=$(basename $d1)   # select subdir of dir/.../subdir
 # create contents page & report files, then prompt for print or more
 ls -l $d2 >tmp/${d2}_files
 uvcopy listall1,fild1=$d1,filo1=tmp/${d2}_report,uop=q0i7$2,arg1=$3
 #==================================================================
 echo "reports created in tmp/${d2}_files & tmp/${d2}_report"
 echo "- enter command to view/print: more, vi, uvlp12, uvlp16L, etc"
 echo "  (use uvlp16L to print Landscape for 150 chars across)"
 read reply
 if [[ -n "$reply" ]]; then
    $reply tmp/${d2}_files
    $reply tmp/${d2}_report
 fi
 exit

Above script 'listall1' calls uvcopy job 'listall1' (listed next 3 pages)

/home/uvadm/sf/util/listall1 <-- script stored in sf/util/...

/home/uvadm/pf/util/listall1 <-- uvcopy job stored in pf/util/...

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7F3. CNVaids: Data File Aids

listall1 uvcopy job called by script listall1

 # listall1 - uvcopy Parameter File from UVSI stored in: /home/uvadm/pf/IBM/
 # listall1 - list All Files in Directory (or all files matching a pattern)
 #          - lists filename + file contents + space before next file
 #          - intended for multiple short files
 #            (example - control card library of SORT FIELDS, etc)
 #          - by Owen Townsend, April 2004
 # listall2 - alt job similar as listall1 (now both jobs sort filenames)
 #          - for Landscape list default 30 lines/page (vs 50 listall1)
 #
 # uvcopy listall1,fild1=parms,filo1=tmp/parms[,arg1=pattern] <-- create report
 # ===========================================================
 # uvlp12 tmp/parms           <-- list report
 # =================
 #
 # listall1 parms       <-- script 'listall1' to run uvcopy job 'listall1'
 # ==============
 #
 opr='$jobname - list All Files in Directory (or files matching a pattern)'
 opr='uvcopy $jobname,fili1=...,arg1=xxx <-- arg1=... may specify pattern match'
 opr='uop=m50p58  - option defaults'
 opr='    m50     - max lines for any 1 file'
 opr='    m20     - reduce or increase as dessired'
 opr='       p58 - lines per page (newpage if current file would exceed)'
 uop=q1m50p58    # user option defaults
 # rop=r1x1      # run option prompt report vi/cat/more/lp/etc
 fild1=?parms,typ=DIR,rcs=80               #directory of small files
 fili1=parms/filexx,typ=LST,rcs=512        #current input file from ls dir
 filo1=?tmp/$fild1,typ=LSTt,rcs=256        #output report file
 fili2=tmp/listall1_files,typ=LST,rcs=256  #current input file from ls dir
 @run
        opn    fild1                    open input1 directory
        opn    filo1                    open output file
 ##     msgwa1c 'enter a filename match pattern, or null for all files'
        mvc    c0(80),$arg1             save pattern in area 'c'
 #
 # create file of filenames via 'sys ls' to ensure filenames sorted
 ##     sysv1  'ls $fild1 >tmp/listall1_files'
 #Aug06/13 - problem with above if $fild1 expands > 6 chars
        mvfv1t1 s0(60),'ls $fild1 >tmp/listall1_files'
        sys     s0(60)                  execute ls $fild1 >tmp/infiles
        opn    fili2                    open file of filenames
 #
 # begin outer loop to read next filename in directory
 man10  get    fili2,a0                 get next filename in directory
        skp>   man80                    if EOD, go execute sort
        skp<   man10                    (cc < to bypass subdirs)
        cmc    c0(8),' '                any filename match pattern entered ?
        skp=   man20
        scng4  a0(80),c0(50)            scan for pattern match in filename ?
        skp!   man10
 #

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

 # create input filename concatenate: dirname + '/' + filename
 man20  clr    f0(300),' '
        mvu    f100(80),$fild1,x'00'   move dirname until ending null
        cat    f100(80),'/'            append '/'
        cata8  f100(80),a0(80)         concat current filename (a8 null terms)
        mvc    $fili1,f100             store input filename before open
        opn    fili1                   open input file
 #
 # use system cmd 'wc -l' to get lines in new file to see if it fits on this page
        sysv9w3 'wc -l $fili1 '
        mvn    $ca2,$ci1
 #
 # skip to new page if line count > option m (default 50?)
 # - and current file wont fit on current page
 # skip to new page if current file > optn 'p' (option p lines)
 # - or if current file would cause lines to exceed option 'p' (default 58?)
 man30  cmn    $ca3,$uopbp            current file > option p lines ?
        skp>   man34
        mvn    $ca4,$ca3              lines on current page
        add    $ca4,$ca2              + lines in new file
        cmn    $ca4,$uopbp            will new file fit on current page ?
        skp<   man36
 man34  put    filo1,'*eject'         no - insert *eject for uvlp12
        mvn    $ca3,0                    - clear line count
 # print filename before file contents
 man36  add    $ca1,1                  count input files
        mvfv9  h0(80),'FILE# $ca1 - $fili1'
        put    filo1,h0
        add    $ca3,1                  +1 lines on current page
        mvn    $ca4,0                  clear ctr for max lines test
 #
 # begin inner loop to list lines from current file
 man40  get    fili1,b0                get next input JCL line
        skp>   man60                   (cc > at EOF)
        trt    b0(512),$trtper         trnslt unprintables to periods
        put    filo1,b0(200)           list current line max 200
        add    $ca3,1                  count lines this page
        add    $ca4,1                  count lines this file
        cmn    $ca4,$uopbm             reached max lines option ?
        skp<   man40                   return to get next line
 #

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

 #----------------------------------------------------------------------
 # End of current input jcl file
 # - print lines printed of total in file & warn if not all printed
 # - print blank line between files
 # - close current files & return to get next filename from indir
 man60  mvfv1  m0(80),'$ca4 lines printed of $ca2 total lines in file'
        put    filo1,m0
        mvn    $ca5,$ca2               total lines in file
        sub    $ca5,$ca4               - printed = remaining
        skp<=  man64
 man62  mvfv1  m0(80),'*** $ca5 lines NOT printed (option m $uopbm max lines)'
        put    filo1,m0
 man64  cls    fili1                   close current input file
        put    filo1,' '               print blank line
        add    $ca3,1                  +1 lines on current page
        skp    man10
 #
 #----------------------------------------------------------------------
 # End of input directory - close files & end job
 # - option r1 will prompt for report disposition (vi/cat/more/uvlp12)
 man80  cls     all
        eoj

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7G1. CNVaids: Data File Aids

CMPjobs.doc - Data File Compare

These jobs will compare data files that may have packed/binary fields.

We will demonstrate uvcmp1 on the following 2 pages using the test files shown below:

test file#1 /home/uvadm/dat1/warmas1

 cust# prod#  description   purch-date  expire-date   price
           1         2         3         4         5         6         7
 01234567890123456789012345678901234567890123456789012345678901234567890
 12345 12345 sony television   950101 1-year 960101 000002911
 22222 00000 dish washer       960101 2-year 980101 000004922
 33333 11111 refrigerator      961231 3-year 991231 000006733
 33333 22222 air conditioner   970101 3-year 000101 000006744
 44444 00000 freezer           970101 4-year 010101 000009955
 55555 11111 clothes dryer     991231 5-year 041231 000055566
 66666 00000 micro wave        001231 6-year 061231 000066677
 88888 00000 HP computer       030101 3-year 070101 000129999

dat1/warmas1a - Alternate test file#2 with differences

 12345 12345 sony television   950101 1-year 960101 000002911
 22222 00000 dish CRASHER      960101 2-year 980101 000004922
 33333 11111 refrigerator      961215 4-year 001215 000005500
 33333 22222 air conditioner   970101 3-year 000101 000006744
 44444 00000 freezer           970101 4-year 010101 000009955
 55555 11111 clothes SHRINKER  990615 6-year 051201 000066699
 66666 00000 micro wave        001215 6-year 999999 000066677
 88888 00000 HP computer       030101 3-year 070101 000129999

Note that we have created some intentional mismatches in the 2nd file.

The operating instructions are shown on the following page --->

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7G2. CNVaids: Data File Aids

uvcmp1 demo#1 - Operating Instructions


 uvcopy uvcmp1,fili1=dat1/warmas1,fili2=dat1/warmas1a,uop=r64
 ============================================================
 uop=q1a0b0c0d0e0f0g0h0p30r256s8t500000u3x2y0  - option defaults
       a#              - dsplcmnt to exclude field #1
       b#              - length   to exclude field #1
         c#            - dsplcmnt to exclude field #2
         d#            - length   to exclude field #2
           e#          - dsplcmnt to exclude field #3
           f#          - length   to exclude field #3
             g#        - dsplcmnt to exclude field #4
             h#        - length   to exclude field #4
               n0      - print column scale only at begin report
               n1      - print column scale for each record mismatch pair
                 p30   - line# to test overflow at begin record only
                  r256 - record size
                s8     - StopPrint count, after s# mismatched records
              t500000  - StopRead count, after s# mismats, else read to EOF
            u1         - stop print at last segment with mismatch
            u2         - inhibit printing all matching segments after 1st
          x#           - hex or char print (x1 char, x2 hex, x0 auto)
        y0             - do NOT translate, file already ASCII, default(y0)
        y1             - translate char lines to ASCII (for EBCDIC files)
 User OPtion (uop) defaults  = q1p30r256s8t500000u3x2y0r64
 -->null to accept or enter/override --> r64 <-- enter record-size
 ==================== EOF or StopPrint/StopRead count reached  ==============
 File1Total=8, File2Total=8, StopPrint=8, StopRead=500000
 File1Reads=8, TotalMisMatches=4, MisMatchesPrinted=4
 090218:093752:uvcmp1: EOF fili01 rds=8 size=512: dat1/warmas1
 090218:093752:uvcmp1: EOF fili02 rds=8 size=512: dat1/warmas1a
 090218:093752:uvcmp1: EOF fild03 size=4096: rptcmp
 090218:093752:uvcmp1: EOF filo03 wrts=53 size=3058: rptcmp/warmas1 hits=4
 EOJ, Output File written to: rptcmp/warmas1
 enter command: vi,cat,more,lp,uvlp12,null -->  vi  <-- enter vi to view rpt

See differences report listed on the next page --->

Note the response to the options prompt was 'r64', specifying the record sizes as 64 bytes. We specified the options twice here to emphasize their importance, once on the command line & again at the prompt (which would be redundant).

You could enter just 'uvcopy uvcmp1' & enter filenames & options at the prompts, but it is better to enter at least the filenames on the command line, so you can use the shell history if you need to repeat the command.


 uvcopy uvcmp1  <-- will prompt for filenames & options if not on command
 =============

For uvcmp1 (intended for 1 pair of files at a time) you could wait for the prompt to specify options, but for uvcmp2/uvcmp3 it is usually advantageous to specify options on the command line & include the 'q0' option to disable the prompts for multiple files in the directory.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7G3. CNVaids: Data File Aids

uvcmp1 demo#1 - sample report

 uvcmpFA1 uvcmp1 - compare 2 files, print mismatched records, '*' flag diffs
 2007/12/12_12:01:35 uop=q1p30r256s8t500000v2x0y0z1q1r64
 recsize  reccount   file-size  typ Report=rpts/warmas1.cmp
 1:   64         8           0  RSF  File1=dat1/warmas1
 2:   64         8           0  RSF  File2=dat1/warmas1a
                       1         2         3         4         5         6
 f#rec#byte# 0123456789012345678901234567890123456789012345678901234567890123
 ============================================================================
 1    2    0 22222 00000 dish washer       960101 2-year 980101 000004922   .
             3333323333326676276766722222223333332327667233333323333333332220
             22222000000049380713852000000096010102D951209801010000004922000A
                              *******
 2    2      22222 00000 dish CRASHER      960101 2-year 980101 000004922   .
             3333323333326676245454452222223333332327667233333323333333332220
             22222000000049380321385200000096010102D951209801010000004922000A
                              *******
 1    3    0 33333 11111 refrigerator      961231 3-year 991231 000006733   .
             3333323333327667666767672222223333332327667233333323333333332220
             3333301111102562975214F200000096123103D951209912310000006733000A
                                               ** *      **  **      ****
 2    3      33333 11111 refrigerator      961215 4-year 001215 000005500   .
             3333323333327667666767672222223333332327667233333323333333332220
             3333301111102562975214F200000096121504D951200012150000005500000A
                                               ** *      **  **      ****
 1    6    0 55555 11111 clothes dryer     991231 5-year 041231 000055566   .
             3333323333326667667267767222223333332327667233333323333333332220
             5555501111103CF48530429520000099123105D951200412310000055566000A
                                 ********    **** *       *  *      *****
 2    6      55555 11111 clothes SHRINKER  990615 6-year 051201 000066699   .
             3333323333326667667254544445223333332327667233333323333333332220
             5555501111103CF485303829EB520099061506D951200512010000066699000A
                                 ********    **** *       *  *      *****
 1    7    0 66666 00000 micro wave        001231 6-year 061231 000066677   .
             3333323333326667627676222222223333332327667233333323333333332220
             666660000000D932F071650000000000123106D951200612310000066677000A
                                               **        ******
 2    7      66666 00000 micro wave        001215 6-year 999999 000066677   .
             3333323333326667627676222222223333332327667233333323333333332220
             666660000000D932F071650000000000121506D951209999990000066677000A
                                               **        ******
 ======================= EOF or stop count reached ==========================
 Total=000008,read=000008,mismatches=000004,stop=000008,term=500000
Note
  • '*' mark differences between record pairs

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7G4. CNVaids: Data File Aids

uvcmp1all - compare all files in 2 directories

Here is a good illustration of the usefulness of the 'uvcmp1all' script:

When we convert mainframe EBCDIC files to ASCII, we can verify the conversions by converting back to EBCDIC & comparing the re-converted EBCDIC files to the original mainframe files.

Here is the flowchart for generating & executing the jobs to convert data-files from EBCDIC to ASCII & back to EBCDIC. If interested see the operating instructions at DATAcnv1.htm#8C1. We are explaining this only as a good example of using the 'uvcmp1all' script to compare all files in 2 directories.

Generate jobs: EBCDIC-->ASCII & ASCII-->EBCDIC

 cpys -------> maps --------> pfx1 --------> pfx2 ---------> pfx3 -------> pfx4
      cobmap1       uvdata51       uvdata52       copy/edit       uvdata55

Execute jobs: EBCDIC-->ASCII, ASCII-->EBCDIC,& compare

 Main -----> d1ebc ----------> d2asc ----------> d3ebc --------> rptcmp
 frame FTP   uvcopyxx 'pfx3/*'  uvcopyxx 'pfx4/*'   **uvcmp1all** mismatch rpts

Compare ALL re-converted files to original EBCDIC files


 #4. mkdir rptcmp           <-- make subdir for mismatch reprots
     ============

 #5. uvcmp1all d1ebc d3ebc  <-- compare all original files to reconverted files
     =====================

 #6a. vi rptcmp/*          <-- inspect all mismatch reports
      ===========

 #6b. uvlpd12 rptcmp/*     <-- print all mismatch reports
      ================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7H1. CNVaids: Data File Aids

gentest1 - generate test data files based on COBOL copybooks

'gentest1' will create uvcopy jobs to generate test data files based on COBOL copybooks. For type X fields, we insert 'A's in 1st field, 'B's in 2nd, etc. For type 9 fields (packed or numeric), we insert the current record#. Every 10th record, we insert the copybook fieldnames (in type X fields).

The generated uvcopy jobs are named after the copybooks and they call sub- routines to generate data for each field. Each picture field in the copybook generates a 'bal' to a subrtn, depending on field type (type X, packed, binary, signed/unsigned numeric). For example:


   bal  genx,'a00035b0025','address'    <-- sample call to subrtn
   =================================

This calls subrtn 'genx' for a type X field starting at byte 35 (option a00035) that is 25 bytes long (option b0025), whose fieldname is 'address'.

Here is a summary of the subrtns called & a description of the actions performed for the various field types:

genx
  • generates data in type X fields
  • inserts field-names in every 10th record
  • else generates 'A's in 1st field, 'B's in 2nd, 'C's in 3rd
  • inserts current record# in bytes 5-10 of fields longer than 15 bytes
gen9
  • generates data in numeric unpacked unsigned fields
  • inserts current record# in entire field, if field longer than 5 bytes
  • else, generates '1's in 1st field, '2's in 2nd, '3's in 3rd
gens
  • generates data in numeric Signed fields
  • inserts current record# in entire field
  • makes all fields in every 3rd record negative
genp
  • generates data in packed fields
  • inserts current record# in entire field
  • makes all fields in every 3rd record negative
genb
  • generates data in binary fields
  • inserts current record# in entire field
  • makes all fields in every 3rd record negative

Calling subrtns keeps the generated uvcopy jobs short since most of the field processing code is in these sub-routines. The subrtn module is called via the following code, which you can see at the end of the sample job listed on the next page.

@pf2=gentest1.sub <-- code to include subfunctions in uvcopy jobs

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7H2. CNVaids: Data File Aids

gentest1 - sample input

 cobmap1  start-end bytes for cobol record fields    200408220851  pg# 0001
 cpys/citytax1                  citytax1           RCSZ=00128  bgn  end  lth typ
 * citytax1 copybook, from signscan1 + edit meaningful names
  01  citytax1.
      10 folio                 pic  x(00010).                 0000 0009  010
      10 name                  pic  x(00025).                 0010 0034  025
      10 address               pic  x(00025).                 0035 0059  025
      10 city                  pic  x(00020).                 0060 0079  020
      10 province              pic  x(00002).                 0080 0081  002
      10 zip                   pic  x(00006).                 0082 0087  006
      10 post-date             pic s9(00007) comp-3.          0088 0091  004pns 7
      10 land-value            pic s9(00009) comp-3.          0092 0096  005pns 9
      10 improv-value          pic s9(00009) comp-3.          0097 0101  005pns 9
      10 face-value            pic s9(00009) comp-3.          0102 0106  005pns 9
      10 maint-tax             pic s9(00007)v99.              0107 0115  009 ns 9
      10 purchase-date         pic  x(00006).                 0116 0121  006
      10 filler001             pic  x(00006).                 0122 0127  006
 *RCSZ=00128                                                       0128

sample output

 opr='JOBNAME citytax1 - generated by cobmap1 & gentest1'
 opr='uop=c100   - option "c" default record output count = 100'
 opr='           - may change at prompt (ex: enter "c2000" for 2000 records)'
 uop=q1c100      # option defaults
 was=a9000b9000
 filo1=?tmp/citytax1,rcs=00128,typ=RSF
 @run
        opn    all
        bal    initj                 inits for job (setup A-Z 0-9 patterns)
 # begin loop to generate fields & output each record
 loop   bal    initr                 inits for record (counts records,etc)
        clr    b0(00128),' '         init output area to all blanks
 #      ---                          <-- insert R/T tests if redef records
        bal    genx,'a00000b0010','folio'
        bal    genx,'a00010b0025','name'
        bal    genx,'a00035b0025','address'
        bal    genx,'a00060b0020','city'
        bal    genx,'a00080b0002','province'
        bal    genx,'a00082b0006','zip'
        bal    genp,'a00088b0004','post-date'
        bal    genp,'a00092b0005','land-value'
        bal    genp,'a00097b0005','improv-value'
        bal    genp,'a00102b0005','face-value'
        bal    gens,'a00107b0009','maint-tax'
        bal    genx,'a00116b0006','purchase-date'
        bal    genx,'a00122b0006','filler001'
 #
 put1   put    filo1,b0              output current record
        cmn    $ca1,$uopbc           reached output Count ?
        skp<   loop
 eof    cls    all
        eoj
 @pf2=gentest1.sub

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7H3. CNVaids: Data File Aids

Op-Instrns for citytax1 demo file


 1. uvcopy cobmap1,fili1=cpys/citytax1,filo1=maps/citytax1
    ======================================================
           - convert the COBOL copybook into a 'cobmap' (record layout)

 2. uvcopy gentest1,fili1=maps/citytax1,filo1=pfg1/citytax1
    =======================================================
           - generate the uvcopy job from the cobmap

 3. uvcopy pfg1/citytax1,filo1=tmp/citytax1  <-- execute the generated job
    =======================================

 3a. uvcopy pfg1/citytax1    <-- same (output file defaults as shown above)
     ====================

console displays for option changes

uop=c100
  • option "c" default record output count = 100
  • may change at prompt (ex: enter "c2000" for 2000 records)

User OPtion (uop) defaults = q1c100 null to accept or re-specify (1 or more) --> c500 <-- may change default

tmp/citytax1 = default filo01 - null accept or reenter --> <-- null accept

 citytax1:040823:105849: EOF filo01 0 rds, 100 wrts, 12800 size; tmp/citytax1

 4. uvhd filename=tmp/citytax1 r128          <-- examine the output
    ===============================

Please see the 'uvhd' output display shown on the next page --->

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7H4. CNVaids: Data File Aids

Here is the 'uvhd' command repeated from the previous page, but with option 's7' added to space out the display to make it easier to read.


 4. uvhd filename=tmp/citytax1 r128s7          <-- examine the output
    =================================

output from citytax1 demo file

                      10        20        30        40        50        60
 r#        1 0123456789012345678901234567890123456789012345678901234567890123
           0 folio     name                     address                  city
             6666622222666622222222222222222222266676772222222222222222226677
             6FC9F00000E1D500000000000000000000014425330000000000000000003949
          64                 przip   ...................000000001purchafiller
             2222222222222222777672220001000010000100001333333333777666666667
             000000000000000002A90000000C0000C0000C0000C00000000105238169CC52
                      10        20        30        40        50        60
 r#        2 0123456789012345678901234567890123456789012345678901234567890123
         128 AAAAAAAAAABBBBB000002BBBBBBBBBBBBBBCCCCC000002CCCCCCCCCCCCCCDDDD
             4444444444444443333334444444444444444444333333444444444444444444
             1111111111222220000022222222222222233333000002333333333333334444
          64 D000002DDDDDDDDDEEFFFFFF...,....,....,....,000000002GGGGGGHHHHHH
             4333333444444444444444440002000020000200002333333333444444444444
             400000244444444455666666000C0000C0000C0000C000000002777777888888
                      10        20        30        40        50        60
 r#        3 0123456789012345678901234567890123456789012345678901234567890123
         256 AAAAAAAAAABBBBB000003BBBBBBBBBBBBBBCCCCC000003CCCCCCCCCCCCCCDDDD
             4444444444444443333334444444444444444444333333444444444444444444
             1111111111222220000032222222222222233333000003333333333333334444
          64 D000003DDDDDDDDDEEFFFFFF...=....=....=....=00000000sGGGGGGHHHHHH
             4333333444444444444444440003000030000300003333333337444444444444
             400000344444444455666666000D0000D0000D0000D000000003777777888888

Please relate this output to the copybook & the rules listed previously:

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7H5. CNVaids: Data File Aids

'gentestA' script

The 'gentestA' script is provided to make it easier to run the gentest1 utility. The script includes both the cobmap1 & gentest1 uvcopy jobs, reducing the operating instructions to 1 line:


 gentestA citytax1      - generates uvcopy job --> pfg1/citytax1
 =================

 uvcopy pfg1/citytax1,filo1=tmp/citytax1  <-- execute the generated job
 =======================================

Op-Instns for all files in directory


 #1. uvcopyx cobmap1 cpys maps uop=q0i7p0  <-- create cobmaps for all copybooks
     ====================================

 #2. uvcopyx gentest1 maps pfg1 uop=q0i7   <-- create data gen jobs for all maps
     ===================================

 #3. uvcopyX 'pfg1/*'                      <-- execute all data generate jobs
     ================

You might want to generate all test data generation jobs as shown in #1 & #2 above, but it is unlikely you would want to execute all at once because they would be generated in the 'tmp' subdir & all default to 100 records.

The uvcopy code for gentest1 & gentest1.sub is not shown here or on the web site documentation, but if you have Vancouver Utilities installed, you may find the code as follows:

 /home/uvadm/pf/IBM/gentest1  - uvcopy code to generate the uvcopy jobs
                                to generate the test data files from copybooks
 /home/uvadm/pf/IBM/gentest1.sub - uvcopy code for the sub-routines called
                                   by the generated uvcopy jobs

Note that the generated jobs would be in your sub-directories. If you had followed the recommended setup procedures this would be:

/home/cnvdata/pfg1/xxxxxx

Each of the generated jobs loads the subrtns via the code found on the last line of each generated job, which is:

 @pf2=gentest1.sub          <-- loads the subrtn code

The subrtns will be loaded from /home/uvadm/pf/IBM/gentest1.sub. If you want to modify the subrtns, you should 1st copy to your own 'pf' directory & place your directory ahead of the 'uvadm' pf directory in the PFPATH variable that uvcopy uses to load uvcopy job code. Do not modify in the uvadm pf directory, because any later update install of Vancouver Utilities would overwrite your modified code.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7I1. CNVaids: Data File Aids

Data File VTOC Report


 #1.  login: ordr --> /p1/testlibs/ordr  (login: apay,arcv,ordr,etc)

 #2.  l $RUNDATA     relevant subdir --> /p2/proddata/ordr

 #3a. uvcopy vtocr1,fild1=${RUNDATA}/ordr,filo1=tmp/vtocrpt  <- defaults
      =====================================================

 #3b. uvcopy vtocr1     <-- same as above (defaults omitted)
      =============
      prompt indir       -->        <-- null for default
      prompt reportfile  -->        <-- null for default
      prompt vi/uvlp/etc --> uvlp12 <-- print at 12 cpi on default printer
        or                                                ($UVLPDEST)
 #4. uvlp12 tmp/vtocrpt -dlaser1     - print report on desired printer
     ===========================
 vtocr1    Directory:  /p2/proddata/ordr
 2000/06/02_10:58:48                           options: q1a1r0s1k2
 file#   file-size   rcsz  records   dels kloc klen  last-modify   filename
    1  298,058,233   450+  660,883            0 16  20000602 08:59 ipalacct
                                             16  6n
    2           64    63+        1            0 23  20000602 08:59 ipaladjw
    3      598,336    31+   18,698            0  9  20000602 08:59 ipaldcal
    4        4,480    31+      140            0  4  20000602 08:59 ipaldtrm
                                              4  4n
    5        8,896    63+      139            0  3  20000602 08:59 ipallcal
    6    2,493,696   255+    9,741            0 16  20000602 08:59 ipallnme
    7        7,680   511+       15            0  4  20000602 08:59 ipalmisc
    8   68,171,008   255+  266,293            0  9  20000602 09:25 ipalname
                                              9  9n
                                             18 16n
    9   10,433,792   255+   40,757            0 12  20000602 09:28 ipalnveh
                                             12  8n
                                             20 19n
   10   11,332,728  3839     2,952                  20000602 09:29 ipalprnt
   11       14,592   127+      114            0  4  20000602 09:30 ipalrate
   12        9,472   255+       37            0  2  20000602 09:30 ipalreas
   13       43,008   255+      168            0  6  20000602 09:30 ipalrept
   14       12,032    63+      188            0 15  20000602 09:30 iordrchd
   15        6,336    63+       99            0 13  20000602 09:30 iordrmss
   16   94,807,040   255+  370,340            0 12  20000602 09:37 iordrveh
                                             12  8n
                                             20  9n
                                             29 19n
       661,590,417 Total 4,092,054      0

See more at VTOCjobs.htm

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7J1. CNVaids: Data File Aids

uvsort

'uvsort' provides most SYNCSORT features at a much lower price.

  1. Input &/or Output files can be many different types - fixed length, sequential, variable length (RDW or IDXFORMAT), Indexed

  2. may select, delete, translate,& reformat records

  3. options to drop duplicate records - all or select 1st/last of a set

  4. may specify up to 20 input files & up to 60 output files.

  5. On input you may specify record selects/deletes/reformats that are applied to all records.

  6. On output you may specify record selects/deletes/reformats that are different for different output files.

  7. Number of input files can be unlimited using option 'f2' to input all files from a specified directory & optionally matching a specified prefix.

  8. For output files, you may specify option 'f1' on key1 (key1f1) to output multiple separate files for duplicate record key sets based on key1. This is a unique & powerful feature that can be used to write out separate files for each customer#, salesman#, state/province, etc. The output filenames are automatically created in the specified output directory, with an optional prefix, followed by the current key1 data value.

There are many more features described in uvsort.htm.

example - sort sequential & load Indexed


 uvsort "fili1=input,rcs=64,typ=RSF,filo1=output,typ=ISF,key1=0(6)"
 ==================================================================

There are many more examples shown in uvsort.htm.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7K1. CNVaids: Data File Aids

uvlist - Program Description

uvlist will list ascii text files (on stdout by default) but with the main intention of piping to a laser printer. Several scripts are provided. For example, this documentation is printed with 'uvlp12D', which prints at 12 cpi, DUPLEX, with margins to allow for 3 hole punched paper.

Many options are provided for laser printers, for example you can list 132 column reports on 8 1/2 width paper using the 'uvlp18' script which includes the option to print at 18 characters per inch.

uvlist will help you get organized & stay organized by allowing you to file your important listings in standard 8 1/2 x 11 3 ring binders & by ensuring that all listings have page headings that identify the file name & the last modification date.

Here are a few sample commands for uvlist, but uvlist is not usually run directly, but rather by using 1 of the many supplied scripts with convenient pre-defined options, such as 'uvlp12' (see below).


 uvlist file [format-options] [HP laser-options]  <-- command format
 ===============================================

 uvlist filename                  <-- display file contents on the screen
 ===============                    - standard output is the default

 uvlist file | lp                 <-- redirect output to the printer
 ================

 uvlist file p60 c12m300 | lp     <-- format options for 60 lines/page (dflt)
 ============================         laser options 12 cpi, margin 300/720"

 uvlp12 file                      <-- same as above, uvlp12 script includes
 ===========                          these options & redirects to the printer

 uvlp12 file b91e95               <-- same as above, with options to
 ==================                   begin on page 91 & end on page 95

uvlp12 script

You can see 'uvlp12' (& other scripts) listed begining at uvlist.htm#E1, But here is just the 1 essential line extracted from the script.


 uvlist $1 p60z2$2 a2t1c12$3 | lp $UVLPDEST $UVLPOPTN
 #===================================================

You can see that $1 is the filename & $2/$3 are optional addons to the default options for the uvlp12 script. Note the 2 sets of options (format & laser). Your .profile should include 'export UVLPDEST="-dlp0"' to set the destination & 'export UVLPOPTN="-onobanner"' to set other desired options.

Please see many more options & examples documented in uvlist.htm.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7K2. CNVaids: uvlist utility

option 'y' for column scale headings

Option 'y' prints a column scale in the page headings. This is a BIG help to determine the layout of mainframe records when no COBOL copybook is available.

For example, we will use option 'y80' to print an 80 byte column scale for test/demo file dat1/customers. We will also specify option 'e1' to End printing after 1 page (but in fact dat1/customers is only 8 lines).


 uvlp12 dat1/customers e1y80
 ===========================

sample uvlist with option 'y80'

 /home/uvadm/dat1/customers now=081102:0911 uvadm pg#  1
          1         2         3         4         5         6         7         8
 12345678901234567890123456789012345678901234567890123456789012345678901234567890
 130140 EVERGREEN MOTORS LTD.  1815 BOWEN ROAD        NANAIMO          BC V9S1H1
 139923 JOHNSTONE BOILER       1250 EAST PENDER ST.   VANCOUVER        BC V5L1W1
 150825 RIGGERS INDUSTRIAL     960 - 6TH AVENUE       HOPE             BC V2P6J1
 201120 ALLTYPE RENTAL LTD.    BOX 1819               DRAYTON VALLEY   AL T0E0M0
 308685 FOOTHILLS ELECTRIC     3932 - 3A ST. N.W.     CALGARY          AL T2E6R4
 315512 PARTS PLUS             BOX 510 MAIN ST.       THREE HILLS      AB T0M2A0
 400002 ACKLANDS LTD           945 -2ND AVE.          PRINCE GEORGE    BC V2L3A7
 406082 PRECAM RENTALS LTD.    10116-94TH AVE.        FORT ST. JOHN    BC V1G5G6

The scale makes it easy to determine field start & end bytes:

 cust# 01-06, name 08-29, address 31-52, city 54-69, province 71-72, zip 74-79.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7K3. CNVaids: uvlist utility

uvlist as a filter - compress blank lines & spaces

Sometimes you encounter a file with a lot of blank lines & blank spaces within lines that make the listing longer than it needs to be & makes it difficult to read because lines wrap to multiple lines even though the data would fit on 1 line - if we could just compress the multiple blank spaces.

For example, the output of 'utmpdump' (utility to display reboots & logins) has many blank spaces that wrap lines. Here is the command to capture the output.


 #1. utmpdump /var/run/utmp >/tmp/utmpdump1
     ======================================

sample output of utmpdump

 [2] [00000] [~~  ] [reboot  ] [~           ] [                    ] [0.0.0.0        ] [Sun Sep 14 07:17:35 2008 PDT]
 [1] [20021] [~~  ] [runlevel] [~           ] [                    ] [0.0.0.0        ] [Sun Sep 14 07:17:35 2008 PDT]
 [7] [03935] [1   ] [root    ] [tty1        ] [                    ] [0.0.0.0        ] [Sun Sep 14 07:29:25 2008 PDT]
 [7] [03939] [2   ] [uvadm   ] [tty2        ] [                    ] [0.0.0.0        ] [Sun Sep 14 07:29:31 2008 PDT]
 [7] [03940] [3   ] [uvbak   ] [tty3        ] [                    ] [0.0.0.0        ] [Sun Sep 14 07:29:37 2008 PDT]
 [7] [03951] [4   ] [uvext   ] [tty4        ] [                    ] [0.0.0.0        ] [Sun Sep 14 09:22:32 2008 PDT]

We can make the listing easier to read by using uvlist as follows:


 #2. uvlist /tmp/utmpdump1 c9d1i1hp0 >/tmp/utmpdump2
     ===============================================
     - option 'c9' reduces multi spaces within lines to 1 space
     - option 'd1' reduces multi blank lines to 1 blank line
     - options 'i1hp0' always when using uvlist as a filter
       (to inhibit laser control codes, uvlist page headings,& FormFeeds)

 #3a. vi /tmp/utmpdump2       <-- display compressed report with 'vi'
      =================

 #3b. uvlp12 /tmp/utmpdump2   <-- OR list with 'uvlp12', etc
      =====================

sample output of uvlist

 [2] [00000] [~~ ] [reboot ] [~ ] [ ] [0.0.0.0 ] [Sun Sep 14 07:17:35 2008 PDT]
 [1] [20021] [~~ ] [runlevel] [~ ] [ ] [0.0.0.0 ] [Sun Sep 14 07:17:35 2008 PDT]
 [7] [03935] [1 ] [root ] [tty1 ] [ ] [0.0.0.0 ] [Sun Sep 14 07:29:25 2008 PDT]
 [7] [03939] [2 ] [uvadm ] [tty2 ] [ ] [0.0.0.0 ] [Sun Sep 14 07:29:31 2008 PDT]
 [7] [03940] [3 ] [uvbak ] [tty3 ] [ ] [0.0.0.0 ] [Sun Sep 14 07:29:37 2008 PDT]
 [7] [03951] [4 ] [uvext ] [tty4 ] [ ] [0.0.0.0 ] [Sun Sep 14 09:22:32 2008 PDT]
Note
  • utmpdump does not create blank lines, I inserted to demo option 'd1'
  • see more on utmpdump at ADMjobs.htm#8J4.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7L1. CNVaids: Data File Aids

uxcp - complex Data File Conversions

We have already illustrated 'uvcp' on page '7C1'. 'uxcp' is a similar utility with the addition of the Micro Focus COBOL file handler to allow access to 'variable length indexed files'.

For mainframe conversions, you may need to transfer/convert variable length files from the mainframe to Unix/Linux. If the files have packed/binary fields, you will need to use the procedures documented in MVSDATA.htm which translate char fields, but preserve packed/binary fields, based on the COBOL copybooks.

Here in CNVaids.doc, we will show you how you can convert mainframe files without packed/binary fields, using a 1 line command to 'uxcp'. Variable length files should be unloaded from the mainframe file system to 'RDW' files for FTP to Unix/Linux.

mainframe file in RDW format for FTP

desired Output file on Unix/Linux

uxcp command to convert file


 uxcp "fili1=dir1/filex,typ=RDW,rcs=500,filo1=dir2/filex,typ=IDXf8v\
 ===================================================================
 ,tra=0(500),isk1=0(10)"
 =======================

See much more in uxcp.htm

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_8. CNVaids.doc Vancouver Utility Conversion Aids

Part 8 PreProgrammed jobs - Contents


8A1. Over 500 Pre-Programmed jobs are provided to perform mainframe conversions
a help you solve data file problems not possible with unix system utilities.

8B1. tabfix1 - tabs can cause problems, such as COBOL compile failures.
- Or maybe you want to reduce the default expansion of 8 to 4
  so you can view/print the file without text on multiple lines.
- tabfix1 converts tabs to a desired number of blanks (4 default).
- alternative jobs (tabfix2 & tabfix3).
tabfix2 - inserts blanks so next field at multiple of option t (default t4)
tabfix3 - inserts blanks to place next field depending on tab rack

8C1. tolower - translate to lower case with options to inhibit translate within
single &/or double quotes, clear cols 1-6 &/or 73-80 (for COBOL).

8D1. toascii - translate EBCDIC files to ASCII with options to specify I/O
filenames, file types, record-sizes,& record translate areas

8E1. scand2 - scan all files in directory for patterns & qualifiers
- very useful to identify files that match multiple criteria
- grep is great when you only need to scan for 1 pattern
- scand2 scans for a primary pattern qualified by 1 or 2 patterns
  on same line & qualified by 1 or 2 patterns anywhere in the file.

8F1. scan3d - scan all files in a directory & select records to a report file
that lie between any 2 specified patterns (start/stop) &
optionally qualified by a 3rd pattern that must be or must not
be present between the 1st 2 patterns.

8I1. 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.

8J1. 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'.

8K1. selectf1 - select records depending on 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 doc End this doc Index this doc Contents this library UVSI Home-Page

CNVaids.doc Vancouver Utility Conversion Aids

Part 8 Pre-Programmed jobs - Contents continued


8L1. scan5d - pre-programmed job to scan all files in a directory, searching
  for exception files. You specify exception conditons in a control
  file of patterns & minimum/maximum counts.
- example given to find COBOL programs with more than 1
  'PROCEDURE DIVISION' or with any (> 0) 'EXEC SQL's

8M1. splitjclproc1 - split subdir of mixed JCLs & PROCs to separate subdirs
- used to separate emailed zip files of mixed JCLs & PROCs
- JCL conversion requires JCLs & PROCs in separate subdirs
- demos uvcopy ability to read directories & process files

8N1. splitcblcpy1 - split mixed directories of COBOL programs & copybooks
to separate subdirs required by COBOL conversion & compile

8O1. scanjcl4varlth1 - scan all jcl in directory for variable length files
- looks for IDCAMS with different max & avg record-lengths

8P1. grepx1 - extract filenames from grep output, sort,& data reduce
  to 1 line for multiple occurrences in same file
- option to insert 'vi' prior to each filename in output file
- saves typing when you need to investigate & possibly change
- example given for mainframe COBOL conversion
  (may need to change 'accept from date' for unix COBOL)

8Q1. verifytext - scan all files in a subdir & report unprintable characters
- verify COBOL programs, copybooks,& JCL have no bad data

8R1. grepsum1 - a uvcopy utility job that will sort the grep results, dropping
duplicates, to get the desired unique list of EXEC programs.

8S1. scan/replace - Vancouver Utility scan/replace jobs can be more effective
  than grep/sed because you can have qualifiers present/absent
- they create an audit trail to guide subsequent edits

8T1. verifylib1 - verify module types in a library & automatically create a
script to move unexpected types out to a separate library.
- very useful for mainframe conversions

8U1. makecopy1 - make script to copy files from a list of filenames
- could create list with editor of via ls subdir >tmp/script

8V1. xref2copy1 - generate script (to copy files) from a cross-reference report
- powerful technique useful for mainframe conversion POC's
to select subset of JCLs & all required cbls,cpys,parms,procs
- saves many hours of research & much more accurate

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8A1. CNVaids.doc Vancouver Utility Conversion Aids

Pre-Programmed jobs using 'uvcopy'

Vancouver Utilities includes over 500 pre-programmed jobs written in 'uvcopy', which has almost unlimited power to perform whatever kind of data manipulation you may need to perform. Here in CNVaids.doc we will present a few examples & refer you to many other examples thruout the Vancouver Utility documentation.

'uvcopy' is essential for mainframe conversions, because it provides mainframe capabilities on unix/linux systems, that are not possible using the standard unix/linux system utilities, such as:

  1. uvcopy can process packed decimal fields

  2. uvcopy can process data files with fixed length record files and without the 'Line-Feeds' required by most unix/linux system utilities.

  3. uvcopy can process Indexed files, compatible with Micro Focus COBOL

  4. uvcopy can address record fields by column position, similar to many mainframe utilities. Very few unix utilities provide column addressing.

Here in Part_8 of CNVaids.doc, we will illustrate a few of the pre-programmed jobs that might be useful during conversions. For example see tabfix1 at '8B1' for an easy way to convert tabs to blanks. There are many more pre-programmed uvcopy jobs thruout the JCL, COBOL, & DATA conversion manuals.

uvcopy - power of assembler without the complexity

The uvcopy language is based on the IBM 360/ZOS assembler instruction set, which means many mainframers will be familiar with it. Since it is interpretive, it gives you the power of assembly without the complexity. No compile required, easy to modify & rerun.

'uvcopy' provides the capabilities on unix/linux to replace various mainframe utilities such as IDCAMS, IEBGENER, FILEAID, EASYTRIEVE, QUIKJOB, etc.

'uvcopy' allows you to do anything on unix/linux systems that you could do on the mainframe - process packed decimal fields, Indexed files, variable length files, fixed length records without linefeeds, column addressing.

See over 90 uvcopy instructions documented at uvcopy3.htm. See many good examples of pre-programmed jobs at UVjobs1.htm Also see the uvcopy training guide at uvtrain.htm#Part_4.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8B1. Vancouver Utility Pre-Programmed jobs

tabfix1 - convert tabs to blanks (1-8, default 4)

'tabs' sometimes cause problems, for example tabs in COBOL programs cause compile failures. As a 2nd example, sometimes you want to reduce the default expansion of 8 to less (default 4), so you can view/print the file without the text expanding on to multiple screen lines or off the print page.

uvcopy utility job 'tabfix1' is an easy way to convert tabs to a desired number of blanks (4 default). Here is the test file we will use to demo tabfix1 or the alternative jobs (tabfix2 & tabfix3).

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

 # tabtest1 - test file for uvcopy jobs tabfix1,2,3 to replace tabs with blanks
 #          - the tab line (between the === lines) has 1 tab between words
 #          - use 'uvhd' to see the actual value of a tab character x'09'
 # - unix utilities (vi,lp,more,etc) expand tabs to next multiple of 8,
 # - note the word following a tab is on a multiple of 8 (8,16,24,32,40,48)
           1         2         3         4         5
 0123456789012345678901234567890123456789012345678901234
 =======================================================
 a	bb	ccc	dddd	eeeee	ffffff	ggggggg	<-- tab x'09' delimited
 =======================================================

use 'uvhd' to see the tabs x'09'


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

run tabfix1 to expand tabs


 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 expanded instructions below showing you how to specify your files

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8B2. tabfix1 - convert tabs to blanks (1-8, default 4)

tabfix1 - Operating Instructions


 uvcopy tabfix1,fili1=tf/tabtest1,filo1=tmp/tabtest1,uop=t4
 ==========================================================
 - demo default I/O files & options
 - you can run with your I/O files & desired option

 uvcopy tabfix1   <-- may omit fili1,filo1,& uop to run the demo
 ==============     - enter null to accept defaults (as shown above)
      uop=t4   - option defaults
          t4   - replace each tab with 4 blanks (t1-t8 allowed)
      120403:110607:tabfix1: uvcopy ver=20120330 pf=/home/uvadm/pf/util/tabfix1
      uvcopy LNX L64  license=20120330_99V_930630 site=UV_Software
      User OPtion (uop) defaults  = q1t4
      -->null to accept or enter/override -->   <--
      tf/tabtest1 = default fili01 - null accept or reenter ?
      tmp/tabtest1 = default filo01 - null accept or reenter ?
      120403:110609:tabfix1: EOF fili01 rds=14 size=942: tf/tabtest1
      120403:110609:tabfix1: EOF filo01 wrts=14 size=958: tmp/tabtest1

inspect I/O files

Here are suggested commands to inspect the Input/Output files (results omitted since already shown on previous 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 4 blanks

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

process entire directory

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. For example, if you wanted to convert tabs to 3 blanks on all scripts:


 #1. mv scripts scripts.old  <-- rename existing scripts subdir
     ======================
 #2. mkdir scripts           <-- remake subdir for tabfix output
     =============

 #3. uvcopyx tabfix1 scripts.old scripts uop=q0i7t3
     ==============================================
     options 'q0i7' inhibit prompts & reduce console messages

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8B3. tabfix1 - convert tabs to blanks (1-8, default 4)

pf/util/tabfix1 - 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
  1. uvcopy jobs are easily modified (or copied & renamed) if you have other conversions that you would like to perform. For example, if you wanted to convert formfeeds to linefeeds, (replace page skips with blank lines), you would add the following line of code (after existing 'rep' above).


       rep   b0(256),x'0C',x'0A'         replace FF with LF
       =========================
  1. See other tabfix jobs at https://www.uvsoftware.ca/UVjobs1.htm#E2 & E3.

      tabfix2 - inserts blanks so next field at multiple of option t (default t4)
      tabfix3 - inserts blanks to place next field depending on tab rack
  1. The uvcopy code for 'tabfix1' was listed here because it was short. The following pre-programmed jobs in this section are not listed because they are longer. If you have Vancouver Utilities installed, you can inspect any of them. For example to see 'tabfix2' (assuming you are in /home/uvadm).


      vi pf/util/tabfix2
      ==================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8C1. 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/CAR102.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)
 =================
 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 doc End this doc Index this doc Contents this library UVSI Home-Page

8C2. 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 doc End this doc Index this doc Contents this library UVSI Home-Page

8D1. 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 doc End this doc Index this doc Contents this library UVSI Home-Page

8D2. 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 doc End this doc Index this doc Contents this library UVSI Home-Page

8D3. 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 doc End this doc Index this doc Contents this library UVSI Home-Page

8E1. Vancouver Utility Pre-programmed jobs

scand2 - scan directory for patterns & qualifiers

scan2d is very useful when you need to identify files that match multiple criteria. 'grep' is great when you only need to scan for 1 pattern. 'scand2' scans for a primary pattern qualified by 1 or 2 patterns on same line & qualified by 1 or 2 patterns anywhere in the file. Major features are:

scand2 - command format & example

 uvcopy scand2,fild1=indir,arg1=pattern,arg2=LineQual1,arg3=LineQual2,
        ,arg4=FileQual1,arg5=FileQual2,arg7=LineIgnore1,arg8=LineIgnore2
        ,arg9=commentID[,fild2=outdir]
 =====================================================================

For example you might wish to find COBOL copybooks that have the combination of of packed fields & 'occurs depending on', since these require complex data file conversions. Run this demo from the Vancouver Utilities homedir as follows:


 #1. Login uvadm --> /home/uvadm
 #2. mkdir tmp tmp1        <-- make output subdirs if not existing
 #2a. rm -f tmp/* tmp1/*   <-- OR clear if output subdirs already exist
 #3. l mf/cpys/            <-- list input copybooks (if you so desire)

 #4. uvcopy scand2,fild1=mf/cpys,arg1=comp-3,arg4u=depending_on,uop=c1w1
     ===================================================================
     - arg1=comp-3 is primary search pattern (arg2,arg3 Line Qualifiers not reqd)
     - arg4u=depending_on is 1st of 2 File Qualifiers (anywhere in the file)
     - option 'u' of arg4u required when pattern contains blanks
       (blanks coded as underscores & removed when stored for search)

 #5a. vi tmp/cpys_comp-3_counts  <-- inspect summary report
      =========================    - filenames only with match counts
 #5b. vi tmp/cpys_comp-3_counts  <-- inspect detail report
      =========================    - matching line contents
 #5c. l tmp1/     <-- list filenames (copybooks) selected & copied to tmp1/...
      =======       - optional, specified via uop=w1

See report contents listed on the next page --->

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8E2. scand2 - scan all files in directory for patterns & qualifiers

output#1 - filenames & match count summary


 #5a. cat tmp/cpys_comp-3_counts  <-- list summary report
      ==========================    - filenames only with match counts

arg1=comp-3,arg2=pic,,arg4=depending,,,,,,uops=q1c0l3f3w0c1w1 2 matching lines of 20 lines in: mf/cpys/custran3 4 matching lines of 25 lines in: mf/cpys/custran4 2 matching lines of 25 lines in: mf/cpys/custran5 8 total matches on 747 total lines in 34 files

output#2 - matching lines detail


 #5b. cat tmp/cpys_comp-3_counts  <-- list detail report
      ==========================    - matching line contents
 00015             10 cmt-count         pic  s9(3) comp-3.
 00019                15 cmt-tran-amt   pic  s9(7)v99 comp-3 occurs 4.
 00016             10 cmt-trans occurs 0 to 5 depending on cmt-count.
       (last line above = 1st match to File Qualifier arg4)
 2 matching lines of 20 lines in: mf/cpys/custran3
 00015             10 cmt-count1        pic  s9(3) comp-3.
 00016             10 cmt-count2        pic  s9(3) comp-3.
 00020                15 cmt-tran1-amt   pic  s9(7)v99 comp-3 occurs 4.
 00024                15 cmt-tran2-amt   pic  s9(7)v99 comp-3 occurs 4.
 00017             10 cmt-trans1 occurs 0 to 5 depending on cmt-count1.
       (last line above = 1st match to File Qualifier arg4)
 4 matching lines of 25 lines in: mf/cpys/custran4
 00020                15 cmt-tran1-amt   pic  s9(7)v99 comp-3 occurs 4.
 00024                15 cmt-tran2-amt   pic  s9(7)v99 comp-3 occurs 4.
 00017             10 cmt-trans1 occurs 0 to 5 depending on cmt-count1.
       (last line above = 1st match to File Qualifier arg4)
 2 matching lines of 25 lines in: mf/cpys/custran5

8 total matches on 747 total lines in 34 files

output#3 - matching files copied to tmp1/


 #5c. l tmp1/    <-- list filenames(copybooks) selected & copied to tmp1
      =======      - optional, specified via uop=w1
      -rw-rw-r-- 1 uvadm apps  988 Apr  2 14:19 custran3
      -rw-rw-r-- 1 uvadm apps 1261 Apr  2 14:19 custran4
      -rw-rw-r-- 1 uvadm apps 1239 Apr  2 14:19 custran5

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8E3. scand2 - scan all files in directory for patterns & qualifiers

console display & option prompts


 #4. uvcopy scand2,fild1=mf/cpys,arg1=comp-3,arg4u=depending_on,uop=c1w1
     ===================================================================
     - arg1=comp-3 is primary search pattern (arg2,arg3 Line Qualifiers not reqd)
     - arg4u=depending_on is 1st of 2 File Qualifiers (anywhere in the file)
     - option 'u' of arg4u required when pattern contains blanks
       (blanks coded as underscores & removed when stored for search)
     - ',uop=c1w1' options on command line could be specified at prompt below:
       (note option descriptions before prompt for entry (or override)
 uop=q1c0l3f3w0 - option defaults
       c0       - default not COBOL (do not use "*" col 7 as comment ID)
       c1       - COBOL option for comment ID "*" column 7
         l3     - default Line qualifier & 2 Present (if specified)
         l1     - Line qual1 Present(if spcfd), Line qual2 Absent(if spcfd)
         l2     - Line qual1 Absent(if spcfd), Line qual2 Present(if spcfd)
         l0     - Line qual1 & 2 Absent (if spcfd)
           f3   - default File qualifier & 2 Present (if specified)
           f1   - File qual1 Present(if spcfd), File qual2 Absent(if spcfd)
           f2   - File qual1 Absent(if spcfd), File qual2 Present(if spcfd)
           f0   - File qual1 & 2 Absent (if spcfd)
             w1 - Write matching files to output subdir (default tmp1/...)
 User OPtion (uop) defaults  = q1c0l3f3w0c1w1
 -->null to accept or enter/override -->      <-- enter/override options
 enter arg3 Line qualifier2, null to inhibit
 enter arg5 File qualifier2, null to inhibit
 enter arg6 comment pattern: " #"(default)," *","/*",etc
 120402:141944:scand2: EOF fili01 rds=8 size=355: mf/cpys/acntmas
 120402:141944:scand2: EOF fili01 rds=15 size=877: mf/cpys/citytax1
 120402:141944:scand2: EOF fili01 rds=36 size=1789: mf/cpys/citytax2
 120402:141944:scand2: EOF fili01 rds=15 size=692: mf/cpys/cust1
 120402:141944:scand2: EOF fili01 rds=15 size=700: mf/cpys/custmas
               ----- 27 lines omitted -----
 120402:141944:scand2: EOF fili01 rds=21 size=941: mf/cpys/vendorpaymasx
 120402:141944:scand2: EOF fili01 size=4096: mf/cpys/warmas
 120402:141944:scand2: EOF fili03 rds=34 size=300: tmp/cpys_files
 120402:141944:scand2: EOF fild01 size=4096: mf/cpys
 120402:141944:scand2: EOF fild02 size=4096: tmp1
 120402:141944:scand2: EOF filo01 wrts=5 size=280: tmp/cpys_comp-3_counts
 120402:141944:scand2: EOF filo02 wrts=18 size=1122: tmp/cpys_comp-3_detail
 enter y/n display matching COUNTS searching for comp-3 in mf/cpys
 enter y/n display matching COUNTS searching for comp-3 in mf/cpys

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8E4. scand2 - scan all files in directory for patterns & qualifiers

example#2 - scan JCL for INCLUDE on SORTs

As a 2nd example, we might want to scan MVS JCL (to be converted) to see if there are any 'INCLUDE's on SORT steps.


 uvcopy scand2,fild1=mvstest/testlibs/jcl0,arg1=INCLUDE,arg4=SORT,arg9=//*,uop=w1
 ================================================================================

output#1 tmp/jcl0_INCLUDE_counts

arg1=INCLUDE,,,arg4=SORT,,,arg7=JOB,,arg9=//*,uop=q1c0l3f3w0w1 3 matching lines of 24 lines in: mvstest/testlibs/jcl0/SPLITSL1 2 matching lines of 16 lines in: mvstest/testlibs/jcl0/SPLITSL2 5 total matches on 860 total lines in 66 files

output#2 tmp/jcl0_INCLUDE_detail

 00019  OUTFIL FILES=1,INCLUDE=(31,6,CH,EQ,C'HAM001',OR,31,6,CH,EQ,C'HAX129',
 00021  OUTFIL FILES=2,INCLUDE=(31,6,CH,EQ,C'CHR001',OR,31,6,CH,EQ,C'TAB013',
 00023  OUTFIL FILES=3,INCLUDE=(3,2,BI,GT,5,2,BI,OR,1,2,BI,EQ,5,2,BI)
 00002  //SPLITSL1 EXEC PGM=SORT
       (last line above = 1st match to File Qualifier arg4)
 3 matching lines of 24 lines in: mvstest/testlibs/jcl0/SPLITSL1
 00014  OUTFIL FILES=(01),INCLUDE=ALL
 00015  OUTFIL FILES=(02),INCLUDE=ALL
 00002  //SPLITSL2 EXEC PGM=SORT
       (last line above = 1st match to File Qualifier arg4)
 2 matching lines of 16 lines in: mvstest/testlibs/jcl0/SPLITSL2

5 total matches on 860 total lines in 66 files

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8F1. uvcopy Pre-Programmed jobs for Data Files

scan3d - select lines between 2 patterns qualified by 3rd

'scan3d' is a pre-programmed job to scan a directory of text files aand create a report including the text lines between any 2 specified patterns, optionally qualified by a 3rd pattern which must be or must not be found between the lines containing the 1st 2 patterns.

For example, you might wish to check the JCL conversion of SORT steps. scan3d can select all SORT/uvsort steps from all JCL/scripts using the demo JCL/scripts provided in /home/uvadm/mvstest/testlibs/jcl3/...

We know all converted JCL/script steps start with '#1===', end with '#4---', and that SORT steps would have PGM=SORT in between.


 #1============= begin step     <-- all converted steps start like this
 ----- step init ------
 # EXEC PGM=SORT                <-- mainframe EXEC shown as #comment
 ----- converted code -----
 #4============= begin step     <-- all converted steps end like this

 #1. Login uvadm
 #2. cd mvstest/testlibs

 #3. uvcopy "scan3d,fild1=jcl3,filo1=tmp/sorts,arg1=#1===,arg2=#4---,arg3==SORT"
     ===========================================================================
     - fild1=input_subdir, filo1=report, arg1=start, arg2=end, arg3=qualifier
     - note 'arg3==' 2nd '=' could be '!' for not present

 #3a. uvcopy scan3d    <-- can omit args & will be prompted
      =============

 #3b. uvcopy "scan3d,fild1=jcl3,arg1=#1===,arg2=#4---,arg3==SORT"
      ===========================================================
      - omitting output report defaults to filo1=tmp/$fild1_arg1pattern

See output report on next page:

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

H2. scan3d - select lines between 2 patterns qualified by 3rd

scan3d - sample report


 Job=scan3d   scan files in Dir: jcl3
 Selecting From: "#1==="  To: "#4---"  Qualified By: "=SORT"
 ====================================================== 2012/05/18_17:42:46
 00015 #1======================= begin step#S0010 SORT ========================
 00021 ##STEP010  EXEC PGM=SORT,REGION=2048K
 00024 exportfile  SORTIN data/ar.sales.items
 00025 exportfile  SORTOUT data/ar.sales.items.sorted append
 00026 exportfile SYSIN $JTMP/${JSTEP}_${PROGID}_SYSIN
 00027 cat > $SYSIN <</*
 00028 SORT FIELDS=(31,6,CH,A,1,6,CH,A)
 00029 OMIT COND=((11,2,CH,EQ,C'65'),OR,(COND=(11,2,CH,EQ,C'85'))
 00030 /*
 00031 logmsg2 "Executing--> uvsort \"fili1=$SORTIN,typ=RSF,rcs=64,filo1=$SORTO..."
 00032 #3----------------------------------------------------------------------
 00033 uvsort "fili1=$SORTIN,typ=RSF,rcs=64,filo1=$SORTOUT,typ=RSFa,rcs=64\
 00034 ,keys=(30,6,c,a,0,6,c,a),del1=10(2c):65,del1=10(2c):85"
 00035 #4----------------------------------------------------------------------
 00075                      21 selected from    75 @EOF: jcl3/jar205.ksh
 00014 #1======================= begin step#S0010 SORT ========================
 00020 ##STEP010  EXEC PGM=SORT,REGION=2048K
 00023 exportfile  SORTIN data/ar.sales.items
 00024 exportfile  SORTOUT $JTMP/__tempsls
 00025 exportfile  PARM200S $RUNLIBS/parms/parm200s
 00026 exportfile SYSIN $JTMP/${JSTEP}_${PROGID}_SYSIN
 00027 cat > $SYSIN <</*
 00028 SORT FIELDS=(31,6,CH,A,1,6,CH,A)
 00029 OMIT COND=((11,2,CH,EQ,C'65'),OR,(COND=(11,2,CH,EQ,C'85'))
 00030 /*
 00031 logmsg2 "Executing--> uvsort \"fili1=$SORTIN,typ=RSF,rcs=64,filo1=$SORTO..."
 00032 #3----------------------------------------------------------------------
 00033 uvsort "fili1=$SORTIN,typ=RSF,rcs=64,filo1=$SORTOUT,typ=RSF,rcs=64\
 00034 ,keys=(30,6,c,a,0,6,c,a),del1=10(2c):65,del1=10(2c):85"
 00035 #4----------------------------------------------------------------------
 00075                      22 selected from    75 @EOF: jcl3/jar200.ksh
 ====================================================== 2012/05/18_17:42:47
  EOD: 00321 selects in 0013 files of 0066 total (04212 lines)

Notes re sample scan3d report

  1. Only 2 of the 13 SORT step selections are shown above

  2. This report useful for checking SORT to uvsort conversions, especially conversions of 'OMIT CONDitions' (as shown above to del1=...), and others such as INCLUDEs, etc.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8I1. uvcopy 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 doc End this doc Index this doc Contents this library UVSI Home-Page

8I2. uvcopy 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 -->
 field length uop=b1-b15 must be specified, job cancelled

sample report from acum1

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

See the 'acum1' uvcopy job listed at UVjobs1.htm#T3

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8J1. uvcopy 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

See the 'cmrpt1' uvcopy job listed at UVjobs1.htm#U2

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8K1. uvcopy 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 doc End this doc Index this doc Contents this library UVSI Home-Page

8K2. 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

See the 'selectf1' uvcopy job listed at UVjobs1.htm#V3

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8L1. uvcopy Pre-Programmed jobs

scan5d - search directory for exception files

'scan5d' is a pre-programmed uvcopy job that will scan all files in a directory, searching for exception files. You specify the exception conditons in a control file of patterns & min/max pattern counts.

For our example, we will scan a directory of COBOL programs, searching for patterns & counts that will identify what we consider to be exceptions. We expect most programs to have 1 'IDENTIFICATION DIVISION', 1 'PROCEDURE DIVISION', etc. More than 1 of these would indicate 1 file with multiple programs, which is very unusual & would be problem for out COBOL conversions.

We will also specify as 'LINKAGE SECTION' & 'EXEC SQL' as exceptions, by sepcifying 0 for min/max counts.

The default options report only the exception files, but we have specified user option 'a1' to report all files, since our directory contained only 14 programs. Without option 'a1' we would report only 3 programs as indicated by the '*' in the report below:

sample exception report

 Job: scan5d  Dir: cbl0  Table: ctl/cobolxcptn.tbl
 Date: 2009/11/04_12:56:54  Uops: q1a0c0a1c2
 ======================================= min41-48  max51-58
  identification division~~~~~~~~~~~~~~~~00000001~~00000001~~~~~~~~~~~~~~~~~~~~~~
  input-output section~~~~~~~~~~~~~~~~~~~00000001~~00000001~~~~~~~~~~~~~~~~~~~~~~
  working-storage section~~~~~~~~~~~~~~~~00000001~~00000001~~~~~~~~~~~~~~~~~~~~~~
  procedure division~~~~~~~~~~~~~~~~~~~~~00000001~~00000001~~~~~~~~~~~~~~~~~~~~~~
  linkage section~~~~~~~~~~~~~~~~~~~~~~~~00000000~~00000000~~~~~~~~~~~~~~~~~~~~~~
  exec sql~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~00000000~~00000000~~~~~~~~~~~~~~~~~~~~~~
 ================================================================================
 0001 0030   CAR101.cbl                  1,1,1,1,0,0,
 0002 0062 * sqlora2.cbl                 1,1,1,1,0,9,
 0003 0019   CAR300.cbl                  1,1,1,1,0,0,
 0004 0045   CAR150.cbl                  1,1,1,1,0,0,
 0005 0045   CAR130.cbl                  1,1,1,1,0,0,
 0006 0063 * sqlora1.cbl                 1,1,1,1,0,8,
 0007 0052   TESTUNIX1.cbl               1,1,1,1,0,0,
 0008 0046   CGL100.cbl                  1,1,1,1,0,0,
 0009 0041   CAR100.cbl                  1,1,1,1,0,0,
 0010 0047 * CAR120.cbl                  1,1,1,1,1,0,
 0011 0045   CAR140.cbl                  1,1,1,1,0,0,
 0012 0052   CAR200.cbl                  1,1,1,1,0,0,
 0013 0052   CGL200.cbl                  1,1,1,1,0,0,
 0014 0037   CPY100.cbl                  1,1,1,1,0,0,
 ================================================================================
 Total files=14, Lines=636, Counts=14,14,14,14,1,17,

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8L2. scan5d - search directory for exception files

Op. Instrns. for scan5d

Here is how we created the exception file that was read by 'scan5d' to create the COBOL exception report shown above.

We used the demo COBOL programs supplied in /home/uvadm/mvstest/testlibs/cbl0/. We setup userid 'mvstest' as documented in JCLcnv1demo.htm or MVSCOBOL.htm, & copied testlibs/* over there. You could copy testlibs/* to your homedir.


 #1. Login mvstest (or yourself if you copied testlibs/* to your homedir)

 #2. cdl --> $TESTLIBS  (alias cdl='cd $TESTLIBS')

 #3. vi ctl/cobolxcptn.tbl     <-- create exception control file
     =====================
 # cobolxcptn.tbl - sample search table for uvcopy job 'scan5d'
 # - scan COBOL programs for exceptions <> expected pattern counts
 # - report programs with < 1 or > 1 of each of following DIVISIONs & SECTIONs
 # - report programs with any LINKAGE section or any 'EXEC SQL's
 #   --- pattern col 01-40 ---           min41-48  max51-58
  identification division~~~~~~~~~~~~~~~~00000001~~00000001~~~~~~~~~~~~~~~~~~~~~~
  input-output section~~~~~~~~~~~~~~~~~~~00000001~~00000001~~~~~~~~~~~~~~~~~~~~~~
  working-storage section~~~~~~~~~~~~~~~~00000001~~00000001~~~~~~~~~~~~~~~~~~~~~~
  procedure division~~~~~~~~~~~~~~~~~~~~~00000001~~00000001~~~~~~~~~~~~~~~~~~~~~~
  linkage section~~~~~~~~~~~~~~~~~~~~~~~~00000000~~00000000~~~~~~~~~~~~~~~~~~~~~~
  exec sql~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~00000000~~00000000~~~~~~~~~~~~~~~~~~~~~~
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note
  • the '#' comment lines are of course optional
  • It is a good idea to code the name of the file & a brief description

 #4. uvcopy scan5d,fild1=cbl0,fili2=ctl/cobolxcptn.tbl,filo3=tmp/cbl0.rpt
     ====================================================================
     - create COBOL exception report (shown on prior page)

 #5a. vi tmp/cbl0.rpt        <-- view exception report
      ===============

 #5b. uvlp12 tmp/cbl0.rpt    <-- print exception report
      ===================      - see listing on prior page

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8L3. scan5d - search directory for exception files

scan JCL for certain programs

Another example might be to analyze JCLs to determine if certain programs are being executed. I used the following table on the mvstest demo JCLs:


 #3. vi ctl/JCLxcptn.tbl     <-- create control file to analyze JCL
     ===================         for desired program EXECutions
 # JCLxcptn.tbl - determine frequency of following program executions in JCLs
 #   --- pattern col 01-40 ---           min41-48  max51-58
  EXEC PGM=IKJEFT01~~~~~~~~~~~~~~~~~~~~~~00000000  00000000
  EXEC PGM=FTP~~~~~~~~~~~~~~~~~~~~~~~~~~~00000000  00000000
  EXEC PGM=MAIL~~~~~~~~~~~~~~~~~~~~~~~~~~00000000  00000000
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 #4. uvcopy scan5d,fild1=jcl0,fili2=ctl/JCLxcptn.tbl,filo3=tmp/jcl0.rpt
     ====================================================================

 #5. cat tmp/JCLxcptn.tbl    <-- display report
     ====================
 Job: scan5d  Dir: jcl0  Table: ctl/JCLxcptn.tbl
 Date: 2009/11/03_05:38:36  Uops: q1a0c0
 ======================================= min41-48  max51-58
  EXEC PGM=IKJEFT01~~~~~~~~~~~~~~~~~~~~~~00000000  00000000
  EXEC PGM=FTP~~~~~~~~~~~~~~~~~~~~~~~~~~~00000000  00000000
  EXEC PGM=MAIL~~~~~~~~~~~~~~~~~~~~~~~~~~00000000  00000000
 ================================================================================
 0015 0007 * IKJEFT01.jcl                1,0,0,
 0023 0013 * FTPGET1.jcl                 0,1,0,
 0026 0011 * FTPDEMO1.jcl                0,1,0,
 0031 0007 * MAILDEMO.jcl                0,0,1,
 0032 0010 * FTPDEMO2.jcl                0,1,0,
 0040 0009 * FTPPUT1.jcl                 0,1,0,
 ================================================================================
 Total files=54, Lines=691, Counts=1,4,1,

Try it yourself

Create your own exception table to analyze whatver problem you can think of. Using the pre-programmed jobs is easy, all you have to do is edit a simple text file. The programming job has been done for you.

In case you wish to see the coding for the 'scan5d' pre-programmed job, it is listed on the following pages. This is 1 the more powerful & complex examples and do not let it scare you. uvcopy is in fact easy to learn if you start with the simpler exercises at https://www.uvsoftware.ca/uvtrain.htm#Part_4.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8M1. uvcopy pre-programmed jobs to aid JCL conversions

splitjclproc1 - split mixed JCLs & PROCs to separate subdirs

The mainframe JCL conversion requires JCLs & PROCs in separate subdirs. If they were in the same library, you can use this job to separate.


 uvcopy splitjclproc1,fili1=jclproc0/xxx,filo2=jcl0/xxx,fild3=proc0
 ==================================================================
 - 1 file at a time

 uvcopyxd3 splitjclproc1 jclproc0 jcl0 proc0 uop=q0i7
 ====================================================
 - use script uvcopyxd3 to process all files in directory

procedure & logic

  1. Store input files in subdir jclproc0/...

  2. This job will copy jclproc0/... files to jcl0 searching for ' PROC ' on // but not //* line

  3. If found, write reaminder of the file to the 3rd directory using the NAME from //NAME PROC ... line

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8N1. uvcopy pre-programmed jobs to aid JCL conversions

splitcblcpy1 - split mixed COBOL programs & copybooks

The mainframe COBOL conversion requires COBOL programs & COBOL copybooks in separate subdirs. If they were in the same library, you can use this job to separate. It leaves any other unrecognized modules in the input subdir.


 uvcopy splitcblcpy1,fild1=indir,fild2=cbls,fild3=cpys
 =====================================================

Logic

  1. Reads indir of mixed cbls/cpys to get next filename & opens current file

  2. For each file, scan for 'IDENTIFICATION DIVISION' or ' PIC '

  3. Creates 'mv' to move file to cbl/ or cpy/ subdir & executes via 'sys' cmd

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8O1. uvcopy pre-programmed jobs to aid JCL conversions

scanjcl4varlth1 - scan JCL for variable length files

For mainframe data file conversions, we need different procedures to convert VARIABLE length files (vs FIXED length files). This job will scan all mainframe JCL for IDCAMS with different average & maximum record-lengths.


 uvcopy scanjcl4varlth1,fild1=jcldir,filo2=outfile           <-- command format
 =================================================

 uvcopy scanjcl4varlth1,fild1=jcl0,filo2=stats/jclvarlth.rpt <-- example
 ===========================================================

sample report

 ahb09.jcl3
    DEFINE CLUSTER (NAME(AHB.INT.CCONS)           -
           RECSZ(24,536))                         -
 ahbm31.ahbm
    DEFINE CLUSTER (NAME(CDR.RESUMEN.AHB)         -
           RECSZ(250,536))                        -
 ahbm31.ahbm
    DEFINE CLUSTER (NAME(AHB.INT.CCONS.TMETA)     -
           RECSZ(24,536))                         -
 ahod03.ahod
    DEFINE CLUSTER(NAME(ARCHIVO.SUCURSAL.SAFX)    -
           RECSZ(40,1530))                        -
           KEYS (03,0)                            -
 ahod12.ahod
    DEFINE CLUSTER (NAME(SAF.MAESTRO.AHORROS)          -
           RECSZ(149,2129))                            -
           KEYS(6,2)                                   -
 ahod12.ahod
    DEFINE CLUSTER (NAME(SAF.MAESTRO.AHORROS.S21)      -
           RECSZ(149,2129))                            -
           KEYS(6,2)                                   -

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8P1. uvcopy pre-programmed jobs to aid JCL conversions

grepx1 - extract filenames from grep output

'grepx1' will extract filenames from grep output, sort,& data reduce to 1 line for multiple occurrences in the same file. There is an option to insert 'vi' prior to each filename in output file, OR use the editor to insert the desired command (vi, cp, mv, rm, etc)

Example
    ACCEPT RUN-DATE FROM DATE.      <-- mainframe code
    MOVE RUNDATE-MDY6 TO RUN-DATE.  <-- may need to change some to this

 1. grep 'from date' cbls/* >tmp/grepx1a
    ====================================
    - select lines from all files containing 'from date', output as follows:
    cbls/car100.cbl:38:        accept run-date from date.
    cbls/car150.cbl:44:        accept run-date from date.
    cbls/cpy100.cbl:35:        accept run-date from date.

 2. uvcopy grepx1,fili1=tmp/grepx1a,filo1=tmp/grepx1b,uop=c1d1
    ==========================================================
    - run this job to insert 'vi' prior to each filename & clear remainder
    - output as follows:

vi cbls/car100.cbl vi cbls/car150.cbl vi cbls/cpy100.cbl


 3. vi tmp/grepx1b   <-- could edit to modify (for commands other than 'vi')
    ==============

 4. ksh tmp/grepx1b  <-- OR execute the output script of 'vi' comamnds
    ===============    - may inspect each file in turn & modify if required
 4a. /from date      <-- search for 'from date' in current file
 4b.  ......           - might need to modify (see Example above)
 4c. :wq               - write & quit (script proceeeds to next 'vi file'

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8Q1. CNVaids: Vancouver Utility Aids

verifytext - scan files in subdir for binary data

'verifytext' is a uvcopy job that will scan all files in a directory, searching for unprintable characters that should not be in text files, such as COBOL programs, copybooks,& JCL.

If any binary data found, it will be reported as shown below, in vertical hexadecimal, similar to the 'uvhd' utility (documented on page '2D1').

verifytext - sample report

verifytext
  • scan for binary data, all files in cbl0 - tmp/cbl0_vfy.txt
 line# - binary data in file: cbl0/HPH2937B.CBL
                1         2         3         4         5         6         7
       123456789012345678901234567890123456789012345678901234567890123456789012
 00211 J90614       VALUE '!....L........TRAY1J  '.
       43333322222225445422200014BF00000055453422222222222222222222222222222222
       A90614000000061C550710000CF600000342191A007E0000000000000000000000000000
 00215 J90614       VALUE '.*I...COVTOPLINE1lllllllllllllllllllllllllllllllllll
       4333332222222544542202401F4455454444366666666666666666666666666666666666
       A90614000000061C55070A90AB3F64F0C9E51CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

EOF: binary data in 1 of 8 total files in cbl0

verifytext - Operating Instructions


 uvcopy verifytext,fild1=cbl0[,filo1=tmp/cbl0_vfy.txt]  <-- example
 =====================================================
 - read all files in subdir 'cbl0' & create output report file
 - in 'tmp' subdir, named same as input subdir + '_vfy.txt'

 uvcopy verifytext,fild1=cbl0    <-- only need to specify the input directory
 ============================      - output file defaults as shown above

 uvlp12 tmp/cbl0_vfy.txt                    <-- print report
 =======================

See 'verifytext' at /home/uvadm/pf/IBM/verifytext

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8R1. CNVaids: Vancouver Utility Aids

grepsum1 - summarize grep search results

Page '1N1' gave an example of using 'grep' to create a list of all EXEC programs used in the JCL directory. The results were NOT very good if our objective was to create a concise list of unique program names.

'grepsum1' is a uvcopy utility job that will sort the grep results, dropping duplicates, to get the desired unique list of EXEC programs.

example - grep for EXEC & drop duplicates from result


 1. grep EXEC jcl1/* >tmp/grepx
    ===========================

 2a. uvcopy grepsum1,fili1=tmp/grepx,filo1=tmp/grepx1
     ================================================
 uop=a0b80c0d0e0f2j1 - option defaults
     a0              - dsplcmnt to begin sort/sum key
       b80           - length of sort key
          c0         - begin sort key word#
            d0       - end sort key word# (disabled if d0)
            d1       - end sort key word#1 (overrides a/b dsplcmnt/lth)
            d1       - end sort key word#1 (overrides a/b dsplcmnt/lth)
              e1     - consider "," comma same as blank for word delimiter
                f1   - number of :colons in grep filenames prior to text
                f2   - scan past 2 :s for text (use if -n option on grep)
                  j1 - drop comments in JCL "//*" in cols 1-3
                  j2 - drop comments in COBOL "*" in col 7
 User OPtion (uop) defaults  = q1a0b80c0d0e0f2j1
  null to accept or re-specify (1 or more) ----->  <-- default options
 060326:085105:grepsum1: EOF fili01 rds=15 size=817: tmp2/grepx
 060326:085105:grepsum1: EOF filo01 wrts=10 size=351: tmp2/grepx3

results AFTER default options a0b80c0d0e0f2j1

 jcl1/jar100.jcl:3:(2) //STEP010 EXEC PGM=CAR100
 jcl1/jar120.jcl:3:(1) //STEP010 EXEC PGM=CAR120,PARM=2002
 jcl1/jar130.jcl:5:(1) //STEP010 EXEC PGM=CAR120,PARM=2003
 jcl1/jar150.jcl:5:(1) //STEP010 EXEC PGM=CAR150
 jcl1/jgl300.jcl:5:(3) //STEP010 EXEC PGM=IEBGENER
 jcl1/jar200.jcl:12:(1) //STEP020 EXEC PGM=CAR100,COND=(4,LT,STEP010),PARM=2003
 jcl1/jar140.jcl:5:(1) //STEP020 EXEC PGM=CAR120,PARM=2004
 jcl1/jar155.jcl:4:(1) //STEP020 EXEC PGM=CAR150
 jcl1/jgl300.jcl:9:(2) //STEP020 EXEC PGM=IDCAMS,COND=(4,LT,STEP010)
 jcl1/jgl330.jcl:10:(1) //STEP020 EXEC PGM=IDCAMS,COND=(8,LT,STEP010)
 The default options 'a0b80' set the sort/compare field to the entire record
 - displacement 0 & length 80
 - duplicates are removed only if they have the same STEP# & PARMs
 Also note that option 'j1' (default) has dropped the //* comment:
 jcl1/jar200.jcl:20:(1) //*STEP030 EXEC PGM=SORT

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8R2. CNVaids: Vancouver Utility Aids

modify grepsum1 options to improve results

We will now use the 'word count' options to improve our results. On the grepsum1 command below, we specify options 'c0d3e1' which specifies the sort field as starting at word 0 (begin line) & ending after word 3.

Option 'e1' means that ',' commas are considered same as blanks for delimiting words, so the 1st 3 words will be STEP#, EXEC,& PGM=... Note the word#s are zero relative.


 2b. uvcopy grepsum1,fili1=tmp/grepx,filo1=tmp/grepx2,uop=c0d3e1
     ===========================================================

results AFTER options a0b0c0d3e1f2j1 + c0d3e1

 jcl1/jar100.jcl:3:(2) //STEP010 EXEC PGM=CAR100
 jcl1/jar120.jcl:3:(2) //STEP010 EXEC PGM=CAR120,PARM=2002
 jcl1/jar150.jcl:5:(1) //STEP010 EXEC PGM=CAR150
 jcl1/jgl300.jcl:5:(3) //STEP010 EXEC PGM=IEBGENER
 jcl1/jar200.jcl:12:(1) //STEP020 EXEC PGM=CAR100,COND=(4,LT,STEP010),PARM=2003
 jcl1/jar140.jcl:5:(1) //STEP020 EXEC PGM=CAR120,PARM=2004
 jcl1/jar155.jcl:4:(1) //STEP020 EXEC PGM=CAR150
 jcl1/jgl300.jcl:9:(3) //STEP020 EXEC PGM=IDCAMS,COND=(4,LT,STEP010)

Some duplicates have been removed by sorting/comparing on 1st 3 words, but we still have duplicates caused by differing STEP#s (1st word)

Our next test will specify options 'c2d3' which means start compare after word#2 & end after word#3, which selects only the PGM=..., since option 'e1' considers the ',' to end word3 as well as a blank.


 2c. uvcopy grepsum1,fili1=tmp/grepx,filo1=tmp/grepx2,uop=c2d3e1
     ===========================================================

results AFTER options a0b0c0d3e1f2j1 + c2d3e1

 jcl1/jar100.jcl:3:(2) //STEP010 EXEC PGM=CAR100
 jcl1/jar200.jcl:12:(1) //STEP020 EXEC PGM=CAR100,COND=(4,LT,STEP010),PARM=2003
 jcl1/jar120.jcl:3:(3) //STEP010 EXEC PGM=CAR120,PARM=2002
 jcl1/jar150.jcl:5:(2) //STEP010 EXEC PGM=CAR150
 jcl1/jgl300.jcl:9:(3) //STEP020 EXEC PGM=IDCAMS,COND=(4,LT,STEP010)
 jcl1/jgl300.jcl:5:(3) //STEP010 EXEC PGM=IEBGENER

We now have the desired concise list of unique programs EXECuted in all our JCLs. You will see only the 1st occurrence of filename, STEP# and PARM data (if any).

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8S1. CNVaids: Vancouver Utility Aids

scan/replace jobs more powerful than grep & sed

Vancouver Utilities provides several general purpose 'scan/replace' utilities that can be more effective than 'grep' & 'sed' in complex situations because:

  1. The search pattern can be qualified with 1 or 2 other patterns that must or must not be present on the same line.

  2. Table driven scan jobs provide unlimited no of search & qualifier patterns

  3. These scan jobs create a much more informative report, with page headings to document the search & qualifier patterns, directory scanned, date, etc - matching lines reported with line# - End-Of-File total hits & total lines for each file with at least 1 hit - End-Of-Directory total hits & total lines

  4. Some of these scan jobs allow for patterns on 1 line qualified by patterns on other lines, preceding or following.

  5. Most of these jobs show matched data lines with their line numbers, which are useful for subsequent edit sessions.

  6. The scan reports are handy for assigning work to other programmers. Scan for patterns & qualifiers that represent a problem & the report can be used as a check list during editing & to make notes about problem situations.

    sample problem for scan1d

Suppose we wanted to scan a directory of mainframe JCL for all 'EXEC's with CONDition codes. Here are a few lines (of thousands):

 //JOBA     JOB
 .......... most lines not shown ..........
 //STEP020  EXEC PGM=IDCAMS,COND=(4,LT,STEP010)
 //JOBB     JOB
 .......... most lines not shown ..........
 //STEP050  EXEC PGM=CGL100,COND=(4,LT),REGION=1024K,PARM=$PARM1

Operating Instructions


 uvcopy scan1d,fild1=jcl0,arg1=EXEC,arg2=PGM,arg3=COND,uop=p2
 ============================================================
 - could enter all info on the command line as above

 uvcopy scan1d,fild1=jcl0,uop=p2
 ===============================
 - OR you will be prompted for info not on the command line
 - see next page for console display prompts & entries

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8S2. CNVaids: Vancouver Utility Aids


 uvcopy scan1d,fild1=jcl0,uop=p2
 ===============================
 uop=q1a1b99999c0d256e0p1 - option defaults
       a1                 - begin scan at line #1 (default) of input file
       a0                 - causes prompt for search pattern to BEGIN scan
         b99999           - end scan at line #99999 (dflt) of input file
         b0               - causes prompt for search pattern to END scan
               c0         - begin scan at col #1 (zero rel) of input lines
                 d256     - length of scan area default 256 bytes
                     e1   - inhibit errmsgs when LF not found within rcsz
                       p1 - 1 present qual(31-60) & 1 absent qual(61-80)
                       p2 - 2 present quals(31-60+61-80) & NO absent quals
                       p4 - 2 absent quals(31-60+61-80) & NO present quals
 User OPtion (uop) defaults  = q1a1b99999c0d256e0p1
  null to accept or re-specify (1 or more) --> p2   <-- enter p2 2 present Quals
 enter search pattern (max 64) --------------> EXEC <-- enter search pattern
 enter 1st qualifier           --------------> PGM  <-- enter 1st qual
 enter 2nd qualifier           --------------> COND <-- entire 2nd qual
 enter options: i,p,q1/q2/q3,n,or null ----->
 080109:205346:scan1d: EOF filo01 wrts=47 size=2172: tmp/jcl0_EXEC hits=14
 EOJ, Output File written to: tmp/jcl0_EXEC
 enter command: vi,cat,more,lp,uvlp12,null -->

sample report

 Job: scan1d  Dir: jcl0  Search: EXEC  Qual1: PGM  Qual2: COND
  SearchBgn:    SearchEnd:    MatchOps:   UserOps: q1a1b99999c0d256e0p1p2
 ====================================================== 2008/01/09_20:53:46
 00005 //STEP020  EXEC PGM=CGL200,COND=(4,LT,STEP010),PARM=&YEAREND
 00010                   1 hits @EOF: jcl0/JGL220.jcl
 00011 //STEP020  EXEC PGM=IDCAMS,COND=(4,LT,STEP010)
 00018                   1 hits @EOF: jcl0/JGL320.jcl
 00012 //STEP020  EXEC PGM=CAR200,COND=(4,LT,STEP010),PARM=2006
 00017                   1 hits @EOF: jcl0/JAR200.jcl
 00006 //STEP020  EXEC PGM=IDCAMS,COND=(4,LT,STEP010)
 00011                   1 hits @EOF: jcl0/JPY402.jcl
 ====================================================== 2008/01/09_20:53:46
  EOD: 00014 hits in 0014 files of 0046 total (00576 lines)

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8T1. CNVaids: Vancouver Utility Aids

verifylib1 - verify module types in a library

'verifylib1' is a utility job to verify module types in a library & automatically create a script of 'mv's to move unexpected types out to a separate library.

Example
  • given library cpy0/... COBOL copybook library from the mainframe
    for conversion on unix/linux
  • all modules expected to be copybooks, but many years of updates
    on the mainframe have added various modules otehr than copybooks
  • following will create script to move any non-copybooks to tmp1/...

 1. uvcopy verifylib1,fild1=cpy0,fild2=tmp1,filo3=sf/cpy0_mv,filo4=sf/cpy0_more,arg1=cpy
    ====================================================================================
    - create script to move non .cpy files to tmp1/...
    - arg1 identifies expected type (must be 1 of cpy, cbl, jcl, asm)
    - also creates 2nd script with 'more's to easily inspect files to be moved

 2. vi sf/cpy0_more    <-- inspect files selected for mv
    ===============      - you only see filenames, execute  3 to see contents
    more cpy0/aaaaaa.cpy
    more cpy0/bbbbbb.cpy
    more cpy0/cccccc.cpy

 3. ksh sf/cpy0_more   <-- execute the _more script
    ================

 4. vi sf/cpy0_mv      <-- inspect created mv script
    =============
    mv cpy0/aaaaaa.cpy tmp1/aaaaaa.cbl
    mv cpy0/bbbbbb.cpy tmp1/bbbbbb.jcl
    mv cpy0/cccccc.cpy tmp1/cccccc.asm

 5. ksh sf/cpy0_mv     <-- EXECUTE the _mv script
    ==============       - moves non matching type modules to tmp1/...

See generated scripts on the next page -->

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8T2. verifylib1 - verify module types in a library

sample output _mv script

   sf/cpy0_mv - move out mismatched file types  2012/05/18 12:05:40
 mv cpy0/A2110201.CPY tmp1/A2110201.cbl
 mv cpy0/A21GEM3.CPY tmp1/A21GEM3.asm
 mv cpy0/A7304017.CPY tmp1/A7304017.jcl
 mv cpy0/ACCOPCT.CPY tmp1/ACCOPCT.other
 mv cpy0/ACMD.CPY tmp1/ACMD.jcl
 mv cpy0/AMSBS040.CPY tmp1/AMSBS040.cbl
     - - - many lines removed - - -
 mv cpy0/XTRANTWA.CPY tmp1/XTRANTWA.jcl
  EOF: 7774 files, 41 cbl, 4458 cpy, 1194 cpy(non pic)
       53 jcl, 3 asm, 1739 other

sample output _more script

   sf/cpy0_more - inspect mismatched file types  2012/05/18 12:05:40
 more cpy0/A2110201.CPY   <-- actually .cbl  (see above)
 more cpy0/A21GEM3.CPY    <-- actually .asm
 more cpy0/A7304017.CPY   <-- actually .jcl
 more cpy0/ACCOPCT.CPY    <-- actually .other
 more cpy0/ACMD.CPY           etc (see above)
 more cpy0/ACRWRK.CPY
 more cpy0/AMSBS040.CPY
 -- many lines removed --
 more cpy0/XTRANTWA.CPY
  EOF: 7774 files, 41 cbl, 4458 cpy, 1194 cpy(non pic)
       53 jcl, 3 asm, 1739 other

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8U1. CNVaids: Vancouver Utility Aids

makecopy1 - make script to copy files from a list of filenames

This is a very useful script for mainframe conversions. Assume we have transferred all available components from the mainframe to unix directories testlibs/jcl0,proc0,parm0,cbl0,cpy0.

Before trying to debug the thousands of JCLs & COBOLs, we would like to convert & test/debug a smaller set (POC). We wish to select a small set of JCL and select all required components (COBOLs,copybooks,parms,procs) to separate superdir & subdirs POC2testlibs/jcl0,proc0,parm0,cbl0,cpy0.

makecopy1 will help us select the JCLs & xref2copy1 (see '8V1') will help us select the other required components from the cross-references. Here is the example from MVSJCLtest2.htm#4C2.


 #1. Login mvstest --> /home/mvstest (or yourself --> homedir)
 #2. cdl           <-- change to $RUNLIBS (POC2testlibs)

 #3. vi ctl/poc2jcl   <-- edit list of filenames to be copied
     ===============
      JAR100.JCL      <-- sample list of filenames
      JAR200.JCL
      JGL100.JCL
      JGL200.JCL
Note
  • When keying the list of JCLs required, the case & extension
    do not matter, since 'makecopy1' has options to modify.
  • options 'uop=t1u1' convert to lower case
  • 'arg3=.ksh,arg4=.ksh' change extensions from '.JCL' to '.ksh'
    as required fro JCL/scripts in jcl3/...

 #4. uvcopy 'makecopy1,fili1=ctl/poc2jcl,filo1=sf/makeselpoc2
             ,arg1=$ATL/jcl3,arg2=jcl3,arg3=.ksh,arg4=.ksh,uop=t1u1'
     ===============================================================
     - enclose command in single quotes so $ATL expanded later at run time
     - sample output script sf/makecopy1 listed below:
      # sf/makeselpoc2 - script to copy files from $ATL/jcl3 to jcl3
      #    - using filenames from: ctl/poc2jcl
      #    - created by makecopy1 at: UV_Software on: 2012/05/14
      cp $ATL/jcl3/jar100.ksh  jcl3
      cp $ATL/jcl3/jar200.ksh  jcl3
      cp $ATL/jcl3/jgl100.ksh  jcl3
      cp $ATL/jcl3/jgl200.ksh  jcl3

 #5. ksh sf/makeselpoc2   <-- execute script created above
     ===================

 #5a. l jcl3     <-- check files copied as expected
      =======
      -rwxrwxr-x 1 mvstest apps 2056 May 14 20:28 jar100.ksh
      -rwxrwxr-x 1 mvstest apps 3314 May 14 20:28 jar200.ksh
      -rwxrwxr-x 1 mvstest apps 2442 May 14 20:28 jgl100.ksh
      -rwxrwxr-x 1 mvstest apps 3827 May 14 20:28 jgl200.ksh

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8V1. CNVaids: Vancouver Utility Aids

xref2copy1 - generate copy scripts from cross-reference reports

This is a very powerful technique useful for mainframe conversion POC's to select subset of JCLs & all required cbls,cpys,parms,procs. This script can save many hours of research & is much more accurate.

On page '8U1' above we used makecopy1 to create s script to copy our desired set of JCLs to subdir POCtestlibs/jcl2/... We can now run the JCL/COBOL crossref (see page '3E2') for input to 'xref2copy1' to create the script to copy the COBOL programs referenced by our set of POC JCLs.


 #1. Login mvstest --> /home/mvstest (or yourself --> your homedir)
 #2. cdl           <-- change to $RUNLIBS (POC2testlibs)

 #3. xkshprog2 jcl3   <-- run cross-ref COBOL programs & calling JCLs
     ==============     - using jcl2 (vs jcl0 on later re-run)

sample crossref: COBOL programs called by JCL/scripts

  xkshprog2 ** crossref to show all ksh SCRIPTS executing each PROGRAM **
  Keyword=progid:program  Exclude=~~ Include=~~ Skip=  page#  1
  Directory=/home/mvstest/POC2testlibs/jcl3 Options=q1a16b16c4e0d0g0h1j0l1p0s2w1a16b16c4d8j4l1
  =======================================================2012/05/15_10:48:03
  car100           jar100.ksh
  car200           jar200.ksh
  cgl100           jgl100.ksh
  cgl200           jgl200.ksh
  sort_2           jar200.ksh      jgl200.ksh
  **TotalWords: 5, TotalFiles=6, TotalRefs: 6

xref2copy1 - create selection script from crossref


 #4. uvcopy 'xref2copy1,fili1=xref/xkshprog2,filo1=sf/makeselpoc2
             ,arg1=$ATL/cbls,arg2=cbls,arg3=.cbl,arg4=.cbl,uop=t1u1'
     ===============================================================
     - converts COBOL/JCL cross-ref into script to copy COBOL programs
       from testlibs/cbls/... to POC2testlibs/cbls/...

output script to select cbls programs

 # sf/makeselpoc2 - script to copy files from $ATL/cbls to cbls
 # - created from xref/xkshprog2 by xref2copy1 at: UV_Software on: 2012/05/15
 cp $ATL/cbls/car100.cbl       cbls
 cp $ATL/cbls/car200.cbl       cbls
 cp $ATL/cbls/cgl100.cbl       cbls
 cp $ATL/cbls/cgl200.cbl       cbls
 cp $ATL/cbls/sort.cbl         cbls

execute script to select desired cbls programs


 #5. ksh sf/makeselpoc2   <-- execute script to select desired cbls programs
     ===================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_9. CNVaids.doc Vancouver Utility Conversion Aids

Tips for users new to Unix/Linux - Contents


9A1. 'vi' editor tutorial for users new to unix/linux
- the essential commands to get you started

9B1. Work in your working directory & address files thru subdirs
- working directories should have subdirs only
- all files are in subdirs (see cleandir1 script '9C1'

9B2. setup a 'tmp/' subdir in your working directories
- to keep your working directory clean (no files, subdirs only)

9B3. File Naming Conventions
 Append a digit (1,2,3,etc) on the end of filenames (customer1,sales1,etc)
- makes filenames 'unique' & easy to find with vi, grep, find, etc.
- makes it easy to create names for related files (customer2,sales2,etc)
 Misspell filenames Intentionally for same reason as appending a digit.
- for example: 'tmp' vs 'temp', 'wrk' vs 'work', etc.
 Common prefixes to identify related files
- for example prefix 'uv' makes it easy to find Vancouver Utilities
  (uvcopy,uvsort,uvlist,uvqrpg,uvhd,etc)

9C1. script 'cleandir1' to move any files in working directory to a subdir

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

9A1. CNVaids: Tips for new users to Unix/Linux

'vi' tutorial

'vi' 2 modes of operation - COMMAND or INSERT

  1. COMMAND mode - cursor movement, read/write files, etc

  2. INSERT mode - enter text (insert or replace) - ESCAPE to return to command mode

It is most important to understand that vi has TWO modes of operation. Switch to INSERT mode using commands such as the following:

i=insert, a=append, R=replace, o=open new line, cw=change word.

Switch back to command mode using 'ESCAPE'. Make it a habit to hit ESCAPE as soon as you finish text entry. If in doubt (COMMAND or INSERT mode) - hit ESCAPE, it will do no harm if already in command mode (will beep).

starting 'vi' to edit a file


 vi filename     - starts vi, reads the file,& displays 1st screen
 ===========       (or blank screen if creating a new file)

CURSOR MOVEMENT

                                 k
                                 |
                           h <-- . --> l
                                 |
                                 j
 'h'  - move cursor left
 'j'  - move cursor down
 'k'  - move cursor up
 'l'  - move cursor right
 ^d   - down 1/2 screen
 ^u   -  up  1/2 screen
 :1   - goto line# 1
 :500 - goto line# 500
 G    - goto end-of-file
 0    - move cursor to begining of current line
 $    - move cursor to end of current line

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

9A2. vi editor tutorial

INSERT text (ESCAPE to end insert)

i
  • enter insert mode at cursor location
a
  • append text after cursor location
A
  • append text onto the end of the current line
r
  • replace 1 character under the cursor
  • automatically returns to command mode (no need to ESCAPE)
R
  • replace (overwrite) text until ESCAPE
cw
  • change word (from cursor to end of word)
  • ESCAPE to end change & adjust line to new word length
o
  • open (insert) a new line BELOW the cursor
O
  • open (insert) a new line ABOVE the cursor

DELETE commands

x
  • delete character (under cursor)
dd
  • delete current line
D
  • delete from the cursor to end of line

5dd - delete 5 lines (current & next 4 lines below cursor)

COPY lines (YANK & PUT)

yy
  • yank current line (into current buffer)
  • move cursor to line above intended insert point
p
  • put (insert) buffer to line below cursor
 5yy - yank 5 lines into current buffer
     - move cursor to line above intended insert point
 p   - put (insert) buffer (5 lines) below cursor

MOVE lines (DELETE & PUT)

dd
  • delete current line (& store in current buffer)
  • move cursor to line above intended insert point
p
  • put (insert) buffer to line below cursor
 5dd - delete 5 lines (& store in current buffer)
     - move cursor to line above intended insert point
 p   - put (insert) buffer (5 lines) below cursor

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

9A3. vi editor tutorial

search commands

 /xxx - search for xxx anywhere in the file
      - search will wrap around EOF back to cursor location
n
  • repeat previous search (next)

substitution commands

 :1,$ s/xxx/yyy    - substitute 'xxx' with 'yyy'
                   - from 1st line to last line (1,$)
 :%s/xxx/yyy       - substitute 'xxx' with 'yyy'
                   - on ALL lines, '%' same as '1,$'
 :%s/xxx/yyy/g     - substitute 'xxx' with 'yyy'
                   - ALL lines ('%') & ALL occurrences on each line (/g)

Global command - to delete, etc

 :g/xxx/d          - on ALL lines (g=global), Delete lines with 'xxx'
 :g/xxx/p          - on ALL lines (g=global), Print lines with 'xxx'

miscellaneous commands

u
  • undo the last change command
U
  • Undo all changes to the current line (since cursor move to it)
 .  - repeat the previous change command
J
  • Join line below cursor onto current line
 :r file2 - read a file into the workspace
            (following the line with the cursor)

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

9A4. vi editor tutorial

MARK lines & copy

m[a-z]
  • mark current line as a,b,c,... (any 1 of 26 alphas)
m a
  • mark current line as mark 'a'
  • can move cursor to some other line
mb
  • mark new current line as mark 'b'
  • no need to leave space between mark command & mark letter
 'a          - goto mark 'a' (addressed by preceding with sungle quote)
             - NO preceding ':' as on following commands
 :'a,'b      - address a range of lines from previously marked a & b
             - may use with 'move' & 'copy' as follows:
 :'a,'b m .  - move lines from mark 'a' thru mark 'b' to follow current line
             - deletes original lines
 :'a,'b co . - copy lines from mark 'a' thru mark 'b' to follow current line
             - preserves original lines

MARK lines, write to tmp/, read into 2nd file

vim dir/file1 <-- edit file1

ma
  • mark desired start line as mark 'a'
  • move cursor to some other line
mb
  • mark desired end line as mark 'b'

 :'a,'b w tmp/file1x  <-- Write selected lines to tmp/...
 ===================
 :q                     - quit editing file1

vim dir/file2 <-- edit file2

 ...         - move cursor to line above desired insert

 :r tmp/file1x        <-- read lines (selected from file1) into file2
 =============
 :wq                    - write & quit

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

9A5. vi editor tutorial

registers a-z

Registers are addressed by preceding '"' double quote vs single quote for marks. Registers are handy for capturing data lines for later insertion as desired.

 "a 5yy   - yank 5 lines into register "a
 "a5yy    - no need to leave space between register ID & Yank number & command
 "a p     - put contents of register "a (following current line)
 "A 2yy   - Append 2 more lines to contents of register "a
            (Upper case register Appends, lower case replaces)

registers to yank lines in file1 & put in file2

You can yank lines into registers (a-z) that will be preserved between files & between logon sessions (since stored in .viminfo file) (a very powerful feature that you should take advantage of).

vim dir/file1 <-- edit file1

 ...         - move cursor to 1st line desired

 "a5yy       - yank 5 lines into register "a
 =====
 :q          - quit editing file1

vim dir/file2 <-- edit file2

 ...         - move cursor to line above desired insert

 "ap         - put lines from register "a into file2
 ===
 :wq                    - write & quit

WRITE & QUIT

 :w  - write workspace back to the file named on the vi entry command
 :w filename  - write workspace to a different file
 :q  - quit vi (warning if changes made without writing)

:wq - write & quit

ZZ
  • write & quit (same as :wq)

:q! - quit without writing

 :10,20 w filex  - write lines 10-20 to filex

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

9A6. vi editor tutorial

.vimrc file

You can create a '.vimrc' file in your home directory to store abbreviations, macros,& command maps. For example here are some 'Insert ABbreviations' I use:

:iab UVw www.uvsoftware.ca :iab UVs UV Software :iab UVu Vancouver Utilities

When I am in Insert mode & type 'UVw ' (following space required), it is automatically expanded to www.uvsoftware.ca. For my abbreviations I use a convention of 2 Upper case & 1 lower case letter to avoid any confusion with an intended word.

vim backup

You can configure vim to create backup files by coding a .vimrc file in your home directory. Here is the .vimrc file I use in my homedir. I set backupdir to create the backup files in some other directory since I do not want to clutter up my homedir with the backup files.

 ".vimrc file - created Apr04/2010 in /home/uvadm/.vimrc"
 "            - to create backup files at begin vi sessions"
 :set backup
 :set backupdir=/home2/uvbak/vimbackup
 :set backupext=.bak

vim References


 ftp://ftp.vim.org/pub/vim/doc/vimbook-OPL.pdf
 ===============================================
 - everything about vim 3.8 MB .pdf file

 https://linuxgazette.net/152/srinivasan.html
 =============================================
 - excellent tutorial on 'vim'
Note
  • 'vim' is an enhanced version of 'vi', used on most Linux systems.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

9B1. CNVaids: Tips for new users to Unix/Linux

tip#1 - stay in your 'working directory'

Your working directory should contain only subdirectories, and all files should reside within sub-directories. In the following example, your working directory should be 'testlibs'

 /p1
 :-----testlibs         <-- working directory
 :     :-----cbl0         - COBOL source from mainframe
 :     :-----cbls         - COBOL converted for Micro Focus
 :     :-----cblx         - compile output (.int .idy .cbl .err)
 :     :-----cpys         - COBOL copybooks
 :     :-----jcl0         - JCL from mainframe
 :     :-----jcls         - JCL converted to Unix/Linux scripts

You should work 1 level above your files & address your files through a sub- directory. In the example above, you would edit your programs as follows:

 cd /p1/testlibs        <-- change to working directory
 cdl                    <-- alias 'cdl' changes to $RUNLIBS (defined in profile)

 vi cbls/apay100.cbl    <-- address program thru subdir
 ===================

advantages of working above subdirs

  1. Helps maintain a clean well organized workplace - Since all files are in subdirs, you can probably list all your subdirs on 1 screen, which reminds you of your subdir organization.

  2. Protects your files, even the infamous 'rm *' would do no harm at the working directory level, since all files are in subdirs.

  3. Garbage files (accidentally created) are highlighted & can be easily removed or moved to their proper subdir. When you list your subdirs, any files (non-subdirs) will stick out like a sore thumb.

  4. Subdirs allow you to maintain the same filename for data & programs in the various stages of conversion, or archiving, etc.

  5. Many operations require addressing multiple files in multiple subdirs and it is then best to work 1 level above the subdirs. For example:


    mfcbl1 car100.cbl        <-- compile 1 COBOL program
    =================          - script assumes program is in subdir 'cbls'

    cnvMF41 cbl0/CAR100.cbl  <-- convert program from cbl0->cbl1->cbl2->cbls
    =======================    - script assumes cbl1,cbl2,cbls are below you

    jcl2ksh41 jcl0/JAR100.jcl  <-- convert JCL from jcl0->jcl1->jcl2->jcl3->jcls
    ========================= - script assumes jcl1,jcl2,jcl3,jcls are below you

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

9B1a. Tips for new users to Unix/Linux

example - editing & compiling programs

Normally you will only edit 1 program at a time because you will usually then compile the program & the compile script must run above the subdirs because it needs to reference source, copybooks,& compiled libraries.

It makes no sense to change into the subdir, edit 1 program,& then change back to compile the program. That would use 4 commands vs only 2 commands when you work above the subdirs.

working IN subdirs - WRONG


 #1. cd cbls                 <-- change into subdir
     =======

 #2. vi car100.cbl           <-- edit program (specify just filename)
     =============               (but overall less efficient)

 #3. cd ..                   <-- change back out (to compile program)
     =====

 #4. mfcbl1 car100.cbl       <-- compile program
     =================

working above subdirs - RIGHT


 #1. vi cbls/car100.cbl      <-- edit program (specify subdir/filename)
     ==================          (but overall more efficient)

 #2. mfcbl1 car100.cbl       <-- compile program
     =================

When you move onto the next program, your keystrokes are minimized by using your shell history & changing only the program name.


 #3. vi cbls/car200.cbl      <-- edit 2nd program
     ==================
 #4. mfcbl1 car200.cbl       <-- compile 2nd program
     =================

Exception to the Rule

When you have extensive editing to do on multiple files in the same subdir, of course you would change into the directory, do the edits,& change back.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

9B2. CNVaids: Tips for new users to Unix/Linux

tip#2 - setup 'tmp' sub-dir in your working directory

I recommend setting up a 'tmp' subdirectory in your various working directories, and use it for any temporary files, rather than clutter up your working directory (keep your working directory clean, subdirs only).

examples of using 'tmp' subdir

  1. Use 'tmp' whenever you want to redirect output to a temporary file so that you can then use the editor to explore the output. For example we might use 'grep' to find all programs using upsi as follows:


 #1a. grep 'UPSI' cbls/* >tmp/upsi    <-- extract lines with UPSI

 #1b. vi tmp/upsi                     <-- review results with editor

 #1c. uvlp12 tmp/upsi                 <-- print results
  1. Editing parts of programs & JCL/scripts into other programs/scripts For example, to copy a paragraph from 1 apay100.cbl to apay200.cbl:


 #2a. vi cbls/apay100.cbl       - edit program apay100.cbl
        ma                     - mark start of desired paragraph (mark 'a')
        mb                     - mark end of desired paragraph   (mark 'b')
        :'a,'b w tmp/chkdigit  - write paragraph out to tmp subdir
                                 (from mark 'a' to mark 'b')
        :q                     - quit edit apay100

 #2b. vi cbls/apay200.cbl       - edit program apay200.cbl
        --                     - move to desired point
        :r tmp/chkdigit        - read paragraph into apay200.cbl
        :wq                    - write/quit apay200

Don't confuse our 'tmp' subdir with /tmp which is a system wide directory.

 /tmp                      - system temporary directory
 /home/joe/tmp             - Joe's temporary directory
 /p1/testlibs/tmp          - temp subdir for apay libraries

You would clean out your 'tmp' subdir at least once a day, or you could setup a 'crontab' to do this automatically.

If multiple programmers working in shared directory (such as /home/testlibs) & desire their own tmp subdir, I suggest they append their initials (tmpaa, tmpbb, etc). Cron job can still clean out via 'rm tmp*/*'.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

9B3. CNVaids: Tips for new users to Unix/Linux

File Naming Conventions

It is a good idea to append a digit (1,2,3,etc) on the end of filenames. For example: 'customer1', 'sales1', etc. This provides several long lasting advantages thru out the life of our applications:

  1. It makes our file & table names 'unique' & avoids confusion with other similar names.

  2. We can reliably use 'grep' & 'find' to search for all instances of a desired file/table name in all our directories.

  3. We can use 'vi' to '/' search for all instances of a desired file/table name when editing our scripts & programs.

  4. It makes it easy to create names for related files/tables. 'customer2' or 'sales2' might be a variant, save, or backup copy. Or we might use 'customer1a', 'sales1a', etc.

    Misspell filenames Intentionally

It is a good idea to intentionally misspell filenames for the same reasons as explained above (appending a digit (1,2,3) on the end of filenames). Misspelling also makes them unique & easy to find with vi,grep,find,etc. For example 'tmp' vs 'temp', 'wrk' vs 'work', etc.

common prefixes to identify related files

Common prefixes make it easy to find related files with 1 command. For example if I wanted to find all instances where my utilities are called in the scripts directory: ('uv' is common to uvcopy,uvsort,uvlist,uvqrpg,uvhd,etc).


 grep 'uv' scripts/*
 ===================

 grep 'uv' sf/*/*  (uvadm scripts are sf/adm/* sf/demo/* sf/util/* sf/IBM/*)
 ================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

9C1. CNVaids: Tips for new users to Unix/Linux

cleandir1 - move files from workdir to subdir

To cleanup an existing working directory with a lot of mixed files & subdirs, you should find the 'cleandir1' script handy. You can then setup various subdirs & move the files to the apporpriate subdir.


 #1. cd workdir??
     ============

 #2. mkdir cleanup090812    <-- make subdir to receive files
     ===================

 #3. mv cleanup090812/... subdirxx  <-- move desired files to desired subdirs
     =============================
 # cleandir1 - cleanup current directory by moving files to subdir
 #           - by Owen Townsend, UV Software, Aug 12/2009
 #           - we recommend no files in working directory
 #           - all files should be stored in appropriate subdirs
 #
 d=$1
 if [[ ! -d "$d" ]]; then
    echo "usage: cleandir1 subdir  <-- arg1 must be a directory"
    echo "       ================"
    echo "       cleandir1 cleanup090812 <-- example"
    echo "       ======================="
    exit 99; fi
 #
 x=0
 for f in *
   { if [[ -f $f ]]; then
        echo "moving $f to $d"
        mv $f $d
        ((x=x+1))
     fi
   }
 echo "$x files moved to $d"
 exit 0

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Visitor Counters for ThisYear and LastYear