Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Insert a Row_number into table useit DB2 2 Tue Sep 19, 2017 1:07 pm
No new posts how to see when the last read access ... Mike 1304 DB2 1 Tue Sep 12, 2017 7:52 pm
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm
No new posts PC (UTF-8) -> z/OS (EBCDIC) -> ... prino All Other Mainframe Topics 4 Fri Sep 01, 2017 1:47 am
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 21 Sun Aug 27, 2017 10:35 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us