View previous topic :: View next topic
|
Author |
Message |
Ashish UK
New User
Joined: 19 Jun 2011 Posts: 2 Location: UK
|
|
|
|
Hi,
My requirement is :
Read a file again from the first record although the EOF (End Of File) condition is encountered while reading the same file (using Selcopy only).
Please let me know at the earliest with the selcopy code.
Thanks,
Ashish |
|
Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Have you tried anything? When, at EOF, you CLOSE the file then OPEN it, does it give you what you want? Obviously watch out for the 2nd EOF, you won't want to do it forever. |
|
Back to top |
|
 |
expat
Global Moderator

Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Ashish UK wrote: |
Please let me know at the earliest with the selcopy code. |
A liitle more bluntly put than Bills comment above.
This is a HELP forum, not a DO MY PAID WORK FOR ME forum.
Now scuttle off and show us what you have achieved so far, and when we see evidence that you have tried to help yourself, feel free to ask for help from others. |
|
Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello and welcome to the forum,
Why does someone believe the file needs to be "read again"?
As others have mentioned, we will help - but NOT simply do the work for you. |
|
Back to top |
|
 |
Ashish UK
New User
Joined: 19 Jun 2011 Posts: 2 Location: UK
|
|
|
|
Hi,
Thanks for the reply. But it does not solve the problem. The requirement is :
01. To read File-A which is having the Duplicate records & those are sorted. I have to keep the duplicate records.
02. Read another file (say, File-B which is not having duplicate records) to get some extra information for all the records of File-A (including the Duplicate records).
03. I am getting the output till encounters a duplicate record from File-A. When ever Selcopy encounters a dupliacte key for the File-A, it is getting the next record from File-B. As a result there is mismatch of records.
04. So, if there is a duplicate record in File-A, then i have to read the File-B once again form Starting.
So, if any way i can reset the pointer value to first record of File-B, i can get all the values from File-B.
Please reply. |
|
Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
I think it is not SELCOPY that is doing this, but the stuff that you type in to SELCOPY. Program only do what you tell them, the thing is to tell them to do the right thing (and assuming that the solution you have chosen is possible).
You have A, sorted, with duplicates.
You have B, sorted(?), without duplicates.
Since you mention a "key" that "Selcopy encounters", I assume you are using some feature of Selcopy (feel free to let us know, otherwise we can shoot away in the dark).
If you are using such a feature, make sure you understand exactly what it is doing. This can also involve some simple tests with various combinations, multiples on first, second, both. Try to work out how the feature works.
I'd just suspect that if you swap the files around you might get the answer you want. But test it out first as I've suggested. |
|
Back to top |
|
 |
Dsingh29
Active User

Joined: 16 Dec 2008 Posts: 132 Location: IBM
|
|
|
|
Hey Ashish,
Your latest post is not in sync with your first one. Anyways, there is still lack of clarity on your requirements.
1. How are you reading file-B, is there any key to identify which records corresponds to file-A.
2. Why do you want to read file-B from starting in case of duplicates, simply hold the previous record (file-B) when next record (file-A) is same (mean duplicate).
3. Suggest you should search the forum for "file match algorithm", i think that is what your requirement is. |
|
Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
Your latest post is not in sync with your first one. Anyways, there is still lack of clarity on your requirements. |
Quote: |
Thanks for the reply. But it does not solve the problem. The requirement is : |
There was no intention to provide "a solution". Until at least most of use have the same understanding of the complete requirement, any "solution" would most likely be a wild guess.
Quote: |
04. So, if there is a duplicate record in File-A, then i have to read the File-B once again form Starting. |
No, you dont. . . The method you have chosen is the worst possible alternative (it it will work at all). If you believe you must to this you do not understand one of the most basic 2-file processes. What you want is a 2-file, match-merge (some call this a line balance). At the top of the COBOL part of the forum is a "Sticky" containing tested working code. It has been downloaded a few thousand times and worked as desired for those who used it. |
|
Back to top |
|
 |
|