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

SQLCODE displayed in zoned-decimal representation


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Anita Etury

New User


Joined: 21 Nov 2007
Posts: 3
Location: India

PostPosted: Fri Nov 23, 2012 6:34 pm
Reply with quote

Hi,In my COBOL-DB2 program, I am trying to handle SQL ERRors .
But it is displaying SQLCODE in zoned decimal format.
For eg. for SQLCODE -803, it is displaying as 00000080L.
Here's the part of code :
************************************************************
EXEC SQL
INSERT INTO TESTR04.CUSTMXXX(CUSTM_NO,CUSTM_NAME,
CUSTM_ADDR,CUSTM_DOB)
VALUES (:CUSTM-NO,:CUSTM-NAME,:CUSTM-ADDR,:CUSTM-DOB)
END-EXEC.
DISPLAY 'SQLCODE: ' SQLCODE
EVALUATE SQLCODE
WHEN 0
continue
WHEN -803
DISPLAY 'CUSTOMER ALREADY EXISTS IN the TABLE'
PERFORM error-processing
When other
Perform eror-processing
END-EVALUATE
**********************************************************
Here SQLCODE is in zoned-decimal format, Hence, the control is not going to the point WHEn -803 DISPLAY 'CUSTOMER .....'
So i want that to be in signed integer (0000080N to be displayed as -803), so that SQL error handling can be done as desired in the program.
How can I do that ?
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Fri Nov 23, 2012 6:39 pm
Reply with quote

No, SQLCODE is with COMP data type.

Quote:
Here SQLCODE is in zoned-decimal format, Hence, the control is not going to the point WHEn -803 DISPLAY 'CUSTOMER .....'

Not true; "WHEN -803" will work perfect when the last executed SQL has -803 as SQLCODE of SQLCA. The format you're concerned here doesn't matter.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Nov 23, 2012 6:45 pm
Reply with quote

Define a field as -(3)9, or -999 or some edited format that you like better, move your signed-zoned (also works with signed-packed) to that new field, and display the new field.
Back to top
View user's profile Send private message
Anita Etury

New User


Joined: 21 Nov 2007
Posts: 3
Location: India

PostPosted: Fri Nov 23, 2012 7:03 pm
Reply with quote

Hi team,
Thanks a lot for the quick response !

@ Bill.. Thanks for the solution icon_smile.gif It works fine !!!
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


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

PostPosted: Fri Nov 23, 2012 7:04 pm
Reply with quote

No

0000080N is equivalent to -805 ( Bind issue)

An excellent post by Dick on Zoned Decimal Conversion
could help

Check here for the post
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Nov 23, 2012 7:28 pm
Reply with quote

Anita Etury,

Glad to hear it is working.

Please be careful when posting, paste from your emulator screen wherever possible. You introduced confusion, picked up by Pandora-Box, over the 803, as you referred to it appearing also as 80N. Have a look at the link Pandora-Box provided, and you can also get the answer, when needed, without using the edited field.
Back to top
View user's profile Send private message
Anita Etury

New User


Joined: 21 Nov 2007
Posts: 3
Location: India

PostPosted: Fri Nov 23, 2012 7:42 pm
Reply with quote

Sure ! Thanks icon_smile.gif
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Need Help with Packed Decimal Signs DFSORT/ICETOOL 4
No new posts Select a DB2 value in a specific deci... DB2 4
No new posts String has hex character need to conv... COBOL Programming 3
No new posts How to display the leading zeros of a... DB2 7
Search our Forums:

Back to Top