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



Isn't what you want something like this.

d ExtractSpecs pr
d LongString 32000a Const Options(*VarSize)

d TEXT50 s 50a

ExtractSpecs(TEXT50) ;


p ExtractSpecs b
d pi
d LongString 32000a Options(*VarSize) Const Opdesc

Now use OPDESC or a second parameter to get actual length passed.

In other words, why do you need the work variable? Let it pass just the
actual variable and get the length a second parameters or OPDESC.


On Wed, Oct 28, 2015 at 9:54 AM, Monnier, Gary <Gary.Monnier@xxxxxxxxx>
wrote:

Hi Jon,

Thanks for catching the varsize. I simply missed it.

Gary Monnier

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jon
Paris
Sent: Wednesday, October 28, 2015 9:34 AM
To: Rpg400 Rpg400-L
Subject: Re: Options(*Varsize) question

No need for the Varsize if you do that Gary.

But why not use CONST and let the compiler do it for you?


On Oct 28, 2015, at 12:18 PM, Monnier, Gary <Gary.Monnier@xxxxxxxxx>
wrote:

How about this?

d ExtractSpecs pr
d LongString 32000a Options( *VarSize )

d LongString s 32000A Varying
d TEXT50 s 50A
...
LongString = TEXT50;
ExtractSpecs( LongString ) ;
...
p ExtractSpecs b
d ExtractSpecs pi
d LongString 32000a Varying

Thanks,

Gary Monnier


-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Dan
Sent: Wednesday, October 28, 2015 8:50 AM
To: RPG400-L@xxxxxxxxxxxx
Subject: Options(*Varsize) question

I've tried a couple of variations on the code snippet below, but this is
the only one that compiled. In the example below, TEXT50 is a 50-char
length variable. Once inside the ExtractSpecs proc, LongString shows the
value of TEXT50 in the first 50 columns, but is followed by "junk".

My (apparently incorrect) understanding of Options(*Varsize) is that the
ExtractSpecs proc would "see" only the value in LongString up to the length
of the variable passed to it. The compile fails if Options(*Varsize) is
not specified. Ditto if I used the VARYING keyword.

My kludgy, hopefully temporary, workaround is to capture the length of
the first parameter and pass it as the second parameter.

Ideas / advice / specific RTFM references appreciated!

d ExtractSpecs pr
d LongString 32000a Options( *VarSize )
...
ExtractSpecs( TEXT50 ) ;
...
p ExtractSpecs b
d ExtractSpecs pi
d LongString 32000a Options( *VarSize )

- Dan
--
This is the RPG programming on the IBM i (AS/400 and 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.

--
This is the RPG programming on the IBM i (AS/400 and 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.


Jon Paris

www.partner400.com
www.SystemiDeveloper.com

--
This is the RPG programming on the IBM i (AS/400 and 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.

--
This is the RPG programming on the IBM i (AS/400 and 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 thread ...

Replies:

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.