To set the POINTER on the start of the seq file



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

To set the POINTER on the start of the seq file

Postby TRESA » Thu Nov 08, 2007 6:04 pm

how do i set the pointer to the start of the sequential file after reaching EOF?
i want to search an item in sequential file and for every EOF i want to get next time and start search again. how do i do this? Any pointers?
TRESA
 
Posts: 8
Joined: Sun Oct 28, 2007 11:51 am
Has thanked: 0 time
Been thanked: 0 time

Re: To set the POINTER on the start of the seq file

 

Re: To set the POINTER on the start of the seq file

Postby CICS Guy » Thu Nov 08, 2007 8:49 pm

Simple, CLOSE & OPEN.......
CICS Guy
 
Posts: 255
Joined: Wed Jun 20, 2007 4:08 am
Has thanked: 0 time
Been thanked: 0 time

Re: To set the POINTER on the start of the seq file

Postby dick scherrer » Fri Nov 09, 2007 1:24 am

Hello,

I'd suggest that you consider some alternative to closing and opening the file repeatedly.

What kind of data are you searching for? How many records might be in the file? How many values will be searched for?

If the sequential file has only 10000 records and there are only 1000 "search values", that run will take 10million reads if the file is read to eof for each value. . . .

If you explain your requirement in a bit more detail, we may be able to suggest an alternative approach.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: To set the POINTER on the start of the seq file

Postby TRESA » Sat Nov 10, 2007 4:12 pm

i want to search an item number in sequential file with item number from vsam file. If a match is found i'll be writing the record to output file. For the first record the sequential file will be searched till EOF but for the second record i cant set the pointer to the start of the seq file. i can use a table for searching but then i need to know the size of the input seq file. any other option?
TRESA
 
Posts: 8
Joined: Sun Oct 28, 2007 11:51 am
Has thanked: 0 time
Been thanked: 0 time

Re: To set the POINTER on the start of the seq file

Postby CICS Guy » Sat Nov 10, 2007 11:24 pm

TRESA wrote:i want to search an item number in sequential file with item number from vsam file. If a match is found i'll be writing the record to output file. For the first record the sequential file will be searched till EOF but for the second record i cant set the pointer to the start of the seq file. i can use a table for searching but then i need to know the size of the input seq file. any other option?
Searched to EOF even if you have already found a match?
Like I said before CLOSE & OPEN, you are back at the begining.
Another option is to use a (external or internal) sort and get the sequential file sorted to the same sequence as the VSAM file, that way you will only need one pass through the seqential file.
CICS Guy
 
Posts: 255
Joined: Wed Jun 20, 2007 4:08 am
Has thanked: 0 time
Been thanked: 0 time

Re: To set the POINTER on the start of the seq file

Postby dick scherrer » Sun Nov 11, 2007 2:20 am

Hello,

Your requirement is to match 2 files. To do this properly, you need to have both files in the "same sequence" - that is the field to be matched.

A 2-file match is one of the most common business requirements.

Most organizations will not permit code that re-reads a sequential file many times to "match" records. The overhead is far too high.

How many records are in the vsam file? How many records are in the sequential file?

The performance problems with the re-start/re-read process are not easily detectable with very small files. The problem is later discovered when full-file testing is done or when the process is promoted to production.

Is it possible that you could read the sequential file and then do a random read on the vsam file to detect if there is a "hit" or a "miss" rather than reading the vsam and then trying to match the item to the sequential file?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post