IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to clear the data in a Dataset?


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
muralialla

New User


Joined: 03 Jan 2007
Posts: 11
Location: Chennai

PostPosted: Thu Jan 11, 2007 7:07 pm
Reply with quote

Hi all

I need to re use a Dataset(PDS/PS) everytime. How to clear the data.....is there any direct command to do that?
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Thu Jan 11, 2007 7:20 pm
Reply with quote

Personally, I use a DFSORT step in the job. In REXX, you could just open the output DD and write nothing:

"EXECIO 0 DISKW ddname (FINIS"
Back to top
View user's profile Send private message
kgumraj

Active User


Joined: 01 May 2006
Posts: 151
Location: Hyderabad

PostPosted: Fri Jan 12, 2007 2:18 pm
Reply with quote

Hi,
use this step for that,

Code:

//S1    EXEC  PGM=ICEMAN                                   
//SYSOUT    DD  SYSOUT=*                                   
//SORTIN DD DSN=USZ9997.PREBIND.ZARC.G0040V00,DISP=SHR     
//SORTOUT DD DSN=USZ9997.PREBIND.ZARC.TEST,DISP=SHR     
//SYSIN    DD    *                                         
    OPTION COPY                                           
    OMIT COND=ALL                                         
/*                                                       
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Jan 13, 2007 12:52 am
Reply with quote

Hello,

If you want to re-use the file by overwriting it in an application program, you can specify DISP=OLD in the JCL. An OPEN OUTPUT will create "new" output in the existing file.

One caution is that you may run out of the "old" space and abend when the "new" data is larger than the "old" data.

Do you want to reuse the file due to a catalog problem? If so, you can add an IEFBR14 step before the "catalog" step that will unconditonally delete the file. Here's an example of what i just described:
Code:
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
//HSKP     EXEC PGM=IEFBR14                                             
//D1       DD DSN=MS.RDS.NEWRATE.M1006,DISP=(MOD,DELETE),UNIT=SYSDA,   
//            SPACE=(TRK,0)                                             
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
//MCH1     EXEC PGM=DSCHMCH1                                           
//CAP      DD DSN=MS.RDS.CAP1006,DISP=OLD                               
//ELIG     DD DSN=MS.RDS.ELIG1006.SORTED,DISP=OLD                       
//NEWRATE  DD DSN=MS.RDS.NEWRATE.M1006,DISP=(,CATLG,DELETE),UNIT=SYSDA,
//            DCB=(RECFM=FB,BLKSIZE=0,LRECL=80),                       
//            SPACE=(CYL,(50,10),RLSE)                                 
//SYSPRINT DD SYSOUT=*                                                 
//SYSOUT   DD SYSOUT=*                                                 


The housekeeping step (HSKP) ensures that the file does not exist. That DISP parameter will delete the file if it exists or, create it then delete it if is does not already exist.

The second step (MCH1) runs a program that creates the file.

Please let me know if you'd like any other info.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Store the data for fixed length COBOL Programming 1
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts SCOPE PENDING option -check data DB2 2
Search our Forums:

Back to Top