Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to clear the data in a Dataset?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
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    Post subject: How to clear the data in a Dataset?
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

Moderator Team Head


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

PostPosted: Thu Jan 11, 2007 7:20 pm    Post subject: Re: How to clear the data in a Dataset?
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    Post subject: RE: How to clear the data in a Dataset?
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

Site Director


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

PostPosted: Sat Jan 13, 2007 12:52 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts copying data without knowing location arunsoods DFSORT/ICETOOL 6 Thu Jul 20, 2017 1:03 pm
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Browse dataset cvnlynn CLIST & REXX 4 Tue Jul 18, 2017 3:52 am
No new posts Loading data to table gives wrong for... Raghu navaikulam DB2 19 Thu Jul 13, 2017 2:11 pm
No new posts How to Clear all TSQs during CICS sta... Hooman24 CICS 10 Mon Jun 26, 2017 9:46 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us