Back Issues

Checking Files for a Sink Machine

When updating a FOCUS or XFOCUS database on MVS, the sink machine typically abends if it encounters an error with the file. Users of the sink machine then receive a FOC542 error (communication not available) and must determine the cause of the failure. If the cause was the space allocated to the FOCUS files, or the size of the FOCUS files, a dump would show a FOC198, but often a dump is not taken, which can lead to a sink coming back up, only to fail again on the first INCLUDE. Similarly, if the FOCUSSU work file was corrupted, the sink job would fail with the first user access.

It's always possible, of course, that the database was fine before the sink came up, and the crash occurred only after it ran for hours. But, since all uncommitted transactions are lost when a sink crashes, application administrators running critical jobs may wish to take the precaution of running at least basic validity checks on their databases before starting the sink, so that, in the event of an abend, they can check the validity of the files to determine the possible cause before restarting the sink.

To make absolutely certain that all pointers, indexes, etc. are correct, you must check the entire database with ? FILE and/or REBUILD CHECK and possibly also run REBUILD INDEX to reconstruct the index. These can be very lengthy procedures for a large file. Alternatively, you can make a number of quick basic checks without involving inordinate machine resources, by adding a job step in your “start sink” job that only starts it up if no errors are found. This would be adequate if the file(s) were being used only for retrieval, and no additional data maintenance was being done.

The general limits to test, which are illustrated in the CHKSNK example that follows, are the number of extents in use (maximum is 16, so the procedure gives a warning at 14); size of the database (maximum is 512K, so the procedure gives a warning at 512,000), and tests to confirm whether the database was created, or if there is a pointer to an incorrect dataset. Additionally, the procedure always includes a CREATE FILE on FOCUSSU, since it is not a costly step and ensures that the file is never corrupted. The CHKSNK FOCEXEC as coded is totally portable and verifies any files listed in the INPT dataset. Those files must also be allocated to the datasets that will be checked. You can run the procedure interactively and prompt the user for the FOCUS filenames, by issuing:

EX CHKSNK GOTO=STEP0

Sample JCL (the sink machine we are starting will have CAR, EMPLOYEE, JOBFILE, and EDUCFILE under its control):

