Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
read then Write from a perticular keyword to end of a file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
maxsubrat

New User


Joined: 27 Feb 2008
Posts: 87
Location: india

PostPosted: Tue Apr 07, 2009 11:59 am    Post subject: read then Write from a perticular keyword to end of a file
Reply with quote

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
View user's profile Send private message

Succor

New User


Joined: 20 Feb 2009
Posts: 96
Location: Bangalore :)

PostPosted: Tue Apr 07, 2009 1:05 pm    Post subject: Reply to: read then Write from a perticular keyword to end o
Reply with quote

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
View user's profile Send private message
leo_sangha

New User


Joined: 11 Aug 2005
Posts: 85
Location: England

PostPosted: Tue Apr 07, 2009 4:11 pm    Post subject: Reply to: read then Write from a perticular keyword to end o
Reply with quote

does the COMPLETE keyword start at one particular position ?
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 Apr 07, 2009 8:37 pm    Post subject:
Reply with quote

Hello,

It should not matter at which position COMPLETE begins. . .
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Tue Apr 07, 2009 8:43 pm    Post subject:
Reply with quote

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
View user's profile Send private message
maxsubrat

New User


Joined: 27 Feb 2008
Posts: 87
Location: india

PostPosted: Tue Apr 07, 2009 9:11 pm    Post subject:
Reply with quote

dick scherrer wrote:
Hello,

It should not matter at which position COMPLETE begins. . .



do u know the solution..?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6970
Location: porcelain throne

PostPosted: Tue Apr 07, 2009 9:35 pm    Post subject:
Reply with quote

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
View user's profile Send private message
leo_sangha

New User


Joined: 11 Aug 2005
Posts: 85
Location: England

PostPosted: Tue Apr 07, 2009 9:36 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Tue Apr 07, 2009 10:41 pm    Post subject:
Reply with quote

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. icon_lol.gif
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 Apr 07, 2009 11:38 pm    Post subject: Reply to: read then Write from a perticular keyword to end o
Reply with quote

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 icon_wink.gif

d
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8201
Location: East Dubuque, Illinois, USA

PostPosted: Tue Apr 07, 2009 11:41 pm    Post subject:
Reply with quote

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! icon_confused.gif
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 Apr 07, 2009 11:54 pm    Post subject: Reply to: read then Write from a perticular keyword to end o
Reply with quote

Was thinking that with the "Mr", i'd already been bestowed. . . icon_rolleyes.gif

Quote:
"Maintainer of the Porcelain Throne"
More like "Driver of the Porcelain Bus" icon_wink.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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts ISSUE IN copying Sequential file reco... thesumitk JCL & VSAM 2 Wed Dec 13, 2017 3:07 pm
No new posts File Tailoring -- Temporary dataset i... samzee71 CLIST & REXX 3 Fri Dec 01, 2017 3:12 am
No new posts Rexx - File tailoring samzee71 CLIST & REXX 10 Thu Nov 30, 2017 10:47 pm
No new posts Moving a PS file as body of a mail! Vignesh Sid JCL & VSAM 4 Tue Nov 21, 2017 9:23 pm
No new posts unable to set RC = 4 when empty file migusd SYNCSORT 1 Tue Nov 21, 2017 1:21 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us