wondering in the mainframe i came across
a simple rexx to tell me if my dataset is empty or not empty or does not exist at all ~
jcl to run above rexx (ISITEMTY) for dataset (MAI.DATASET):
an alternative to my earlier post .... tell me icetool ~ is it emty ?
a simple rexx to tell me if my dataset is empty or not empty or does not exist at all ~
arg dsname
say DSNAME
x=LISTDSI(DSNAME)
if x = 0 then do
if SYSUSED > 0 then do
Say 'Dataset 'DSNAME' exists and is not empty'
exit 0
end; else do
Say 'Dataset 'DSNAME' exists but is empty'
exit 1
end
end; else do
say "Dataset "DSNAME" does not exist"
exit 2
end
exit
jcl to run above rexx (ISITEMTY) for dataset (MAI.DATASET):
//RUNMYREX EXEC PGM=IKJEFT1A,
// DYNAMNBR=30,REGION=0M
//SYSEXEC DD DSN=B.T.R,DISP=SHR
//INC INCLUDE MEMBER=SYSOUT
//SYSTSIN DD *
PROFILE NOPREFIX
%ISITEMTY MAI.DATASET
so u can then conditionally continue like this....// IF (RUNMYREX0.RC=0) THEN /*if MAI.DATASET exists and is not empty
...do whatever u wanna do with your dataset here
// ENDIF
an alternative to my earlier post .... tell me icetool ~ is it emty ?