× 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.



Dieter

The problem I had is resolved. Somewhat of a stupid issue but that comes
from not being a MS SQL developer.

The issue with the double dot in the file name as in

AXTRN01..UNITOFMEASURE'

(which was provided by the DBA) was resolved by changing it to

AXTRN01.dbo.UNITOFMEASURE' ;

What had me is that the double dot works in STRSQL but would not work in
RPG.

Working with one of the MS SQL developers here, we inserted the dbo in
between the double dot and it worked.

This is exactly the code I need.

-----

Exec Sql set option naming = *SQL,
commit = *cs,
usrprf = *USER,
dynusrprf = *OWNER,
DATFMT = *ISO,
CloSqlCsr = *ENDMOD;

pReturn_code = ' ';
Count = 0 ;
Symbol = ' ';

// -------------------------------------------------
// Point to AXTRN01 database
// -------------------------------------------------

Sql_User = 'CCAXAX';
SqlPwd = 'cxxxxx';

Exec Sql CONNECT TO AXTRN01
USER :SQL_USER
Using :SqlPwd;

Exec Sql Select count(*) into :count from AXTRN01.dbo.UNITOFMEASURE
;

If Count = 0;
Return *off;
Else;
pReturn_Code = '01';
Return *on;
Endif;

Return;
/end-free
-----

Thank you all for you your support.

Darryl

On Mon, Aug 29, 2016 at 3:38 AM, D*B <dieter.bender@xxxxxxxxxxxx> wrote:

<Dave Clark>

Can't PREPARE host variables in dynamic SQL, either. At least,
I've gotten errors when I tried to do it before.


Sincerely,


Dave Clark

</Dave Clark>

Dave,
you are right, a prepare String can't include hostvars (:soemVar).

... the answer out of my head was not precise. In the meantime I've had
the time to reproduce the situation (it's easier, if a complete minimalized
programm and the java log is provided).
the OP had the problem to do a select count(*) into someInt from ...
against an MS SQL database:
1.) the simpelst way is working, something like this:
D*B CRTSQLRPGI TSTDARRYL
D*B+ OBJTYPE(*MODULE)
D*B+ DBGVIEW(*SOURCE)
D*B+ COMMIT(*CS)
D*B+ RDB(*LOCAL)
D*B+ OPTION(*SQL)
D*B CRTPGM TSTDARRYL
D*B+ ACTGRP(TSTDARRYL)
d myuser s 10 inz('DBMSSQL')
d mypwd s 10 inz('denkste')
d someInt s 10i 0 inz
exec sql
connect to dbmssql
user :myuser
using :mypwd;
exec sql
SELECT COUNT(*)
into :someInt
from covelenz;
if someInt > 0;
dsply 'success';
else;
dsply sqlcode;
endif;
exec sql
release DBMSSQL;
exec sql commit;
return;
(this was not included in early versions of ArdGate)
2.) trying to use dynamic sql (like OP did) will fail on MS SQL, because
MS SQL does not follow the SQL standard (select into works like create
table as (select ...) with data on as/400)
3. ) trying to fix this with replacing select into by values into, will
fail, because MS SQL doesn't support this
4.) using set is not recognized by ArdGate (mainly because ArdGate is
supporting only input parameters for prepare execute.
5.) return parameters should work for calling stored procedures (with the
current release)
6.) using a cursor and fetch would work for all releases of ArdGate

finally) It seems to be possibel to support in out parameters for prepare
execute and I will take it to the todo list (priority isn't really high,
because there are alternatives available.

Dieter
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.