i have some confused about TSO Free command operands file and dataset, are they the same function,whichever i use is ok ? or what condition to use ?
i ran some test in rexx,
1,fisrt example, one file allocate to one ddname, so at then end of code, i use "free fi(myindd)" or "free da(CUSTOMER.MASTER)" , it works fine, resubmit wouldn't be error.
/*rexx*/
"alloc da(CUSTOMER.MASTER) fi(myindd) old"
if rc=0 then
do
"execio * diskr myindd (finis"
do i=1 to queued()
pull sth
say sth
end
end
"free da(CUSTOMER.MASTER)"
exit
"alloc da(CUSTOMER.MASTER) fi(myindd) old"
if rc=0 then
do
"execio * diskr myindd (finis"
do i=1 to queued()
pull sth
say sth
end
end
"free da(CUSTOMER.MASTER)"
exit
2, second example, two file alloc to one ddname,
if i use "free da(CUSTOMER.MASTER,COPY.MASTER)" , after display two files,it will say:
"DATA SET userid.CUSTOMER.MASTER NOT FREED, MEMBER OF CONCATENATION
DATA SET userid.COPY.MASTER NOT FREED, MEMBER OF CONCATENATION"
resubmit will be error.
if i use "free fi(myindd)" , i will work fine.
/*rexx*/
"ALLOC DA(CUSTOMER.MASTER,COPY.MASTER) FI(MYINDD) OLD"
if rc=0 then
do
"execio * diskr myindd (finis"
do i=1 to queued()
pull sth
say sth
end
end
"free da(CUSTOMER.MASTER,COPY.MASTER)"
exit
3, third exaple, one file allocate to two ddname, and i use "free fi(myindd,mydd) " or "free da(CUSTOMER.MASTER)" both works fine,resubmit wouldn't be error.
another question, i use "old" operand, it should be exclusive use, i think the second allocate should fail, but it doesn't .why?
/*rexx*/
"ALLOC DA(CUSTOMER.MASTER) FI(MYINDD) old"
if rc=0 then
do
"execio * diskr myindd (finis"
do i=1 to queued()
pull sth
say sth
end
end
say "------------------------------------------"
"ALLOC DA(customer.MASTER) FI(MYDD) old"
if rc=0 then
do
"execio * diskr mydd (finis"
do i=1 to queued()
pull sth
say sth
end
end
"free fi(myindd,mydd) "
exit
"ALLOC DA(CUSTOMER.MASTER) FI(MYINDD) old"
if rc=0 then
do
"execio * diskr myindd (finis"
do i=1 to queued()
pull sth
say sth
end
end
say "------------------------------------------"
"ALLOC DA(customer.MASTER) FI(MYDD) old"
if rc=0 then
do
"execio * diskr mydd (finis"
do i=1 to queued()
pull sth
say sth
end
end
"free fi(myindd,mydd) "
exit