× 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.




well, let's see....  why not something like:

DS         RYM
   1 6     MONTHID
   1 4 0   yer
   5 6 0   mon

then somewhere after the read/calc.....  yer=yer-1 ???

I would do a TESTN before....

OK, I'm using an old rpg DS and you'll have to put the stuff in the right
columns, and you could do it in D specs just as easily...I"m just in RPG
III mode this morning... :(  (Some people just WON'T convert!)

Don in DC
It's Monday, which RPG am I using today?

---------------------------------------------------

On Mon, 24 May 2004, Robert Clay wrote:

> 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.
>


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.