Portal | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
sushanth bobby

Senior Member

Joined: 29 Jul 2008
Posts: 1018
Location: India

 Posted: Sat Nov 22, 2008 3:36 pm    Post subject: SQLCODE 00000080N Hello, I want know, what this SQLCODE 00000080N stands for. Sushanth

dick scherrer

Moderator Emeritus

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

 Posted: Sat Nov 22, 2008 3:40 pm    Post subject: Hello, -805
sushanth bobby

Senior Member

Joined: 29 Jul 2008
Posts: 1018
Location: India

 Posted: Sat Nov 22, 2008 3:43 pm    Post subject: Dick, How ? 00000080N = -805. Is there any conversion process to know the actual number(-805). Sushanth
dick scherrer

Moderator Emeritus

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

 Posted: Sat Nov 22, 2008 3:48 pm    Post subject: Hello, 80N is the zoned-decimal representation of -805. Do you know how to "read" zoned-decimal numbers in a file?
sushanth bobby

Senior Member

Joined: 29 Jul 2008
Posts: 1018
Location: India

 Posted: Sat Nov 22, 2008 3:50 pm    Post subject: NOPE. Can you tell me, dick ?
sushanth bobby

Senior Member

Joined: 29 Jul 2008
Posts: 1018
Location: India

 Posted: Sat Nov 22, 2008 3:56 pm    Post subject: Dick, I just did a search in google for this error , there was already a post Here. But, he has resolved it using the SQLSTATE. Can you tell me how to "READ the ZONED decimal numbers". Sushanth
sushanth bobby

Senior Member

Joined: 29 Jul 2008
Posts: 1018
Location: India

Posted: Sat Nov 22, 2008 4:11 pm    Post subject:

Hi,
I just google'd more & got this table.
 Code: Digit   EBCDIC Display +0   { +1   A +2   B +3   C +4   D +5   E +6   F +7   G +8   H +9   I -0   } -1   J -2   K -3   L -4   M -5   N -6   O -7   P -8   Q -9   R

So, according the to the table & my error.

00000080N = 80N
80N = 80(-5)
80N = -805

Is this correct dick or is there any other method ?

Sushanth
dick scherrer

Moderator Emeritus

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

Posted: Sat Nov 22, 2008 4:11 pm    Post subject:

Hello,

The sign of a zoned-decimal number is in the high-order nibble of the low-order byte.

A cobol field of pic s9(5) with a value of +12345 is stored as 1234E (which is x'F1F2F3F4C5'). The "C" is the positive sign. A "D" is the negative sign. An "F" is no sign, but is treated as positive.

Positive values are from C0 thru C9, negative values are from D0 thru D9.

 Quote: Is this correct dick or is there any other method ?
That will work
dick scherrer

Moderator Emeritus

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

Posted: Sat Nov 22, 2008 4:18 pm    Post subject:

Hello,

 Code: Digit   EBCDIC/Hex         Display +0       {     C0    +1       A     C1 +2       B     C2 +3       C     C3 +4       D     C4 +5       E     C5 +6       F     C6 +7       G     C7 +8       H     C8 +9       I     C9 -0       }     D0 -1       J     D1 -2       K     D2 -3       L     D3 -4       M     D4 -5       N     D5 -6       O     D6 -7       P     D7 -8       Q     D8 -9       R     D9
sushanth bobby

Senior Member

Joined: 29 Jul 2008
Posts: 1018
Location: India

 Posted: Sat Nov 22, 2008 4:25 pm    Post subject: Thank You Dick, Till now, i was thinkin SQLCODEs will be coming in numeric format like -805. Today only i got know, SQLCODEs might also come in this way. Thank You Again for the Valuable information DICK. Sushanth
dick scherrer

Moderator Emeritus

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

 Posted: Sat Nov 22, 2008 4:28 pm    Post subject: Reply to: SQLCODE 00000080N You're welcome d
enrico-sorichetti

Senior Member

Joined: 14 Mar 2007
Posts: 10701
Location: italy

 Posted: Sat Nov 22, 2008 4:36 pm    Post subject: Reply to: SQLCODE 00000080N sqlcode is a binary number, wether it is displayed in an intelligible form depends only on the laziness of the programmer... for -805 ==> 8 bytes for the CVD work area 15 bytes for the display area 15 bytes for the edit mask 1 instruction to convert from binary to packed 4 instructions for the edit for 80n ==> 8 bytes for the CVD work area 15 bytes for the display area 1 instruction to convert from binary to packed 1 instructions to unpack to the display area
