Download SELCOPY Manual

Transcript
EXAMPLES
Match 2 Files out of Sequence ***
Example 8 - VSAM Dump/Restore
First, let us consider Dumping the VSAM file to tape. Because VSAM's KSDS and ESDS records may be of any length between 1
and the defined maximum, they are treated by SELCOPY as Undefined length input records (RECFM=U).
However, writing such records to tape would mean that they would be unblocked, which is rather wasteful, so we must change the
RECFM on output to Variable Blocked, which will be much more efficient.
SELCOPY will generate the necessary 4 bytes of RDW (Record Descriptor Word) in front of each record.
MVS users may omit RECFM and BLKSIZE on SELCOPY control cards, but they must then be coded on the DD card for the tape
in the JCL instead.
READ ABC KSDS
* The VSAM input file.
WRITE TAPE10 RECFM=V @b2 BLKSIZE=32000
Now let us consider Restoring the same file from tape, back to a VSAM file.
If this is a file of some importance, it is unlikely that it would have been defined as REUSABLE. It is therefore necessary to erase
and re-DEFINE it before the Restore operation. If you forget to do this, your restored data will simply be appended on the end of
any existing data. In the case of a KSDS, probably all records will have a key sequence error and you will notice immediately, but
for ESDS and RRDS it will all look satisfactory, but you would have doubled your data.
On the Restore, SELCOPY will strip off the 4 byte RDW from each input record before passing it to VSAM.
VSE users will probably need the BLKSIZE parameter on the input card as it is so large, and probably exceeds their installation
standard (in CBLNAME).
READ TAPE10
WR ABC @b2 KSDS
* RECFM=V BLKSIZE=32000 needed for VSE.
A Few Words of Caution:
Never trust any Back-up job suite until you have used the Restore part of it and proved it to your
*** FULL SATISFACTION ***
In order to put a little interest into this otherwise very boring example, let us consider that on the restore the user requires to zeroise
every Packed Decimal field in every record.
Very conveniently, these are all together from positions 5 to 2626 inclusive, but very inconveniently, they all vary in size.
The job then becomes:
read TAPE10
* RECFM=V BLKSIZE=32000 needed for VSE.
@BEG = 4
* Start position for loop.
==LOOP==
if p @BEG,2616
ones x'0c'
ptr @END
* Scan for X'nC' or X'nD'.
t p @BEG,@END-1 =
x'00'
pad x'00' * Set to X'00' except last byte.
t p @END
=
x'0c'
* Zero in sign pos.
t
@BEG = @END+1
* Start scan from next pos.
t goto LOOP
write ABC
ksds
A much more sophisticated VSAM Back-Up example follows:
Back-Up 6 VSAM Files to 1 Tape File
Problem:
Back-up 6 small VSAM files to a single tape volume without the usual multi-file volume difficulties and dangers.
Solution:
Use SELCOPY to prefix a one-byte file identifier to each record and write all files to the same tape file, one after the
other.
Write RECFM=V output, blocked to device capacity, 32760. The overhead of 5 bytes for each record (4 for RDW and 1
for File Id) is more than compensated by the large blocksize. Use of NORDW on the restore suppresses the RDW from
the input area.
Omitting JCL for defining files, the SELCOPY control cards are below.
Notes:
SELCOPY treats lower case as upper case unless in 'quotes', the Exclamation Mark is a Line End Character, and valid
abbreviations used are:
rd
2015-03-03 11:16:07
read
w
worklen
fr
from
l
SELCOPY Manual
lrecl
b
blksize
t
then
319