|
Hi All,
I'm having a small problem moving values in from my SQL to my RPG. I
have a FETCH command that obtain five values from an SQL statement.
When I declare the SQL statement, it works fine (it has the appropriate
values in the variable names). However, once it goes to fetch the
values into the variables I have set up, it always comes up with blanks.
Can someone tell me if I am doing something wrong?
Thanks!
Brian.
Here's the code I am using:
C/Exec SQL
c+ declare MyCursor cursor for
C+ SELECT soptno, soptcl, SOKDL2, SOKDL3,
C+ ((:inhse+:iyard)-(select sum(soqty) from SSWDPSO
C+ where SOKDL3<=a.SOKDL3
C+ and soptno=:partno and soptcl=:partcl))
C+ FROM SSWDPSO a where soptno=:partno
C+ and soptcl=:partcl group by soptno, soptcl,
C+ SOKDL2, SOKDL3 having
C+ (select sum(soqty) from SSWDPSO
C+ where SOKDL3<=a.SOKDL3 and soptno=:partno
C+ and soptcl=:partcl) > (:inhse+:iyard)
C/End-Exec
C/exec SQL
c+ open MyCursor
c/end-exec
c/exec sql
c+ fetch MyCursor into :curptno, :curptcl, :curkym, :curkrrn, :cursqty
c/end-exec
C*
C/Exec SQL
C+ Close MyCursor
C/End-exec
C*
C*
C* Add the updated values to the DMDPG_PF file
/free
SQLstmt = 'Update DMDPG_PF set shortqty = ' + %char(cursqty);
SQLstmt = SQLstmt + ' ,skdlym=' + apos + curkym + apos;
SQLstmt = SQLstmt + ' ,skdlrrn=' + apos + curkrrn + apos;
SQLstmt = SQLstmt + ' WHERE plcd = ' + apos + plcd + apos;
SQLstmt = SQLstmt + ' AND partno = ' + apos + curptno + apos;
SQLstmt = SQLstmt + ' AND partcl = ' + apos + curptcl + apos;
/end-free
C*
-=-=-=-=-=-=-=-=-=-=-=-=-=-
Brian Piotrowski
Specialist - I.T.
Simcoe Parts Service, Inc.
Ph: 705-435-7814 x343
Fx: 705-435-6746
bpiotrowski@xxxxxxxxxxxxxxx
-=-=-=-=-=-=-=-=-=-=-=-=-=-
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.