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

Deleting records from empty DB2 table


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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: 2358
Location: Israel

PostPosted: Thu Jun 29, 2006 6:27 pm
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Load new table with Old unload - DB2 DB2 6
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Multiple table unload using INZUTILB DB2 2
No new posts Check data with Exception Table DB2 0
Search our Forums:

Back to Top