Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 4650
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 Where to get sample for processing RM... vice_versa PL/I & Assembler 2 Tue Jan 16, 2018 2:03 pm
No new posts Data security erase on RAID device steve-myers All Other Mainframe Topics 0 Sat Jan 13, 2018 6:41 am
No new posts VSAM dataset not found abdulrafi JCL & VSAM 5 Fri Jan 12, 2018 11:19 am
No new posts Append the milliseconds to the data s... girishb2 DFSORT/ICETOOL 1 Thu Dec 21, 2017 9:07 pm
No new posts Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us