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



Barbara can give you the definitive answer but I would not expect it to work.

RPG has a rule that it can can only process a single assignment in one statement. And += is a short form assignment operation. In C I think it is a distinct entity (an iterator?) . So in RPG it would have to be done in two statements.

start_seq_n += 1;
SeQN = start_seq_n;


Jon

On Jul 29, 2020, at 5:58 PM, Javier Sanchez <javiersanchezbarquero@xxxxxxxxx> wrote:

Good day everyone.

I have to write several records into a file (or table), for which there is
al field (or column), that is a sequential number, but for some key field
combination.

Say that I have some USER, TASK, SEQUENCE key combination, for which the
SEQUENCE would start from 1 through an arbitrary ending number.

USER1 ADD 1
USER1 ADD 2
USER1 ADD 3
and so on.

I was trying to do this for the sequence:

USER = USER1;
TASK = 'ADD';
SEQN = (start_seq_n += 1);

where start_seq_n would be initially 1. I was expecting, like in "C", that
the compiler would first evaluate the internal increment and assignment and
just then assign to SEQN the result, so as to save some lines of code. I
see it gives me an error. I thought this was possible in RPGLE.

If not that I'm doing something wrong, and the error is real, then I'd
suggest that the compiler be able to evaluate that as a recursive RVALUE
and then an LVALUE.

JS
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com


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.