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 Loading data to table gives wrong for... Raghu navaikulam DB2 16 Thu Jul 13, 2017 2:11 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts unload data from table with lob columns farhad_evan DB2 1 Sat Apr 22, 2017 1:32 pm
No new posts Data replication from multiple Db2 ta... kishpra DB2 9 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


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