|
Hello Ken,
Since I was the one warning about the 4-byte alignment error I guess I should
answer ...
Parameter 11 is a variable length structure.
The first 4-bytes indicate the count of records that follow (since there are 7
possible
key values -- at VRM440 -- this field should be a number between 1 and 7
inclusive).
Each record has a 4-byte key, a 4-byte length, and the data. The key point is
that the
data is variable length. The API documentation shows the length could be up to
10-bytes
long if it is a name (e.g., user profile, device, etc.) or up to 20-bytes long
if it is
the network address. Conceivably, there could be other keys added in the
future which
may require different data lengths. So if you are passing in the profile name
the
structure looks like:
count BIN(4) ==> set to 1
key BIN(4) ==> set to 1
len BIN(4) ==> set to 8
prf CHAR(8) ==> set to FREDNURK
In hex: 00000001 00000001 00000008 C6D9C5C4 D5E4D9D2
If passing the profile, password, and device name, the structure looks like:
count BIN(4) ==> set to 3
key BIN(4) ==> set to 1
len BIN(4) ==> set to 8
prf CHAR(8) ==> set to FREDNURK
key BIN(4) ==> set to 2
len BIN(4) ==> set to 6
pwd CHAR(6) ==> set to XYZ123
key BIN(4) ==> set to 6
len BIN(4) ==> set to 10
dev CHAR(10) ==> set to QPADEV0001
In hex: 00000003 00000001 00000008 C6D9C5C4 D5E4D9D2 00000002 00000006 E7E8E9F1
F2F30000
00060000 000AD8D7 C1C4C5E5 F0F0F0F1
Note how the numeric values are NOT aligned on a 4-byte boundary?
If the data values change then the length, and therefore the actual positions
of the
data, will also change. Because you can pass each key structure in any order
and can
omit keys you can't use a fixed data structure but there is no reason why you
can't
allocate a chunk of space and use fixed-length based structures to map it
accordingly.
You will need to move the basing pointer up by the actual amount of data rather
than the
DS length.
I can't show you my code for this 'cause I don't own it but the above
description does
work. You will have to spend a little time with debug ensuring the structure
is built
correctly.
Regards,
Simon Coulter.
«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»
«» FlyByNight Software AS/400 Technical Specialists «»
«» Eclipse the competition - run your business on an IBM AS/400. «»
«» «»
«» Phone: +61 3 9419 0175 Mobile: +61 0411 091 400 «»
«» Fax: +61 3 9419 0175 mailto: shc@flybynight.com.au «»
«» «»
«» Windoze should not be open at Warp speed. «»
«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---
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.