BPX1RD2 (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 64 callers use BPX4RD2 (readdir2) example.
                                              
       MVC   DIRECTDES,..          Directory descriptor from  opendir 56
         MVC   FUIOID,=CL4'FUIO'     Eye Catcher                        
         MVC   FUIOLEN,=AL4(FUIO#LENGTH) length                         
         LA    R15,BUFFERA           Set address of buffer              
         ST    R15,FUIOBUFFERADDR    for directory data in FUIO         
         MVC   FUIOIBYTESRW,=F'1023' Max number of bytes to read        
         SPACE ,                                                        
         CALL  BPX1RD2,              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                       +
               VL,MF=(E,PLIST)       ----------------------------------