Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 6970
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 Extract the records with a PD field's... sudhakar84 DFSORT/ICETOOL 11 Mon Apr 02, 2018 7:26 pm
No new posts Merge 2 records sancraig16 SYNCSORT 19 Tue Mar 27, 2018 8:17 pm
No new posts Copy set of records based on condition krish.deepu SYNCSORT 2 Thu Mar 08, 2018 11:39 am
No new posts write multiple lines in PS file in cobol Balu5491 COBOL Programming 7 Wed Mar 07, 2018 10:27 am
No new posts A couple of Interview Questions on Co... viplavmodi36 Mainframe Interview Questions 5 Fri Feb 23, 2018 6:21 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us