Need to empty records from PDS members but do not delete them. Say there is a PDS library (TEST.JOBPDS)with 5 members JCL1,JCL2,JCL3,JCL4 and JCL5. I need to remove the contents of each of these members so that the members JCL1,JCL2,JCL3,JCL4 and JCL5 are now empty. But they should themselves remain in the library and show up.
/*Rexx example to empty all pds members */
Say "Empty all members in '" || dsn ||"'? (Y/N)"
If substr(ans,1,1) = 'Y' Then
"ALLOC F(OUT) SHR DA('"||dsn||"') REUSE"
"LISTD '" || dsn || "' MEM"
Say "Emptying" (stem.0 - 6) "members from '" || dsn || "'..."
Do a= 7 to stem.0
"ALLOC F(OUT) OLD DA('"||dsn||"("||strip(stem.a)||")') REUSE"
If rc=0 Then
"EXECIO 0 DISKW OUT (OPEN FINIS"
For faster results, modify to get member names, delete and recreate original data set, then write empty members. For fastest results, modify to get member names, generate IEBUPDTE ADD statements, recreate the data set and call IEBUPDTE to create empty members. (last two suggestions untested, not sure if IEBUPDTE creates empty members)