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
 

 

Deleting records from empty DB2 table

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
monasu1998

Active User


Joined: 23 Dec 2005
Posts: 176
Location: India

PostPosted: Thu Jun 29, 2006 6:23 pm    Post subject: Deleting records from empty DB2 table
Reply with quote

Hi All:
There is a Program which deletes records from a DB2 table.
If the table is empty (i.e. no records in the table) what will happen???
It will abend, or give any error?
If error that will be a SQL error o any other error code??
It was an interview question....

Thanks in Advance.
Back to top
View user's profile Send private message

ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Thu Jun 29, 2006 6:27 pm    Post subject:
Reply with quote

It depends how the program deletes the records. Can you give us the SQL snippest from the program?

O.
Back to top
View user's profile Send private message
Prajesh_v_p

Active User


Joined: 24 May 2006
Posts: 133
Location: India

PostPosted: Thu Jun 29, 2006 7:01 pm    Post subject: Re: Deleting records from empty DB2 table
Reply with quote

If you are using direct DELETE query to delete rows, there will not be any sql error if the table is empty.
Back to top
View user's profile Send private message
twissi

Active User


Joined: 01 Aug 2005
Posts: 105
Location: Somerset, NJ

PostPosted: Fri Jun 30, 2006 11:16 am    Post subject:
Reply with quote

Hi Monasu1998,

It all depends on the way the program's coded!

When a DELETE query is executed against an empty table, it returns an SQLCODE of +100, mind you this's not an error.

But, if your program has a piece of code like this (assuming the launguage to be COBOL):

IF SQLCODE = +100
PERFORM Z010-CALL-ABEND
END-IF.

and Z010-CALL-ABEND invokes the ABEND routine, the job will abend.

But for that interview question, "an SQLCODE of +100" would have been the best answer.

Cheers, Twissi.
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Data replication from multiple Db2 ta... kishpra DB2 0 Mon Mar 27, 2017 9:58 pm
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am
No new posts how to send just 10 rows in a CICS sc... Megha Gupta CICS 5 Thu Feb 23, 2017 6:57 pm


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