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

Copy records to output file and delete records in input file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
bhaskar_kanteti

Active User


Joined: 01 Feb 2007
Posts: 123
Location: Hyderabad

PostPosted: Tue Dec 18, 2007 1:09 pm
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: 1436
Location: Bangalore,India

PostPosted: Tue Dec 18, 2007 1:38 pm
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Dec 18, 2007 1:42 pm
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: 123
Location: Hyderabad

PostPosted: Tue Dec 18, 2007 2:18 pm
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: 1436
Location: Bangalore,India

PostPosted: Tue Dec 18, 2007 2:21 pm
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 Developer


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

PostPosted: Tue Dec 18, 2007 8:49 pm
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

Moderator Emeritus


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

PostPosted: Tue Dec 18, 2007 8:51 pm
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: 123
Location: Hyderabad

PostPosted: Thu Dec 20, 2007 4:00 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
Search our Forums:

Back to Top