×
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.
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
As an Amazon Associate we earn from qualifying purchases.
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.