sushanth bobby

Senior Member

Joined: 29 Jul 2008
Posts: 1018
Location: India

 Posted: Sat Nov 22, 2008 4:48 pm    Post subject: WOW, so there is so more in SQLCODE than, what meets the eye. I got thank the DB2 designers for making, life of the programmer's easier, and i got to blame them for making them lazy... Only, one thing i did'nt get ENRICO, what is CVD ? Sushanth
enrico-sorichetti

Senior Member

Joined: 14 Mar 2007
Posts: 10701
Location: italy

Posted: Sat Nov 22, 2008 5:05 pm    Post subject: Reply to: SQLCODE 00000080N

from the POP ( principles of operations )

short format..
CVD[G] Register,Storage_location
 Quote: The first operand is changed from binary to decimal, and the result is stored at the second operand location. - For CONVERT TO DECIMAL (CVD), the first operand is treated as a 32-bit signed binary integer, and the result occupies eight bytes in storage. - For CONVERT TO DECIMAL (CVDG), the first operand is treated as a 64-bit signed binary integer, and the result occupies sixteen bytes in storage. The result is in the format for packed decimal data, as described in Chapter 8, “Decimal Instructions.” The rightmost four bits of the result represent the sign. A positive sign is encoded as 1100; a negative sign is encoded as 1101.
sushanth bobby

Senior Member

Joined: 29 Jul 2008
Posts: 1018
Location: India

 Posted: Sat Nov 22, 2008 5:12 pm    Post subject: Thank U Enrico, for that pretty information.
enrico-sorichetti

Senior Member

Joined: 14 Mar 2007
Posts: 10701
Location: italy

Posted: Sat Nov 22, 2008 6:37 pm    Post subject: Reply to: SQLCODE 00000080N

here is the full logic

 Code: 1 ...  2 ... call some subroutine to perform something  3         CALL  Some_subroutine  4         LTR   R15,R15           5         BZ    Continue             6... extract the reason code  7... for brevity I assume that the feedback area is defined  8... and already addressable  9         L     R15,Reason_Code 10         CVD   R15,Double_Word  1... now the road diverge  2... lazy bum  3         UNPK Display_area,Double_Word  4... done  5... decent approach  6         MVC  Display_area,=x'40202020202020202020202020202020212121'  7         LA   R1,Display_area+1  8         EDMK Display_area,Double_word  9         BNM  Not_negative 20         BCTR R1,0  1         MVI  0(R1),C'-'  2Not_negative  DS   0H  3... the reason code is ready to be printed  4... continue with error processing  5... exit error processing  6Continue      DS   0H  7...  8... work areas  9Double_Word   DS   D 30...  1Display_Area  DS   CL16  2...

here is the explanation ( code tag for the alignment )
 Code: ( 4) Load and test register, will return the condition code for the sign ( 5) Branch if zero ( 9) load the reason code in a register      for short term utilization 15 is OK (10) Convert the binary content of reg 15 to a packed decimal lets skip (11) (12) (13) (16) move to the display area the edit mask      40 is the fill char ( for non significant )      20 is the edit indicator, space or non zero digit      21 digit even if is zero      the first non zero digit or the 21 will set the significance indicator (17) load register 1 for neatness ( should not be needed anyway ) (18) EDIT and MARK,      will edit the number according to the mask and load in      register 1 the address of the first non zero digit (19) edit will set the condition code      branch if not minus ( >= 0 ) (20) decrement register 1 by one (21) move the minus (29) the area for the packed result (30) the display area
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Is SQLCODE -811 possible while fetchi... Abhi_1985 DB2 1 Tue Aug 18, 2020 12:19 am SQLCODE=-204 SQLSTATE=42704 mughais27 DB2 4 Fri Feb 14, 2020 5:04 pm Getting sqlcode 805 while executing R... abdulrafi DB2 10 Thu Dec 26, 2019 11:46 am SQLCODE -950 in PREPARE statement ... PeD DB2 2 Sat Apr 20, 2019 7:00 pm How to resolve sqlcode of CALL ATTACH... maxsubrat DB2 3 Fri Feb 22, 2019 11:54 am

 © 2003-2020 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us