MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

clearing the content of the file

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
hogandeveloper
Beginner


Joined: 05 Aug 2008
Posts: 11
Topics: 10

PostPosted: Tue Aug 18, 2009 6:05 am    Post subject: clearing the content of the file Reply with quote

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
View user's profile Send private message
hogandeveloper
Beginner


Joined: 05 Aug 2008
Posts: 11
Topics: 10

PostPosted: Tue Aug 18, 2009 6:08 am    Post subject: Reply with quote

Hi All,
The file is a GDG type actually.

thanks,
HD
Back to top
View user's profile Send private message
luckystarlak
Beginner


Joined: 12 Jan 2007
Posts: 4
Topics: 1

PostPosted: Tue Aug 18, 2009 6:57 am    Post subject: Reply with quote

isnt this as simple to add a delete step ? or am i missing some thing Shocked
Back to top
View user's profile Send private message
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Tue Aug 18, 2009 8:10 am    Post subject: Reply with quote

Just copy an empty file (i.e. DD DUMMY) into it.
Back to top
View user's profile Send private message
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Wed Aug 19, 2009 7:01 am    Post subject: Reply with quote

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
View user's profile Send private message
Anuj Dhawan
Intermediate


Joined: 19 Jul 2007
Posts: 298
Topics: 7
Location: Mumbai,India

PostPosted: Thu Sep 17, 2009 1:45 am    Post subject: Reply with quote

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
View user's profile Send private message
slade
Intermediate


Joined: 07 Feb 2003
Posts: 266
Topics: 1
Location: Edison, NJ USA

PostPosted: Mon Sep 28, 2009 7:09 pm    Post subject: Reply with quote

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
View user's profile Send private message
taltyman
JCL Forum Moderator
JCL Forum Moderator


Joined: 02 Dec 2002
Posts: 310
Topics: 8
Location: Texas

PostPosted: Tue Sep 29, 2009 8:33 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group