|
|
| Author |
Message |
Time2Live
New User
Joined: 27 Apr 2005 Posts: 1
|
|
|
|
Hi,
I have a lot of empty datasets after a after running a DFSort. Is there a special technique to delete these dataset in a following JCL step, or a way to not catalog them if they are empty during the sort?
Currently my Sort Sysin looks like this:
//SYSIN DD DATA
SORT FIELDS=(9,4,CH,A,121,4,CH,A,86,10,CH,A,46,4,CH,A)
MERGE FIELDS=COPY
OUTFIL FILES=1,INCLUDE=(9,4,CH,EQ,C'AU ')
OUTFIL FILES=2,INCLUDE=(9,4,CH,EQ,C'SH ')
OUTFIL FILES=3,INCLUDE=(9,4,CH,EQ,C'PW ')
OUTFIL FILES=4,INCLUDE=(9,4,CH,EQ,C'SS ')
OUTFIL FILES=5,INCLUDE=(9,4,CH,EQ,C'AN ')
Thank you in advance.
Time2Live |
|
| Back to top |
|
 |
References
|
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4683 Location: San Jose, CA
|
|
|
|
I'd be very interested to hear if somebody has an easy way to do this.
It would probably be possible to check each output file to see if it's empty and if so generate the JCL or a control statement (IEHPROGM?) to delete it, but it seems like there really should be a better way. I don't do this kind of thing myself, so I'm not aware of a simple solution.
BTW, MERGE FIELDS=COPY will do a COPY - your SORT statement will be ignored. |
|
| Back to top |
|
 |
ankyhunk
Moderator
Joined: 05 May 2005 Posts: 102 Location: Navi Mumbai, India
|
|
|
|
Isnt it possible to delete the datasets using IEFBR14 utility?
e.g -
//STEP001 EXEC PGM=IEFBR14
//DD1 DD DSN=MY.DATA.SET,DISP=(OLD,DELETE)
Also you can check for empty datasets using FILEAID utility -
//CHKEMPTY EXEC PGM=FILEAID
//DD01 DD DSN=G1SG00AT.INFILE,DISP=SHR
//DD01O DD DSN=DUMMY,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA
//SYSOUT DD *
//SYSPRINT DD SYSOUT=*
//SYSLIST DD SYSOUT=*
//SYSTOTAL DD SYSOUT=*
//SYSIN DD DUMMY
If the input file is empty then this step will give RC = '08'. Trapping the return code of this step one can say whether the input file was empty. |
|
| Back to top |
|
 |
infoman123
New User
Joined: 01 Mar 2005 Posts: 10
|
|
|
|
| use icetool program itself to copy the 1st record of sorted data set into another....if its empty it will give a RC of 8 and delte if its empty. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4683 Location: San Jose, CA
|
|
|
|
| Quote: |
| use icetool program itself to copy the 1st record of sorted data set into another....if its empty it will give a RC of 8 and delte if its empty. |
ICETOOL COPY does NOT set RC=8 if a file is empty and does NOT automatically delete an empty file. ICETOOL COUNT or NULLOUT can be used to force a non-zero return code for an empty data set, but the question still remains of how you "translate" that to the action of deleting the empty file. |
|
| Back to top |
|
 |
ankyhunk
Moderator
Joined: 05 May 2005 Posts: 102 Location: Navi Mumbai, India
|
|
|
|
You put an if stmt like - if RC = 8 then execute the delete step.
Also you can compare the files produced with an empty file. If its true then delete the file produced. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4683 Location: San Jose, CA
|
|
|
|
| Quote: |
| You put an if stmt like - if RC = 8 then execute the delete step. |
I think you're missing the point. The DFSORT step produces multiple output data sets. Some of them may be empty and some of them may not be empty. Only the empty data sets are to be deleted. DFSORT's NULLOFL parameter can set a RC=16 if any of the output data sets is empty. But if we use that RC=16 to execute the delete step, it will delete the non-empty data sets as well as the empty data sets. The challenge here is to find a way to delete ONLY the empty data sets without deleting the non-empty data sets.
Of course this could be done by using a step that creates one output data set followed by a step that deletes the output data set if its empty, and repeating for each output data set. But what the poster wants is a way to delete only the empty output data sets after a step that creates multiple output data sets, each of which may or may not be empty. |
|
| Back to top |
|
 |
dneufarth
Active User
Joined: 27 Apr 2005 Posts: 170 Location: Cincinnati OH USA
|
|
|
|
Frank,
I think Ankur's method will work, but it does require two additional steps per output file.
First step is the Fileaid step to set the RC and followed by second step which is executed only upon RC=8 from first step and is and pgm=IEFBR14 with a MOD,DELETE,DELETE for the empty DSN.
Repeat for each output file.
In this case 5 output files from SORT step require additional 10 steps to achieve the desired result.
Dave |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4683 Location: San Jose, CA
|
|
|
|
| You don't need FileAid to set the RC. You can use the COUNT operator of DFSORT's ICETOOL to do that. But I really think the whole idea here was to avoid having to do multiple steps for each output file. The original poster said "Is there a special technique to delete these dataset in a following JCL step". "step" here is singular. Or maybe I'm reading too much into it. If any number of steps will do, then it's easy. |
|
| Back to top |
|
 |
|
|
|