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: 4648
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 Fileaid 2 commands instream work. In ... descann Compuware & Other Tools 2 Tue May 16, 2017 3:31 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Group Data based on a key Arun Raj DFSORT/ICETOOL 7 Thu Apr 27, 2017 11:29 pm
No new posts To find out size allocated to a seque... ashek15 JCL & VSAM 15 Thu Apr 27, 2017 9:42 am
No new posts unload data from table with lob columns farhad_evan DB2 0 Sat Apr 22, 2017 1:32 pm


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