Copy Records from a Non-VSAM Data Set into an Entry-Sequenced VSAM Cluster, Then Print the Records: Example 4
The first 15 records from a non-VSAM data set, EXAMPLE.NONVSAM,
are copied into an entry-sequenced cluster, KRL.EXAMPLE.ESDS1. If
the records are copied correctly, the cluster's records are printed
in hexadecimal format. If the records are not copied correctly, the
non-VSAM data set's first 15 records are printed in character format.
//PRINT2 JOB ...
//STEP1 EXEC PGM=IDCAMS
//VSDSET2 DD DSNAME=KRL.EXAMPLE.ESDS1,DISP=OLD
//SYSPRINT DD SYSOUT=A
//SYSIN DD *
REPRO -
INDATASET(EXAMPLE.NONVSAM) -
OUTFILE(VSDSET2) -
COUNT(15)
IF LASTCC = 0 -
THEN -
PRINT -
INFILE(VSDSET2) -
HEX
PRINT -
INDATASET(EXAMPLE.NONVSAM) -
COUNT(15) -
CHARACTER
/*
Job control language statement:
- VSDSET2 DD identifies the entry-sequenced VSAM cluster, KRL.EXAMPLE.ESDS1, that the records are copied into.
Hint: If the AMP=(BUFND=n) parameter were specified, performance would improve when the data set's records were accessed. In this example, the BUFND default is taken because only 15 records are being processed.
The REPRO command copies the first 15 records from the source data
set, EXAMPLE.NONVSAM, into the target entry-sequenced cluster, KRL.EXAMPLE.ESDS1.
Its parameters are:
- INDATASET identifies the source data set, EXAMPLE.NONVSAM.
- OUTFILE points to the VSDSET2 DD statement. The VSDSET2 DD statement identifies the output data set, KRL.EXAMPLE.ESDS1.
- COUNT specifies that 15 records are to be copied. Because the SKIP parameter was not specified, access method services assumes the first 15 records are to be copied. The records are always added after the last record in the output data set.
The IF ... THEN command sequence verifies that the REPRO command completed successfully before the first PRINT command runs.
The IF ... THEN command sequence ends with the HEX parameter because no continuation character follows this parameter. If you want two or more access method services commands to run only when the IF statement is satisfied, enclose the commands in a DO...END command sequence.
The first PRINT command prints the records in the entry-sequenced
cluster, KRL.EXAMPLE.ESDS1. Its parameters are:
- INFILE points to the VSDSET2 DD statement. The VSDSET2 DD statement identifies the cluster, KRL.EXAMPLE.ESDS1.
- HEX specifies that each record is to be printed as a group of
hexadecimal characters. An example of the printed record is shown
in Figure 1. Figure 1. Example of the Printed Record in Hexadecimal
RBA OF RECORD = 0 C2D6E8C5D940404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040 4040404040404040404040404040404040404040
The second PRINT command, which runs even if the REPRO command
was unsuccessful, prints the first 15 records of the non-VSAM data
set, EXAMPLE.NONVSAM. Its parameters are:
- INDATASET identifies the non-VSAM data set, EXAMPLE.NONVSAM.
- COUNT specifies that 15 records are to be printed. Because SKIP was not specified, access method services prints the first 15 records.
- CHARACTER specifies that each record is to be printed as a group of alphanumeric characters. Figure 2 shows an example of the printed record.
Figure 2. Example of
a Printed Alphanumeric Character Record
RECORD SEQUENCE NUMBER - 3
CLARK