View previous topic :: View next topic
|
Author |
Message |
krishnadevanur
New User
Joined: 02 Aug 2006 Posts: 8
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
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 |
|
|
krishnadevanur
New User
Joined: 02 Aug 2006 Posts: 8
|
|
|
|
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 |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
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 |
|
|
muthuvel
Active User
Joined: 29 Nov 2005 Posts: 217 Location: Canada
|
|
|
|
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 |
|
|
raak
Active User
Joined: 23 May 2006 Posts: 166 Location: chennai
|
|
|
|
Hey,
What does this GENERATE MAXFIELDS do? |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
Back to top |
|
|
|