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

CSC Interview Questions


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Kmr.deepakcs

New User


Joined: 11 Oct 2013
Posts: 37
Location: India

PostPosted: Thu Nov 14, 2013 7:34 pm
Reply with quote

I have a question which i have asked in csc interview.
what will the sqlcode of this query after execution.


select count(*) from tablename.

even there is no rows in table.

My answer: I told it will give sqlcode=100.


Please give your suggestion.....


Deepak kumar
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Thu Nov 14, 2013 7:58 pm
Reply with quote

Did you try to execute and see what happens?
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Fri Nov 15, 2013 4:00 pm
Reply with quote

Code:

---------+---------+---------+---------+---------+---------+---------+---------+
SELECT COUNT(*)                                                                 
FROM QUALIFIER.TABLE                                                           
---------+---------+---------+---------+---------+---------+---------+---------+
                                                                               
---------+---------+---------+---------+---------+---------+---------+---------+
          0                                                                     
DSNE610I NUMBER OF ROWS DISPLAYED IS 1                                         
DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100                     
---------+---------+---------+---------+---------+---------+---------+---------+
DSNE614I AUTOCOMMIT IS NO; NO CHANGES COMMITTED                                 
---------+---------+---------+---------+---------+---------+---------+---------+
DSNE601I SQL STATEMENTS ASSUMED TO BE BETWEEN COLUMNS 1 AND 72                 
DSNE620I NUMBER OF SQL STATEMENTS PROCESSED IS 1                               
DSNE621I NUMBER OF INPUT RECORDS READ IS 2                                     
DSNE622I NUMBER OF OUTPUT RECORDS WRITTEN IS 16                                 
Back to top
View user's profile Send private message
Kmr.deepakcs

New User


Joined: 11 Oct 2013
Posts: 37
Location: India

PostPosted: Fri Nov 15, 2013 4:12 pm
Reply with quote

Thanks bharat.icon_smile.gif
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Fri Nov 15, 2013 4:49 pm
Reply with quote

I believe SPUFI always gives a return code of 100 on a successful SELECT. Certainly used to. You really need to try this in batch. I cannot as we do not use DB2 here.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri Nov 15, 2013 4:56 pm
Reply with quote

Nic Clouston wrote:
I believe SPUFI always gives a return code of 100 on a successful SELECT. Certainly used to. You really need to try this in batch. I cannot as we do not use DB2 here.
Yes, that's correct and an annoying quirk (for me) of SPUFI. I had to create a report once, derived from a DB2 Table, and I ended up using the Batch Job instead of SPUFI as having SQLCODE=+100 was another test case to capture...
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Fri Nov 15, 2013 5:34 pm
Reply with quote

But again SQLCODE = + 100 is clear that there is no row to process further something like equivalent to EOF
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Fri Nov 15, 2013 5:46 pm
Reply with quote

But in batch does SELCT COUNT(col) FROM table; return SQLCODE=+000 or SQLCODE=+100. I think +000 because the SELECT has successfully returned data (a count of 0). But, as I said, I cannot test this.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Sat Nov 16, 2013 3:48 pm
Reply with quote

Spufi always returns +100 when number of lines are less than "MAX SELECT LINES". SPUFI fetches rows in a loop; the attempted FETCH after the last row gets SQLCODE +100 (row not found), and this is the code that SPUFI reports for the entire SELECT. You're correct Nic, in batch SQLCODE=+000 will be returned back.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Sun Nov 17, 2013 3:32 pm
Reply with quote

Thanks, Anuj. Another piece of "working it out mentally" gives RC=0!
Back to top
View user's profile Send private message
Kmr.deepakcs

New User


Joined: 11 Oct 2013
Posts: 37
Location: India

PostPosted: Sun Nov 17, 2013 4:55 pm
Reply with quote

thanks anuj and nic.
I thought answer is rc=0, bt i said sqlcode=100...my fault

But thanks for everyone for giving your valuable suggestions..........





Deepak kumar
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Nov 19, 2013 12:43 am
Reply with quote

You're welcome and Good Luck!
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 Comp interview questions Mainframe Interview Questions 5
No new posts Interview Questions on Cobol DB2 program Mainframe Interview Questions 5
No new posts The Last Two Question For You To Ask ... Mainframe Interview Questions 0
No new posts Mainframe Interview Questions CICS,CO... Mainframe Interview Questions 6
No new posts Viewing executing process in NDM .. q... IBM Tools 0
Search our Forums:

Back to Top