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
 

 

SQLCODE displayed in zoned-decimal representation

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: SQLCODE displayed in zoned-decimal representation
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: 785
Location: Chennai, India

PostPosted: Fri Nov 23, 2012 6:39 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Nov 23, 2012 6:45 pm    Post subject: Reply to: SQLCODE displayed in zoned-decimal representation
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    Post subject:
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

Moderator


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

PostPosted: Fri Nov 23, 2012 7:04 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Nov 23, 2012 7:28 pm    Post subject: Reply to: SQLCODE displayed in zoned-decimal representation
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am
No new posts Convert Decimal to hexadecimal Steve Ironmonger DFSORT/ICETOOL 5 Fri May 27, 2016 4:19 pm
This topic is locked: you cannot edit posts or make replies. JCL to convert float decimal into rea... polymathtarun JCL & VSAM 3 Sun May 15, 2016 9:57 pm
No new posts conversion from char to packed decimal Musab Ahmed DFSORT/ICETOOL 7 Fri Apr 08, 2016 1:12 pm
No new posts SIGNED DECIMAL TO COMP-3 using cobol ... ram_vizag COBOL Programming 1 Tue Mar 01, 2016 11:32 pm


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