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

SQLCODE FFFFFC66 what is this error ?


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Wed Jan 07, 2009 7:20 pm
Reply with quote

HI,

I have SQLCODE FFFFFC66. How to convert it to readable SQLCODE. This error occurred when executing a cobol program which uses CICS.

Thank You In Advance,
Sushanth Bobby
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8700
Location: Dubuque, Iowa, USA

PostPosted: Wed Jan 07, 2009 7:43 pm
Reply with quote

Windows has a calculator function that converts hex to decimal. There are also other ways to convert the value both on the web and on mainframes. FC66 is -922 decimal.
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Wed Jan 07, 2009 7:51 pm
Reply with quote

Robert,

In windows i have tried the CALCULATOR application for FC66, its giving 64614. I also tried in the EXCEL using =HEX2DEC("FC66"). Same result 64614.

Can you give me tip to how to convert in any one of the applications in windows or mainframe.

Sushanth Bobby
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Wed Jan 07, 2009 7:57 pm
Reply with quote

negative numbers in binary are in two complement notation

FFFFFC66 ==> -39A ==> -922
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8700
Location: Dubuque, Iowa, USA

PostPosted: Wed Jan 07, 2009 8:01 pm
Reply with quote

Windows calculator, scientific mode, hex, key or click in FC66. Hit the +/- key to negate the value and note the 039A. Clear, enter 39A and hit the decimal key. See the value 922 on the display. Hit the +/- key again to reverse the sign to its original value.
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Wed Jan 07, 2009 8:38 pm
Reply with quote

Thank You Enrico,
Thank You Robert,

Sushanth Bobby
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1248
Location: Richfield, MN, USA

PostPosted: Wed Jan 07, 2009 9:04 pm
Reply with quote

or subtract 64K (65536) from 64614 to get -922.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1248
Location: Richfield, MN, USA

PostPosted: Wed Jan 07, 2009 9:10 pm
Reply with quote

or have DB2 translate the error for you by calling DSNTIAC (DSNTIAR for batch) for a formatted version of the SQLCODE.
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Thu Jan 08, 2009 9:55 am
Reply with quote

Thank You Terry,

Quote:
subtract 64K (65536) from 64614 to get -922.


I have one doubt, for any type of SQLCODE error will it be 64K only. What is the reason behind 64K, that is WHY 64K ?

Sushanth
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Thu Jan 08, 2009 10:31 am
Reply with quote

Hello,

The decimal value of x'FFFF' is 65535. When 1 is added, it gives 65536 - which is 64k. This is the largest number that will fit in 2 bytes.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1248
Location: Richfield, MN, USA

PostPosted: Thu Jan 08, 2009 10:38 am
Reply with quote

Someone with a math background can probably explain it better than me, but I once noticed that if you increment 32,767 (the largest positive number that fits in a 2-byte binary field) by one you get X'8000' which is -0. Increment by one again and you get -1. Again, you get -2. In other words every increment by a +1 results in a successively smaller number. The same thing happens with 64K. Once you reach the maximum positive number, adding +1 to it results in successively smaller numbers. I guess this is because the sign of a binary number is stored in the leftmost bit. As I said, someone with a math background could I'm sure explain it better. icon_smile.gif
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Thu Jan 08, 2009 11:05 am
Reply with quote

D.sh & Terry,


I just want to check is my calculation correct.
SQLCODE : FFFFFC66
splitting the SQLCODE in 2 parts,
first part : FFFF
FFFF+1 = 65536
second part : FC66
FC66 = 64614

Subracting the decimals of Part2 from Part 1,
922

And the -ve sign is got by,
Quote:
Once you reach the maximum positive number, adding +1 to it results in successively smaller numbers


Final Result Code = -922


Sushanth
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1248
Location: Richfield, MN, USA

PostPosted: Thu Jan 08, 2009 8:54 pm
Reply with quote

I don't fully understand 2s compliment but if you flip all the bits of X'FC66' which is 1111 1100 0110 0110 you get 0000 0011 1001 1001 which is X'0399'. Adding 1 you get X'039A' which is decimal 922. Reversing the sign, it becomes -922. A quicker way to get to the final result is to simply subtract 64K from the SQLCODE as shown by SQLCA. I don't know if that's more confusing or not. icon_smile.gif
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Thu Jan 08, 2009 10:23 pm
Reply with quote

sushanth bobby wrote:
I just want to check is my calculation correct.
SQLCODE : FFFFFC66
splitting the SQLCODE in 2 parts,
first part : FFFF
FFFF+1 = 65536
second part : FC66
FC66 = 64614

Subracting the decimals of Part2 from Part 1,
922

Sushanth

No splitting of SQLCODE!!!

If you really want, you can do the full calculation (all numbers in hexa): 100000000 - FFFFFC66 = 39A

But it's easier to use smaller numbers, they give the same result:
(100000000 - FFFFFC66) = (1000000 - FFFC66) = (10000 - FC66)

Isn't that magic ??? icon_smile.gif
Back to top
View user's profile Send private message
surya.kalyan

New User


Joined: 09 Jan 2007
Posts: 20
Location: Mumbai

PostPosted: Thu Jan 15, 2009 8:55 pm
Reply with quote

A simple way:
1) Use the windows scientific calculator...
2) select hex in the radio button....
3) select Dword radio button (4 bytes)...
4) paste your number FFFFFC66...
5) press the button +/-....
6) press =....
7) I got 39A...
8) select the dec radio button now...
9) the decimal number 922...


One more way using the calculator is:
Repeat the procedure till 4 in the steps above...
after pasting FFFFFC66
5) press NOT button...
6) add 1....
7) I got 39A...
8) select the dec radio button now...
9) the decimal number 922...

So, the number was -922

In short: The negative of a number is stored as Two's complement which is inverting the bits from zero to 1 (1's complement and then adding 1).
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 -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Help on IMS -API URL migrating from P... IMS DB/DC 1
No new posts JES datasets IO Error ABENDS & Debugging 3
No new posts Error to invoke MPP program through B... IMS DB/DC 3
No new posts SQLCODE=-311 in Cobol SP-DB2. COBOL Programming 2
No new posts PKZIP error ZPFM121E and ZPCE009E JCL & VSAM 6
Search our Forums:

Back to Top