Charles,
That's good news - inasmuch as I at least know I'm not missing something
painfully obvious! All these little helper routines are stored in a
service program anyway so adding a routine to parse the buffer will work
well. Thanks, JK
On Tue Jun 26 14:51 , 'Wilt, Charles' sent:
John,
Unfortunately, there isn't a really good way to handle this.
The DS has to have some finite size defined. I just define a buffer of
32K or so and use the offsets
to figure out where stuff is at.
It should be too big of a deal as your program calling the API can be
wrapped in a procedure that is
easier to use.
d t_RtvMsgFmt0100...
d ds qualified based(TEMPLATE)
d bytesRtnd like(t_Int4)
d bytesAval like(t_Int4)
d msgLenRtnd like(t_Int4)
d msgLenAval like(t_Int4)
d msgHlpLenRtnd like(t_Int4)
d msgHlpLenAval like(t_Int4)
d data like(t_Buffer32k)
if msgInfo.msgHlpLenRtnd > 0;
msgHelp = %subst(msgInfo.Data
:msgInfo.msgLenRtnd + 1
:msgInfo.msgHlpLenRtnd);
else;
msgHelp = *BLANKS;
endif;
HTH,
Charles
> -----Original Message-----
> From: rpg400-l-bounces@xxxxxxxxxxxx
>
[rpg400-l-bounces@xxxxxxxxxxxx','','','')">rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of johnking@xxxxxxx
> Sent: Tuesday, June 26, 2007 4:30 PM
> To: rpg400-l@xxxxxxxxxxxx
> Subject: Defining DS to retrieve variable length data from API
>
> All,
>
> Q) How to define a DS to retrieve variable-length data from
> an API? The goal is to define an /include member that can be
> used in V5R3 RPGLE.
>
> For example, QMHRCVM uses format RCVM0100 to return the text
> of a message.
> Although the length of the data available to "MsgRplData" is
> actually defined by "RplDAvail", for most purposes just
> defining "MsgRplData" as a fixed length is sufficient.
> Referencing this DS in a calling program with
> "LikeDS(RCVM0100_t) Inz(*likeDS)" makes using this API
> convenient and consistent.
--code removed here--
> I'm sure there is some combination of "%addr" and "%len" and
> "overlay" and "presto" that will accomplish this but I'm sure
> having trouble getting clear on the concept. Would anyone be
> kind enough to point me to a previous thread or article that
> discusses this?
>
> Many thanks, JK
---- Msg sent via Internet America Webmail -
http://www.internetamerica.com/
As an Amazon Associate we earn from qualifying purchases.