|
I've created a module that will be placed in a service program, and
created an SQL Function that makes the service program module callable
from within an SQL view. The problem is that, as you can see from the
prototype, I am using packed decimals, which translate to DECIMAL
types in SQL. Even if I use fields from a database file that are
packed decimal, I have to CAST them in SQL to DECIMAL. What RPG
number type can I use to avoid this CASTing in SQL?
Prototype follows:
D DLMCCalc PR 7P 2
D MedNecLvl 1P 0 Const
D EMLvlCharg 7P 0 Const
D Acronym 3A Const
D Family# 9P 0 Const
D Member# 2P 0 Const
D SvcDate D Const
The SQL function creation was done like this:
Create Function DMart.CalcDCost
( DEC (1,0),
DEC (7,0),
CHAR (3),
DEC (9,0),
DEC (2,0),
DATE)
Returns DEC (7,2)
Language RPGLE
Deterministic
no sql
returns null on null input
no external action allow parallel
simple call
External Name 'DMART/DL_FUNC(DLMCCALC)';
Now, the pain in the rear, is that to call the function, I have to
code it in the SQL as follows:
DMart.CalcDCost(Cast(Log.MedNecLvl As DECIMAL(1,0)),
Cast(Log.EMLvlCharg As DECIMAL(7,0)),
Log.SysAcr,
Cast(Log.Famly# As DECIMAL(9,0)),
Cast(Log.Membr# As DECIMAL(2,0)),
Log.Date1Post)
--
"Enter any 11-digit prime number to continue..."
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.