Here is code from program B, using embedded SQL:
D PRMMCH S 10
D PRMOPN S 3 0
D PRMORD S 6 0
D PRMTUR S 4 0
D PRMWKC S 6 0
C *ENTRY PLIST Input parms
C PARM PRMORD
C PARM PRMOPN
C PARM PRMWKC
C PARM PRMMCH
* Output parms
C PARM PRMTUR
* --- M A I N P R O G R A M ---
C Eval PRMTUR = 0
C/EXEC SQL
C+ DECLARE c1 CURSOR FOR
C+ SELECT MAX(IRHTUR) FROM @IRH
C+ WHERE IRHORD=:PRMORD AND IRHOPN=:PRMOPN
C+ AND IRHWKC=:PRMWKC AND IRHMCH=:PRMMCH
C/END-EXEC
C/EXEC SQL
C+ OPEN c1
C/END-EXEC
C/EXEC SQL
C+ FETCH c1 INTO :PRMTUR
C/END-EXEC
C/EXEC SQL
C+ CLOSE c1
C/END-EXEC
C Eval *INLR = *ON
C Return
and here is code from program B without SQL:
D PRMMCH S 10
D PRMOPN S 3 0
D PRMORD S 6 0
D PRMTUR S 4 0
D PRMWKC S 6 0
D KEYMCH S 10
D KEYOPN S 3 0
D KEYORD S 6 0
D KEYWKC S 6 0
C *ENTRY PLIST Input parms
C PARM PRMORD
C PARM PRMOPN
C PARM PRMWKC
C PARM PRMMCH
* Output parms
C PARM PRMTUR
* --- M A I N P R O G R A M ---
C IRHKY9 KLIST
C KFLD KEYORD
C KFLD KEYOPN
C KFLD KEYWKC
C KFLD KEYMCH
C Eval PRMTUR = 0
C Eval PRMQTY = 0
* Find the latest reel number and its quantity for this shop order/operation/machine
C Eval KEYORD = PRMORD
C Eval KEYOPN = PRMOPN
C Eval KEYWKC = PRMWKC
C Eval KEYMCH = PRMMCH
C IRHKY9 Chain @IRHL09
C If %Found
C Eval PRMTUR = IRHTUR
C EndIf found @irhl09
C Eval *INLR = *ON
C Return
When I call each of these from a test program, they both return the correct value in PRMTUR. Here is the code for the stored procedure:
P MYPGMCURRENTINFO01...
P B EXPORT
D MYPGMCURRENTINFO01...
D PI
D PRMSYS 1 System ("P" = PROTO)
D PRMWKC 6 0 Work Center
D PRMMCH 10 Machine
D PRMPRT S 3
D PRMODS S 30
D PRMTUR S 4 0
D PRMTYP S 3
D OUTPUT DS OCCURS(1)
D SONUMBER 6 0
D MSNUMBER 15
D MSREV 3 0
D OPERATION 3 0
D REELQUANTITY 9 3
D REELNUMBER 4 0
D LAYERONENOMDIAMETER...
D 5 4
<ETC.>
C PRMABC PLIST Input parms
C PARM PRMWKC
C PARM PRMMCH
* Output parms
C PARM PRMORD
C PARM PRMOPN
C PARM PRMITM
C PARM PRMREV
C PARM PRMIDS
C PARM PRMWHS
C PRMPGMB PLIST Input parms
C PARM PRMORD
C PARM PRMOPN
C PARM PRMWKC
C PARM PRMMCH
* Output parms
C PARM PRMTUR
<ETC.>
C CallB 'MYPGMC' PRMABC
* Get reel info
C CallB 'MYPGMB' PRMPGMB
C Eval ROWS = 1
C ROWS Occur OUTPUT
C Eval SONUMBER = PRMORD
C Eval MSNUMBER = PRMITM
C Eval MSREV = PRMREV
C Eval OPERATION = PRMOPN
C Eval REELNUMBER = PRMTUR
C Eval LAYERONENOMDIAMETER = PR1DIA
<ETC.>
C/Exec SQL
C+ Set Result Sets Array :OUTPUT for :ROWS Rows
C/End-Exec
P E
RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx> writes:
Assuming you're doing things right in A and B, the only possible
answer I can think of is memory corruption caused by mismatching
parameters.
Note: this doesn't necessarily mean A or B are mismatched, it could be
a C called by either A and/or B..
If you put together some example code, we can tell if there's anything
wrong with A & B.
If you can't get a simple example A & B to show the same error, start
looking at all the C's.
HTH,
Charles
Mike Naughton
Senior Programmer/Analyst
Judd Wire, Inc.
124 Turnpike Road
Turners Falls, MA 01376
413-676-3144
Internal: x 444
mnaughton@xxxxxxxxxxxx
****************************************
NOTICE: This e-mail and any files transmitted with it are confidential and solely for the use of the intended recipient. If you are not the intended recipient or the person responsible for delivering to the intended recipient, be advised that any use is
strictly prohibited. If you have received this e-mail in error, please notify us immediately by replying to it and then delete it from your computer.
As an Amazon Associate we earn from qualifying purchases.