How do I find corrupted records in physical files?
The CL source program provided below can help you find damage records in physical files, but does not support other files.
File Types in the system, such as/qcnt and/qopt. Other types of objects on OS/400 are not supported.
If your OS version is earlier than r420, the program requires a logical file to support:
/**********************************/
R record pfile (qsys/qadbxref)
Dbxfil
Dbxlib
Dbxrecognition
Dbxrdl
K dbxlib
K dbxfil
/**********************************/
The following is the CL source program, which can be run by compiling the program into executable code.
**************************************** ******************************
** Note :------------------------------------------------------**
** Do not run this program on the production machine !! Please perform a full test on the testing machine before running it !! -**
**************************************** ******************************
/* Accept two parameters, the range of libraries to be scanned -----*/
/* Do not forget to check files starting with $ ,@,#---------------*/
/* If you want to scan everything, start with $ and ----------------*/
/* End with z999999999 ---------------------------------------------*/
/* Warning:-a small spooled file will be created for each ----------*/
/* File tested. If no errors are found, the spool * // * file is empty .*/
PGM parm (& start & End)
/* Library to start --------------------------------------------*/
Dcl var (& START) type (* char) Len (10)
/* Library to stop after --------------------------------------------*/
Dcl var (& End) type (* char) Len (10)
Dcl var (& nbrrcds) type (* dec) Len (6)
Dclf file (checklf) alwnull (* yes)
Chgjob log (4 30 * seclvl) logclpgm (* No)
Ovrprtf file (* prtf) Hold (* yes)
/* Position in the file to the partial key library name ------------*/
Ovrdbf file (checklf) position (* keyae 1 record + & START) opnscope (* job)
RCF: rcvf
Monmsg msgid (cpf0864) exec (goto cmdlbl (endp ))
Chgvar VAR (& nbrrcds) value (32000/& dbxrdl)
Ovrdbf file (& dbxfil) opnscope (* job) seqonly (* Yes + & nbrrcds)
If cond (& dbxlib> & End) Then (goto cmdlbl (endp ))
If cond (& dbxrecognition = 'pf '│ & dbxrecognition = 'tb') Then (DO)
If cond (& dbxrdl> 4) Then (DO)
Cpyf fromfile (& dbxlib/& dbxfil) tofile (* print) +
Frommbr (* All) fromrcd (1) incchar (* RCD 1 + * EQ '[-')
Monmsg msgid (cpf0000)
Enddo
Enddo
Dltovr file (& dbxfil)
Goto cmdlbl (RCF)
Endp:
Endpgm