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
 

 

Copy records to output file and delete records in input file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
bhaskar_kanteti

Active User


Joined: 01 Feb 2007
Posts: 120
Location: USA

PostPosted: Tue Dec 18, 2007 1:09 pm    Post subject: Copy records to output file and delete records in input file
Reply with quote

Hi,

My requirement is after copying the records to output file i need to delete all the records that were there in input file. Means after copying, out file should be empty.
How can i do this.

In the below code i am copying the records to output file. But how to delete the records in input file.

Code:

//STEP010  EXEC PGM=ICETOOL                                     
//TOOLMSG  DD SYSOUT=*                                         
//DFSMSG   DD SYSOUT=*                                         
//SYSOUT   DD SYSOUT=*                                         
//SYSUDUMP DD SYSOUT=C                                         
//SYSPRINT DD SYSOUT=*                                         
//*INPUT FILE                                                   
//INPUT DD DSN=MY.INPUT.FILE,DISP=SHR     
//*OUTPUT FILE                                                 
//OUTPUT DD DSN=MY.OUTPUT.FILE,           
//            DISP=(,CATLG,DELETE),SPACE=(CYL,(500,500),RLSE), 
//            RECFM=FB,LRECL=72,                               
//            BLKSIZE=0                                         
//TOOLIN   DD *
  COPY FROM(INPUT) TO(OUTPUT) USING(CTL1)
/*
//CTL1CNTL DD *
  SORT FIELDS=(1,4,CH,A)   
  OUTFIL FNAMES=OUTPUT,REMOVECC,
  OUTREC=(1:1,72)                 
/*
Back to top
View user's profile Send private message

murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Tue Dec 18, 2007 1:38 pm    Post subject:
Reply with quote

Bhaskar,

Quote:
My requirement is after copying the records to output file i need to delete all the records that were there in input file.


Quote:
Means after copying, out file should be empty


Its c icon_confused.gif nfusing. Could you tell your req?
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10277
Location: italy

PostPosted: Tue Dec 18, 2007 1:42 pm    Post subject: Reply to: Copy records to output file and delete records in
Reply with quote

Might be too simple to be true...
( or the question is badly posed )
why not delete the dataset itself ???

or run a second step to write an end of file...
Back to top
View user's profile Send private message
bhaskar_kanteti

Active User


Joined: 01 Feb 2007
Posts: 120
Location: USA

PostPosted: Tue Dec 18, 2007 2:18 pm    Post subject: Reply to: Copy records to output file and delete records in
Reply with quote

Sorry for confusing you all.

The requirement is after copying the records to output file, no records should be present in the input file.

Its something like records should be moved to output file.

Actually the input of this job is the output for the previous job. After taking the backup no recods whould be there in the input file. So that in next days run new records will be added to this input file.

Am i clear now.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Tue Dec 18, 2007 2:21 pm    Post subject:
Reply with quote

As Enrico suggested, delete the i/p file. Next day re-create it again.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Dec 18, 2007 8:49 pm    Post subject:
Reply with quote

Deleting and recreating the file is probably the safest thing to do.

But since you're doing a sort, you could delete all of the records in the input file with a second OUTFIL statement using a DFSORT/ICETOOL job like this:

Code:

//STEP010  EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//SYSUDUMP DD SYSOUT=C
//*INPUT FILE
//INPUT DD DSN=MY.INPUT.FILE,DISP=SHR
//*OUTPUT FILE
//OUTPUT DD DSN=MY.OUTPUT.FILE,
//            DISP=(,CATLG,DELETE),SPACE=(CYL,(500,500),RLSE)
//TOOLIN   DD *
COPY FROM(INPUT) USING(CTL1)
/*
//CTL1CNTL DD *
  SORT FIELDS=(1,4,CH,A)
  OUTFIL FNAMES=OUTPUT,REMOVECC,
    OUTREC=(1:1,72)
  OUTFIL FNAMES=INPUT,OMIT=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: Tue Dec 18, 2007 8:51 pm    Post subject:
Reply with quote

Hello,

How is the "new" data put into the "input" file? Is this a qsam file or a vsam file?

Depending on how the data is put into the "input" file, your implementation may vary.
Back to top
View user's profile Send private message
bhaskar_kanteti

Active User


Joined: 01 Feb 2007
Posts: 120
Location: USA

PostPosted: Thu Dec 20, 2007 4:00 pm    Post subject: Reply to: Copy records to output file and delete records in
Reply with quote

Hi Frank,

You have provided me the exact solution.
This is my correct requirement.
Thanks for providing me the solution.
Thank You So Much.
Back to top
View user's profile Send private message
clickit

New User


Joined: 08 Jul 2005
Posts: 3
Location: Hellas

PostPosted: Tue Aug 11, 2009 1:52 pm    Post subject: Re: Reply to: Copy records to output file and delete records
Reply with quote

bhaskar_kanteti wrote:
Hi Frank,

You have provided me the exact solution.
This is my correct requirement.
Thanks for providing me the solution.
Thank You So Much.


many thanks from me too icon_biggrin.gif
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Split file based on comparsion to 2 f... Div Grad DFSORT/ICETOOL 3 Thu Jul 27, 2017 9:16 pm
No new posts Read two inputs and write into output... murali.andaluri DFSORT/ICETOOL 6 Wed Jul 26, 2017 7:35 pm
No new posts Extra character appears in file when ... Balu5491 All Other Mainframe Topics 1 Wed Jul 26, 2017 2:39 pm
No new posts SSH - known_hosts file configuration vasanthz All Other Mainframe Topics 2 Wed Jul 26, 2017 2:10 am
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


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