|
We are at V5R1 so I have to jump through hoops to get things to work.
Here's the situation:
We have MONTHID (A 6) which represents YYYYMM, where YYYY is the year and MM
is the month number. Sample data would be '200404'.
I need to do some manipulation where this value is the key and I need to know
the same month of the previous year. So, I came up with this EVAL statement
(in free format):
PASTMONTH = %char(atoi(%subst(MONTHID:1:4))-1) + %subst(MONTHID:5:2)
PASTMONTH is also (A 6).
I have the "atoi" C function prototyped:
h BNDDIR('QC2LE')
d atoi PR 10I 0 ExtProc('atoi')
d charValue * VALUE Options(*STRING)
When I attempt to compile the program, I get this message on the above EVAL
statement:
RNF0955 Item is not valid as the left-hand side of an EVAL operation.
Cause . . . . . : The left-hand side of an EVAL operation must be an item
that can be modified. This means that the following cannot be on the
left-hand side since they cannot be modified: figurative constants;
literals; named constants; lookahead fields; entry parameters with the CONST
keyword specified; prototype names; certain special words and built-in
functions. The specification is ignored.
Recovery . . . : Specify a variable in the left-hand side of the EVAL
operation or remove the specification. Compile again.
PASTMONTH is not a figurative constant, literal, named constant, lookahead
field, etc.
It is a field in the file I am using:
fLUMTM UF A E K DISK Rename( RLUMTM : LUMTMR ) USROPN
And, yes, I have the file opened on a prior statement due to the USROPN keyword.
Why the error?
It's probably something simple but I just can't see it.
Any help is greatly appreciated.
Robert
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.