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



I have a program that used to work fine in a straight character
environment, but it was recently converted to graphic data.  Something's
changed in the way the parameters are coming in and I can't figure out
what's going on.

Here is the prototype of the module:

     D getSqFt         pr
     D  gsqMCU                       12c   Varying
     D  gsqItm                        8s 0
     D  gsqUM                         2c   Varying
     D  gsqFactor                    15s 7
     D  sqlNull1                      5i 0
     D  sqlNull2                      5i 0
     D  sqlNull3                      5i 0
     D  sqlOutNull                    5i 0
     D  sqlState                      5
     D  sqlFuncNm                   517    Varying
     D  sqlSpecName                 128    Varying
     D  sqlMsgTxt                    70    Varying
     D  sqlScrPad                    20
     D  sqlFinalFlg                   5i 0

The 2 lines denoted with BR01 are 2 of the lines I converted from character
to graphic definition.

When I run this in the debugger utilizing the following SQL statement, the
field values are not correct.

SQL:
select imitm,imuom1,getsqft(ibmcu, imitm, imuom1)
 from f4101 join f4102 on imitm=ibitm    where imitm=144206

Values:
GSQMCU = 000CFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFE
GSQITM = 00144206
GSQUM = 0002FEFE

The equivalent character values of the 2 fields should be:
GSQMCU = '       00203'
GSQUM = 'PC'


The tables are defined as 13488.
----------------------------------------------------

If it helps any, here is the complete program:



H NoMain Option(*SrcStmt : *NoDebugIO) Ccsid(*UCS2 : 13488)
*
* BR01 05Sep06 Transition to UCS2 data required change to logic.
*
*
FF41002_1 if e k disk UsrOpn
D getSqFt pr
D gsqMCU 12c Varying
D gsqItm 8s 0
D gsqUM 2c Varying
D gsqFactor 15s 7
D sqlNull1 5i 0
D sqlNull2 5i 0
D sqlNull3 5i 0
D sqlOutNull 5i 0
D sqlState 5
D sqlFuncNm 517 Varying
D sqlSpecName 128 Varying
D sqlMsgTxt 70 Varying
D sqlScrPad 20
D sqlFinalFlg 5i 0
P*
P* getSqFt : Feed in the Optional MCU, Item Number, UM to convert and
P* return the conversion factor to SqFt.
P*
P* To Compile:
P* CrtRpgMod module(produsr/getSqFt ) srcfile(produsr/qrpglesrc) 
dbgview(*list)
P* CrtSrvPgm srvpgm(produsr/getSqFt ) export(*all)
P* CREATE FUNCTION PRODDTA/GETSQFT (VARGRAPHIC (12), NUMERIC(8,0), 
VARGRAPHIC (2))
P* RETURNS NUMERIC (15,7)
P* LANGUAGE RPGLE
P* DETERMINISTIC
P* NO SQL
P* RETURNS NULL ON NULL INPUT
P* NO EXTERNAL ACTION
P* ALLOW PARALLEL
P* FINAL CALL
P* SCRATCHPAD 20
P* PARAMETER STYLE DB2SQL
P* EXTERNAL NAME 'PRODUSR/GETSQFT(GETSQFT)'
P*
P getSqFt b Export
D getSqFt pi
D gsqMCU 12c Varying
D gsqItm 8s 0
D gsqUM 2c Varying
D gsqFactor 15s 7
D sqlNull1 5i 0
D sqlNull2 5i 0
D sqlNull3 5i 0
D sqlOutNull 5i 0
D sqlState 5
D sqlFuncNm 517 Varying
D sqlSpecName 128 Varying
D sqlMsgTxt 70 Varying
D sqlScrPad 20
D sqlFinalFlg 5i 0
* Work Fields

/Free
// The SQL Final Flag is a signal specifying whether this is the
// first, continuing, or last call to the procedure.

If sqlFinalFlg = 1 ;
If %Open(F41002_1) ;
Close F41002_1;
EndIf ;
*InLR = *On ;
Return ;
EndIf ;

If sqlFinalFlg = -1 ;
If Not %Open(F41002_1) ;
Open F41002_1;
EndIf ;
EndIf ;

gsqFactor = 0 ;
Chain (gsqMCU:gsqItm:gsqUM) F41002_1;

If Not %Found(F41002_1) ;
Chain (%UCS2(' '):gsqItm:gsqUM) F41002_1;

If Not %Found(F41002_1) ;
Return ;
EndIf ;

EndIf ;

gsqFactor = umconv * .0000001 ;
Return ;

/End-Free
P getSqFt e

-------------------------------------------------------------------

Am I missing anything?

Bill 



As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.