Example 3: Detailed coding example in assembler

This example provides the detailed coding for prefetch prime block processing for applications that are written in assembler.

In this example, the following conditions occur:
  1. Five subfiles of the same file are opened with a hold, and the retrieval of the prime blocks of the subfiles are immediately initiated. Some of the DBOPN macro calls might fail. For example:
    • If a prime file ID is corrupted, a DB0100 system error occurs, the SW00SR error counter is incremented, and control returns to the application. This error is detected in the application by subsequent DBWAIT macro processing.
    • If an invalid algorithm was specified, a DB012E system error occurs, the SW00SR error counter is incremented, and control returns to the application. This error is detected in the application by subsequent DBWAIT macro processing.
    • If a return-optional system error occurs, such as a DB010A system error, even if control returns to the application, prefetch prime block processing might not be completed, and the SW00SR error counter is not incremented. This error is detected only in a subsequent attempt to access or use the intended SW00SR slot, for example, on a DBIFB macro call.
  2. Four other subfiles of different files are opened. Some of these subfiles are opened without a hold.
  3. The application issues a DBWAIT macro to complete the access of all the subfiles.
  4. The application checks whether any errors were detected. If any errors were detected, the application loops through each SW00SR slot to look for the subfiles that were not correctly opened.

Example

* Open various subfiles with prefetch.
   DBOPN REF=IR11DF00,HOLD,ORD==F'0',PREFETCH=PRIME
   DBOPN REF=IR11DF01,HOLD,ORD==F'1',PREFETCH=PRIME
   DBOPN REF=IR11DF02,HOLD,ORD==F'2',PREFETCH=PRIME
   DBOPN REF=IR11DF03,ORD==F'3',PREFETCH=PRIME
   DBOPN REF=IR11DF04,ORD==F'4',PREFETCH=PRIME
   MVC EBW000(8),=C'IR12DF  '   SET UP REFERENCE NAME
   MVC EBW010(3),=X'000100'     SET UP INVALID ID/RCC
   DBOPN FILE=ZZZZZZ,REF=EBW000,ID=EBW010,                    X
         ORD==F'5',PREFETCH=PRIME
   DBOPN REF=IR75DF,ALG=='A',PREFETCH=PRIME
   DBOPN REF=IR90DFA,ALG=='A',HOLD,PREFETCH=PRIME
   DBOPN REF=IR90DF9,ALG=='9',PREFETCH=PRIME

* Complete all pending open prefetch prime.
* Since one of the subfiles has a wrong ID a DB0100 return
* dump is done.
   DBWAIT                    COMPLETE PENDING OREFETCH PRIME

* Find each SW00SR marked with a serious error.
   #IF   (LTR,R3,R3,NZ)      DBWAIT DETECTED ERRORS
   DBIFB FIRST               LOCATE 1ST SW00SR
   #DO   WHILE=(LTR,R3,R3,NZ) LOOP WHILE SW00SRS FOUND
   #IF   (DBERROR,YES)       SERIOUS ERROR DETECTED
* Error processing for this 'error SW00SR'.
   ⋮
   #EIF                      END CHECK IF SERIOUS ERROR
   DBIFB NEXT                STEP TO NEXT SW00SR
   #EDO                      END LOOP WHILE SW00SRS FOUND
   #ELSE                     DBWAIT DETECTED NO ERROR
*  Normal z/TPFDF file processing after successful DBWAIT for
*  prefetch prime(s).
   ⋮
   #EIF                      END CHECK IF DBWAIT WAS SUCCESSFUL