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



Adam: I'm passing a pointer to the address of the field that I want to retreive the value from. If the data file field is 1A then I'm OK but if the data file field is 10A I need to adjust the length of CheckField to be 10A. I tried defining it as 50A Varying but then I get the error as the procedure is trying to fit 50 chars into a 1A field. I can't find any help that explains how to define the variable CheckField to accomadate what I'm trying to do.

******************************************
Don Wereschuk
ISD - Programmer/Analyst
Simcoe Parts Service Inc.
Phone: 705-435-7814 Ex: 302
Fax: 705-435-6746
mailto:dwereschuk@xxxxxxxxxxxxxxx
******************************************
"Save the Cheerleader - Save the world" - Hiro Nakamura

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Adam Glauser
Sent: Monday, January 21, 2008 2:14 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: Passing Parameters

Don Wereschuk wrote:
Hi All: I am having a problem with passing parameters to a procedure that I just can't seem to solve.
The following code is my procedure:


P FillArrayAll B
D FillArrayAll PI
D FieldToCheck *
D CheckValue 50A
D ArrayValue 50A
D*
DCheckField S 1A based(FieldToCheck) VARYING
D
[...]
CheckValue is pre-set.
CheckField is a value from a data file
[...]
All the help I've been able to find
Says that using VARYING should set the variable to the proper length but this is not working.

Don, this will only work if the fields in the calling program/procedure
are also defined as VARYING (or if you fake it). I think you might want
something more along these lines (not tested):

P FillArrayAll B
D FillArrayAll PI
D CheckField 1A varying
D const
D options(*VARSIZE)
D CheckValue 50A
D ArrayValue 50A
D*

The options(*VARSIZE) part does what I think you are trying to do by
using a pointer - it allows you to pass values of different lengths.
Since you aren't changing the value of CheckField, const lets the
compiler automatically set the VARYING length for you (and converts any
non-varying character variables to varying automatically).

You can also make this work using a pointer, but you will have to
calculate and pass the length manually.

HTH,
Adam
--
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 thread ...

Follow-Ups:
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.