Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

copy Matching records from KSDS files

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
dilpreet

New User


Joined: 18 Mar 2008
Posts: 34
Location: INDIA

PostPosted: Sun Apr 19, 2009 11:20 pm    Post subject: copy Matching records from KSDS files
Reply with quote

I have two KSDS files and want to copy matching records in the two files into a third file in a cobol program.

Both the files have a different number of records.
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sun Apr 19, 2009 11:35 pm    Post subject:
Reply with quote

Hello,

Depending on what you mean by "matching records" you could:

Read one file sequentially.

Read the other file randomly with the key from the first file.

If they "match" write to the 3rd file.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1239
Location: Richfield, MN, USA

PostPosted: Mon Apr 20, 2009 1:15 am    Post subject:
Reply with quote

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.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Apr 20, 2009 3:24 am    Post subject:
Reply with quote

or,

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.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Sort Card to Remove Duplicate records... raj4neo SYNCSORT 2 Wed Jan 25, 2017 4:44 am
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts HALDB data refresh/copy from producti... vineetanand2007 IMS DB/DC 1 Mon Jan 02, 2017 11:16 am
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us