Don,
Is the issue that you're passing a reference to a pointer of a pointer?
I don't know if I understand that correctly, I never pass pointers
explicitly (however I do prefer to pass my parameters by reference,
which to my understanding means I'm passing a pointer implicitly).
So below, while the number may appear too large a value you'd want to
pass, you're still only passing a parameter. Use the length of the
field in the parm after it to determine how much of that FieldToCheck
field you want to compare against.
(I threw Const in there b/c I wasn't sure if you were updating a
parameter or not, so if you are just drop the Const.)
P FillArrayAll B
D PI
D FieldToCheck 32767a Const Options(
*VarSize )
D FieldToCheckL 5p 0 Const // length of
FieldToCheck
D CheckValue 50A
D ArrayValue 50A
Kurt Anderson
Application Developer
Highsmith Inc
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Don Wereschuk
Sent: Monday, January 21, 2008 12:52 PM
To: RPG programming on the AS400 / iSeries
Subject: Passing Parameters
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
D
D***********************************************************************
**
/FREE
COUNT = 1;
read input filerec;
dow CheckField < CheckValue;
read input filerec;
enddo;
dow not %eof(input) and
CheckField = CheckValue and
COUNT < 9999;
WrkSupp(COUNT) = ArrayValue;
COUNT += 1;
read input filerec;
enddo;
/END-FREE
P FillArrayAll E
CheckValue is pre-set.
CheckField is a value from a data file
If I define CheckField to be the same size as the field in the file I
have no problems. My problem is that I want to pass different fields
from the file at different times, each field Having a different size.
When I defined CheckField larger than the actual length of the field I
get an error (Length of variable is out of range). 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. Can anyone see what I'm doing
wrong here. Thanks in advance for any help.
******************************************
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
________________________________
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they are
addressed. If you have received this email in error please notify the
system manager. Please note that any views or opinions presented in this
email are solely those of the author and do not necessarily represent
those of the company. Finally, the recipient should check this email and
any attachments for the presence of viruses. The company accepts no
liability for any damage caused by any virus transmitted by this email.
--
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.