How to check if a dataset is empty using the LISTD command.
Release :
Component : Disk Backup and Restore
Checking the DISK documentation at the section below reported:
Subfile Record Format - (DSNINDEX)
...
DSNFLAG6 DS X +93 FLAG BYTE 6
DSNP2 EQU X'80' ..PRIMARY2 DSNINDEX
DSNRENMD EQU X'40' ..DSNINDEX RENAMED
DSNFAST EQU X'20' ..FAST ARCHIVE
DSNNEWNM EUQ X'10' ..ARCHIVE with NEWNAME or NEWHLQ
DNSEMPTY EQU X'08' ..EMPTY DATA SET
...
the last position of FLAG6 field contains the information if the dataset is empty.
This field can be included in the LISTD command output, specifying FIELD FLAG6 (even if the LISTD explanation doesn't report it).
All the datasets with FLAG6 ending with an 8, are empty