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



Hi Adam,

The really "unpredictable" results come from the caller not providing enough memory to hold the parameter. As long as the caller provides parameters that are at LEAST as long as the RPG program expects them to be, you should not have to worry about unpredictable errors.

Of course, since CL doesn't really support the date data type, you do have to worry about "predictable" errors! That is, if the CL program doesn't format the bytes correctly for the date field, then you'd get an "invalid date/time/timestamp" error on the RPG side -- but that's a predictable error. The error message will clearly tell you what the problem is.

On the other hand, if the CL program passes too few parameters, or passes a variable that's shorter than the RPG program expects it to be, then the RPG program will start reading/writing into memory that the CL program didn't intend it to. This is where the unpredictable results come from. I can't even guess what sort of error you'd get! It's unpredictable.

So... hopefully that makes sense. Make sure the caller's variables are big enough, and enough parameters are passed, and they use the same passing convention (reference or value).

If the only problem is that they're different data types, then the errors will be "predictable" :)


AGlauser@xxxxxxxxxxxx wrote:
I have an RPG procedure with the following prototype.
D utrmDates_newDateTime...
D PR 2 0
D oldDate...
D D value
D oldTime...
D 6 0 value
D unitsToAdd...
D 9 0 value
D unitTypeIn...
D 7A value
D newDate...
D D
D newTime...
D 6 0
And my CL code:
DCL VAR(&startDate) TYPE(*CHAR) LEN(10)
DCL VAR(&startTime) TYPE(*DEC) LEN(6 0)
DCL VAR(&delayTime) TYPE(*DEC) LEN(9 0)
DCL VAR(&delayUnits) TYPE(*CHAR) LEN(7)
DCL VAR(&endDate) TYPE(*CHAR) LEN(10)
DCL VAR(&endTime) TYPE(*DEC) LEN(6 0)


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.