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: 6968
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: 6968
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: 757
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 Read two inputs and write into output... murali.andaluri DFSORT/ICETOOL 5 Wed Jul 26, 2017 7:35 pm
No new posts Need to write record of PS File in ex... Chandan1993 JCL & VSAM 1 Wed Jun 07, 2017 1:35 am
No new posts Testing rerad cursor for status with ... John F Dutcher DB2 8 Fri May 19, 2017 9:35 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm


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