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: 6968
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 How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts question about dfsms management clas... Hervey Martinez IBM Tools 0 Tue Oct 10, 2017 6:19 pm
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts Question related to Data dictionary f... rexx77 SYNCSORT 3 Thu Aug 31, 2017 7:23 am

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