Page 1 of 1

Reading FLat file and VSAm file to find matching records.

PostPosted: Tue Sep 26, 2017 7:21 pm
by mayankjha025
I have 2 files. One is VSAM file with key of length 24 and 10 lakh plus records. The second file is a flat file, which has 70 thousand records. I have to fetch a particular field from flat file, if the record matches the key of VSAM file. suppose i read first record of VSAM file, then i read the flat file one by one till end and if the key matches any record in between, it is written in out file. Then again i read the VSAM for second key, then i read the flat file and use the same logic as mentioned before. The records are written correctly to the out file but the problem is since the VSAM is very large, the Job is running for a very long time(around 1.5 hours). Can anyone help with an alternate logic so the program can be more efficient? Thanks!

Re: Reading FLat file and VSAm file to find matching records

PostPosted: Tue Sep 26, 2017 7:47 pm
by NicC
'lakh' is not an appropriate measure. Please clarify.
You are using data sets not files.

If you are reading the VSAM data set in key sequence and the sequential data set is in the same sequence then there is not much that you can do programmatically but you could look at your JCL and in particular the blocksize of your sequential data set and the number of buffers allocated.

Re: Reading FLat file and VSAm file to find matching records

PostPosted: Tue Sep 26, 2017 7:50 pm
by mayankjha025
VSAM file has 1,000,000 records while flat file has 70,000 records. Basically, i am going through the read process for 70,000 * 1,000,000 times which is making the Job run for a long time.

Re: Reading FLat file and VSAm file to find matching records

PostPosted: Tue Sep 26, 2017 10:31 pm
by enrico-sorichetti
from the murky description it looks like a good old plain two files match

Re: Reading FLat file and VSAm file to find matching records

PostPosted: Tue Sep 26, 2017 11:32 pm
by Terry Heinze
Are you reading all 70,000 records of the sequential data set for each of the 1 million records of the VSAM data set? I still don't understand your matching logic. Do records get written from the PS or the VSAM data set?

Re: Reading FLat file and VSAm file to find matching records

PostPosted: Tue Sep 26, 2017 11:36 pm
by mayankjha025
Hi Terry,
Yes u r right.
And the data gets written from PS file.

Re: Reading FLat file and VSAm file to find matching records

PostPosted: Tue Sep 26, 2017 11:45 pm
by mayankjha025
If the key matches some fields of flat file, I have to fetch another field from flat file(which obviously isn't present in vsam otherwise there was no need to read the flat file).
That's the logic

Re: Reading FLat file and VSAm file to find matching records

PostPosted: Wed Sep 27, 2017 12:14 am
by enrico-sorichetti
too bad that obviously You did not care to explain it clearly from the beginning
and ...
this is a professional forum, do DO NOT USE ANY SMS SLANG :evil:

Re: Reading FLat file and VSAm file to find matching records

PostPosted: Wed Oct 11, 2017 8:46 pm
by lawnless
Your best option is probably to sort the flat file to match the key sequence of the VSAM. Then you can write proper match code, which will mean you only read each record in the flat file once. That assumes that you have described your requirements accurately. I would have considered that a very basic and obvious solution.