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

Repeat read a file from starting after EOF using Selcopy


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Ashish UK

New User


Joined: 19 Jun 2011
Posts: 2
Location: UK

PostPosted: Sun Jun 19, 2011 11:52 am
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sun Jun 19, 2011 12:10 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Sun Jun 19, 2011 2:46 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Mon Jun 20, 2011 9:42 am
Reply with quote

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
View user's profile Send private message
Ashish UK

New User


Joined: 19 Jun 2011
Posts: 2
Location: UK

PostPosted: Mon Jun 20, 2011 11:59 am
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jun 20, 2011 12:12 pm
Reply with quote

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
View user's profile Send private message
Dsingh29

Active User


Joined: 16 Dec 2008
Posts: 132
Location: IBM

PostPosted: Mon Jun 20, 2011 12:14 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Mon Jun 20, 2011 9:12 pm
Reply with quote

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
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 -> All Other Mainframe Topics

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 7
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top