Example 3

Operation:
  • If additional data exists, re-issue HZSPREAD to read the next data
The code is as follows.
*                                                            
* Place code to check available bytes here, in case          
* more bytes were available than could be returned in        
* the output buffer                                          
*                                                            
*************************************************************
* Retrieve next group of prior IPL persistent data          *
* The example presumes that a call similar to that          *
* in the first example had been made                        *
*************************************************************
         SYSSTATE ARCHLVL=2                                  
         CLC   avail,thelen                                  
         JNH   done_pread                                    
         L     2,startbyte     Previous starting byte        
         AL    2,thelen        Increment by length read      
         ST    2,startbyte     Next starting byte            
         LHI   2,L'thebuff     Length to read this time      
         ST    2,thelen                                      
         HZSPREAD CHECKOWNER=cowner,CHECKNAME=cname,        *
               IPL=PRIOR,INSTANCE=FIRST,                    *
               STARTBYTE=startbyte,                         *
               BUFFER=thebuff,DATALEN=thelen,               *
               BYTESAVAIL=avail,                            *
               RETCODE=LRETCODE,RSNCODE=LRSNCODE,           *
               MF=(E,PREADL)                                 
*                                                            
* Place code to check return/reason codes here               
*                                                            
*                                                            
* Place code to process the output buffer here               
*                                                            
done_pread DS 0H                                             
         ....                                                
cowner   DC   CL16'MY_CHECK_OWNER'                           
cname    DC   CL32'MY_CHECK_NAME'                            
         LTORG ,                                             
         HZSZCONS ,            Return code information       
DYNAREA  DSECT                                               
thelen   DS   F                Length of output buffer       
avail    DS   F                Available bytes               
startbyte DS  F                Starting byte position
LRETCODE DS   F                                      
LRSNCODE DS   F                                      
         HZSPREAD MF=(L,PREADL),PLISTVER=MAX         
         DS   0D