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

Point a cursor on first record after reading last record


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
arunmozhicholan

New User


Joined: 07 Feb 2007
Posts: 27
Location: chennai

PostPosted: Mon Mar 31, 2008 10:52 am
Reply with quote

Hi ,

can anyone give a solution for this ,
how to Point a cursor on first record after reading last record
in a file
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Mon Mar 31, 2008 11:04 am
Reply with quote

well cursors are for db2 rows and have nothing to do with records.


so, rephrase you question. explain a little what you are doing and need to do.
Back to top
View user's profile Send private message
arunmozhicholan

New User


Joined: 07 Feb 2007
Posts: 27
Location: chennai

PostPosted: Mon Mar 31, 2008 11:16 am
Reply with quote

Hi ,

i need to read a file again and again, that is after reading the last record i need to read the file from the first record.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Mon Mar 31, 2008 11:58 am
Reply with quote

ok, since you have the keep rereading the file, either load the file into an internal cobol table or sort your input so a simple match merge can be accomplished.

why, by the way, do you have to keep re-reading the file?
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Mon Mar 31, 2008 1:27 pm
Reply with quote

Hi !

Simple solution for that bizarre requirement ->

Close the file at end and open it again.

UmeySan
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: Mon Mar 31, 2008 7:54 pm
Reply with quote

Hello,

Why do you need to read the file "again and again"? If this is to match records in one file to records in another file you do not need to read the file again and again.

If you post your requirement, we can probably offer much better solutions than reading the file many times. . .
Back to top
View user's profile Send private message
arunmozhicholan

New User


Joined: 07 Feb 2007
Posts: 27
Location: chennai

PostPosted: Mon Apr 14, 2008 2:58 pm
Reply with quote

i need to check a field of i/p file 1 with all the records of i/p file 2 and to retrieve the matching records,

ex:
i/p file1
123 03
234 05
345 10

i/p file2
123 01
345 03
123 02
234 04
345 07
234 01

need an output file like

123 01
123 02
234 04
234 01
345 03
345 07
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: Mon Apr 14, 2008 7:37 pm
Reply with quote

Hello,

To get the result you want using cobol, you need to first sort both files by the "keys".

Next, there is a "Sticky" near the top of the Mainframe COBOL section that contains working, sample code for a 2-file match/merge. The code as posted is very close to what you need.

Download the sample and review it. If you have any questions, please post back here.

With few changes, you can modify that code to get the output you need.
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Point and Shoot )PTNS TSO/ISPF 0
Search our Forums:

Back to Top