|
Here's a quick sample of accessing the valid values list:
dGetMsg pr extpgm('QMHRTVM')
d Receiver 1
d SizRcv 10i 0 const
d Format 8 const
d MsgID 7 const
d Msgf 20 const
d RplData 1 const
d SizRplDta 10i 0 const
d RplSubVal 10 const
d RtnCtls 10 const
d ErrCod 10i 0 const
dGetSize ds
d GetBytRtn 10i 0
d GetBytAvl 10i 0
dFmt0400 ds based(FmtPtr)
d BytRtn 10i 0
d BytAvl 10i 0
d MaxRpyLen 117 120i 0
d OffVldRpy 125 128i 0
d NbrVldRpyR 129 132i 0
d LenVldRpyR 133 136i 0
d LenVldRpyA 137 140i 0
d LenVldRpyE 141 144i 0
dVldRpyE s 32 based(VldRpyPtr)
c *entry plist
c parm MsgID 7
c* How much storage is needed for everything?
c callp GetMsg( GetSize :%size(GetSize)
c :'RTVM0400' :MsgID
c :'QCPFMSG QSYS '
c :' ' :0
c :'*NO' :'*NO'
c :0)
c* Allocate it and then call the API again
c eval FmtPtr = %alloc(GetBytAvl)
c callp GetMsg( Fmt0400 :GetBytAvl
c :'RTVM0400' :MsgID
c :'QCPFMSG QSYS '
c :' ' :0
c :'*NO' :'*NO'
c :0)
c* If any valid replies returned display them
c if NbrVldRpyR > 0
c eval VldRpyPtr = FmtPtr + OffVldRpy
c do NbrVldRpyR
c VldRpyE dsply
c eval VldRpyPtr = VldRpyPtr + LenVldRpyE
c enddo
c endif
c eval *inlr = '1'
c return
Hope this helps,
Bruce
Steven.Gray@arval
phh.co.uk
Sent by: To
rpg400-l-bounces@ rpg400-l@xxxxxxxxxxxx
midrange.com cc
Subject
09/22/2004 11:04 API problem
AM
Please respond to
RPG programming
on the AS400 /
iSeries
All,
This is my 1st venture into the world of API programming , and I sort of
have the concept , but I am struggling on the example below.
I am trying to retrieve the message valid reply values by using API QMHRTVM
with format RTVM0400 , I have retrieved the definition from QSYSINC for the
format , but it does not include the definition of the variable length
fields at the end of the formats fixed length fields , so I have had to
'guess' at what they should be.
The API manuals do not (as far as I can see) go into that much detail about
these.
The required parameter group has its 1st parameter as the message
information output (*) , as I see it (and I may be wrong) the format fields
are placed in here , but you have to implicitly define the length of this
variable length field via the next parameter!
I have created the below code and hardcoded in a message ID and message
file
and library (for test purposes only) and when running I get the error code
CPF24B4 in QUSBND.This informs me that a serious error occurred whilst
addressing the parameter list.
But it does not tell me which parameter is in error.
Any help would be appreciated
H
D QMHRTVM C 'QMHRTVM'
dQUSBN ds
d qusbnb 1 4b 0
d qusbnc 5 8b 0
d qusbnd 9 15
d qusbnf 16 16
d excdta 17 116
dQmsgf ds
d qmfile 10
d qmlib 10
dqmsg s 512 inz
dqmsglen s 4b 0 inz
dqformat s 8 inz
dqmsgid s 7 inz
dqrpldta s 512 varying inz
dqrpllen s 4b 0 inz
dqsubval s 10 inz
dqfctl s 10 inz
D*****************************************************************
D*Type Definition for the RTVM0400 format.
D*****************************************************************
DQMHM0400 DS
Qmh Rtvm RTVM0400
D QMHBR08 1 4B 0
Bytes Return
D QMHBAVL14 5 8B 0
Bytes Available
D QMHMS11 9 12B 0
Message Severity
D QMHAI01 13 16B 0
Alert Index
D QMHAO04 17 25
Alert Option
D QMHLI03 26 26
Log Indicator
D QMHMID00 27 33
Message ID
D QMHERVED28 34 36
Reserved
D QMHNRDF00 37 40B 0
Number Replace Data Formats
D QMHSIDCS09 41 44B 0
Text CCSID Convert Status
D QMHSIDCS10 45 48B 0
Data CCSID Convert Status
D QMHCSIDR08 49 52B 0
Text CCSID Returned
D QMHORT00 53 56B 0
Offset Reply Text
D QMHLRRTN01 57 60B 0
Length Reply Returned
D QMHLRAVL01 61 64B 0
Length Reply Available
D QMHOMRTN00 65 68B 0
Offset Message Returned
D QMHLMRTN05 69 72B 0
Length Message Returned
D QMHLMAVL05 73 76B 0
Length Message Available
D QMHOHRTN00 77 80B 0
Offset Help Returned
D QMHLHRTN05 81 84B 0
Length Help Returned
D QMHLHAVL05 85 88B 0
Length Help Available
D QMHOF00 89 92B 0
Offset Formats
D QMHLFRTN00 93 96B 0
Length Formats Returned
D QMHLFAVL00 97 100B 0
Length Formats Available
D QMHLFE00 101 104B 0
Length Format Element
D QMHRT02 105 114
Reply Type
D QMHRSV210 115 116
Reserved2
D QMHMRL 117 120B 0
Maximum Reply Length
D QMHMRDP 121 124B 0
Maximum Reply Dec Positions
D QMHOVR 125 128B 0
Offset Valid Replies
D QMHNBRVR 129 132B 0
Number Valid Replies
D QMHLVRR 133 136B 0
Length Valid Replies Returne
D QMHLVRA 137 140B 0
Length Valid Replies Availab
D QMHLVRE 141 144B 0
Length Valid Reply Entry
D QMHOSV 145 148B 0
Offset Special Value
D QMHNBRSV 149 152B 0
Number Special Value
D QMHLSVR 153 156B 0
Length Special Value Returne
D QMHLSVA 157 160B 0
Length Special Value Availab
D QMHLSVE 161 164B 0
Length Special Value Entry
D QMHOLR 165 168B 0
Offset Lower Range
D QMHLLRR 169 172B 0
Length Lower Range Returned
D QMHLLRA 173 176B 0
Length Lower Range Available
D QMHOUR 177 180B 0
Offset Upper Range
D QMHLURR 181 184B 0
Length Upper Range Returned
D QMHLURA 185 188B 0
Length Upper Range Available
D QMHORT01 189 192B 0
Offset Rel Test
D QMHLRTR 193 196B 0
Length Rel Test Returned
D QMHLRTA 197 200B 0
Length Rel Test Available
D QMHMCD 201 207
Message Creation Date
D QMHRSV300 208 208
Reserved3
D QMHMCL 209 212B 0
Message Creation Level
D QMHMMD 213 219
Message Modification Date
D QMHRSV400 220 220
Reserved4
D QMHMML03 221 224B 0
Message Modification Level
D QMHCCSID07 225 228B 0
Stored Message CCSID
D QMHODL 229 232B 0
Offset Dump List
D QMHNDLE 233 236B 0
Number Dump List Entries
D QMHLDLR 237 240B 0
Length Dump List Returned
D QMHLDLA 241 244B 0
Length Dump List Available
D QMHDPGMN 245 254
Default Program Name
D QMHDPGML 255 264
Default Program Library
D QMHDR01 32 varying
D QMHSSAGE05 32 varying
message
D QMHMH05 32 varying
message help
D QMHRDF00 18 DIM(00099)
sub variable formats
D QMHLSRD01 9B 0 OVERLAY(QMHRDF00:00001)
len
D QMHFSODP01 9B 0 OVERLAY(QMHRDF00:00005)
dec pos
D QMHSVT01 10 OVERLAY(QMHRDF00:00009)
type
D QMHVRE00 33 DIM(00020)
valid reply values
D QMHVRV00 32 OVERLAY(QMHVRE00:00001)
reply value
D QMHERVED29 1 OVERLAY(QMHVRE00:00033)
D QMHSRVE00 65 DIM(00020)
special reply value
D QMHFV00 32 OVERLAY(QMHSRVE00:00001)
from value
D QMHTV00 32 OVERLAY(QMHSRVE00:00033)
to value
D QMHERVED30 1 OVERLAY(QMHSRVE00:00065)
*****************************************************************
c eval qmsglen = 512
c eval qformat = 'RTVM0400'
c eval qmsgid = 'OPS0002'
c eval qmfile = 'OPSMSGF'
c eval qmlib = 'AUTOPGMS'
c eval qsubval = '*NO'
c eval qfctl = '*NO'
c call QMHRTVM
c parm qmsg
c parm qmsglen
c parm qformat
c parm qmsgid
c parm qmsgf
c parm qrpldta
c parm qrpllen
c parm qsubval
c parm qfctl
c parm qusbn
c move qmsg QMHM0400
c eval *inlr = *on
*****************************************************************
Any idea where the error lies ?
> Regards
>
> Steven Gray
> Senior Analyst
> ARVAL PHH
>
> * Post Dept 73
> PHH Centre
> Windmill Hill
> Whitehill Way
> Swindon
> SN5 6PE
> England
> * 0870 419 4639
> Fax: 0870 419 4386
>
>
_____________________________________________________________________
This e-mail has been scanned for viruses by MCI's Internet Managed Scanning
Services - powered by MessageLabs. For further information visit
http://www.mci.com
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
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.