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.
D RCVM0100_t DS Qualified
D RCVM0100 32767A
D ByteReturn 10I 0 INZ Overlay(RCVM0100)
D ByteAvail 10I 0 INZ Overlay(RCVM0100:*next)
D MsgSever 10I 0 INZ Overlay(RCVM0100:*next)
D MsgId 7 INZ Overlay(RCVM0100:*next)
D MsgTyp 2 INZ Overlay(RCVM0100:*next)
D MsgKey 4 INZ Overlay(RCVM0100:*next)
D Resserve_1 7 INZ Overlay(RCVM0100:*next)
D CCSID_CnvSt 10I 0 INZ Overlay(RCVM0100:*next)
D CCSID_RplD 10I 0 INZ Overlay(RCVM0100:*next)
D RplDReturn 10I 0 INZ Overlay(RCVM0100:*next)
D RplDAvail 10I 0 INZ Overlay(RCVM0100:*next)
D MsgRplData 127 INZ Overlay(RCVM0100:*next)
So how should RCVM0200 be defined if it became necessary to retrieve the
"MsgText" or "MsgHText" fields? Their start positions depend of the length of
the
previous fields.
D RCVM0200_t DS Qualified
D RCVM0200 32767A
D ByteReturn 10I 0 INZ Overlay(RCVM0200)
D RplDReturn 10I 0 INZ Overlay(RCVM0200:*next)
D RplDAvail 10I 0 INZ Overlay(RCVM0200:*next)
D MsgReturn 10I 0 INZ Overlay(RCVM0200:*next)
D MsgAvail 10I 0 INZ Overlay(RCVM0200:*next)
D MsgHReturn 10I 0 INZ Overlay(RCVM0200:*next)
D MsgHAvail 10I 0 INZ Overlay(RCVM0200:*next)
D RplDText (*)
D MsgText (*)
D MsgHText (*)
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.