|
I tried your suggestion but it didn't work. Still getting the error. -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Martin, Steve (MAN-Golden) Sent: Monday, May 24, 2004 12:47 PM To: 'RPG programming on the AS400 / iSeries' Subject: RE: Need a sanity check, please Should you be casting the entire result to char()? // by adding overall parenthesis PASTMONTH = %char((atoi(%subst(MONTHID:1:4))-1) + %subst(MONTHID:5:2)) ^ ^ -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Robert Clay Sent: Monday, May 24, 2004 10:12 AM To: RPG400-L@xxxxxxxxxxxx Subject: Need a sanity check, please 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 _______________________________________________ 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. _______________________________________________ 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 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.