IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Which of the following statements correctly describe?


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
CIS777
Currently Banned

New User


Joined: 16 Sep 2005
Posts: 6

PostPosted: Mon Sep 19, 2005 10:14 pm
Reply with quote

EXEC SQL INSERT INTO T1 (C1, C2, C3, C4, C5) VALUES
(:HV1, :HV2, :HV3, :HV4, :HV5) END-EXEC.

Which of the following statements correctly describe what happens when the above statement is executed in PGM1?

A. The statement will succeed if each of the columns is defined as NOT NULL
WITH DEFAULT.

B. If an SQLCODE -803 is encountered, an update statement can be issued to modify the non-key columns of T1.

C. PGM1 will automatically be rolled back if the values for HV1 and HV2
already exist.

D. The statement will fail because only 5 of the 6 columns are specified.

E. The statement will return an SQLCODE -104.
Back to top
View user's profile Send private message
ikumar

New User


Joined: 02 Aug 2005
Posts: 81

PostPosted: Thu Sep 22, 2005 8:28 pm
Reply with quote

i think it could be option B.
Back to top
View user's profile Send private message
reshma

New User


Joined: 10 Sep 2005
Posts: 9
Location: software engineer

PostPosted: Fri Sep 23, 2005 10:39 am
Reply with quote

i think option A is correct.option with -104 code is irrelevant.
Back to top
View user's profile Send private message
sandeep4u

New User


Joined: 12 Aug 2005
Posts: 32

PostPosted: Fri Sep 23, 2005 11:09 am
Reply with quote

Hi,

answer is option A.........
Back to top
View user's profile Send private message
ikumar

New User


Joined: 02 Aug 2005
Posts: 81

PostPosted: Fri Sep 23, 2005 4:08 pm
Reply with quote

It is not necessary to have all the columns defined with "NOT NULL WITH DEFAULT" option. just "NOT NULL" is enough to execute as all the 5 columns are specified in VALUE clause.
If there are any other columns other than the 5 mentioned then only you need "WITH DEFAULT" option.
that is why i have chosen the answer B.

Please let me know if i am wrong...
Back to top
View user's profile Send private message
anuradha

Active User


Joined: 06 Jan 2004
Posts: 247
Location: Hyderabad

PostPosted: Fri Sep 23, 2005 8:57 pm
Reply with quote

Hi CIS777!

For a moment forget about OPTION A.

Option B says " If an SQLCODE -803 is encountered, an update statement can be issued to modify the non-key columns of T1. "

-803 error occurs if any duplicate row is found. we should issue a update statement to modify KEY-COLUMNS (Not Non-Key columns) of T1 table. So this option is ruled out.

Option C says "PGM1 will automatically be rolled back if the values for HV1 and HV2 already exist. "

We dont know what are the key columns and we are not sure how the program is handling SQL abends for the given query. So we can't judge by this statement. So this is ruled out.

Option D says "The statement will fail because only 5 of the 6 columns are specified. "

we are not sure for this statement too as they didn't mention the number of columns here. Who knows the 6th column may allow nulls too. So this option is also ruled out.

Option E says "The statement will return an SQLCODE -104"

The given SQL statement is fine. So this too ruled outttttttt


Now the left over is option A. There is no harm if we code not null with Default. So guys, Option A is correct. icon_biggrin.gif

HTH,
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Relate COBOL statements to EGL statement All Other Mainframe Topics 0
No new posts Embeding DB2 sql statements in scirpt... DB2 7
No new posts filter COMMIT/ROLLBACK statements DFSORT/ICETOOL 13
No new posts Rexx to create VSAM define statements CLIST & REXX 10
Search our Forums:

Back to Top