View previous topic :: View next topic
|
Author |
Message |
JOJO
New User
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
WRITE-file-DETAILS. PROC
GET file1
IF EOF file1
STOP
ELSE
SEARCH file2 WITH file1-NM GIVING WS-DESC
IF file2
WRITE o-file ADD FROM file1
END-IF
GET file1
END-IF
END-PROC |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
Have you looked into SEARCH statement in Chapter 13: Table and Array Processing?
Or how about Synchronized File Processing in Chapter 12: File Processing? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
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. |
|
Back to top |
|
|
JOJO
New User
Joined: 06 Dec 2007 Posts: 4 Location: Jacksonville
|
|
|
|
I just changed the JOB INPUT and removed references to EOF as below, and the job ran fine in less than 1 minute.
JOB INPUT file1
SEARCH file2 WITH file1-NM GIVING WS-DESC
IF file2
WRITE o-file ADD FROM file1
END-IF
GOTO JOB
Thanks! |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Take a look at the SELECT statement used by ICETOOL, that can do what you want, and is pretty efficient. |
|
Back to top |
|
|
|