× 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.



Passing pointer. Ugh!! The manual is just telling you that if you specify a 
length of 50 on the parameter, you could actually pass 10 or 100, it doesn't 
care(Just a pointer to string) but if you try to refer any part of the string 
past 50 bytes, the compiler is going to throw an error. 

I would just use VARYING bearing in the mind the previous posts about how 
VARYING works. Keep in mind the field having two bytes in the front but I have 
noted that If I pass a VARYING string to a system API, the compiler is smart 
enough to pass the pointer at start plus two bytes. 

-----Original Message-----
From: brian [mailto:bsl04@xxxxxxxx]
Sent: Thursday, May 26, 2005 8:45 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: options(*varsize)


I'm writing a procedure that's a nicer interface to cvthc. cvthc's
parameters are two pointers and an integer. In the fields of my
procedure's prototype, I don't want to specify some arbitrary field length
limit. I basically want to pass two pointers and an integer indicating the
length of one of the fields. I originally coded it exactly like that, but
the caller has to specify %addr(source), etc. I'd like to avoid that.

I'm looking at changing the source and destination fields to be
options(*varsize), but there is a strange detail. The V5R2 RPG manual says
"When OPTIONS(*VARSIZE) is specified, the passed parameter may be shorter
or longer in length than is defined in the prototype." So it's up to me to
pass sane fields and a sane length, etc. I'm prepared to do that.

The question is, on options(*varsize) fields, what do I specify as the
length? The procedure knows to expect data "longer or shorter" (I suppose
they also mean equal) than whatever I specify for the length. If so, why
do I have to specify a length at all? I'm thinking about just saying the
field is 1a options(*varsize). I think that'll be like passing a pointer,
except the caller doesn't have to do %addr.

Thanks.
brian.





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.