IAMRECVR — RECOVER Command
RECOVER Command
The RECOVER command is used to read an IAM data set, which may be damaged or corrupted, and copy the records the utility is able to read into another data set. Any errors encountered reading the input IAM data set will be reported on, and may result in the loss of some data records if the errors cause some of the records to be unreadable. The output data set can be a sequential data set, an IAM data set, a VSAM cluster, or a combination of sequential and IAM or VSAM. While there are several choices for the type of output data set, We recommend using only a sequential output data set. The sequential data set can then be copied into an IAM or VSAM data set using IDCAMS REPRO.
The RECOVER command may not detect some errors, particularly if they occur within the overflow control information or extended index areas. Such errors may result in being unable to open the IAM data set through normal programs. IAMRECVR does not rely on that information to open or read the data set. The RECOVER will still work and be valid, even though no errors were detected within the data blocks.
If the input IAM data set has records in Extended Overflow, or for Compatible format files in Independent Overflow, the output file will have to be sorted. The RECOVER command can automatically invoke the SORT, and it is highly recommended that the SORT be done by IAMRECVR. You will need to provide IAMRECVR with sufficient SORT work space based on the size of the file that is being recovered.
For some good examples of procedures to follow when recovering IAM data sets, be sure to read Recovering IAM Datasets of the manual, Recovering IAM Data Sets. A full explanation of how to use the RECOVER command is provided there, along with several examples.
IAMRECVR Recover Command Operands
[AUDIT= cccccc ] [,BLKSIZE= nnnnn ]
[,COMPRESSED] [,DUPLICATES= cccccc ]
[,FROMDDNAME= ddname ] [,IAMDDNAME= ddname ]
[,KEEPRRN ] [,KEYLEN= nnn ]
[,LOGDDNAME= ddname ] [,LRECL= nnnnn ]
[,MAXBLKS= n...n ] [,NOPRIMESORT]
[,OUTPUTFILES= cccc ] [,OVERFLOW= nnnnn ]
[,PRTLENGTH=nnnnn ] [,RKP= nnnn ]
[,SORT= ccccc ] [,SORTCORE= n...n ]
[,SORTMSG= cc ] [,SORTPFX= cccc ]
[,SPANDDNAME= ddname ] [,TODDNAME= ddname ]
[,VARIABLE ] [,VSAMDDNAME= ddname ]
Recover Command Operands
Operand | Description |
AUDIT= | Defines the audit trail requirements for duplicate records processed by the RECOVER command if SORT=IFREQ or SORT=YES and DUPLICATE= APPLY or if DUPLICATE= PRINT or DUPLICATE=LOG are specified. KEY - Print the key from the data record. The default is KEY. |
BLKSIZE= | Specifies the actual block size of the IAM file. This value can be obtained from the run time statistics or a LIST command. |
COMPRESSED | Identifies the file as containing compressed records. |
DUPLICATES= | Defines the processing requirements for any duplicate records processed by the RECOVER command if SORT=IFREQ or SORT=YES is specified. APPLY - Update the IAM file being created with the duplicate records. Ignored unless 'OUTPUTFILES=IAM' or 'OUTPUTFILES=BOTH' is specified. IGNORE - Ignore duplicate records. LOG - Create a log data set of any duplicate records. This data set may later be used as input the 'APPLY' command. PRINT - Print any duplicate records. The default is PRINT. |
FROMDDNAME= | Defines the DDNAME of the IAM file that is to be recovered. The default is DISKIN. |
IAMDDNAME= | Defines the DDNAME of the IAM file that is to be created when OUTPUTFILES=IAM or BOTH is specified. The default is DISKOUT. NOTE: For Compatible format files, IAMRECVR will use the native IAM interface. For Enhanced format files, IAMRECVR uses the IAM VIF interface, so the file will have to be defined prior to running the RECOVER. |
KEEPRRN | For RRDS data sets, specifies that the Relative Record Number (RRN) will be included with the data for each record that is written to the output file. When specified on the RECOVER control card include the RRDS keyword on the subsequent APPLY command for the record number to be used when recovering the data set. |
KEYLEN= | Specifies the length of the key within the data records in the IAM file. This value can be obtained from the run time statistics or a LIST command. NOTE: This value is ignored unless the IAM control record is destroyed, at which time it is required. |
LOGDDNAME= | Defines the DDNAME of the log file to be created. The default is LOG. |
LRECL= | Specifies the logical record length of the data records in the IAM file. This value can be obtained from the run time statistics or a LIST command. NOTE: This value is ignored unless the IAM control record is destroyed, at which time it is required. |
MAXBLKS= | Specifies the number of data blocks in the IAM file. This value can be obtained from the run time statistics or a 'LIST' command. NOTE: This value is ignored unless the IAM control record is destroyed, at which time it is required. |
NOPRIMESORT | Useful when large IAM files contains records in overflow, which normally requires a sort of all records. If the IAM file is very large, it may be difficult to obtain enough SORTWORK space for this. Since all records in the IAM Prime Data Area are in sorted order, the only records that need to be sorted are in Extended Overflow. This option causes two sequential output files to be created – one containing the records from the Prime Data Area and the other containing the sorted records from Extended Overflow. Once the records from the Prime Data Area have been reloaded into the new IAM file, the sorted records from Extended Overflow can be added back via REPRO REUSE or by using the APPLY command of IAMRECVR. |
OUTPUTFILES= | Defines the output requirements for the RECOVER subcommand. Valid values are: BOTH - Create both an IAM file and a sequential copy. BOTHV - Create both an IAM file (using the VSAM interface) or a VSAM file, and a sequential copy. IAM - Create only an IAM file. SEQ - Create only a sequential copy of the recoverable data remaining in the IAM file. VSAM - Create an IAM file (using the VSAM interface) or a VSAM file. The default is SEQ. |
OVERFLOW= | Specifies the number of Independent Overflow blocks in the IAM file. This value can be obtained from the run time statistics or a LIST command. NOTE: This value is ignored unless the IAM control record is destroyed, at which time it is required. |
PRTLENGTH= | Limit the amount of data printed for each block to this value or the length of block, which ever is smaller. The default is 32768. |
RKP= | Specifies the relative location of the key within a data record in the IAM file. This value can be obtained from the run time statistics or a LIST command. NOTE: This value is ignored unless the IAM control record is destroyed, at which time it is required. |
SORT= | Defines the output sorting requirements for the RECOVER command. Valid values are: IFREQ - Sort the records only if sequence checks are encountered in the file. NO - Do not sort the records. YES - Sort the records. The default is NO. |
SORTCORE= | Specifies the amount of storage the program SORT is to use if external sorting is required. The number maybe from 10000 to 8000000 inclusive. The default is 100000. |
SORTMSG= | Specifies the message option to be used by the program SORT if external sorting is required. AC - All messages to the console AP - All messages to the printer (SYSOUT) CC - Critical messages to the console CP - Critical messages to the printer NO - No messages to be produced PC - Critical messages to both console and printer The default is CC. |
SORTPFX= | Specifies the DDNAME prefix to be used by the program SORT if external sorting is required. If the string specified is less than 4 characters, a dollar sign ($) fill character will be used. The default is SORT. |
SPANDDNAME= | Defines the DDNAME of the sequential output data set created during recovery that contains the spanned records. The default is SPANOUT. |
TODDNAME= | Defines the DDNAME of the sequential output data set created during recovery. The default is TAPEOUT. |
VARIABLE | Identifies the IAM file as having variable length records. |
VSAMDDNAME= | Defines the DDNAME of the IAM or VSAM file to be created when OUTPUTFILES=VSAM or BOTHV is specified. The default is VSAMOUT. |
EXAMPLE A: Recover
The example below shows a basic RECOVER operation to a sequential data set. Subsequent to the RECOVER, the sequential data would be copied into an IAM data set using an IDCAMS REPRO. While it is rare that there will be duplicate records, they do occur on occasion. To save time when such a circumstance occurs, the example below includes logging the duplicate records to a LOG data set. Such a situation does not necessarily indicate a problem with the data set. If a record had to be moved from the block it was in into an overflow block, the overflow block is always immediately rewritten out to the data set. At a subsequent point in time, the original data block is rewritten with the record deleted. So, there is an opportunity for a record with the same key to be duplicated in the data set. IAM is able to handle this circumstance, and return the proper record. If there are duplicates, refer to Section 10.87, Recovering IAM Data Sets for complete instructions and examples of recovering files from that situation.
Example of Running a Recover (EX4509A)
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT-*
//DISKIN DD DISP=OLD,DSN=my.iam.cluster
//TAPEOUT DD DSN=my.seq.dataset,DISP=(,CATLG),
// UNIT=SYSDA,SPACE=(CYL,(20,10))
//LOG DD DSN=my.duprec.dataset,DISP=(,CATLG),
// UNIT=SYSDA,SPACE=(CYL,(2,1))
//SORTWK01 DD UNIT=SYSDA,SPACE=(CYL,(20,10))
//SORTWK02 DD UNIT=SYSDA,SPACE=(CYL,(20,10))
//SORTWK03 DD UNIT=SYSDA,SPACE=(CYL,(20,10))
//$ORTPARM DD * --> Use for SyncSort
EQUALS
/*
//DFSPARM DD * --> Use for DFSORT
EQUALS
/*
//SYSIN DD *
RECOVER DUP=LOG
/*
Example B: Recover
The example below shows a RECOVER using the NOPRIMESORT option which causes two output files to be created, one containing all the records from the Prime Data Area and the other containing all records from Extended Overflow.
Example of using NOPRIMESORT (EX4509B)
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//DISKIN DD DISP=SHR,DSN=my.iam.dataset
//TAPEOUT DD DSN=&&SEQOUT,DISP=(,PASS),SPACE=(CYL,(100,50)),
// UNIT=SYSDA
//OVERFLOW DD DSN=&&OVOUT,DISP=(,PASS),SPACE=(CYL,(100,50)),
// UNIT=SYSDA
//SORTWK01 DD SPACE=(CYL,(10)),UNIT=SYSDA
//SORTWK02 DD SPACE=(CYL,(10)),UNIT=SYSDA
//SORTWK03 DD SPACE=(CYL,(10)),UNIT=SYSDA
//SYSIN DD *
RECOVER NOPRIMESORT
/*
//*****************************************************************
//* RELOAD IAM FILE WITH RECORDS FROM PRIMARY OUTPUT FILE
//*****************************************************************
//RELOAD EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//IAMFILE DD DISP=SHR,DSN=my.iam.file
//INPUT DD DISP=(OLD,DELETE,DELETE),DSN=&&SEQOUT
//SYSIN DD *
REPRO INFILE(INPUT) OUTFILE(IAMFILE) REUSE
/*
//*****************************************************************
//* ADD RECORDS FROM OVERFLOW BACK TO NEW IAM FILE
//*****************************************************************
//INSERTOV EXEC PGM=IAMRECVR
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//VSAMOUT DD DISP=SHR,DSN=IAMV.KSD428P.CLUSTER
//OVERFLOW DD DSN=&&OVOUT,DISP=(OLD,DELETE,DELETE)
//SYSIN DD *
APPLY LOGDDNAME=OVERFLOW
/*