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
 

 

CSC Interview Questions

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
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    Post subject: CSC Interview Questions
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

Moderator


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

PostPosted: Thu Nov 14, 2013 7:58 pm    Post subject:
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    Post subject:
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    Post subject:
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: 1712
Location: UK

PostPosted: Fri Nov 15, 2013 4:49 pm    Post subject:
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

Senior Member


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

PostPosted: Fri Nov 15, 2013 4:56 pm    Post subject:
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

Moderator


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

PostPosted: Fri Nov 15, 2013 5:34 pm    Post subject:
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: 1712
Location: UK

PostPosted: Fri Nov 15, 2013 5:46 pm    Post subject:
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

Senior Member


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

PostPosted: Sat Nov 16, 2013 3:48 pm    Post subject:
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: 1712
Location: UK

PostPosted: Sun Nov 17, 2013 3:32 pm    Post subject:
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    Post subject:
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

Senior Member


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

PostPosted: Tue Nov 19, 2013 12:43 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts INCLUDE condition questions van bui DFSORT/ICETOOL 1 Thu Jun 30, 2016 9:52 am
No new posts SAS Programming - Basic Questions Techelm All Other Mainframe Topics 3 Fri Mar 18, 2016 10:53 pm
No new posts Where can i find Interview questions ... Elixir Mainframe Interview Questions 4 Sat Feb 20, 2016 12:38 am
This topic is locked: you cannot edit posts or make replies. Mainframe interview on 10th Oct 2015 ... kotesh Mainframe Jobs 0 Thu Oct 08, 2015 5:21 pm
No new posts File Aid DB2 Questions niks_jude Mainframe Interview Questions 1 Mon Aug 24, 2015 5:13 pm


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