|
My suggestion would be to break it into two or more statements. Not only would it be easier for someone else to figure out what you are trying to do but it would be easier to debug. Trying to cram everything into one statement doesn't really accomplish much. The computer ends up doing the same amount of work either way. It just makes it harder to read and change. Even if you finally find the magic combination which makes it work, what happens when someone tries to maintain it five years from now? Why jump through hoops at all? Albert York -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [SMTP:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Chris_Bougher@xxxxxxxxxxxxx Sent: Monday, May 24, 2004 9:56 AM To: RPG programming on the AS400 / iSeries Subject: Re: Need a sanity check, please Is there a semi-colon at the end of your statement? Chris Bougher "Robert Clay" <rclay@xxxxxxxxxxx To: <RPG400-L@xxxxxxxxxxxx> m> cc: Sent by: Subject: Need a sanity check, please rpg400-l-bounces@m idrange.com 05/24/2004 12:12 PM Please respond to RPG programming on the AS400 / iSeries 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.