Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
In addition to Dick's suggession, you could sort both VSAM files in the same sequence (if they aren't already) then use simple match logic to write matched records to your 3rd file. Matching 2 files on the same key is a very fundamental process in COBOL logic.
Joined: 20 Oct 2006 Posts: 6970 Location: porcelain throne
even though this is a cobol forum,
a simple compare
and output matches to a third file
has only been done a gizzillion times by dfsort with the COPY function.
search the dfsort forum,
would not even be suprised if it is one of the dfsort tricks.
check out the sticky in the dfsort forum for references.
by the way, you could use the COPY function and not SORT,
if the ksds key is what you are matching - already sorted.
other wise, SORT the files using the CTLnnn stuff with your keys
dfsort (and syncsort) can read vsam files...
it is easy - there are tons of examples
and if you have syncsort, no problem,
the control cards are probably the same.
actually this is a waste of a cobol program,
especially since you apparently don't know enough to write a cobol pgm on your own.
and, if you go the sort route,
there are IBMers that maintain DFSORT that are always here,
as well as syncsort has representatives that provide help.
(read help as they will provide you the control cards),
whereas if you waste your time trying to write your first cobol program,
you need to debug it.