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
 

 

JCL to empty the input flat file without deleting it

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
krishnadevanur

New User


Joined: 02 Aug 2006
Posts: 8

PostPosted: Mon Jan 15, 2007 5:19 pm    Post subject: JCL to empty the input flat file without deleting it
Reply with quote

hi folks,

I want to write a JCL in which the executing program will empty the input flatfile and empties it.(It should not delete). there may be any kind of record format for the flat file
Also my question is, if we write a COBOL program to do the operation and the input file is of FB format, how will the cobol program calculate the length and how does t empties ?

Please help me in coding the JCL.

Thanks,

Krishna
Back to top
View user's profile Send private message

William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Mon Jan 15, 2007 5:31 pm    Post subject: Re: how to code
Reply with quote

krishnadevanur wrote:
I want to write a JCL in which the executing program will empty the input flatfile and empties it.(It should not delete). there may be any kind of record format for the flat file
Empty? You can use the utility of your choice and open the file for output with a disp of OLD.
Quote:
Also my question is, if we write a COBOL program to do the operation and the input file is of FB format, how will the cobol program calculate the length and how does t empties ?
The operation? The COBOL program had better know the length of the record but doesn't need to know the length of the file. Like the above utility, open for output with a disp of OLD.
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: Mon Jan 15, 2007 9:45 pm    Post subject:
Reply with quote

Hello,

If you have an input file and after successfully reading the data your requirement is to "empty" the file you can do this within your COBOL program that reads the file.

Open the file as input and read until end-of-file. When the AT END is reached, close the file. NOW - open the file as output and close the file. What remains will be an empty file. In the DD statement, specify DISP=OLD.

Keep in mind that when you do this, you will not be able to re-run that program without first re-creating the input data.
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Tue Jan 16, 2007 4:28 am    Post subject: Re: JCL to empty the input flat file without deleting it
Reply with quote

Krishna, This JCL will empty you dataset

Code:

//JS00100  EXEC PGM=IDCAMS               
//DDDMMY   DD DUMMY                     
//DDOUT    DD DSN=YOUR.SEQ.FILE,         
//            DISP=OLD                   
//SYSIN    DD *                         
  REPRO IFILE(DDDMMY) OFILE(DDOUT)       
//SYSPRINT DD SYSOUT=*                   
//SYSOUT   DD SYSOUT=*                   
Back to top
View user's profile Send private message
krishnadevanur

New User


Joined: 02 Aug 2006
Posts: 8

PostPosted: Mon Feb 19, 2007 8:00 pm    Post subject: Re: how to code
Reply with quote

Thanks William, The info you gave me was of great help.
Thank you.

Krishna






William Thompson wrote:
krishnadevanur wrote:
I want to write a JCL in which the executing program will empty the input flatfile and empties it.(It should not delete). there may be any kind of record format for the flat file
Empty? You can use the utility of your choice and open the file for output with a disp of OLD.
Quote:
Also my question is, if we write a COBOL program to do the operation and the input file is of FB format, how will the cobol program calculate the length and how does t empties ?
The operation? The COBOL program had better know the length of the record but doesn't need to know the length of the file. Like the above utility, open for output with a disp of OLD.
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Tue Feb 20, 2007 10:26 am    Post subject:
Reply with quote

Hi There,
You can also use sort for this
Code:

//STEP010 EXEC PGM=SORT                           
//SORTIN  DD  DSN=YOUR.DATASET,DISP=SHR
//SORTOUT DD  DSN=YOUR.DATASET,,DISP=SHR
//SYSOUT  DD SYSOUT=*                             
//SYSIN   DD *                                     
  OPTION COPY                                     
  OMIT COND=ALL                                   
/*   
Back to top
View user's profile Send private message
muthuvel

Active User


Joined: 29 Nov 2005
Posts: 217
Location: Chennai

PostPosted: Tue Feb 20, 2007 11:58 am    Post subject: Re: JCL to empty the input flat file without deleting it
Reply with quote

One more way of empting the file,
Code:

//*THIS JOB IS USED TO CREATE EMPTY DATASET OR EMPTY DATA IN A DATASET 
//STEP1 EXEC PGM=IEBGENER                                               
//SYSUT1 DD DUMMY                                                       
//SYSUT2 DD DSN=file name,                 
//         DISP=SHR                                                     
//SYSPRINT DD SYSOUT=*                                                 
//SYSIN DD *                                                           
  GENERATE MAXFLDS=1                                                   
/*                                                                     
//SYSOUT  DD SYSOUT=*                                                   
//*                                           
Back to top
View user's profile Send private message
raak

Active User


Joined: 23 May 2006
Posts: 166
Location: chennai

PostPosted: Wed Feb 21, 2007 10:48 am    Post subject:
Reply with quote

Hey,

What does this GENERATE MAXFIELDS do?
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Wed Feb 21, 2007 11:47 am    Post subject:
Reply with quote

Hi There,

Please refer the below link

http://virtual.clemson.edu/dcit/sig/docs/os390/o440.html
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 31 Tue Dec 06, 2016 8:04 pm
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 15 Thu Dec 01, 2016 8:28 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm


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