View previous topic :: View next topic
|
Author |
Message |
maxsubrat
Active User
Joined: 27 Feb 2008 Posts: 110 Location: india
|
|
|
|
There are few records in a file, i want to read when i found the keyword COMPLETE in that file. So i want to read the file from that line COMPLETE to the end and write also.
exp: file is like that
xxxxxxxxxxxxxxxxx
yyyyyyyyyyyyyyyyyyyyy
gggggggggggggg
he jajajja COMPLETE nnnn
aaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbbbb
...
So i want to write the records from aaaa.... that is from 5th line.. as i got the keyword COMPLETE in the previous record, so i want to write records from the next record to the last..
i.e..
aaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbbbb
...
How to put the read logic in cobol and write logic..
Thanks |
|
Back to top |
|
|
Succor
New User
Joined: 20 Feb 2009 Posts: 96 Location: Bangalore :)
|
|
|
|
Maxsubrat, you will have to read every record in FILE 1 in order to search for the variable "COMPLETE ". Once it is found ,you can write in the FILE 2 from the remaining records of FILE 1.
WTF |
|
Back to top |
|
|
leo_sangha
New User
Joined: 11 Aug 2005 Posts: 85 Location: England
|
|
|
|
does the COMPLETE keyword start at one particular position ? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
It should not matter at which position COMPLETE begins. . . |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
|
|
|
|
Leo might have been thinking in terms of the fact that searching for "COMPLETE" would be faster if it started at a known location rather than having to use INSPECT. |
|
Back to top |
|
|
maxsubrat
Active User
Joined: 27 Feb 2008 Posts: 110 Location: india
|
|
|
|
dick scherrer wrote: |
Hello,
It should not matter at which position COMPLETE begins. . . |
do u know the solution..? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
maxsubrat wrote: |
dick scherrer wrote: |
Hello,
It should not matter at which position COMPLETE begins. . . |
do u know the solution..? |
more than likely, Mr. Scherrer knows the answer. considering all the posts in this thread, what about the answer do you not understand, Maxsubrat? |
|
Back to top |
|
|
leo_sangha
New User
Joined: 11 Aug 2005 Posts: 85 Location: England
|
|
|
|
dick scherrer wrote: |
Hello,
It should not matter at which position COMPLETE begins. . . |
hello Dick scherrer, As Terry said it would definitely help if COMPLETE begins is at a fixed position.
maxsubrat,
you didnt answer whether complete begins at a particular position.
If it does not, read file sequentially,
move the record into working storage and do a INSPECT clause on it looking for COMPLETE, at the same time keep incrementing a counter for number of records read.
If NOT found, keep reading next records until EOF reached.
If found, read next record and write into o/p file. Set some flag for COMPLETE found. |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
|
|
|
|
dbzTHEdinosauer wrote: |
maxsubrat wrote: |
dick scherrer wrote: |
Hello,
It should not matter at which position COMPLETE begins. . . |
do u know the solution..? |
more than likely, Mr. Scherrer knows the answer. considering all the posts in this thread, what about the answer do you not understand, Maxsubrat? |
Mr Scherrer might be holding out for that big pay raise before he answers the question. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Quote: |
do u know the solution..? |
Unless i completely misunderstand the requirement, yes. . .
Actually the post following my last reply is one way. . .
Another is to code a loop and use reference modification to determine if a record contains COMPLETE.
Quote: |
Mr Scherrer might be holding out for that big pay raise before he answers the question. |
Sure, instead of $ - a title
d |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Quote: |
Sure, instead of $ - a title |
Be careful what you ask for, Dick -- somebody might bestow something like "Maintainer of the Porcelain Throne" upon you! |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Was thinking that with the "Mr", i'd already been bestowed. . .
Quote: |
"Maintainer of the Porcelain Throne" |
More like "Driver of the Porcelain Bus" |
|
Back to top |
|
|
|