View previous topic :: View next topic
|
Author |
Message |
arunmozhicholan
New User
Joined: 07 Feb 2007 Posts: 27 Location: chennai
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
arunmozhicholan
New User
Joined: 07 Feb 2007 Posts: 27 Location: chennai
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
Hi !
Simple solution for that bizarre requirement ->
Close the file at end and open it again.
UmeySan |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
arunmozhicholan
New User
Joined: 07 Feb 2007 Posts: 27 Location: chennai
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
|