View previous topic :: View next topic |
Author |
Message |
hogandeveloper Beginner
Joined: 05 Aug 2008 Posts: 11 Topics: 10
|
Posted: Tue Aug 18, 2009 6:05 am Post subject: clearing the content of the file |
|
|
Hi All,
I have a requirement wherein i need to clear the content of a file and process that as an empty file. this file gets created in one of the previous jobs though database unload. please help me in this regard.
thanks
HD |
|
Back to top |
|
 |
hogandeveloper Beginner
Joined: 05 Aug 2008 Posts: 11 Topics: 10
|
Posted: Tue Aug 18, 2009 6:08 am Post subject: |
|
|
Hi All,
The file is a GDG type actually.
thanks,
HD |
|
Back to top |
|
 |
luckystarlak Beginner
Joined: 12 Jan 2007 Posts: 4 Topics: 1
|
Posted: Tue Aug 18, 2009 6:57 am Post subject: |
|
|
isnt this as simple to add a delete step ? or am i missing some thing  |
|
Back to top |
|
 |
superk Advanced

Joined: 19 Dec 2002 Posts: 684 Topics: 5
|
Posted: Tue Aug 18, 2009 8:10 am Post subject: |
|
|
Just copy an empty file (i.e. DD DUMMY) into it. |
|
Back to top |
|
 |
superk Advanced

Joined: 19 Dec 2002 Posts: 684 Topics: 5
|
Posted: Wed Aug 19, 2009 7:01 am Post subject: |
|
|
Also, this is another good option. I like this one because you don't need to be concerned with the RECFM and LRECL of the dataset:
Code: |
//SORTSTP EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=DATASET.TO.BE.EMPTIED,DISP=SHR
//SORTOUT DD DSN=DATASET.TO.BE.EMPTIED,DISP=SHR
//SYSIN DD *
OPTION COPY
OMIT COND=ALL
/*
|
|
|
Back to top |
|
 |
Anuj Dhawan Intermediate
Joined: 19 Jul 2007 Posts: 298 Topics: 7 Location: Mumbai,India
|
Posted: Thu Sep 17, 2009 1:45 am Post subject: |
|
|
If this has to be done with COBOL, open the file in OUTPUT mode and don't write anything in it -- and you are done. _________________ Regards,
Anuj |
|
Back to top |
|
 |
slade Intermediate
Joined: 07 Feb 2003 Posts: 266 Topics: 1 Location: Edison, NJ USA
|
Posted: Mon Sep 28, 2009 7:09 pm Post subject: |
|
|
Your req isn't clear. If you just want to clear the file of its data, Anuj's reply is the way to go - open/close the file as O/P.
If you want to use the file for your own data, open as O/P, WRITE what you want, then close it. The last rec ptr will be re-set to the last rec you wrote.
Just remember the file attributes have to be the same as the orig file. _________________ Regards, Jack.
"A problem well stated is a problem half solved" -- Charles F. Kettering |
|
Back to top |
|
 |
taltyman JCL Forum Moderator

Joined: 02 Dec 2002 Posts: 310 Topics: 8 Location: Texas
|
Posted: Tue Sep 29, 2009 8:33 am Post subject: |
|
|
I'm confused. If it's a gdg then why would you want to empty it? When you write a new gdg then the 0 one will have your new data and the -1 will have the old contents. |
|
Back to top |
|
 |
|
|