BookmarkSubscribeRSS Feed
ErikNM
Calcite | Level 5

When trying to read (or open) a table from an IBM Db2 database (via DI Studio), we get the following errors: 

ERROR: CLI open cursor error: [IBM][CLI Driver] SQL30020N Execution of the command or SQL statement failed because of a syntax error in the communication data stream that will affect the successful execution of subsequent commands and SQL statements: Reason Code "0x220A"("0100")"". SQLSTATE=58009

 

ERROR: CLI close cursor error: [IBM][CLI Driver] CLI0108E Communication link failure. SQLSTATE=40003

This is because of 1 specific numeric variable. If we stop reading it, then everything else loads correctly.

 

The numeric variable is likely troublesome because it's stored with the length 38,0 in the source database.

 

Do you have any advice on how we might remedy this? I'm hoping there's some kind of library setting or precode we might use to force the variable into an acceptable numeric format.

3 REPLIES 3
Tom
Super User Tom
Super User

Does DI give you any option to tell SAS to convert it to a string?  Using the DBSASTYPE dataset option?

There is no way to store 38 digits accurately in a numeric variable.

Most likely the value is being used as an identifier and not an actual number with 38 significant digits so you would want to convert it to a string anyway.

ChrisNZ
Tourmaline | Level 20

DB2 can store no more than 19 digits accurately afaik, just like SAS (on PC/Unix) can store no more than 16 accurate digits (mainframes can store a few more as they use a longer mantissa).

So any 32-digit number in DB2 will almost certainly be different from the number stored. This can be seen in SAS too.

data _null_;
  A=12345678901234567890123456789012;
  put A= 32.0; 
run;

A=12345678901234566802609541218304

                  ^ the digits after this point are inaccurate

 

A precision of 38 is silly, and creates issues, even within the IBM world. See link below. 


You best bet is to create a view or a nickname. See here.

 

 

 

 

 

Patrick
Opal | Level 21

Using DBSASTYPE like @Tom suggests set as an option on your table metadata objects is certainly worth a try (using CHAR(38)). If you also write to the table then set also the DBTYPE option.

http://support.sas.com/documentation/cdl/en/acreldb/63647/HTML/default/viewer.htm#a001371572.htm

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 928 views
  • 2 likes
  • 4 in conversation