'uvcp' is the command line version of the 'uvcopy' utility. You can reformat files with a 1 line command. 'uvcp' does not require a separate parameter file as does the more powerful 'uvcopy'.
| A1. | Overview of uvcp & uxcp |
| - uxcp is an alternate version of uvcp to support | |
| Indexed Sequential Variable record length files | |
| compatible with Micro Focus COBOL IDXFORMAT3 |
| B1. | Introductory examples |
| C1. | FUNCTION summary & Interrupt processing |
| D1. | File definition parameters (fili1/filo1, typ, rcs, isk) |
| D2. | ISAM option for Duplicate keys Allowed on first & secondary keys |
| D3. | No need to specify ISAM keys for input files (read from .idx partition) |
| - ISAM keys copied to output file if both input & output typ=ISF | |
| - option 'k' for key of reference (read sequence) |
| E1. | I/O File Declaration - 3 methods |
| (command line, environmental variables,& parameter file) |
| F1. | File types - typ=RSF/RSV/ISF/IDX/LST |
| Record Seqntl Fixed, Indexed Seqntl Fixed/Variable, Line Seqntl Terminated | |
| F3. | Variable length Indexed files (typ=IDXf1,IDXf3,IDXf8) |
| compatible with Micro Focus COBOL IDXFORMAT1,3,8) | |
| F4. | File type options (a thru z) |
| F7. | File type options for typ=IDX files (f,v,x,y) |
| G1. | Run options (rop=a1b2c3...z9999) |
| H1. | Select & Delete records (sel/del) |
| - Year2000 options for windowed date field selections | |
| - option u1 to code blanks as underscores | |
| - option u2 to code commas as at-signs |
| I1. | Record Sequential Variable (typ=RSV) files |
| - compatible with Micro Focus COBOL IDXFORMAT3 files | |
| - also applies to the data partition of typ=IDX files |
| J1. | Test/demo Indexed Seqntl Variable length files |
| - convert supplied text file to typ=IDX & back to typ=LST |
| J2. | uvhd (hexdump display) of IDXf3 file |
| J3. | uvhd (hexdump display) of IDXf8 file |
| J4. | IDXf3/IDXf8 file header & record header layout |
Goto: Begin this document , End this document , UVSI Home-Page
| J5. | scripts to test/demo file typ=IDX options (f,v,x,y). |
| uxcpIDXf3w - write various IDXf3 formats, run prior to uxcpIDXf3r | |
| uxcpIDXf3r - read back IDXf3 files & convert back to text files | |
| uxcpIDXf3c - copy IDXf3 files to same output file types & record-sizes | |
| uxcpIDXf8w - write various IDXf8 files for read back by uxcpIDXf8r | |
| uxcpIDXf8r - read back various IDXf8 files written by uxcpIDXf8w | |
| uxcpIDXf8c - copy IDXf8 files to same output file types & record-sizes |
| J9. | tmp1 subdir listings of files created by above scripts |
| K1. | typ=RDW (default typ=RDWz4) Record Descriptor Word variable length files |
| - 4 byte record prefix with 2 byte binary record size & 2 unused nulls | |
| - using 'uvhd' to display & convert EBCDIC RDW files to ASCII text | |
| - using 'uvcp' to convert EBCDIC RDW files to ASCII fixed length files | |
| K6. | typ=RDWz2 - uvcp conversion for 2 byte record prefix (vs 4 above) |
| L1. | INSTRUCTION summary |
| L2. | instruction formats & operand areas |
| M0. | Instruction details |
| - mvc,mvn,clr,tra,tre,trl,tru,add,sub,mpy,div,pac,unp, | |
| anc,orc,chx,hxc,cmc,skp,cmn,rep,scn,sqz,tim,put |
| N1. | Instruction options (repeat, op length increment inhibit, etc) |
| O1. | special working storages 'a' 'b' 'w' 'x' 'y' |
| P1. | uvcp restrictions |
| Q1. | example #1 - reformatting records |
| R1. | example #2 - processing multiple same size contiguous fields |
| S1. | Using 'mkscript' to generate 'uvcp's to copy & reorganize directories |
| of data files (re-sequences & drops deleted records in ISAM files) |
| T1. | Converting TEXT files to FIXED record length files |
| - uvcp with input typ=LST & output typ=RSF |
| T4. | Converting FIXED record length files to TEXT files |
| - uvcp with input typ=RSF & output typ=LST |
| T5. | uvcpF2L - script using uvcp to convert Fixed length records w/o LineFeeds |
| - to text files with LineFeeds inserted after last nonblank | |
| - makes it easier to use the 'uvcp' utility |
| T7. | uvcpL2F - script using uvcp to convert text files to Fixed length records |
| - use when you need to convert a text file for use in a mainframe | |
| type application that requires fixed length with no LineFeeds. |
Goto: Begin this document , End this document , UVSI Home-Page
'uvcp' is a mini version of the uvcopy utility that can accept all it's parameters on the command line rather than requiring a separate parameter file as does uvcopy. This makes it convenient for use within scripts to perform jobs that do not require the power of uvcopy.
The program can perform record selection, reformatting, translation, and field conversion such as packed to zoned or to binary. uvcp is more than adequate as a replacement for the mainframe DATA utility which has a limited record selection & record reformatting capabilities.
uvcp is driven by 'keyword=argument's which may be entirely specified on the command line for simple file copies. For more complex operations the command line would specify the name of a parameter file which would contain any lengthy list of instructions, but it is better to use the uvcopy utility in this situation.
Note that 'uvsort' is compatible with 'uvcp'. uvsort uses the same functions and instructions, but also allows you to specify 'sort keys'.
'uxcp' is an alternate version of uvcp that includes support for Micro Focus COBOL IDXFORMAT3 files (Indexed Sequential Variable length records). You must execute uxcp to read or write 'typ=IDX' files. Note that Fixed length Indexed files (compatible with Micro Focus COBOL IDXFORMAT1) are supported by both uvcp & uxcp.
'uxcp' must be compiled with the Micro Focus 'cob' command. Please see install.doc which describes the use of the 'cobccuv' script which makes it easy to compile Vancouver Utility programs using the 'cob' command.
Goto: Begin this document , End this document , UVSI Home-Page
Required: copy the file to 'tmp/sales1' appending linefeeds so it can be
investigated with the editor.
Solution: uvcp "fili1=dat1/sales1,rcs=64,typ=RSF,filo1=tmp/sales1,typ=LST"
===============================================================
| Note |
|
Required: translate the file to UPPER case EBCDIC for export to an
IBM or Unisys S80 mainframe.
uvcp "fili1=dat1/sales1,rcs=64,typ=RSF,filo1=tmp/sales1,tru=0(64),tre=0(64)"
============================================================================
| Note |
|
solution: uvcp "fili1=dat1/custmas1,typ=ISF,rcs=256,filo1=bak1/custmas1,typ=RSF"
======================================================================
uvcp "fili1=bak1/custmas1,typ=RSF,rcs=256,filo1=dat1/caustmas1,typ=ISF,isk1=0(6),isk2=59(15)" ================================================================================
| Note |
|
Goto: Begin this document , End this document , UVSI Home-Page
required - convert the variable length records to fixed length 80 byte
records as required for existing programs.
- the records should have a linefeed in col 80 so the text
editor can still be used to view (& carefully update the file)
(will create a Unix Sequential file Terminated by LFs)
uvcp "fili1=tmp/updts,typ=LST,filo1=dat1/updts,typ=RST,rcs=80"
==============================================================
required - move the name&adrs from cols 7-79 max to cols 11-89 max and
insert a constant date '9212' in cols 7-10 (out rcsz 90 bytes)
uvcp "fili1=tmp/ups,typ=LST,filo1=dat1/ups,rcs=90,mvc=10(80)6,mvc=6(4):9212"
============================================================================
required - zero out the 12 months accumulators to begin a new year
uvcp "fili1=dat1/aphist,typ=RSF,rcs=200,filo1=tmp/aphist,mvnx12=20(p5):0"
=========================================================================
| Note |
|
| Note |
|
Goto: Begin this document , End this document , UVSI Home-Page
| Note |
|
# makeISF0 - create empty D-ISAM file
#
#usage: makeISF0 filename rcsz keys
# ===========================
#
#example: makeISF0 isamtest 255 0,8,50,20
# ===============================
#
if [[ $# -ne 3 ]]; then
echo "usage: makeISF0 filename rcsz key1strt,key1lth,key2strt,key2lth,etc"
exit 9; fi
#
uvcp "fili1=/dev/null,typ=RSF,rcs=$2,filo1=$1,typ=ISF,isks=($3)"
#
exit 0
Goto: Begin this document , End this document , UVSI Home-Page
fili1=infilename - declare input filename
typ=LST,RSF,RST,RSV,ISF,IDX,RUF - declare file type typ=LSTt & possible options appended to file type
rcs=9999 - declare record size
filo1=outfilename - declare output filename
iskx=start(length) - declare indexed file keys
rop=abc...xyz - declare misc run options
sel=start(lth):constant - select records with spcfd value in spcfd cols
del=start(lth):constant - delete records with spcfd value in spcfd cols
prm=paramfile - declare name of a parameter file which would
contain any lengthy list of instructions
- not normally required since all parameters
may be specified on the command line
(use the sort facility of uvcopy if required)
You may press the 'interrupt' key while uvcp is copying files. Interrupt causes uvcp to display current input/output record counts & prompts you for a response. Enter 'q' to close files & end the program, or null to continue. Interrupt processing must be enabled via run option 'e1' (rop=e1) for example:
uvcp "fili1=infile,rcs=80,typ=LST,filo1=outfile,rcs=80,typ=LSTt,rop=e1" =======================================================================
Goto: Begin this document , End this document , UVSI Home-Page
fili1=, typ=, rcs=, [isk#=,] filo1=, [typ=,] [rcs=,] [isk#=]
fili1 - specifies input filename (fili1=pathname)
- may specify as null (fili1=,) to cause environment search for
variables fili1/filo1 & retrieve equated values for filenames
(initftab subfunction also used with COBOL programs)
filo1 - specifies output filename (filo1=pathname)
- same rules as for fili1
| Note |
|
| typ |
|
| rcs |
|
| isk? |
|
isk1=0(8) - declare 1st key (bytes 1-8)
isk2=59(15) - declare 2nd key (bytes 61-75)
isk1p1=0(8) - declare key#1 part#1
isk1p2=20(6) - declare key#1 part#2
isk1p3=30(4) - declare key#1 part#3
isk1p1=0(8),isk1p2=20(6),isk1p3=30(4),isk2p1=100(30),isk2p2=150(15)
uvcp "fili1=xx,typ=RSF,rcs=80,filo1=yy,typ=ISF,isk1=0(8),isk2=59(15)"
=====================================================================
uvcp "fili1=xx,typ=RSF,rcs=80,filo1=yy,typ=ISF,isks=(0,8,59,15)"
================================================================
Goto: Begin this document , End this document , UVSI Home-Page
uvcp "fili1=x,typ=RSF,rcs=80,filo1=y,typ=ISF,isk1=0(8),isk2=40(6),isk3=60(9)" ================================================================================ - omitting any Dups/Nodups options on isk1/isk2/isk3
uvcp "fili1=x,typ=RSF,rcs=80,filo1=y,typ=ISF,isk1=0(8n),isk2=40(6d),isk3=60(9d)" ================================================================================ - defaults same as this (Nodups isk1, Dups isk2,isk3,etc)
uvcp "fili1=x,typ=RSF,rcs=80,filo1=y,typ=ISF,isk1=0(8d),isk2=40(6n)" ================================================================================
uvcp "fili1=x,typ=RSF,rcs=80,filo1=y,typ=ISF,isks=(0,8,40,20,60,10)" ==================================================================== - omitting any Dups/Nodups options on isks=(...) format
uvcp "fili1=x,typ=RSF,rcs=80,filo1=y,typ=ISF,isks=(0,8n,40,20d,60,10d)" ======================================================================= - defaults same as this (Nodups on 1st key, Dups Allowed on 2nd,3rd,etc)
uvcp "fili1=x,typ=RSF,rcs=80,filo1=y,typ=ISF,isks=(0,8d,40,20n)" ====================================================================
Goto: Begin this document , End this document , UVSI Home-Page
You do not need to specify ISAM keys for input files (only required when creating output indexed files). You may specify 'isk' for input files if desired, but you will get an error if the declared 'isks' do not match the existing indexed file keys. For example, the following 2 commands are the same:
uvcp "fili1=x,rcs=80,typ=ISF,isks=(0,8,40,20,60,10),filo1=y,typ=RST"
uvcp "fili1=x,rcs=80,typ=ISF,filo1=y,typ=RST"
If both input & output files are indexed (typ=ISF or typ=IDX) and no output keys are declared, then the input file keys are automatically used for the output file. For example if file 'x' has keys as shown above, the following would create indexed file 'y' with the same keys:
uvcp "fili1=x,rcs=80,typ=ISF,filo1=y,typ=ISF"
You can specify option 'k' to specify the Key of Reference. For example option 'k3' of file 'typ=ISFk3' specifies the key of reference as key #3, to cause record retrieval in sequence by the 3rd key.
uvcp "fili1=x,rcs=80,typ=ISFk3,filo1=y,typ=RST"
Goto: Begin this document , End this document , UVSI Home-Page
uvcp "fili1=dat1/sales1,rcs=64,typ=RSF,filo1=tmp/sales1"
======*****************================****************
command line: uvcp prmfilexx
==============
parameter file: fili1=dat1/custsales,rcs=128,typ=RSF
filo1=prodsales
mpy=b60(8):120 increase price by 20%
div=b60(8):100
Goto: Begin this document , End this document , UVSI Home-Page
File type codes are 3 upper case alpha + misc options (a-z), for example:
uvcp "fili1=test1,typ=RSF,rcs=80,filo1=test2,typ=LST"
==================*******====================*******
| RSF |
|
| RST |
|
| RSR |
|
| RUF |
|
| LST |
|
| ISF |
|
| RSV |
|
| IDX |
|
| RDWz4 |
|
| RDWz2 |
|
| RDWz8 |
|
Goto: Begin this document , End this document , UVSI Home-Page
| typ=ISF |
|
uvcp "fili1=test1,typ=LST,rcs=80,filo1=test2,typ=ISF,isk1=0(6)"
======================***========================***===========
The example above will convert a text input file to an Indexed Sequential Fixed record size file with key in 1st 6 bytes. This is an easy way to create indexed files - just use the editor to create the keys & data fields, with no need to worry about record sizes, then use uvcp to create the ISAM data partition of fixed records & indexed partition.
You may export ISDATEXT=dat if you wish to use '.dat' extensions on D-ISAM files read or written by uvcp (+ uvsort + uvcopy). The default is no extension on data partition, which is compatible with Micro Focus COBOL. Add to /etc/profile if your site always needs '.dat'. See options for Micro Focus to use '.dat' extensions (EXTFH & IDXNAMETYPE=2). See extfh.cfg listed at MVSCOBOL.htm#5D2 or VSECOBOL.htm#5D2
uvcp "fili1=dat1/pmast,typ=RSV,rcs=4000,filo1=tmp/pm,typ=ISF,rcs=200,isk1=0(6)" ===============================================================================
The above would convert a Record Sequential Variable (Micro Focus IDXFORMAT3) data file to an Indexed Sequential Fixed record length file. The 'ISF' file is compatible with MF COBOL fixed length Indexed files & C-ISAM files.
Please see pages 'I1' thru 'I3' for more details & examples --->
Goto: Begin this document , End this document , UVSI Home-Page
'typ=IDX' declares Indexed Sequential Variable length record files compatible with Micro Focus COBOL IDXFORMAT3 files. See the 'File Handling' documentation for Micro Focus Object or Server Express COBOL.
The Micro Focus COBOL 'EXTFH' file handler is compiled into an alternate version of uvcp called 'uxcp' using the 'cobccuv' script as explained in install.doc.
'uxcp' supports the same file types as uvcp with typ=IDX in addition. Two versions of the program are required since only Micro Focus COBOL users (server express 2.2+) could compile 'uxcp' whereas any user can compile 'uvcp' which uses D-ISAM to support Indexed Sequential FIXED record length files.
Note that 'typ=RSV' (Record Sequential Variable with no indexed keys) files are supported by both uvcp & uxcp. 'uxcp' must be used when either input or output or both files are typ=IDX.
uxcp "fili1=x,typ=LST,rcs=256,filo1=tmp/y,typ=IDXf3v62,rcs=254,isk1=0(6d)" ==========================================================================
This would read text file 'x' & build an Indexed Sequential Variable file 'y' whose key is the 1st 6 bytes of each record. The output records could vary from 62 to 254 bytes depending on the last nonblank character of input record. 'rcs=254' sets the maximum size & option 'v62' on typ=... sets the minimum size. The records will actually vary from 64 to 256 allowing for the 2 byte record header (see page 'J2' which displays a sample IDXf3 file).
You can run this example using a test file provided (uvadm/dat1/testRSV1) in place of file 'x' above.
Please see pages 'J1' thru 'J8' for more details & examples --->
Goto: Begin this document , End this document , UVSI Home-Page
File options may be appended to the 3 byte file typ code (lower case letters a-z with possible numeric suffixes).
uvcp "fili1=text1,typ=LSTb1c1,rcs=80,filo1=text2,typ=LSTt"
==========================================================
^^^^ ^
| a |
|
| b1 |
|
| b2 |
|
| b4 |
|
| b8 |
|
| Note |
|
| c1 |
|
| c2 |
|
| d1 |
|
| d2 |
|
| d3 |
|
| d4 |
|
| d8 |
|
| e2 |
|
| e1 |
|
| e3 |
|
| f# |
|
| f1 |
|
| f3 |
|
| f8 |
|
Goto: Begin this document , End this document , UVSI Home-Page
| g_ |
|
| g4 |
|
| g2 |
|
| g6 |
|
| h1 |
|
| j1 |
|
| j2 |
|
| j4 |
|
Option 'j' useful when you are processing all files in directory (with uvcopyx) And you want the output files in a different case than input files.
| k# |
|
| l_ |
|
| l0 |
|
| l1 |
|
| l2 |
|
| l4 |
|
Goto: Begin this document , End this document , UVSI Home-Page
| Note |
|
| l8 |
|
| m# |
|
| m100000 |
|
| n1 |
|
| n4 |
|
| r1 |
|
| s4 |
|
| t |
|
| v# |
|
| note |
|
| w2 |
|
Goto: Begin this document , End this document , UVSI Home-Page
| Note |
|
| IDXf1 |
|
| IDXf3 |
|
| IDXf8 |
|
| v9999 |
|
| x |
|
| x1 |
|
| x2 |
|
| y |
|
| y1 |
|
| y2 |
|
| y4 |
|
| y8 |
|
| z4 |
|
| z2 |
|
| z8 |
|
| n4 |
|
Goto: Begin this document , End this document , UVSI Home-Page
The output record size for IDX3/IDX8 variable length records defaults to the corresponding input record size. The record size is passed thru the sort by appending it on the end of the record & using it on the output phase.
This works well if both input & output are variable length (typ=IDX3v/IDXf8v). If input was fixed (typ=RSF/ISF/IDXf1) & output was variable (typ=IDXf3/IDXf8v), then output records would be in the variable length format, but all same size.
See pages 'J1' thru 'J9' for scripts to test/demo IDXf3/IDXf8 options.
Goto: Begin this document , End this document , UVSI Home-Page
'rop' is used to declare various options for the entire run.
rop=y75 #example - set Year2000 window to 75 for sel1y/del1y
Do not confuse with file options which apply only to a file (fili1/filo1) & which are appended to the file typ code (example: typ=LSTtd). Do not confuse with instruction options which apply only to the current instruction & are appended to the instruction opcode.
| b99999 |
|
| i99999 |
|
| o99999 |
|
| Note |
|
| e1 |
|
| h2 |
|
| r99999 |
|
| y70 |
|
| z |
|
| y70z1 |
|
Goto: Begin this document , End this document , UVSI Home-Page
#1. uvcp "fili1=dat1/warmas1a,typ=RSF,rcs=64,filo1=wm2,sel1y=44(2)>98,rop=y70z1"
==================================================================*********
rop=y70z1 - set Year2000 sliding window '70' for sel1y/del1y
(select/delete on windowed date fields)
in 1998 the window value would be '68' meaning 68-99 = 1968-1999,
00-67 = 2000-2067
#2. uvcp "fili1=xx,typ=RSF,rcs=64,filo1=yy,sel1y=44(6y),rop=b2000,o500
====================================================**************
b2000 - bypasses the 1st 2000 records of the input file
o500 - sets a stop count to end output after 500 records
(not necessarily #2000-2500 due to select)
| Note |
|
Goto: Begin this document , End this document , UVSI Home-Page
example1: rop=r8000i1000t300
Options must be 1 contiguous string with no blanks (except in quotes)
Valid options are the 26 lower case letters. The letter options may be specified in any sequence. Each letter used should only be specified once in the string, but the last specification would override previous specs.
The option letter may be followed by a numeric value which is often bit coded for suboptions (a7 includes a1+a2+a4).
example2: rop=(a,b,c768,d1,e='embedded blanks')
String values must be assigned via the '=' separator & the string must be enclosed in quotes if any embedded blanks. Hex values are indicated by enclosing in circumflexes
Comma separators are optional if no value or only numeric values are assigned, but are mandatory following string values.
When the '=' or ',' is required/desired within the option string, you must enclose the option string within (...) to not confuse the parsing of the overall keyword & argument prmtr string which must then be enclosed in quotes to prevent the shell choking on the parenthesis - also true if any isk1=start(length) keywords are present.
sqzmb=20(80):0x20 - options 'mb' squeeze multiple blanks to 1
vs the default of all blanks
Goto: Begin this document , End this document , UVSI Home-Page
sel=start(length):dataconstant
sel=0(2):a1 - select if bytes 1-2 = 'a1'
sel1=78(2):BC - select records with 'BC' in cols 79-80
sel2=8(1)!D that do not have a 'D' in column 9
del1=90(2)>55 - delete if 91-92 > '55'
del2=99(1)!0xff and if 100 not = x'ff'
'sel' & 'del' are mutually exclusive.
The 'and/or' condition is indicated by 4th byte of sel/del. sel1/sel2/etc indicates 'and' conditions. The 'or' condition is indicated when 4th byte reverts to 1 or blank.
'sel's or 'del's are stored in a common table at setup time for execution at run time (100 entries allowed).
sel1y=20(6)>980630 - select records with dates in cols 21-26
from 19980701 up to 20491231
Option 'y' assumes 1st 2 bytes of specified field is the 2 digit year regardless of field length (yymmdd, yymm, yy).
The default window is '50', may be changed by run option 'y__' to specify the window value,& option 'z1' for sliding windows.
| Note |
|
rop=y50 -------- means 50-99 = 1950-1999,& 00-49 = 2000-2049
rop=y50z1 in 1998 means 48-99 = 1948-1999,& 00-47 = 2000-2047
sel1y=20(2)>98,rop=y70z1 - select records with years in cols 21-22
from 1998 to 2067 (rop=y70z1) if now 1998
Goto: Begin this document , End this document , UVSI Home-Page
Option 'u1' allows you to code blanks as underscores, which is convenient because blanks are not allowed in the uvcp command string. The alternative would be to code blanks in hexadecimal (' ' = 0x20). Here are some examples:
Option 'u2' allows you to code commas as at-signs, which is convenient because commas are used to separate commands in the command string and therefore can not be coded as constants.
sel1u1=0(1):_,sel1u2=0(1):@,... =============================== - select record if 1st byte blank ' ' OR 1st byte comma ','
sel1u1=0(1):_,sel2u2=1(1):@,... =============================== - select record if 1st byte blank ' ' AND 2nd byte comma ','
sel1u3=0(2):_@,... =============================== - select record if 1st byte blank ' ' AND 2nd byte comma ',' - coding a 2 byte constant (vs separate 1 byte constants) - note option u3 = (u1 + u2)
Goto: Begin this document , End this document , UVSI Home-Page
As of Nov 2002 'typ=RSV' supports OUTPUT files as well as INPUT files. 'typ=RSV' provides compatibility with Micro Focus COBOL IDXFORMAT3 Variable length files, but only for Sequential. Indexed variable length support will be provided in Jan 2003 by an alternate version of uvcp (uxcp linked with EXTFH).
For complete documentation on these files, please see the 'FILE STRUCTURES' chapter in Micro Focus Object COBOL or Server Express COBOL, or the web site http://supportline.microfocus.com/documentation/books/ocds4140/fhfile.htm.
'typ=RSV' files have 128 byte file header. Each record has 2 or 4 byte record header/prefix which has x'40' in the first nibble to identify a data record, followed by the record size in the next 12 bits or 28 bits, depending on max recsize <= 4095 or > 4095 bytes.
Same as ex#1 but writes typ=RSV records varying from 64 to 256
- 064 bytes (2 hdr + 062 data) if bytes 62+ all blank
??? bytes (2 hdr + ??? data) depending on last nonblank (multiple of 4)
- 256 bytes (2 hdr + 254 data) is maximum
This example writes 4 byte record headers (vs 2 bytes in above examples)
because the maximum record size is > 4095 bytes (rcs=5000).
Record sizes vary from 404 to 5004 depending on last nonblank
- 0404 bytes (4 hdr + 0400 data) if bytes 400+ all blank
- ???? bytes (4 hdr + ???? data) depending on last nonblank in 400-5000
- 5004 bytes (4 hdr + 5000 data) is maximum
Goto: Begin this document , End this document , UVSI Home-Page
2. uvcp "fili1=dat1/testRSV3,rcs=256,typ=LST,filo1=tmp/RSV3,rcs=254,typ=RSVv80"
=============================================================================
#1 testRSV3 - text to create Rec Seqntl Variable(RSV) file to test uvcp&uvsort #2 uvcp "fili1=dat1/testRSV3,rcs=256,typ=LST,filo1=tmp/testx,rcs=254,typ=RSVv80" #3 output records vary from min(82) to max(256) depending on last nonblank-----| -----this record will be 164 (data 160 + 2 byte rechdr + 2 round to mult 4)---->
uvhd tmp/RSV3 v <-- display file using uvhd with option 'v' ===============
1 2 3 4 5 6
r# 1 0123456789012345678901234567890123456789012345678901234567890123
0 0~......030114102019.................>.......................P..
370000003333333333330000000000000000030000000000000000000F000500
0E00000003011410201900000000000000000E0100000000100000000E000000
64 ................................................................
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
1 2 3 4 5 6
r# 2 0123456789012345678901234567890123456789012345678901234567890123
128 @P#1 testRSV3 - text to create Rec Seqntl Variable (RSV) file to
4523276775553222767727626766762566256767625676666622555226666276
00310453423630D0458404F032514502530351E4C0612912C5082369069C504F
64 test uvcp/uvsort
27677277672777677222
0453405630F563F24000
1 2 3 4 5 6
r# 3 0123456789012345678901234567890123456789012345678901234567890123
212 @P#2 uvcp "fili1=dat1/testRSV3,rcs=256,typ=LST,filo1=tmp/test3,r
4523277672266663366732767755532767333327773455266663376727677327
0032056300269C91D4141F45342363C233D256C490DC34C69CF1D4D0F45343C2
64 cs=254,typ=RSVv80"
67333327773555733222
33D254C490D236680200
1 2 3 4 5 6
r# 4 0123456789012345678901234567890123456789012345678901234567890123
296 @.#3 output records vary from min(84) to max(256) depending on l
4A23267777727666767276772676626662332276266723332266766666626626
00330F540540253F24306129062FD0D9E884904F0D188256904505E49E70FE0C
64 ast nonblank-----|-----this record will be 164 (data 160 + 2 byt
6772666666662222272222276672766676276662662333226676233322232677
1340EFE2C1EBDDDDDCDDDDD48930253F24079CC025016408414101600B020294
128 e rechdr + 2 round to mult 4)---->
627666672223276766276267672322222322
502538420B0202F5E404F0D5C4049DDDDE00
Goto: Begin this document , End this document , UVSI Home-Page
1 2 3 4 5 6
r# 1 0123456789012345678901234567890123456789012345678901234567890123
0 0~......021125110120.................>.......................~..
370000003333333333330000000000000000030000000000000000000F000700
0E00000002112511012000000000000000000E0100000000100000000E000E00
64 ................................................................
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00-00 - x'30' identifies the file header record (vs x'40' for data records)
01-01 - data size of this record x'7E' = (7*16+14*1) = 112+14 = 126
- total size is 128 including the 2 byte record header
00-03 - If max rcsz > 4095, the record header would be 4 bytes x'3000007C'
- 7*16 + 12*1) = 112+12 = 124 + 4 byte header = 128 total record size
08-19 - file creation date/time stamp (yymmddHHMMSS)
36-36 - reserved value x'3E' required for Micro Focus COBOL IDXFORMAT3 files
39-39 - file ORGanization x'01' = Sequential
48-48 - Recording Mode x'01' = Variable format
54-57 - Maximum record length
- In this example x'000000FE' = (15*16+14*1) = 240+14 = 254
58-61 - Minimum record length
- In this example x'0000007E' = (07*16+14*1) = 112+14 = 126
The file structure described above for typ=RSV files also applies to typ=IDX files which include an indexed partition & some extra system records in the data partition. You must use the alternate program 'uxcp' (vs 'uvcp) if either input or output or both files are typ=IDX.
Goto: Begin this document , End this document , UVSI Home-Page
'uxcp' supports Indexed Sequential Variable length record files & must be compiled with the Micro Focus COBOL 'cob' command as shown on page D1 of install.htm. You can demo uxcp using test files provided as shown below:
0010.0060 idxtest text file to create Var Lth Indexed files. 0020.0064 - input to COBOL,uxcp,uxcopy to create IDXf1,3,8 files 0030.0065 - 01-04=ISAM key, 05=separator, 06-09=size, 10-400 text 0040.0067 - output record varies from 64 to 256, depending on 06-09 0050.0080 - here is an 80 byte record------------------------------------------> 0060.0160 - here is a 160 byte record........................................... 0070.0240 - here is a 240 byte record (last record in file)..................... ===============================================================================>
#1. uxcp "fili1=dat1/idxtest,rcs=256,typ=LST\
==========================================
,filo1=tmp/IDXf3v60,rcs=254,typ=IDXf3v60,isk1=0(4)"
===================================================
#2. uvhd tmp/IDXf3v60.dat v <-- examine output data partition with 'uvhd'
======================= - use 'v' option for IDXf3 files
| Note |
|
#3. uxcp "fili1=tmp/IDXf3v60,rcs=256,typ=IDXf3,filo1=tmp/idxf3.txt,typ=LSTt"
========================================================================
#4. vi tmp/idxf3.txt <-- examine output file with 'vi'
================
This converts the typ=IDX file back to a text file (typ=LSTt) which should be the same as the original file used in step #1. Note that you do not need to specify option 'v' on input files (only when creating output files).
Goto: Begin this document , End this document , UVSI Home-Page
#1a. uvhd tmp/IDXf3v60.dat v <-- examine output data partition with 'uvhd'
=======================
10 20 30 40 50 60
r# 1 0123456789012345678901234567890123456789012345678901234567890123
0 0~......0705141326133507051413261335.>.......................<..
370000003333333333333333333333333333030000000000000000000F000300
0E00000007051413261335070514132613350E0200000000100000000E000C00
64 ............................................X"8*................
0000000000000000000000000000000000000000000052320000000000000000
00000000000020100000000000000000000000000000828A0000000000000000
10 20 30 40 50 60
r# 2 0123456789012345678901234567890123456789012345678901234567890123
384 @<0010.0060 idxtest text file to create Var Lth Indexed files...
4333332333326677677276772666627626766762567247624666766266667200
0C0010E00600948453404584069C504F032514506120C4809E45854069C53E00
10 20 30 40 50 60
r# 3 0123456789012345678901234567890123456789012345678901234567890123
448 @@0020.0064 - input to COBOL,uxcp,uxcopy to create IDXf1,3,8 fil
4433332333322266777276244444277672776677276267667624456323232666
000020E00640D09E05404F03F2FCC5830C583F0904F0325145094861C3C8069C
64 es..
6700
5300
10 20 30 40 50 60
r# 4 0123456789012345678901234567890123456789012345678901234567890123
516 @A0030.0065 - 01-04=ISAM key, 05=separator, 06-09=size, 10-400 t
4433332333322233233345442667223337676767672233233376762233233327
010030E00650D001D04D931D0B59C005D3501214F2C006D09D39A5C010D40004
64 ext.
6770
5840
10 20 30 40 50 60
r# 5 0123456789012345678901234567890123456789012345678901234567890123
584 @C0040.0067 - output record varies from 64 to 256, depending on
4433332333322267777727666762767667267662332762333226676666662662
030040E00670D0F540540253F240612953062FD06404F0256C04505E49E70FE0
64 06-09...
33233000
06D09000
10 20 30 40 50 60
r# 6 0123456789012345678901234567890123456789012345678901234567890123
656 @P0050.0080 - here is an 80 byte record-------------------------
4533332333322266762672662332677627666762222222222222222222222222
000050E00800D0852509301E080029450253F24DDDDDDDDDDDDDDDDDDDDDDDDD
64 ----------------->..
22222222222222222300
DDDDDDDDDDDDDDDDDE00
----- last 3 records omitted to keep this on 1 page -----
Goto: Begin this document , End this document , UVSI Home-Page
#1. uxcp "fili1=dat1/idxtest,rcs=256,typ=LST\
==========================================
,filo1=tmp/IDXf8v60,rcs=254,typ=IDXf8v60,isk1=0(4)"
===================================================
#2. uvhd tmp/IDXf8v60.dat v <-- examine output data partition with 'uvhd'
=======================
10 20 30 40 50 60
r# 1 0123456789012345678901234567890123456789012345678901234567890123
0 3.......0705141522382607051415223827.>.......................<..
3F0000003333333333333333333333333333030000000000000000000F000300
3E00000007051415223826070514152238270E0200180000106000000E000C00
64 ............................................X"8*X"8*............
0000000000000000000000000000000000000000000052325232000000000011
00000007000022100000000000000000000000000008828A828A000000000000
128 ................................................................
00000011000000000000000000000000000000000000000F0000000000000000
000000004244010400000040000000C0000000000000003E0000000000000000
----- bytes 192-960 removed (all x'00's) -----
960 ................................................................
10 20 30 40 50 60
r# 2 0123456789012345678901234567890123456789012345678901234567890123
3328 @<0010.0060 idxtest text file to create Var Lth Indexed files...
4333332333326677677276772666627626766762567247624666766266667200
0C0010E00600948453404584069C504F032514506120C4809E45854069C53E00
10 20 30 40 50 60
r# 3 0123456789012345678901234567890123456789012345678901234567890123
3392 @@0020.0064 - input to COBOL,uxcp,uxcopy to create IDXf1,3,8 fil
4433332333322266777276244444277672776677276267667624456323232666
000020E00640D09E05404F03F2FCC5830C583F0904F0325145094861C3C8069C
64 es..
6700
5300
10 20 30 40 50 60
r# 4 0123456789012345678901234567890123456789012345678901234567890123
3464 @A0030.0065 - 01-04=ISAM key, 05=separator, 06-09=size, 10-400 t
4433332333322233233345442667223337676767672233233376762233233327
010030E00650D001D04D931D0B59C005D3501214F2C006D09D39A5C010D40004
64 ext.
6770
5840
10 20 30 40 50 60
r# 5 0123456789012345678901234567890123456789012345678901234567890123
3536 @C0040.0067 - output record varies from 64 to 256, depending on
4433332333322267777727666762767667267662332762333226676666662662
030040E00670D0F540540253F240612953062FD06404F0256C04505E49E70FE0
64 06-09...
33233000
06D09000
----- records 6,7,8 not shown to fit 1 page -----
Goto: Begin this document , End this document , UVSI Home-Page
The Vancouver Utilities (uxcopy,uxsort,uxqrpg,uxcp,uvhd) are compatible with Micro Focus COBOL variable length sequential & Indexed files (IDXFORMAT3 & 8).
We will document the most important fields in the file header for IDXf3/IDXf8. If desired, you can find all fields defined on the Micro Focus website.
Note that you can investigate the file headers using 'uvhd' with option 'v' for IDXFORMAT3 or IDXFORMAT8. See sample on the previous page.
000-003 - file header record length
- 1st 4 bits x'30' identifies a system record
- next 12 bits is header length if max record length is < 4095
- next 28 bits is header length if max record length is => 4095
008-014 - creation date/time yymmddhhmmsscc (indexed files only)
039-039 - organization (1=seqntl, 2=indexed, 3=relative)
043-043 - file type (3=IDXFORMAT3, 8=IDXFORMAT8)
048-048 - recording mode (0=fixed, 1=variable)
068-071 - record count (4 bytes Big-End Binary)
- Indexed files only (not in variable length non-indexed file hdrs)
054-057 - maximum record length (big end format)
- example recsize 80 = x'00000050'
058-061 - minimum record length
128-135 - offset to End-of-File (8 bytes binary big end format)
140-141 - number of keys in Indexed file
000-000 - 1st 4 bits identifies the record type x'1_' - system record - duplicate occurrence record x'2_' - deleted record x'3_' - system record x'4_' - user data record x'5_' - reduced user data record x'6_' - pointer record x'7_' - user data record referenced by a pointer record x'8_' - reduced user data record referenced by a pointer record
000-001 - next 12 bits is the record length if max recsize < 4095 000-003 - next 28 bits is the record length if max recsize =? 4095 002-... - record data if max recsize < 4095 004-... - record data if max recsize => 4095
| Note |
|
Goto: Begin this document , End this document , UVSI Home-Page
The next few pages will list several scripts used at UV Software to test/demo using uxcp to write IDXFORMAT3/IDXFORMAT8 files & read them back to verify.
These scripts are supplied in /home/uvadm/sf/demo/..., which is in the PATH of the supplied profile. You can run these at your site. See instructions & explanations embedded within the scripts.
| uxcpIDXf3w |
|
| uxcpIDXf3r |
|
| uxcpIDXf3c |
|
| Note |
|
| J6. | uxcpIDXf8w - write various IDXf8 files for read back by uxcpIDXf8r |
| - reads a text file & writes out 6 files with various options |
| J7. | uxcpIDXf8r - read back various IDXf8 files written by uxcpIDXf8w |
| to verify result same as original text file input |
| J8. | uxcpIDXf8c - copy IDXf3 files to same output file types & record-sizes |
| - to prove we can copy unchanged (passing recsizes to output) | |
| - but you can add selects/deletes & modify instructions |
| J9. | tmp1 subdir listings after uxcpIDXf3w & after uxcpIDXf8w |
| Note |
|
Goto: Begin this document , End this document , UVSI Home-Page
# uxcpIDXf8w - write various IDXFORMAT files to test uxcp # - by Owen Townsend, Jan28/06, updated Feb22/07 # - IDXFORMAT8 files created by Micro Focus COBOL EXTFH # - file handler used by uxcp, uxsort, uxcopy, uxqrpg # #*uxcpIDXf8w - write various IDXf8 files for read back by uxcpIDXf8r <--this job # uxcpIDXf8r - read back various IDXf8 files written by uxcpIDXf8w # uxcpIDXf8c - Copy IDXf3 files to same output file types & record sizes # uxcpIDXf3w - write various IDXf3 formats in tmp1, run prior to uxcpIDXf3r # uxcpIDXf3r - read back IDXf3 files & convert back to text files in tmp2 # uxcpIDXf3c - Copy IDXf3 files to same output file types & record sizes # # OPTIONS: f1=IDXFORMAT1, f3=IDXFORMAT3, f8=IDXFORMAT8 (see www.microfocus.com) # x1=noindex, x2=indexed; y1=fixed, y2=variable, y4=scanback to last non-blank # v=min recsize, (maxsize declared by rcs=___) # # 1. typ=LST-->IDXf8 indexed, data maxsz 252+4 (since no minsz v optn) uxcp "fili1=dat1/idxtest,typ=LST,rcs=252,filo1=tmp1/idxf8,typ=IDXf8,isk1=0(4)" #=========================================================================== # # 2. typ=LST-->IDXf8v60 indexed, variable recsize passed thru from input uxcp "fili1=dat1/idxtest,typ=LST,rcs=252,filo1=tmp1/idxf8v60,typ=IDXf8v60,isk1=0(4)" #=============================================================================== # # 3. typ=LST-->IDXf8v60y4 indexed variable min v60+4, depending on last nonblank uxcp "fili1=dat1/idxtest,typ=LST,rcs=252,filo1=tmp1/idxf8v60y4,typ=IDXf8v60y4,isk1=0(4)" #=============================================================================== # # 4. typ=LST-->IDXf8x1 noindex(x1), fixed 252, no IDX filehdr, same as typ=RSF uxcp "fili1=dat1/idxtest,typ=LST,rcs=252,filo1=tmp1/idxf8x1,typ=IDXf8x1,isk1=0(4)" #=============================================================================== #note - must read back using typ=RSF, since no index & fixed lth (no v) # # 5. typ=LST-->IDXf8v60x1 noindex(x1), varfmt, but all 252+4 uxcp "fili1=dat1/idxtest,typ=LST,rcs=252,filo1=tmp1/idxf8v60x1,typ=IDXf8v60x1,isk1=0(4)" #=============================================================================== # # 6. typ=LST-->IDXf8v60x1y4 noindex(x1), variable 60-252, depending on LNB uxcp "fili1=dat1/idxtest,typ=LST,rcs=252,filo1=tmp1/idxf8v60x1y4,typ=IDXf8v60x1y4,isk1=0(4)" #=============================================================================== # echo "You can examine output files with 'uvhd', example for output#1 above" echo " " echo "uvhd tmp1/idxf8.dat v <-- use 'v' option for IDXf8 files" echo "=====================" # #Note - script may bomb on uxcp #6 if you only have 1 Micro Focus COBOL license # - But you can add following to your profile to wait 1 minute (vs bomb) # # export ASLMFRETRY="5,15" # ========================
Goto: Begin this document , End this document , UVSI Home-Page
# uxcpIDXf8r - read back various IDXFORMAT3 files to test uxcp # (files written by prior job uxcpIDXf8w) # - this job converts back to text files (typ=LSTt) # - by Owen Townsend, Jan28/06, updated Feb22/07 # - IDXFORMAT8 files created by Micro Focus COBOL EXTFH # - file handler used by uxcp, uxsort, uxcopy, uxqrpg # # uxcpIDXf8w - write various IDXf8 files for read back by uxcpIDXf8r #*uxcpIDXf8r - read back various IDXf8 files written by uxcpIDXf8w <--this job # uxcpIDXf8c - Copy IDXf3 files to same output file types & record sizes # uxcpIDXf3w - write various IDXf3 formats, run prior to uxcpIDXf3r # uxcpIDXf3r - read back IDXf3 files & convert back to text files # uxcpIDXf3c - Copy IDXf3 files to same output file types & record sizes # # options: f1=IDXFORMAT1, f3=IDXFORMAT3, f8=IDXFORMAT8 (see www.microfocus.com) # x1=seqntl, x2=indexed; y1=fixed, y2=variable, y4=set rcsz after last nonblank # v=min recsize, (maxsize declared by rcs=___) # # 1. typ=IDXf8-->LSTt - input IDXf8 indexed fixed (no option v) uxcp "fili1=tmp1/idxf8,typ=IDXf8,rcs=252,filo1=tmp2/idxf8L,typ=LSTt" #=================================================================== # # 2. typ=IDXf8v60-->LSTt - input variable from 60+4 to 252+4 uxcp "fili1=tmp1/idxf8v60,typ=IDXf8,rcs=252,filo1=tmp2/idxf8v60L,typ=LSTt" #========================================================================= # # 3. typ=IDXf8v60y4-->LSTt - input variable determined by y4 scanback to LNB uxcp "fili1=tmp1/idxf8v60y4,typ=IDXf8,rcs=252,filo1=tmp2/idxf8v60y4L,typ=LSTt" #============================================================================= # # 4. typ=IDXf8x1-->LSTt - input IDXf8 noindex, all 252+4 uxcp "fili1=tmp1/idxf8x1,typ=RSF,rcs=252,filo1=tmp2/idxf8x1L,typ=LSTt" #======================================================================= #note - must read back using typ=RSF, since no index & fixed lth (no v) # # 5. typ=IDXf8v60x1-->LSTt - input IDXf8 noindex, varfmt, all 252+4 uxcp "fili1=tmp1/idxf8v60x1,typ=IDXf8,rcs=252,filo1=tmp2/idxf8v60x1L,typ=LSTt" #============================================================================= # # 6. typ=IDXf8v60x1y4-->LSTt - input IDXf8 noindex, varfmt, 60+4 to 252+4, y4 uxcp "fili1=tmp1/idxf8v60x1y4,typ=IDXf8,rcs=252,filo1=tmp2/idxf8v60x1y4L,typ=LSTt" #============================================================================= # echo "All outfiles in tmp2/... should be same as original input to uxcpIDXf3w" echo " " echo "--> cat tmp2/idxf8L <-- display output file, example for #1 above" echo " ===============" # #Note - on inputs you only need to specify the file type (IDXf1,IDXf3,IDXf8) # - options v,x,y need not be specified # - EXTFH file handler reads existing files OK
Goto: Begin this document , End this document , UVSI Home-Page
# uxcpIDXf8c - copy various IDXFORMAT3 files to test uxcp # (files written by prior job uxcpIDXf8w) # - copy the IDXf3 files to same output file types & recsizes # - IDXFORMAT8 files created by Micro Focus COBOL EXTFH # - file handler used by uxcp, uxsort, uxcopy, uxqrpg # - by Owen Townsend, Jan28/06, updated May14/07 # # uxcpIDXf8w - write various IDXf8 files for read back by uxcpIDXf8r # uxcpIDXf8r - read back various IDXf8 files written by uxcpIDXf8w #*uxcpIDXf8c - Copy IDXf3 files to same output file types & recsizes <--this job # uxcpIDXf3w - write various IDXf3 formats, run prior to uxcpIDXf3r # uxcpIDXf3r - read back IDXf3 files & convert back to text files # uxcpIDXf3c - Copy IDXf3 files to same output file types & record sizes # # options: f1=IDXFORMAT1, f3=IDXFORMAT3, f8=IDXFORMAT8 (see www.microfocus.com) # x1=seqntl, x2=indexed; y1=fixed, y2=variable, y4=set rcsz after last nonblank # v=min recsize, (maxsize declared by rcs=___) # # 1. copy typ=IDXf8 indexed but fixed 252+4 since no optn v uxcp "fili1=tmp1/idxf8,typ=IDXf8,rcs=252,filo1=tmp3/idxf8,typ=IDXf8" #=================================================================== # # 2. copy typ=IDXf8v60 variable, passes input recsizes to output file uxcp "fili1=tmp1/idxf8v60,typ=IDXf8,rcs=252,filo1=tmp3/idxf8v60,typ=IDXf8v60" #============================================================================ # # 3. copy typ=IDXf8v60y4, option y4 scans back to last nonblank for out recsize uxcp "fili1=tmp1/idxf8v60y4,typ=IDXf8,rcs=252,filo1=tmp3/idxf8v60y4,typ=IDXf8v60" #=============================================================================== # # 4. copy typ=IDXf8x1 noindex, option x1 (fixed lth), all out recs 252+4 bytes uxcp "fili1=tmp1/idxf8x1,typ=RSF,rcs=252,filo1=tmp3/idxf8x1,typ=IDXf8x1" #======================================================================= #note - must read back using typ=RSF, since no index & fixed lth (no v) # # 5. copy typ=IDXf8v60x1 noindex, varfmt, all 252+4 uxcp "fili1=tmp1/idxf8v60x1,typ=IDXf8,rcs=252,filo1=tmp3/idxf8v60x1,typ=IDXf8v60x1" #============================================================================= # # 6. copy typ=IDXf8v60x1y4 noindex, varfmt, 60+4 to 252+4, y4 uxcp "fili1=tmp1/idxf8v60x1y4,typ=IDXf8,rcs=252,filo1=tmp3/idxf8v60x1y4,typ=IDXf8v60x1y4" #============================================================================= # echo "All outfiles in tmp3/... should be same as original input to uxcpIDXf3w" echo " " echo "--> cat tmp3/idxf8L <-- display output file, example for #1 above" echo " ===============" # #Note - on inputs you only need to specify the file type (IDXf1,IDXf3,IDXf8) # - options v,x,y need not be specified # - EXTFH file handler reads existing files OK
Goto: Begin this document , End this document , UVSI Home-Page
0010.0060 idxtest text file to create Var Lth Indexed files. 0020.0064 - input to COBOL,uxcp,uxcopy to create IDXf1,3,8 files 0030.0065 - 01-04=ISAM key, 05=separator, 06-09=size, 10-400 text 0040.0067 - output record varies from 64 to 256, depending on 06-09 0050.0080 - here is an 80 byte record------------------------------------------> 0060.0160 - here is a 160 byte record........................................... 0070.0240 - here is a 240 byte record (last record in file)..................... ===============================================================================>
#1. -rw-rw-r-- 1 uvadm users 2176 May 14 13:50 idxf3.dat
-rw-rw-r-- 1 uvadm users 3072 May 14 13:50 idxf3.idx
#2. -rw-rw-r-- 1 uvadm users 1148 May 14 13:50 idxf3v60.dat
-rw-rw-r-- 1 uvadm users 3072 May 14 13:50 idxf3v60.idx
#3. -rw-rw-r-- 1 uvadm users 1148 May 14 13:50 idxf3v60y4.dat
-rw-rw-r-- 1 uvadm users 3072 May 14 13:50 idxf3v60y4.idx
#4. -rw-rw-r-- 1 uvadm users 1920 May 14 13:50 idxf3x1
#5. -rw-rw-r-- 1 uvadm users 892 May 14 13:50 idxf3v60x1
#6. -rw-rw-r-- 1 uvadm users 892 May 14 13:50 idxf3v60x1y4
#1. -rw-rw-r-- 1 uvadm users 4864 May 14 15:26 idxf8.dat
#2. -rw-rw-r-- 1 uvadm users 4112 May 14 15:26 idxf8v60.dat
#3. -rw-rw-r-- 1 uvadm users 4112 May 14 15:26 idxf8v60y4.dat
#4. -rw-rw-r-- 1 uvadm users 1764 May 14 15:26 idxf8x1
#5. -rw-rw-r-- 1 uvadm users 892 May 14 15:26 idxf8v60x1
#6. -rw-rw-r-- 1 uvadm users 892 May 14 15:26 idxf8v60x1y4
| Note |
|
Please see 'uvhd' of IDXF3v60 on page 'J2' & IDXf8v60 on page 'J3'.
Please see uvcopy6.htm for IDXf3/IDXf8 test/demos (similar to the above), but for 'uxcopy' vs 'uxcp'.
Goto: Begin this document , End this document , UVSI Home-Page
RDW (Record Descriptor Word) variable length files are often used to FTP variable length EBCDIC files from the mainframe to unix/linux/windows systems.
uvcp provides for the following types of RDW files:
| RDWz4 |
|
| RDWz2 |
|
| RDWz8 |
|
| RDWn4 |
|
| dat1/testLST |
|
| dat1/testRDW |
|
| dat1/testRDWe |
|
We will illustrate how to convert RDW EBCDIC files using both 'uvcp' & 'uvhd'.
You could use 'uvhd' when there you only have a few files to do,& when the interactive utility is preferred.
You could use 'uvcp' when you want to write a script to convert several files and for repeatability.
Note that neither of uvhd or uvcp can be used for files with packed or binary fields. For those please see DATAcnv1.htm to generate data conversion jobs that preserve packed & binary fields as defined by COBOL copybook record layouts. For high volume conversions of files with packed/binary fields see MVSDATA.htm or VSEDATA.htm.
We will 1st investigate the testRDWe file using 'uvhd'. We can not use unix tools (vi, lp, etc) since the file is EBCDIC & contains binary record sizes.
Goto: Begin this document , End this document , UVSI Home-Page
uvhd dat1/testRDWe as3 <-- examine the RDW test file
====================== - option 'a' translates character line to ASCII
- option 's3' to space between scale & 3 line groups
10 20 30 40 50 60
r# 1 0123456789012345678901234567890123456789012345678901234567890123
0 ....DELL00 - Dell Inc. ....HP0000 - Hewlett Packard....IBM000 -
0100CCDDFF464C8994C984440100CDFFFF464C8A98AA4D8898980200CCDFFF46
080045330000045330953B000C008700000008563533071321940C0092400000
64 International Business Machines....MFC000 - Micro Focus COBOL
4C9A8998A899894CAA898AA4D888898A0200DCCFFF464D88994C98AA4CDCDD44
0953595139651302429552204138955200004630000004939606634203626300
128 ....MS0000 - Microsoft Corp.....REDHAT - Red Hat Linux ....SUN0
0100DEFFFF464D8899A98A4C99940100DCCCCE464D884C8A4D89AA440200EEDF
0C0042000000049396266303697B0C0095481300095408130395470004002450
192 00 - Sun Microsystems Ltd ....UVSI00 - UV Software Inc.
FF464EA94D8899AAAA89A4DA84440200EEECFF464EE4E98AA8984C984444
00000245049396282354203340000000452900000450266361950953B000
The entire file is only 252 bytes & contains 8 short variable length records:
Option 'z' tells uvhd to look for the 'RDW' record prefixes & show 1 record at a time (vs multiple records as fits in a 256 byte block). The default is to show any file in 256 byte blocks (4 groups of 3 64 byte lines for characters, zones,& digits).
See the next page where we will specify option 'z' to show RDW files 1 record at a time. You can press enter to browse forward until EOF reached. Then you could enter '1' to return to the begining of the file.
Goto: Begin this document , End this document , UVSI Home-Page
uvhd dat1/testRDWe z4a <-- display RDW file using option 'z4'
====================== - option 'a' to display character line in ASCII
- null entries browse forward til EOF reached
10 20 30 40 50 60
r# 1 0123456789012345678901234567890123456789012345678901234567890123
0 ....DELL10 - Dell Inc.
0100CCDDFF464C8994C98444
080045331000045330953B00
10 20 30 40 50 60
r# 2 0123456789012345678901234567890123456789012345678901234567890123
24 ....HP0010 - Hewlett Packard
0100CDFFFF464C8A98AA4D889898
0C00870010000856353307132194
10 20 30 40 50 60
r# 3 0123456789012345678901234567890123456789012345678901234567890123
52 ....IBM010 - International Business Machines
0200CCDFFF464C9A8998A899894CAA898AA4D888898A
0C009240100009535951396513024295522041389552
10 20 30 40 50 60
r# 4 0123456789012345678901234567890123456789012345678901234567890123
96 ....MFC010 - Micro Focus COBOL
0200DCCFFF464D88994C98AA4CDCDD44
00004630100004939606634203626300
10 20 30 40 50 60
r# 5 0123456789012345678901234567890123456789012345678901234567890123
128 ....MS0010 - Microsoft Corp.
0100DEFFFF464D8899A98A4C9994
0C0042001000049396266303697B
10 20 30 40 50 60
r# 6 0123456789012345678901234567890123456789012345678901234567890123
156 ....REDH10 - Red Hat Linux
0100DCCCFF464D884C8A4D89AA44
0C00954810000954081303954700
10 20 30 40 50 60
r# 7 0123456789012345678901234567890123456789012345678901234567890123
184 ....SUN010 - Sun Microsystems Ltd
0200EEDFFF464EA94D8899AAAA89A4DA8444
040024501000024504939628235420334000
10 20 30 40 50 60
r# 8 0123456789012345678901234567890123456789012345678901234567890123
220 ....UVSI10 - UV Software Inc.
0200EEECFF464EE4E98AA8984C984444
0000452910000450266361950953B000
| Note |
|
Goto: Begin this document , End this document , UVSI Home-Page
On this page we will show you how to convert EBCDIC RDWz4 files to ASCII text using 'uvhd'. On the next page we will do the same with 'uvcp'.
We will specify uvhd options 'z4a3p4y7' which mean:
| z4 |
|
| a3 |
|
| a1 |
|
| a2 |
|
| p4 |
|
| y7 |
|
| y1 |
|
| y2 |
|
| y4 |
|
uvhd dat1/testRDWe z4a3p4y7 <-- display 1st record & wait for command ===========================
10 20 30 40 50 60
r# 1 0123456789012345678901234567890123456789012345678901234567890123
0 ....DELL10 - Dell Inc.
0100CCDDFF464C8994C98444
080045331000045330953B00
---> w99999 <-- write all records (8) to tmp/testRDWe_yymmdd_hhmmssW
- output filename will be date/time stamped
- On Dec 18, 20007 at 12:15 tmp/testRDWe_071218_121500W
---> q <--- quit uvhd
vi tmp/testRDWe_071218_121500W ============================== vi tmp/*00W <-- shortcut to display desired file ===========
DELL00 - Dell Inc.
HP0000 - Hewlett Packard
IBM000 - International Business Machines
MFC000 - Micro Focus COBOL
MS0000 - Microsoft Corp.
REDHAT - Red Hat Linux
SUN000 - Sun Microsystems Ltd
UVSI00 - UV Software Inc.
Goto: Begin this document , End this document , UVSI Home-Page
We will now use 'uvcp' to perform the conversion from EBCDIC RDWz4 to ASCII.
Instead of variable length text, we will create fixed length output records that are required for most COBOL input files. For this demo, we will convert to fixed 64 byte records & insert a LineFeed in the last byte so we can have it both ways (fixed length for COBOL, but LFs allow investigation with vi).
uvcp "fili1=dat1/testRDWe,rcs=64,typ=RDWz4,filo1=tmp/testz4,typ=RST,tra=0(64)" ==============================================================================
| tra=0(64) |
|
| typ=RST |
|
uvhd tmp/testz4 r64h2 <-- display output file with uvhd
===================== - option r64 for record size
- option 'h2' for hex display to see LineFeed
- only 1st record shown below
10 20 30 40 50 60
r# 1 0123456789012345678901234567890123456789012345678901234567890123
0 DELL10 - Dell Inc. .
4444332224666246622222222222222222222222222222222222222222222220
45CC100D045CC09E3E000000000000000000000000000000000000000000000A
| Note |
|
Goto: Begin this document , End this document , UVSI Home-Page
This page is similar to the previous page, but for typ=RDWz2 (2 byte prefixes) vs RDWz4 (4 byte prefixes). We will use uvhd to show the 1st 2 input records, then the 'uvcp' command with 'typ=RDWz2',& then the 1st 2 output records (with binary record length prefix stripped & blank filled to 64 bytes).
uvhd dat1/testRDWez2 z2a <-- display RDW file, option z2 for 2 byte hdrs ======================== - option 'a' to translate char line to Ascii
10 20 30 40 50 60
r# 1 0123456789012345678901234567890123456789012345678901234567890123
0 ..DELL10 - Dell Inc.
01CCDDFF464C8994C98444
0445331000045330953B00
10 20 30 40 50 60
r# 2 0123456789012345678901234567890123456789012345678901234567890123
22 ..HP0010 - Hewlett Packard
01CDFFFF464C8A98AA4D889898
08870010000856353307132194
| Note |
|
uvcp "fili1=dat1/testRDWez2,rcs=64,typ=RDWz2,filo1=tmp/testz2,typ=RST,tra=0(64)" ================================================================================
uvhd tmp/testz2 r64h2 <-- display output file with uvhd
===================== - option r64 for record size
- option 'h2' for hex display to see LineFeeds
10 20 30 40 50 60
r# 1 0123456789012345678901234567890123456789012345678901234567890123
0 DELL10 - Dell Inc. .
4444332224666246622222222222222222222222222222222222222222222220
45CC100D045CC09E3E000000000000000000000000000000000000000000000A
10 20 30 40 50 60
r# 2 0123456789012345678901234567890123456789012345678901234567890123
64 HP0010 - Hewlett Packard .
4533332224676677256666762222222222222222222222222222222222222220
8000100D0857C5440013B124000000000000000000000000000000000000000A
Goto: Begin this document , End this document , UVSI Home-Page
logical: mvc, mvn, clr
arithmetic: add, sub, mpy, div, pac, unp
compare/skip: cmc, cmn, skp
scan/replace: rep, scn, sqz
translates: tra, tre, trl, tru
other: anc, orc, chx, hxc, tim
I/O: put
mvc=tobyte(lth)frombyte - move character data field mvn=to(lth)from(lth) - move numeric data field (right adjusted) clr=start(lth):constant - clear an area to a specified value
tra=start(length) - translate to ASCII (from EBCDIC) tre=start(length) - translate to EBCDIC (from ASCII) trl=start(length) - translate to lower case (any upper case) tru=start(length) - translate to UPPER case (any lower case)
add=op1dsp(lth)op2dsp(lth) - add op2 data to op1 data, result in op1 sub=op1dsp(lth)op2dsp(lth) - subtract op2 data from op1, result in op1 mpy=op1dsp(lth)op2dsp(lth) - multiply op2 by op1, result in op1 div=op1dsp(lth)op2dsp(lth) - divide op1 by op2, result in op1 pac=op1dsp(lth)op2dsp(lth) - pack op2 data into op1 area unp=op1dsp(lth)op2dsp(lth) - unpack op2 data into op1 area
anc=start(lth):mask - and character (erase bits) orc=start(lth):mask - or character (add bits)
chx=op1start(lth)op2start - convert op2 hex representation to data in op1 hxc=op1start(lth)op2start - convert op2 data to hex representation in op1
rep=strt(lth):patrn:alt - replace pattern with alternate scn=start(lth):patrn - scan for a pattern, set cc equal if found sqz=start(lth):constant - squeeze out the op2 character from op1
cmc=op1strt(lth)op2strt - compare op1 to op2 & set condition code skp?=n - test condition code & skip n instrns
cmn=op1strt(lth)op2strt(lth) - compare numeric & set condition code
- op1 & op2 may be any combination of
packed, zoned, or binary
put=b0(rcsz) - write current record (exception output)
Goto: Begin this document , End this document , UVSI Home-Page
unp=100(9)20(5) - sample instruction
unpack bytes 21-25 of the input record
into bytes 101-109 of the output record
opcode=op1start(op1lth)op2start(op2lth) - instruction format
receiving-operand <-- sending-operand
unp=b100(9)a20(5) - op1 defaults to outrec & op2 to inrec
- may identify explicitly by alpha prefixes
b100 - 'b' identifies the output record area
w___ - 'w' identifies the 'work' area (misc use)
a20 - 'a' identifies the input record area
w__ - 'w' op2 could specify the work area
h__ - 'b' op2 could specify the outrec area
:________ - ':' identifies a constant
:0x______ - ':0x' identifies a hexadecimal constant
_100 - start bytes are displacements within the area
(the number of bytes preceding the 1st byte)
(or the offset within the area)
(9) - the length of the data field
- startbyte + length cannot exceed area size
- outrec & inrec depend on rcs= parameter
- work area max is 32768 unless increased
by rop=r99999 parameter
:_________ - constant max length is 64 bytes
mvc=200(100)0 - some instructions such as move character
do not require op2 length since it is always
the same as the output length
mvn=100(9za)20(5pe) - instructions such as move numeric allow
field type codes within the length specs
- this example would convert a packed ebcdic
field to a zoned ascii field
mvc=b0(rcsz)a0 <---- this instruction is automatically performed
by uvcp before your 1st instruction is
executed.
clr=b0(rcsz):0x20 - sometimes you may want to clear the outrec
area if you are radically changing the layout
& want to ensure blanks between your fields.
Goto: Begin this document , End this document , UVSI Home-Page
logical: mvc, mvn, clr
arithmetic: add, sub, mpy, div, pac, unp
compare/skip: cmc, cmn, skp
scan/replace: rep, scn, sqz
translates: tra, tre, trl, tru
other: anc, orc, chx, hxc, tim
I/O: put
The following pages will describe each instruction in detail in the sequence listed above.
Note that 'uvsort' provides the same instruction set as this 'uvcp'. The instructions are documented in detail ONLY here in uvcp.doc.
Goto: Begin this document , End this document , UVSI Home-Page
'mvc' is the 1st instruction to be documented (vs prior items that are termed 'functions'). Instructions are validated at setup time and stored in memory for execution on each record cycle (at run time). uvcp allows for 200 instructions.
The move instruction documentation will include detailed description of instruction operands,lengths,etc which will also apply to all instructions following.
mvc=tobyte(length)frombyte - format & examples
mvc=op1dspl(op1lth)op2dsp
mvc=100(30)0 move from 1-30 to 101-130
mvc=b100(30)a0 same with area codes explicit
(op1 defaults to 'b' output record)
(op2 defaults to 'a' input record)
mvc=w0(200)b100 - move bytes 101-200 of the output record
area to bytes 1-200 of the work area
mvc=130(07):updated ':' indicates constant vs frombyte
mvc=137(02):0x0d0a ':0x' indicates hex constant
The following rules apply to most instructions (not just 'mvc')
Goto: Begin this document , End this document , UVSI Home-Page
Option 'u1' allows you to code blanks as underscores, which is convenient because blanks are not allowed in the uvcp command string. The alternative would be to code blanks in hexadecimal (' ' = 0x20). Here are some examples:
Option 'u2' allows you to code commas as at-signs, which is convenient because commas are used to separate commands in the command string and therefore can not be coded as constants.
mvcu1=0(1):_,mvcu2=1(1):@,... ============================= - move a ' ' blank to the 1st byte & a ',' comma to the 2nd byte
mvcu3=0(2):_@,... ================= - move a ' ' blank to the 1st byte & a ',' comma to the 2nd byte - coding a 2 byte constant (vs separate 1 byte constants) - note option u3 = (u1 + u2)
Goto: Begin this document , End this document , UVSI Home-Page
'mvn' will pack, unpack, convert to binary or decimal and convert signs as required depending on data type codes (in the length specification).
mvn=todsp(tolth/typ)fromdsp(fromlth/typ)
mvn=todsp(tolth/typ):constant
mvn=100(9)20(7) - move 21-27 to 101-109
right adjusted, left zero filled
(defaults to zoned ASCII numeric)
mvn=30(-9za)30(9za-) - moves 31-39 input to 31-39 output
shifting sign trailing to leading
'-' present if neg, absent if pos
'+' means + for pos, - for neg
mvn=200(4bs)50(9za) - converts 51-59 from zoned ASCII
to 201-204 binary long word
's' means switch big-end/little-end
mvn=160(5pa):235- - store constant neg 235 in 161-165
packed ASCII (sign in zone)
mvn=80(9za)20(5pe) - unpacks 21-25 into 81-89
21-25 is packed EBCDIC
81-89 is zoned ASCII (zoned sign)
mvn=80(9za)80(9zx) - convert 81-89 zoned type 'x' (see below)
to zoned ASCII numeric
- type 'x' corrects zoned numeric signs
translated from EBCDIC to ASCII
before testing possible zoned signs
(see explanation next page)
Goto: Begin this document , End this document , UVSI Home-Page
1st alpha letter defines the data type
z - zoned numeric (default)
p - packed decimal
b - binary - length should be either 2 or 4 bytes
- usually on a halfword or fullword boundary
2nd alpha letter defines the codeset (or indicates binary switch)
a - ASCII (default)
e - EBCDIC (probably from an mainframe)
s - causes a big-end/little-end switch
when converting data between INTEL chip machines & others
x - ASCII zoned numeric translated from EBCDIC that may have had
signs in the units zone (see explanation below)
separate sign byte codes
'-' sign indicates a separate sign byte (vs zone of units digit)
('-' is coded if negative, else positive is assumed)
'+' sign indicates a separate sign byte, but code '+' for positive
as well as '-' for negative
'-' or '+' in the 1st byte of the length indicates a leading sign byte
else the sign byte will be trailing
Data type code 'x' is 'ASCII zoned numeric translated from EBCDIC'.
data type code 'x' is provided to correct the units position of numeric zoned (unpacked) fields that have been translated from EBCDIC to ASCII without allowing for possible zoned signs.
EBCDIC zone + sign is x'C0', + 0123456789 becomes {ABCDEFGHI
EBCDIC zone - sign is x'D0', - 0123456789 becomes }JKLMNOPQR
Code 'x' converts positive units digits to 0123456789 (numeric zones) but negative units digit depends on whether the uvcp/uvcopy/uvsort utility has been generated with DISAM for Microfocus COBOL or not since conventions are different for Microfocus COBOL & MBP-COBOL(obsolete)
| Microfocus zone |
|
| MBP COBOL zoned |
|
Goto: Begin this document , End this document , UVSI Home-Page
clr=tobyte(lth):constant
clr=tobyte(lth)frombyte
clr=b0(200):0x20 - blank out 1st 200 bytes of the output
record area
clr=b0(200): - may also code like this if this is the
last instrn on the command line or the
last or only instrn on any 1 line of
the parameter file
clr=w0(500):0xff - fill 1st 500 bytes of work area
with hex FF
clr=b100(100)a0 - fill 101-200 of outrec with the
value from byte 1 of inrec
Goto: Begin this document , End this document , UVSI Home-Page
tra=op1dsp(lth)
tra=0(40) - translate 1-40 to ASCII from EBCDIC
- defaults to the output record area
since no alpha prefix on op1
tra=b100(28) - translate 100-128
(possibly bypassing packed fields 40-99 ?)
Here is the complete uvcp command to translate a 152 byte EBCDIC record to ASCII (OK if no packed fields & no zoned signed fields).
uvcp "fili1=infile,typ=LST,rcs=152,filo1=outfile,tra=0(152)" =================================================^^^^^^^^^^=
Option 's' of 'tras' will translate zoned signs from EBCDIC to ASCII for use with Micro Focus COBOL. You could use this to fix the signs in files that have been FTP'd in text mode from the mainframe to unix/linux/windows.
FTP from the mainframe in text mode will automatically translate EBCDIC to ASCII. Most people know that you can't do this if there are any packed or binary fields, but some don't realize that any unpacked signs need to be corrected from the mainframe conventions to Micro Focus COBOL conventions.
In EBCDIC +'0123456789' is '{ABCDEFGHI' (x'C0' thru x'C9')
In EBCDIC -'0123456789' is '}JKLMNOPQR' (x'D0' thru x'D9')
In ASCII +'0123456789' is '0123456789' (x'30' thru x'39') (no diff)
In ASCII -'0123456789' is 'pqrstuvwxy' (x'70' thru x'79')
For example if the file had a zoned signed field in bytes 41-49 (0 rel), then we could use the following uvcp to correct the units zone in byte 49.
uvcp "fili1=infile,typ=LST,rcs=100,filo1=outfile,tras=49(1)" ====================================================^=======
We could also have used 'mvn=41(9za)41(9ze)', but the advantage of 'tras' is that we can correct multiple contiguous signed fields with 1 instruction. For example if we had 12 * 9 byte signed fields in bytes 41-112, we could use:
uvcp "fili1=infile,typ=LST,rcs=154,filo1=outfile,tras=41(112)" ====================================================^=========
The recsize is specified as 154 because FTP text would have added 2 bytes for CR/LF to the original 152 (40 + 112). If we wanted to drop the CR/LF to get back to the original record length of the mainframe file, (so we don't have to change the COBOL programs) we should use the following:
uvcp "fili1=infile,typ=LST,rcs=154,filo1=outfile,tras=41(112),rcs=152,typ=RSF" ====================================================^=========================
Goto: Begin this document , End this document , UVSI Home-Page
tre=op1dsp(lth)
tre=b0(500) - translate the 500 byte output record area
to EBCDIC (from ASCII)
tre=w50(30) - translate bytes 51-80 of the work area
Option 's' of 'tres' will translate zoned signs from ASCII to EBCDIC. You could use this to fix the signs in files that have been FTP'd in text mode from unix/linux/windows back to the mainframe.
Goto: Begin this document , End this document , UVSI Home-Page
trl=op1dsp(lth)
trl=b0(100) - translate bytes 1-100 of the output
record area to lower case
trl=w200(100) - translate bytes 201-300 of the work
area to lower case
tru=op1dsp(lth)
tru=b100(100) - translate 101-200 of the output record
area to UPPER case
tru=w200(100) - translate 201-300 of the work area
area to UPPER case
Goto: Begin this document , End this document , UVSI Home-Page
Add will pack, unpack, convert to binary or decimal, and convert signs as required depending on data type codes (in the length specification).
add=todsp(tolth/typ)fromdsp(fromlth/typ)
add=todsp(tolth/typ):constant
add=100(9)20(7) - add 21-27 to 101-109
& store result in 101-109 (op1)
(defaults to zoned ASCII numeric)
(op1 dflts recout, op2 to recinput)
add=b80(9za)a20(5pe) - adds 21-25(outrec) to 81-89(inrec)
21-25 is packed EBCDIC
81-89 is zoned ASCII (zoned sign)
add=w30(-9za):100 - adds constant 100 to bytes 31-39
in the work area
leading '-' sign if negative
'-' present if neg, absent if pos
'+' means + for pos, - for neg
add=200(4bs)b50(9za) - adds 51-59 to 201-204
51-59 is zoned ASCII in outrec
201-204 is a binary long word
in outrec area (by default)
's' means switch big-end/little-end
on both retrieval & store result
add=160(5pa):235- - adds constant neg 235 to 161-165
161-165 packed ASCII (sign in zone)
------------------ instruction options --------------------
Please note the 'repeat' options which are described further below & that apply to add (& mvn,sub,mpy,div,pac,unp,anc,orc,rep,sqz)
| x99 |
|
| j/k/l |
|
Goto: Begin this document , End this document , UVSI Home-Page
sub=todsp(tolth/typ)fromdsp(fromlth/typ)
sub=todsp(tolth/typ):constant
sub=100(9)20(7) - subtract 21-27 from 101-109
(defaults to zoned ASCII numeric)
op1 defaults to outrec area (h)
op2 defaults to inrec area (r)
sub=w150(-9za):125 - subs constant 125 from work area bytes
151-159 zoned ASCII
with leading '-' sign if negative
| Note |
|
sub=b60(5pa)b65(5pa) - subtract bytes 66-70 from 61-65
skp<=2 - skip next 2 instrns if negative
Goto: Begin this document , End this document , UVSI Home-Page
Multiply will pack, unpack, convert to binary or decimal, and convert signs as required depending on data type codes (in the length specification).
mpy=todsp(tolth/typ)fromdsp(fromlth/typ)
mpy=todsp(tolth/typ):constant
mpy=100(9)20(7) - multiply 101-109 by 21-27
& store result in 101-109 (op1)
(defaults to zoned ASCII numeric)
op1 dflts to recout, op2 to recinput
mpy=b80(9za)a20(5pe) - multiply 81-89 by 21-25
21-25 is packed EBCDIC
81-89 is zoned ASCII (zoned sign)
mpy=w30(-9za):115 - multiply work area bytes 31-39
by constant 115
'-' present if neg, absent if pos
'+' means + for pos, - for neg
mpy=200(4bs)50(9za) - multiply 51-59 by 201-204
51-59 is zoned ASCII
201-204 is a binary long word
's' means switch big-end/little-end
on both retrieval & store result
mpy=160(5pa):235- - mpys 161-165 by constant -235
161-165 packed ASCII (sign in zone)
div=todsp(tolth/typ)fromdsp(fromlth/typ)
div=todsp(tolth/typ):constant
div=100(9)20(7) - divide 101-109 by 21-27
& store result in 101-109 (op1)
(defaults to zoned ASCII numeric)
op1 dflts to recout, op2 to recinput
div=w30(-9za):115 - divide work area bytes 31-39
by constant 115
| Note |
|
Goto: Begin this document , End this document , UVSI Home-Page
pac=op1dsp(op1lth)op2dsp(op2lth)
pac=100(5)50(9) - pack 51-59 into 101-105
| operation |
|
| Note |
|
unp=op1dsp(op1lth)op2dsp(op2lth)
unp=100(9)50(5) - unpack 51-55 into 101-109
| operation |
|
| Note |
|
Goto: Begin this document , End this document , UVSI Home-Page
Perform a logical 'and' on the op1 data with the op2 mask op2 is usually a constant, but could address a data area. Use 'anc' to clear bits in the data that are 0's in the mask.
anc=op1dsp(lth):0xconstant (op2 usually constant)
anc=op1dsp(lth)op2dsp
anc=20(10):0x0f - clear the zones of bytes 21-30
anc=20(10)10 - op2 could be an adrs, but unusual
ancm=20(3):0x0f0c0f - erase 0 bits in the mask of bytes
21-23, option 'm' required to allow
op2 to be more than 1 byte
Perform a logical 'or' on the op1 data with the op2 mask op2 is usually a constant, but could address a data area. Use 'or' to add bits in the data that are 1's in the mask.
orc=op1dsp(lth):0xconstant (op2 usually constant)
orc=20(10):0x30 - set zones of byte 21-30 to 0x30's
orc=20(10)10 - op2 could be an adrs, but unusual
orcm=20(3):0x303040 - set zones of 21-23 to 0x303040
option 'm' required to allow
op2 to be more than 1 byte
Goto: Begin this document , End this document , UVSI Home-Page
chx=0(16)0 - converts the hex representation characters
in the 1st 32 bytes of input record
to true data in the 1st 16 bytes of outrec
sample op2 input = 3132332041424320616263207E5E3E2E
op1 output = 123 ABC abc ~^>.
| Notes |
|
uvcp "fili1=temp1,typ=LST,filo1=binaryctl,typ=RSF,rcs=32,chx=0(16)0"
hxc=0(32)0 - converts the data in the 1st 16 bytes of the
input record to hex representation in the
1st 32 bytes of the output record
sample op2 input = 123 ABC abc ~^>. sample op1 output = 3132332041424320616263207E5E3E2E
| Note |
|
uvcp "fili1=binary,typ=RSF,rcs=16,filo1=hexrep,typ=RST,rcs=33,hxc=0(32)0"
Goto: Begin this document , End this document , UVSI Home-Page
'rep' will scan the op1 area replacing all occurrences of the op2 pattern with the op3 replacement.
The op1 area will be truncated or blank right filled depending on whether The replacement is longer than or shorter than the original pattern.
rep=op1dsp(op1lth):searchpattern:replacementpattern
rep=op1dsp(op1lth)op2dsp(op2lth)op3dsp(op3lth)
rep=op1dsp(op1lth):constant:constant
rep=0(128):AS400:UNIX - search outrec area replacing all
occurrences of 'AS400' with 'UNIX'
rep=b100(200)a10(5)w20(8) - scan outrec 101-200 replacing any
patterns matching 11-15 of inrec
with the data at 21-28 of work area
rep=0(128):0x0a:0x0d0a - scan the outrec area replacing any
line feeds with CR & LF
(demos hex constants id by ':0x')
skp?=nn - may use the skip instrn to test
whether any replacements were made
skp:=1 - skip 1 instrn if any replcmnts made
skp!=2 - skip 2 instrns if no replacements made
Goto: Begin this document , End this document , UVSI Home-Page
Option 'u1' allows you to code blanks as underscores, which is convenient because blanks are not allowed in the uvcp command string. The alternative would be to code blanks in hexadecimal (' ' = 0x20). Here are some examples:
Option 'u2' allows you to code commas as at-signs, which is convenient because commas are used to separate commands in the command string and therefore can not be coded as constants.
repu1=0(1):_:X,repu2=1(1):@:Y,... ================================= - replace any blank ' ' in 1st byte with 'X' - and replace any comma ',' in 2nd byte with 'Y'
repu3=0(2):_@:XY,... ==================== - replace ' ,' (blank+comma) in 1st 2 bytes with 'XY' - note option u3 = (u1 + u2) - not same as above since both conditions must be met
repu3=0(1):_:@,repu3=1(1):@:_,... ================================= - replace any blank ' ' in 1st byte with comma ',' - and replace any comma ',' in 2nd byte with blank ' ' - note option u3 = (u1 + u2)
Goto: Begin this document , End this document , UVSI Home-Page
'scn' searches the op1 area for any occurrence of the data pattern contained in op2 & sets the internal condition code equal if found which may then be tested by a following 'skp' instruction.
scn=op1dsp(op1lth):constant
scn=op1dsp(op1lth):op2dsp(op2lth)
scn=a0(128):comp-3 - scan input record area for pattern
'comp-3' & set cc equal if found
skp!=2 - skip next 2 instrns if not found
Goto: Begin this document , End this document , UVSI Home-Page
sqz=start(length):constant - format
sqz=20(80):0x20 - squeeze all blanks between words
in bytes 21-100 of outrec area
blank filling on the right
(0x20 is an ASCII blank in hex)
sqz=20(80): - can code as character blank if
last keyword on a prmfile line
sqzm=20(80):0x20 - squeeze multiple blanks to 1 blank
between words in op1 (m option)
- see other options described below
sqz=w0(10)w10 - op2 could be an adrs but unusual
- this would squeeze out whatever char
was in byte# 11 of w/s from the 1st
10 bytes of w/s
'sqz' with no options will squeeze all blanks from between the words in the op1 area & blank fill on the right as required
| option f |
|
m - squeezes multiple blanks to 1 blank between the words
b - will convert any characters less than a blank (0x00-0x20)
into a blank so they will then be squeezed
h - will convert any characters greater than '~' (0x7e-0xff)
into a blank so they will then be squeezed
Goto: Begin this document , End this document , UVSI Home-Page
cmc=op1dsp(op1lth)op2dsp - compare op1 to op2 & set cc
cmc=op1dsp(op1lth):constant - compare op1 to a constant
skp?=nn - skip if ? matches internal cc
cmc=0(2):a5 - compare cols 1-2 to constant 'a5'
skp:=1 - if equal skip the next instrn
(':' colon used for equal condition)
cmc=b10(5)w10 - compare bytes 11-15 of outrec area
to bytes 11-15 of the work area
skp>=2 - if > skip the next 2 instrns
--- else fall thru to this instrn
skp.=1 skip (.)unconditionally 1 instrn
---
| Notes |
|
| Note |
|
Goto: Begin this document , End this document , UVSI Home-Page
cmn=op1dsp(op1lth)op2dsp(op2lth) - compare op1 to op2 & set cc
cmn=op1dsp(op1lth):constant - compare op1 to a constant
skp?=nn - skip if ? matches internal cc
cmn=0(8):125 - compare cols 1-8 to constant '125'
- numeric compare rt adjust, left 0 fill
cmn=0(8z)20(5p) - compare cols 1-8 (zoned num default)
to cols 21-25 packed
cmn=20(5p)40(4b) - compare packed 21-25 to binary long 41-44
| Note |
|
Goto: Begin this document , End this document , UVSI Home-Page
put=b0(256) - write the current outrec area data
| Note |
|
| Note |
|
| example |
|
mvn=w0(6p):0 - clear some w/s for accumulation
addx12j0=w0(6p)a100(5) - accumulate the 12 fields & set cc
skp:=1 - test cc & skip next instrn if zero
put=b0(200) - write the record if nonzero
---
Goto: Begin this document , End this document , UVSI Home-Page
The documentation above has described options that apply to specific instructions, but there are some options that apply to entire classes of instructions.
The options described below apply to the following instructions: mvn,add,sub,mpy,div,pac,unp,anc,orc,rep,sqz.
| x99 |
|
| j0/j9 |
|
| k0/k9 |
|
| l0/l9 |
|
addx12=160(5p)100(5p) - adds the 12 5 byte packed fields in 101-160
to the 12 5 byte packed fields in 161-120
addx12j0=w0(4b)160(5p) - adds the 36 5 byte packed fields in 101-280
to the 4 byte binary field in work area w1-w4
- the 'j0' option prevents op1 from being
incremented, to get the cross-foot effect
addx12j10=b40(5p)100(5p) - adds to the 12 x 5 byte packed fields 41-100
from every 2 nd 5 byte field in 101-220
- option 'j10' causes op2 to be incremented
by 10 vs the op2 length of 5
Goto: Begin this document , End this document , UVSI Home-Page
There are 3 working storages which the user may address by prefixing the displacements of the item desired with the letters 'w','x',or 'y'
| w |
|
| x |
|
| y |
|
--------- input file information -----------
| x0(80) |
|
| x80(80) |
|
| x560(80) |
|
| x640(16) |
|
| x656(16) |
|
| x672(28) |
|
| x700(104) |
|
| x804(4) |
|
| x808(4) |
|
| x812(4) |
|
| x816(4) |
|
--------- output file information -----------
| x1000(80) |
|
| x1080(16) |
|
| x1096(16) |
|
| x1112(28) |
|
| x1140(104) |
|
| x1244(4) |
|
| x1248(4) |
|
| x1252(4) |
|
Goto: Begin this document , End this document , UVSI Home-Page
---- system dates & times (begin) ----
| y00(16) |
|
| y16(4) |
|
| y20(20) |
|
---- system dates/times (tim instrn/prgm end) ----
| y40(16) |
|
| y56(4) |
|
| y60(20) |
|
| y80(5) |
|
| y85(5) |
|
| y90(10) |
|
| y100(20) |
|
| y120(20) |
|
| y140(20) |
|
| y160(40) |
|
| y200(100) |
|
| y300(10) |
|
| y310(10) |
|
| y320(10) |
|
| y330(8) |
|
| y338(1) |
|
| y340(8) |
|
Goto: Begin this document , End this document , UVSI Home-Page
'uvcp' is a mini version of the 'uvcopy' utility & is not intended to include all the facilities of that powerful utility.
uvcp was primarily intended to provide at least the functionality of the mainframe DATA utility to assist converting JCL to UNIX scripts.
The uvcp instruction format is restrictive compared to uvcopy because the intention was to allow all instructions to be specified on the command line & not be restricted to a parameter file.
The full featured version (uvcopy) allows a more user friendly format but restricts instructions (vs functions) to the parameter file since their syntax is incompatible with UNIX shell rules.
------------------ example of uvcp instruction format ----------------
unp=100(9)20(5)
mvc=200(60):cannot_have_blanks_equalsigns_commas_in_uvcp_constants
cmc=109(1):0x20 (use hex constants for blanks,equals,etc)
---------------- example of uvcopy instruction formats ----------------
unp 100(9),20(5)
mvc 200(60),'no problem to have blanks, commas, = signs in uvcopy'
cmc 109(1),x'3f' (uvcopy hex constants)
---------------------- restriction summary ---------------------------
1 - no embedded blanks, commas, equal signs in uvcp parameters
- can use hexadecimal constants for these in most cases
- could use underscores to separate words in character constants
2 - uvcp allows for 100 record selects or deletes (sel/del)
3 - uvcp allows for 100 instructions (mvc,mvn,add,sub,etc) but this could be easily changed & the program recompiled
4 - must enclose command line in double quotes if any parenthesis present as on "isk=0(8)" (unix shell restriction)
5 - uvcp has a limited instruction set compared to the OS3 UVCOPY or the UNIX full featured uvcopy
6 - uvcp cannot skip to a label or use index registers as per UVCOPY or uvcopy
Goto: Begin this document , End this document , UVSI Home-Page
| given |
|
01-08=cust#,09=status,10-34=company,35-59=adrs1,60-84=adrs2,
85-109=adrs3,110-116=zip,117-122=telephone(packed),
176-200=contact-name
| required |
|
001-008 = cust# - to be key1
009-009 = status - any 'd' status records to be deleted
010-034 = contact name (from 176-200 of input record)
035-059 = adrs1
060-084 = adrs2 & adrs3 squeezed together
085-093 = zip code - to be key2
094-103 = telephone# unpacked
104-104 = line feed terminator so backup versions
can be easily viewed with a line editor
| solution |
|
# cnvtcm - parameter file for the uvcp utility # - to convert the mainframe EBCDIC customer master file to a # UNIX ASCII 2 key Indexed contact name & address file fili1=/dev/rmt0,typ=RSF,rcs=256 filo1=contacts,typ=ISF,rcs=104,isk1=0(8),isk2=84(9) del=8(1):0xc4 # delete records with EBCDIC 'D' in col 9 mvc=w0(256)a0 # move entire record to the work area tra=w0(256) # translate entire work area to ASCII mvc=0(9)w0 # move cust# & status from w/a to outrec mvc=b9(25)w175 # move contact name from w/a to outrec mvc=b34(25)w35 # move adrs1 from w/a to outrec sqzm=w59(50):0x20 # squeeze adrs2 & adrs3 together in w/a mvc=b59(25)w59 # move combined adrs2+adrs3 to adrs2 out mvc=b84(7)w109 # move zip code from w/a to outrec unp=b93(10)a116(6) # unpack the telephone# orc=b102(1):0x30 # ensure zone of units digit is ASCII numeric mvc=b103:0x0a # insert line feed in last byte of record put=b0(104) # write out the record
After preparing the parameter file with the editor, you may execute it with the command line shown below:
uvcp cnvtcm ===========
Goto: Begin this document , End this document , UVSI Home-Page
The entire record was 1st moved to the work area & translated to ASCII in the work area in order to give us complete flexibility in then reformatting the unpacked data from the work area & the packed data from the record area
This example includes some 'overkill' in order to demonstrate more of the available instructions
'put' is unnecessary since it is automatic unless we use 'skp's.
'clr' is unnecessary since the output record area is automatically cleared before each record is processed.
mvc=b103(1):0x0a
The above instrn to put a line feed in the last byte is not required since typ=ISF,rcs=104 actually writes 105 byte records with LF in last byte. (Indexed files use extra byte as a status byte, changed to x'00' if deleted)
unp=b93(10)a116(6)
orc=b102(1):0x30
The above 2 instrns could be replaced with the 1 'mvn' shown below since mvn ensures zones conform to the data type specified (zoned ASCII)
mvn=b93(10za)a116(6pe)
Goto: Begin this document , End this document , UVSI Home-Page
| given: |
|
| required: |
|
solutions:
(a) uvcp "fili1=/def/rmt0,typ=RSF,rcs=240,filo1=glmaster,typ=ISF,isk1=0(20),
tra=0(60)"
(b) uvcp "fili1=/def/rmt0,typ=RSF,rcs=240,filo1=glmaster,typ=ISF,isk1=0(20),
rcs=240,tra=0(60),mvnx36=60(-10za)60(5pe)"
(c) uvcp "fili1=/def/rmt0,typ=RSF,rcs=240,filo1=glmaster,typ=ISF,isk1=0(20),
rcs=240,tra=0(60),mvnx36=60(4b)60(5pe)"
Notes:
(a) - translates only the gl# & the description (not packed fields)
- you do not need to code 'mvc=0(240)0' before the 'tra' instrn
since uvcp automatically moves the input record to the
output record area before your 1st instrn is executed.
(b) - 'mvn' with repeat option 'x36' converts all 36 packed fields from
5 byte packed EBCDIC to 10 byte zoned ASCII with separate leading
sign byte '-' if negative.
(c) - 'mvn' with repeat option 'x36' converts all 36 packed fields from
5 byte packed EBCDIC to 4 byte binary long integers.
- note that the 's' option to switch from big end to little end
is only required if you were converting binary mainframe fields.
Goto: Begin this document , End this document , UVSI Home-Page
| NOTE |
|
Make script from directory of data files & a command template with patterns to be replaced by current file values. The template may contain the following patterns, which will be replaced by the actual values for the current file:
| FNAME |
|
| TYP |
|
| RSIZE |
|
| FSIZE |
|
| KEYS |
|
| RCOUNT |
|
| DATETIME |
|
The default template is for 'uvcp' (data file copy utility), which will copy all files from the input directory to a 2nd directory, reorganizing indexed files (sequencing active records & dropping deleted records). The default template & a corresponding generated script line might be:
cmnd: uvcopy mkscript,fild1=dat1,filo1=sf/reorg1,filr1=ctlI/ctlfile1
==============================================================
enter script template or null for default --> <-- null for default
dflt: uvcp "fili1=$DIR1/FNAME,typ=TYPl1,rcs=RSIZE,filo1=$DIR2/FNAME #keys=KEYS"
=========================================================================
# sf/reorg1 - created by mkscript 1998/12/17_17:14:03 # - uvcp template as follows: # uvcp "fili1=$DIR1/FNAME,typ=TYPl1,rcs=RSIZE,filo1=$DIR2/FNAME" #keys=KEYS uvcp "fili1=$DIR1/custmas1,typ=RSFl1,rcs=256,filo1=$DIR2/custmas1" #keys= uvcp "fili1=$DIR1/custmas2,typ=ISFl1,rcs=256,filo1=$DIR2/custmas2" #keys=(0,6,60,16) uvcp "fili1=$DIR1/warmas1,typ=RSFl1,rcs=64,filo1=$DIR2/warmas1" #keys= uvcp "fili1=$DIR1/warmas2,typ=ISFl1,rcs=64,filo1=$DIR2/warmas2" #keys=(0,12)
2. vi sf/reorg1 - inspect & modify created script
============
Goto: Begin this document , End this document , UVSI Home-Page
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.
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 document , End this document , UVSI Home-Page
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
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 document , End this document , UVSI Home-Page
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.
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
Goto: Begin this document , End this document , UVSI Home-Page
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 |
|
Goto: Begin this document , End this document , UVSI Home-Page
| uvcpF2L |
|
| uvcpL2F |
|
We will repeat the previous page demo (#3), but using the 'uvcpF2L' script (instead of using the 'uvcp' utility directly).
#1. uvcpF2L dat1/sales1 64
======================
- convert file type from RSF (fixed no LFs) to LSTt (text with LFs)
- record-size must be specified as arg2
#2. vi tmp/sales1 <-- view the output (automatically stored in 'tmp' subdir)
=============
130140 21 940802 IN111001 HAM001 00002{ 0000001 00000002{
130140 21 940802 IN111001 SCR012 00002A 0001001 00002102A
139923 35 950802 IN111002 CHR001 00002B 0002001 00004402B
139923 35 950802 IN111002 TAB013 00002C 0003001 00006902C
The 'custmas1' file records are 256 bytes with name & address in the 1st 120 bytes & 24 * 5 byte packed decimal fields in bytes 120-239. You could use uvcpF2L optional arg3 to clear the packed fields so you could view/print the name & address portion. See the uvhd view of custmas1 on page '2D1'.
#1. uvcpF2L dat1/custmas1 256 'clr=120(136):0x20'
=============================================
#2. vi tmp/custmas1 <-- view output (always left in tmp subdir)
===============
130140 EVERGREEN MOTORS LTD. 1815 BOWEN ROAD NANAIMO BC V9S1H1 250-754-5531 LARRY WRENCH 132588 GEECOE GENERATOR SERVICESUNIT 170 - 2851 SIMPSON RICHMOND BC V6X2R2 604-278-4488 HARRY LIGHT 139923 JOHNSTONE BOILER & TANKS 1250 EAST PENDER STREET VANCOUVER BC V5L1W1 604-320-1845GEORGE BROWN
| Note |
|
Goto: Begin this document , End this document , UVSI Home-Page
#!/bin/ksh
# uvcpF2L - convert datafile from Fixed length format to Line Seqential
# - inserts a LineFeed after the rightmost non-blank character
# to allow mainframe type files to be viewed, printed, etc
# - converts any unprintable characters to '.'s
# - may also enter uvcp commands to move,clear,translate fields
# - also see uvcpL2F (reverse)
# - these scripts simplify datafile type changes (reduce keystrokes)
# - by Owen Townsend, Oct 19,2005
# - copies to tmp subdir & prompts for disposition
# - may enter vi,cat,more, or uvlp12(etc) to print 1st page, or null
# - may then move from tmp to other desired location
#
fpn="$1"; cmd="$3"; # capture filename & optional instrns
fbn=$(basename $fpn); # get file basename (drop directories)
integer rcs="$2"; # capture recsize (ensure numeric)
((rcs2=rcs*2)); # allow output recsize to be twice input
if [[ -f "$fpn" && $rcs -gt 0 ]]; then :
else echo "usage: uvcpF2L filename recsize [mvc=..,clr=..,tra=..,etc]"
echo " ==================================================="
echo " filename not found or recsize unspecified"
echo " "
echo "example1: uvcpF2L dat1/sales1 64"
echo " ======================"
echo " - /home/uvadm/dat1/sales1 is fixlth 64 byte records w no LFs"
echo " "
echo "example2: uvcpF2L dat1/sales0 64 tra=0\(64\)"
echo " =================================="
echo " - dat1/sales0 is EBCDIC no LFs, tra=0\(64\) translates to ASCII"
echo " "
echo "example3: uvcpF2L dat1/custmas1 256 clr=120\(136\):0x20"
echo " =============================================="
echo " - clear packed fields (cols 121-256) so we can vi, etc"
echo "note - any ( & ) must be escaped \( & \) for Korn shell"
exit 1; fi
# verify filesize evenly divisible by recsize
wcc=$(wc -c $fpn)
fs=${wcc:0:8} # extract file-size (1st 8 bytes)
((rem = fs % rcs))
if ((rem)); then
echo "file size $fs not evenly divisible by recsize $rs, remndr=$rem"
exit 2; fi
uvcp "fili1=$fpn,typ=RSF,rcs=$rcs,filo1=tmp/$fbn,typ=LSTtc2d3,rcs=$rcs2,$cmd"
#============================================================================
#note - output file typ option 'c2' converts any unprintable chars to '.'s
echo "$fpn converted to tmp/$fbn"
echo "enter command: vi,cat,more, or uvlp12,14,18,etc (1st page only)"
echo "- or null & then move file from tmp/$fbn to another desired location"
read reply
if [[ "$reply" == uvlp* ]]; then $reply tmp/$fbn e1
elif [[ -n "$reply" ]]; then $reply tmp/$fbn
fi
exit 0
Goto: Begin this document , End this document , UVSI Home-Page
#!/bin/ksh
# uvcpL2F - convert datafile from Line Seqential to Fixed length records
# - for COBOL programs that require fixed size records
# - might use to remove the CR/LF inserted by FTP in text mode
# - may also enter uvcp commands to move,clear,translate fields
# - also see uvcpF2L (reverse)
# - these scripts simplify datafile type changes (reduce keystrokes)
# - by Owen Townsend, Oct 19,2005
#
# - copies to tmp subdir & prompts for disposition
# - may enter uvhd to display records (without LineFeeds)
# - may then move from tmp to other desired location
# - input record size is determined by the terminating LineFeed
# - input records may be up to 2 times the size specified for output
# - input record data will be truncated if greater than out size specified
#
fpn="$1"; rcs="$2"; cmd="$3"; # capture filename, recsize,& optional instrn
fbn=$(basename $fpn) # get file basename (drop directories)
#
if [[ ! -f "$fpn" || -z "$rcs" ]]; then
echo "usage: uvcpL2F filename recsize [mvc=..,clr=..,tra=..,etc]"
echo " ==================================================="
echo " filename not found or recsize unspecified"
echo " "
echo "example1: uvcpL2F dat1/custupdts 80"
echo " ========================="
echo " - convert dat1/custupdts text file to fixlth 80 bytes no LFs"
echo " - for input to COBOL update that demands fixlth no LFs"
echo " "
echo "example2: uvcpL2F ar/custupdts 80 mvc=79\(1\):x'0A'"
echo " ========================================"
echo " - convert text file to fixlth 80 with LF in byte 79 (col 80)"
echo " - do this when col 80 is unused by COBOL, so you can use vi"
echo "note - any ( & ) must be escaped \( & \) for Korn shell"
exit 1; fi
#
# allow input records to be up to 2 times the specified output size
((rcsi = rcs * 2))
#
uvcp "fili1=$fpn,typ=LSTt,rcs=$rcsi,filo1=tmp/$fbn,typ=RSF,rcs=$rcs,$cmd"
#========================================================================
#
echo "$fpn converted to tmp/$fbn"
echo "enter command: (uvhd is recommended when no LineFeeds)"
echo "- or null & then move tmp/$fbn to another desired location"
read reply
if [[ "$reply" == "uvhd" ]]; then uvhd tmp/$fbn r$rcs
elif [[ -n "$reply" ]]; then $reply tmp/$fbn
fi
exit 0
Goto: Begin this document , End this document , UVSI Home-Page