//FOCUS   EXEC PGM=FOCUS 
//FOCUSSU  DD   DSN=prod.FOCUSSU.FOCUS,DISP=SHR 
//FOCLIB  DD DSN=focus.FOCLIB.LOAD,DISP=SHR 
//ERRORS  DD DSN=focus.ERRORS.DATA,DISP=SHR 
//FOCSTACK DD UNIT=SYSDA,SPACE=(TRK,(5,5)),DISP=NEW 
//SYSOUT   DD SYSOUT=* 
//SYSPRINT DD SYSOUT=* 
//MASTER DD DSN=prod.MASTER.DATA,DISP=SHR 
//       DD DSN=focus.FOCCTL.DATA,DISP=SHR 
//CAR      DD DSN=prod.CAR.FOCUS,DISP=SHR 
//JOBFILE  DD DSN=prod.JOBFILE.BAD.FOCUS,DISP=SHR 
//EMPLOYEE DD DSN=prod.CAR.FOCUS,DISP=SHR 
//EDUCFILE DD DSN=prod.CAR.FOCUS,DISP=SHR 
//FOCEXEC DD DSN=prod.FOCEXEC.DATA,DISP=SHR 
//INPT DD * 
CAR 
EMPLOYEE 
EDUCFILE 
JOBFILE 
/* 
//SYSIN   DD * 
EX CHKSNK 
FIN 
/*       
//HLISNK   EXEC PGM=HLISNK,PARM=' STAT',REGION=64M,COND=(0,EQ,FOCUS)    
   **** This will fail the sink if any warnings occurred. 

The CHKSNK FOCEXEC:

-DEFAULT &GOTO=STEP1 
-GOTO &GOTO 
-STEP0 
-* WHEN RUN INTERACTIVELY, USED TO SPECIFY FILES TO BE CHECKED 
-*   NOTE DEFAULT IS TO SKIP THIS STEP, AS FILE WOULD BE IN JCL 
-*   TO EXECUTE THIS STEP FIRST, EX CHKSNK GOTO=STEP0 
DYNAM ALLOC F INPT SP 1,1 TRACK NEW REU 
-RUN 
-LP 
-PROMPT &DDNAME.A8.ENTER DDNAME TO CHECK OR END. 
-IF &DDNAME EQ 'END' GOTO SEND0; 
-WRITE INPT &DDNAME 
-GOTO LP 
-SEND0 
-CLOSE INPT 
-STEP1 
-* NORMAL START OF PROCEDURE. 
-SET &ERR = 0; 
-LP1 
-*  THIS LOOPS THROUGH ALL SPECIFIED FILES, CHECKING EACH. 
-*  ALL FILES WILL BE CHECKED, AND THEN RETURN CODE SET. 
-READ INPT NOCLOSE &DDNAME.A8. 
-IF &IORETURN GT 0 GOTO DONE; 
-TYPE CHECKING &DDNAME 
-? MVS DDNAME &DDNAME 
-IF &LRECL EQ 4096 OR 16384 GOTO CHK1 ELSE GOTO NOCR; 
-CHK1 
-IF &BLKSWRITTEN EQ 0 GOTO NOCR; 
-IF &FOCUSPAGES EQ 0 GOTO NOCR; 
-IF &EXTENTSUSED GT 14 GOTO TOOBIG1; 
-IF &FOCUSPAGES GT &BLKSWRITTEN GOTO VOLS; 
-IF &FOCUSPAGES GT 512000 GOTO TOOBIG2; 
-GOTO LP1 
-NOCR 
-TYPE FILE &DDNAME -- EMPTY FILE OR INCORRECT LRECL 
-TYPE  DATASETNAME &DSNAME 
-TYPE   EITHER CORRECT DATASETNAME, OR ISSUE CREATE FILE 
-TYPE 
-SET &ERR = &ERR + 1; 
-GOTO LP1 
-TOOBIG1 
-TYPE FILE &DDNAME HAS USED &EXTENTSUSED EXTENTS 
-SET &DIFF = &BLKSWRITTEN - &FOCUSPAGES; 
-TYPE      WILL WRITE &DIFF PAGES BEFORE ANOTHER EXTENT IS NEEDED 
-TYPE     IF FILE READ ONLY, NO FURTHER ACTION NEED TO BE TAKEN 
-TYPE     IF R/W, 
-TYPE      EITHER COPY INTO LARGER DATASET, USE REBUILD TO DELETE 
-TYPE      RECORDS. 
-SET &ERR = &ERR + 1; 
-GOTO LP1 
-TOOBIG2 
-TYPE FILE &DDNAME IS CLOSE TO MAXIMUM -- FOCUS PAGES &FOCUSPAGES
-TYPE                          MAXIMUM IS 524,288 
-TYPE     IF FILE READ ONLY, NO FURTHER ACTION NEED TO BE TAKEN 
-TYPE     IF R/W, 
-TYPE      USE REBUILD TO DELETE RECORDS, OR CREATE ANOTHER 
-TYPE      PARTITION FOR NEW RECORDS. 
-SET &ERR = &ERR + 1; 
-GOTO LP1 
-VOLS 
-TYPE FILE &DDNAME FOCUSPAGES > BLOCKS WRITTEN -- MULTIPLE VOLUMES ? 
-TYPE  FOCUS PAGES IS &FOCUSPAGES     BLKS WRITTEN IS &BLKSWRITTEN 
-TYPE  CHECK FOR PORTIONS OF DATABASE CREATED BY OTHER SOFTWARE, AND 
-TYPE  DUMP/ LOAD INTO ONE VOLUME, OR CREATE BACKUP, AND RE-ALLOCATE
-TYPE   FILE WITH MULTI-VOLUME SUPPORT 
-SET &ERR = &ERR + 1; 
-GOTO LP1 
-DONE 
-CLOSE INPT 
-*  CREATE FILE FOR FOCUSSU 
-*  AUTOMATICALLY REBUILDING FOCUSSU 
CREATE FILE FOCUSSU 
-IF &ERR EQ 0 GOTO GOOD; 
-DANGER 
-SET &&RC = 4; 
-EXIT

Note: You could set the return code to 8, if you wish to test other possibilities (? FDT on the files, etc.).

This procedure will be distributed with future release of FOCUS, and will be stored on the Technical Support Web site (techsupport.ibi.com) for your convenience.

Back Next