The reason that you are getting the compiling error is because the
FieldToCheck is passed by reference (no const/value keyword).
If this procedure does not need to update the FieldToCheck value for the
caller, you can simply add the const or value keyword on this parameter
and change this field to the larges possible alpha length to solve the
problem.
For example:
P FillArrayAll B
D FillArrayAll PI
D FieldToCheck 4000 const varying
D CheckValue 50A
D ArrayValue 50A
Note: I couldn't quite understand what this procedure is trying to do.
:(
-----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.