My guess is that your CLLE is passing the last parm as char(16) instead of the varChar(16) the RPGLE expects.

I don't know of a good solution. When passing a constant, in the past I've manually added the 2 byte length to the front of the character field. Normally i don't even bother with CALLPRC, and i just use RPGLE to make the call.
________________________________________
From: Greg Wilburn [gwilburn@xxxxxxxxxxxxxxxxxxxxxxx]
Sent: Tuesday, November 27, 2018 10:35 AM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: CALLPRC

I am trying to call a well-established RPG procedure (function) from a CLLE program. I call this all the time from RPGLE.

When executing the CLLE pgm, I get "Length of varying length variable is out of range"

The ILE RPG procedure is defined as follows:
P Ast_GetRf B Export Procedure to Get
D Ast_GetRf pi 800a Reference File Data
D incat 4a Const Input Category
D inslc 16a Varying Const Input Selection

I've tried all different iterations within the CL pgm. I don't do this very often... so I know I'm missing something.
The CLLE looks like this:

DCL VAR(&RFCAT) TYPE(*CHAR) LEN(4)
DCL VAR(&RFSLC) TYPE(*CHAR) LEN(16)
DCL VAR(&RFDTA) TYPE(*CHAR) LEN(800)

CHGVAR VAR(&RFCAT) VALUE('0021')
CHGVAR VAR(&RFSLC) VALUE(&WHS#)
CALLPRC PRC('Ast_GetRf') PARM((&RFCAT) (&RFSLC)) RTNVAL(&RFDTA)

I'm just about to give up and write a RPGLE program to call from the CLP. Any insight would be appreciated.

Greg



This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 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].