BPX4RD2 (readdir2) example

The following code reads multiple name entries from the specified directory (DIRECTDES). FUIOCURSOR, set to zero by the BPXYFUIO macro, indicates that the system is to begin reading with the first entry in the directory. For the callable service, see readdir2 (BPX1RD2, BPX4RD2) — Read an entry from a directory. For the data structure, see BPXYDIRE — Map directory entries for readdir. AMODE 31 callers use BPX1RD2 (readdir2) example.
                                              
       MVC   DIRECTDES,..          Directory descriptor from  opendir   
         MVC   FUIOID,=CL4'FUIO'     Eye Catcher                        
         MVC   FUIOLEN,=AL4(FUIO#LENGTH) length                         
         LA    R15,BUFFERA           Set address of buffer              
         STG   R15,FUIOBUFF64VADDR    for directory data in FUIO        
         MVC   FUIOIBYTESRW,=F'1023' Max number of bytes to read        
         MVI  FUIOFLAG2,FUIOADDR64   Set 64bit addressing               
         SPACE ,                                                        
         CALL  BPX4RD2,              Read directory entries            +
               (DIRECTDES,           Input: Directory file descriptor  +
               FUIO,                 Input/output: BPXYFUIO            +
               RETVAL,               Return value: 0, -1 or char count +
               RETCODE,              Return code                       +
               RSNCODE),             Reason code                       +
               MF=(E,PLIST)          ----------------------------------