|
SELCOPY
Examples Menu
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 read w worklen fr from l lrecl b blksize t then
pr print p pos ty type s stopaft li elseif ti thenif
VSAM is specified throughout for simplicity, but the same principle
works for any file. RECFM, LRECL and BLKSIZE would be needed for VSE,
but not for MVS and CMS as the operating system supplies this, as
does VSAM.
Back-Up
equ LMAX 4000 * Maximum record length.
read F1 ksds into 102 w=LMAX+110 * GS009 DOC *
cat F2 esds * INTO effective on all CAT's.
cat F3 ksds * 2nd char of filename used as identifier.
cat F4 esds
cat F5 rrds
cat F6 vsam * More CAT statements can be added.
move 1 fr fname+1 to 101 * Set File Identifier (2nd char of filename).
lrecl = L+1 * Add 1 to record length of current record.
wr TAPE10 recfm=v b=32760 fr=101
do PRINTIT * Print sample of data backed up.
goto get * GET is implicit label - 1st ctl stmt.
==PRINTIT== * Subrtn only coded for additional info on printer *
if p 6 ne p 101 len 1 * same File Id No?
t p 1 = 'File x --- started.' s 1
t move 1 fr 101 to 6 * Save File Id No.
t space 2 !t pr l 30 * Print file id msg.
if p 101 = '1' !t pr fr 101 ty=b s=3 * Print 1st 3 recs, Both char+hex.
li p 101 = '2' !t pr fr 101 ty=b s=3 * and the same for F2
li p 101 = '3' !t pr fr 101 ty=b s=3 * and F3
li p 101 = '4' !t pr fr 101 ty=b s=3 * etc.
li p 101 = '5' !t pr fr 101 ty=b s=3
li p 101 = '6' !t pr fr 101 ty=b s=3
=ret= * Return to statement following DO PRINTIT.
Restore All Files
rd TAPE10 recfm v nordw blksize=32760
lrecl = L-1 * Reduce record length.
if p 1 = '1' !t wr F1 ksds fr 2
li p 1 = '2' !t wr F2 ksds fr 2
li p 1 = '3' !t wr F3 esds fr 2
li p 1 = '4' !t wr F4 esds fr 2
li p 1 = '5' !t wr F5 rrds fr 2
li p 1 = '6' !t wr F6 vsam fr 2
Restore Just One File
rd TAPE10 recfm v nordw blksize=32760
if p 1 lt '3' !t goto get * GET is implicit label - 1st ctl stmt.
if p 1 gt '3' !t eoj * Force eoj when finished with file 3.
lrecl = L-1
write F3 esds fr 2
|