Reading FLat file and VSAm file to find matching records.



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

Reading FLat file and VSAm file to find matching records.

Postby mayankjha025 » Tue Sep 26, 2017 7:21 pm

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!
mayankjha025
 
Posts: 4
Joined: Tue Sep 26, 2017 7:10 pm
Has thanked: 0 time
Been thanked: 0 time

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

Postby NicC » Tue Sep 26, 2017 7:47 pm

'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.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

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

Postby mayankjha025 » Tue Sep 26, 2017 7:50 pm

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.
mayankjha025
 
Posts: 4
Joined: Tue Sep 26, 2017 7:10 pm
Has thanked: 0 time
Been thanked: 0 time

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

Postby enrico-sorichetti » Tue Sep 26, 2017 10:31 pm

from the murky description it looks like a good old plain two files match
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 3002
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

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

Postby Terry Heinze » Tue Sep 26, 2017 11:32 pm

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?
.... Terry
Terry Heinze
 
Posts: 239
Joined: Wed Dec 04, 2013 11:08 pm
Location: Richfield, MN, USA
Has thanked: 12 times
Been thanked: 11 times

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

Postby mayankjha025 » Tue Sep 26, 2017 11:36 pm

Hi Terry,
Yes u r right.
And the data gets written from PS file.
mayankjha025
 
Posts: 4
Joined: Tue Sep 26, 2017 7:10 pm
Has thanked: 0 time
Been thanked: 0 time

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

Postby mayankjha025 » Tue Sep 26, 2017 11:45 pm

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
mayankjha025
 
Posts: 4
Joined: Tue Sep 26, 2017 7:10 pm
Has thanked: 0 time
Been thanked: 0 time

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

Postby enrico-sorichetti » Wed Sep 27, 2017 12:14 am

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:
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 3002
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

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

Postby lawnless » Wed Oct 11, 2017 8:46 pm

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.
lawnless
 
Posts: 5
Joined: Tue Nov 10, 2015 11:23 pm
Has thanked: 0 time
Been thanked: 1 time


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post