× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: Getting the serial number
  • From: bmorris@xxxxxxxxxx
  • Date: Mon, 8 Nov 1999 13:32:46 -0500




>> From: "Colin Williams" <Williamsc@technocrats.co.uk>
>>
>> Why?
>>
>> >-----Original Message-----
>> >From: Simon Coulter [mailto:shc@flybynight.com.au]
>> > ... That's a really good way to shoot yourself in the foot!
>> > ...
>> >> From: "Colin Williams" <Williamsc@technocrats.co.uk>
>> >> The way I usually do this is to create a 1 char field for
>> >any field that
>> >> is defined as char(*), and set up a field to point to the
>> >data once the
>> >> API has been called.

This will work as long as you never reference the field except
for %ADDR, and as long as you have actually enough storage in
your API returned value to accommodate the full data.  (i.e.
as long as you tell the API the correct amount of data it can
fill up.)

I assume you are not actually doing what others have warned
you against (telling the API your returned structure is longer
that you have actually declared it), but that you are declaring
the whole structure big enough and just declaring those
variable-length subfields as char(1).

A better way is to avoid naming the subfield of the returned
value and use address-arithmetic to set the basing pointer.
This way, there's no possibility of future programmers being
confused about the purpose of that 1A subfield.

e.g.
D api_ret_val         DS
D  ... only define fixed-length subfields

D data_offset         C              275

C         eval  ptr1 = %addr(api_ret_val) + data_offset

Barbara Morris


+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-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 thread ...


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

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