Posted: Thu Dec 16, 2010 5:43 pm Post subject: can sorting be done here
I have two files (X and Y) as input to a program.
Y is in sorted order containing a key value in each record.
A sql query is run in the program for each input record from X file giving key value to program. Now the key value has to be matched with file Y and if its there, then it is written as output.
My doubt is :
For each X file record, the whole Y file should be checked for match. Is there any alternative for this?
I have also an idea of executing the query as a whole for all X file records and keeping it in a temporary table in program. In that case, can this temporary table be sorted in program so that I can compare easily with Y file without reading it fully each time.
Help me out to get this done. _________________ Thanks,
actually, this sounds like a good candidate for a cobol program and a sort.
cobol reads the unsorted x,
does query and outputs the x with key value that will match y.
sort x and y, joining on key and outputing required data.
if y record is small, then it can be stored in cobol program internal table,
find match on y,
I would personally go for the first suggestion.
the cobol logic is easy,
the sort logic/control cards can be provided by Frank or Kolusu within a day or so.
I would not use a temporary db2 table. unnecessary use of resources.
also, the last suggestion:
COBOL pgm query, output x with key, sort/join x&y
would work without much thought to record size or file volume. _________________ Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum