Joined: 06 Dec 2007 Posts: 4 Location: Jacksonville
Hi,i have a requirement for processing a vsam ksds file (file1) with more than 10000 records and compare with a flat file (file2) with around 1000 records, and copy the matched record to another vsam output file o-file.
The file1 key length is 58 but i need to check for match only with part of the key from position 45 (length 8).
i have given my easytrieve code below. the output file has been already created and hence i am updating it.
The job is taking more than an hour to execute, and i have cancelled it twice, fearing that there is some problem. Is there a better way to code or should i let my job to complete? Pls advise. Thanks!
FILE file2 TABLE 30000
ARG 1 8 A
DESC 10 10 A
FILE file1 VS
file1-KEY 1 58 A
file1-LIB 1 15 A
file1-DESC 45 135 A
file1-NM 45 8 A
FILE o-file VS UPDATE
WS-DESC W 135 A
JOB INPUT NULL
IF EOF file1
SEARCH file2 WITH file1-NM GIVING WS-DESC
WRITE o-file ADD FROM file1
Joined: 23 Nov 2006 Posts: 19270 Location: Inside the Matrix
To compare 10000 records against 1000 should take very little time - a couple of minutes max. . .
I'd suggest you simply sort both sets of data on "the key" and use your sort product to match the files.
You could also use a small bit COBOL code to do a 2-file match/merge to get what you want. If you are not familiar with this, there is a "sticky" near the top of the COBOL section of the forum that is a working sample.