|
I prefer using the date BIFs for this myself. It's not to hard to add an 01 to the end so you'll have YYYYMMDD. Convert to a date data type, subtract 1 month and convert to YYYYMM. Don't see it in your original code, but I assume you are checking to see if it is January and handling it correctly. As to the original code, somebody already mentioned semi-colons and you said it was there. Did you double check the line above? Charles > -----Original Message----- > From: Robert Clay [mailto:rclay@xxxxxxxxxxxx] > Sent: Monday, May 24, 2004 1:26 PM > To: RPG programming on the AS400 / iSeries > Subject: RE: Need a sanity check, please > > > No re-declarations. > > Date BIFs won't work because the fields are CHARACTER and > don't include complete date values. > > -----Original Message----- > From: rpg400-l-bounces@xxxxxxxxxxxx > [mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Lim Hock-Chai > Sent: Monday, May 24, 2004 1:15 PM > To: RPG programming on the AS400 / iSeries > Subject: RE: Need a sanity check, please > > The only thing that I can think of is that PASTMONTH is > re-declared as a local variable in the sub-procedure as const. > > Do want to mention that it might be safer to use date BIFs to > do date calculation. > > -----Original Message----- > From: rpg400-l-bounces@xxxxxxxxxxxx > [mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Robert Clay > > 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.