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
 

 

Point a cursor on first record after reading last record

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Point a cursor on first record after reading last record
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    Post subject:
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    Post subject: little more clear
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    Post subject:
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: 743
Location: Germany

PostPosted: Mon Mar 31, 2008 1:27 pm    Post subject:
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

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Mar 31, 2008 7:54 pm    Post subject:
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    Post subject: Hi Dick
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

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Apr 14, 2008 7:37 pm    Post subject:
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    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 How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts Updating Cursor row withour using FOR... chandan.inst DB2 15 Tue Nov 08, 2016 11:17 am
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am
No new posts Get Record count in summary record fo... Atul Banke DFSORT/ICETOOL 21 Fri Sep 23, 2016 4:17 pm
No new posts Reading data from PS file and send it... rajatbagga All Other Mainframe Topics 18 Fri Sep 23, 2016 12:51 pm


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