× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Not absolutely sure, but I recall having problems making stored procedure calls to RPG when using SQL CHAR types. I think SQL wants us to use VARCHAR types for all character parms....

hth,
Eric

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of
Arturo_Duarte@xxxxxxxxxxxxxxx
Sent: Friday, September 28, 2007 5:09 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: SQL CLI Parameter Value Issue


Greetings.

I am calling a Stored Procedure passing four character parameters. The
first parameter is of 9 bytes. When passing the value of '000001204', the
Stored Procedure shows the value '000001200'. Here is my CLI code:
D testNum S 9a
D Frm_TXYear S 4a
D ReqSystem S 6a
D Too_TXYear S 4a inz(*blanks) Optional
D LenDFlag S 4a inz(*blanks) Optional
D Service_ID S 6a inz(*blanks) Optional

/free

EvalR testNum = '000000000' + %Trim('1204') ;
Eval Frm_TXYear = '2007' ;
Eval ReqSystem = 'SPEECH' ;

SQLAllocEnv(env);
SQLAllocConnect(env: conn);

SQLSetConnectAttrI( conn
: SQL_ATTR_DBC_SYS_NAMING
: SQL_TRUE
: %size(SQLINTEGER) );

SQLConnect( conn
: '*LOCAL'
: SQL_NTS
: *NULL
: SQL_NTS
: *NULL
: SQL_NTS );

SQLAllocStmt( conn : stmt );
SQLPrepare(stmt :'Call YESTMNT1R(?,?,?,?,?,?)' :SQL_NTS) ;

SQLBindParameter(stmt :1 :SQL_PARAM_INPUT
:SQL_CHAR
:SQL_CHAR
:9 :0
:%Addr(testNum)
:%Size(testNum)
:%len(testNum));
SQLBindParameter(stmt :2 :SQL_PARAM_INPUT
:SQL_CHAR :SQL_CHAR :4 :0 :%Addr(Frm_TXYear)
:%Size(Frm_TXYear) :%len(Frm_TXYear));

SQLBindParameter(stmt :3 :SQL_PARAM_INPUT
:SQL_CHAR :SQL_CHAR :6 :0 :%Addr(ReqSystem)
:%Size(ReqSystem) :%len(ReqSystem));

SQLBindParameter(stmt :4 :SQL_PARAM_INPUT
:SQL_CHAR :SQL_CHAR :4 :0 :%Addr(Too_TXYear)
:%Size(Too_TXYear) :%len(Too_TXYear));

SQLBindParameter(stmt :5 :SQL_PARAM_INPUT
:SQL_CHAR :SQL_CHAR :4 :0 :%Addr(LenDFlag)
:%Size(LenDFlag) :%len(LenDFlag));

SQLBindParameter(stmt :6 :SQL_PARAM_INPUT
:SQL_CHAR :SQL_CHAR :6 :0 :%Addr(Service_ID)
:%Size(Service_ID) :%len(Service_ID));

SQLExecute(stmt);
...

The prototype for the called procedure is
D Yestmnt1R PI
D itestNum 9a Const
D**
D iTaxYear 4a Const
D iReqSystem 6a Const
D iTo_TaxYr 4a Const
D iLendFlag 4a Const
D iService_ID 6a Const


Why is the value of testNum passing as '000001200' instead of '000001204'?

Thank you
Art Duarte


======================================================================

Confidentiality Notice: The information contained in and transmitted with this communication is strictly confidential, is intended only for the use of the intended recipient, and is the property of Countrywide Financial Corporation or its affiliates and subsidiaries. If you are not the intended recipient, you are hereby notified that any use of the information contained in or transmitted with the communication or dissemination, distribution, or copying of this communication is strictly prohibited by law. If you have received this communication in error, please immediately return this communication to the sender and delete the original message and any copy of it in your possession.

======================================================================


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.