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
 

 

Interview question to write the records from A & B to C

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

New User


Joined: 05 Nov 2006
Posts: 1

PostPosted: Wed Nov 15, 2006 12:08 pm    Post subject: Interview question to write the records from A & B to C
Reply with quote

There are 2 tables A , B ..

There are 3 files C , D and E

now... the conditions to write the records from A & B to C,D,E files .. is...


if the Record found in A and B then write that record into C
if the Record found in A and not in B then write that record into D
if the Record found in B and not in A then write that record into E


.. Plzz place the code for this..

thanking you...
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


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

PostPosted: Wed Nov 15, 2006 2:29 pm    Post subject: Re: a gud interview question that i faced. plz place d solut
Reply with quote

this kind of thing can be accomplished by sort. there are probably 10 million variations of this question in the SORT forum. plzz look there!
Back to top
View user's profile Send private message
twissi

Active User


Joined: 01 Aug 2005
Posts: 105
Location: Somerset, NJ

PostPosted: Wed Nov 15, 2006 2:59 pm    Post subject:
Reply with quote

Dipu,

The question is unclear, so I'm assuming few things:

Quote:
if the Record found in A and B then write that record into C

Code:
SELECT * FROM Table_A WHERE Pri_Id IN (SELECT Pri_Id FROM Table_B)

Quote:
if the Record found in A and not in B then write that record into D

Code:
SELECT * FROM Table_A WHERE Pri_Id NOT IN (SELECT Pri_Id FROM Table_B)

Quote:
if the Record found in B and not in A then write that record into E

Code:
SELECT * FROM Table_B WHERE Pri_Id NOT IN (SELECT Pri_Id FROM Table_A)


And write the records returned by the queries accordingly.

Cheers, Twissi.
Back to top
View user's profile Send private message
vijay_bn79

New User


Joined: 20 Nov 2006
Posts: 48
Location: Hyderabad

PostPosted: Mon Nov 20, 2006 3:03 pm    Post subject: if the Record found in A and B then write that record into
Reply with quote

Hi..,

the concept of JOIN i.e

INNER JOIN
OUTER JOIN

Will provide you the solution

Thanks icon_biggrin.gif
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 Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts QUESTION: RETURN CHANNEL pahiker CA Products 21 Thu Apr 20, 2017 12:31 am
No new posts The Last Two Question For You To Ask ... CaptBill Mainframe Interview Questions 0 Fri Apr 14, 2017 5:42 am
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am


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