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



On 31-Mar-2015 09:56 -0500, Jerry Adams wrote:
On Tuesday, March 31, 2015 6:37 AM Mark Murphy wrote:

Cross posted in RPG and WDSC lists because it applies to both.
Just for reference, IBM i 7.1 TR?, RDi 9.1.1.1.

So just by accident, due to fat fingers, I discovered that the
following RPG code does not generate an error:

handle = ls_init(LSOA_COPY + + LSOA_BLOCK + LSOA_REPEAT);

Note the two + operators separated only by a space. What does that
compile to? It is obvious to me that an operand is missing, but
the compiler happily creates something and goes on it's merry way.
The LPEX source checker thinks it is OK as well!


I wrote a real quick and dirty program that did no more than:

D pComp S 2s 0
D pDiv S 2s 0
D pRef S 6s 0
/free
pComp = 1;
pDiv = 2;
pRef = pComp + + pDiv;
*inLR = *on;

<<SNIP>>

Further testing may be appropriate, but it looks like it fits what
John said: "Most likely the first is the addition operator and the
second is a sign (positive)."

In the interest of full disclosure, we're still running V5R1 (yuck).


The OP does not show the declarative of the variables nor the prototype for the procedure, so whether the expression in the OP was valid can not be known; i.e. what the compiler should\would do, can not be known without more information.

But for the numeric expression coded in the example from the most recently quoted message ["pRef = pComp + + pDiv;" and the snipped variant "pRef = pComp - + pDiv;"], see the following doc on unary operators:

IBM i 7.2->Programming->ILE languages->RPG->ILE RPG Reference-> Operations, Expressions, and Functions->Expressions->Expression Operators
<http://www-01.ibm.com/support/knowledgecenter/ssw_ibm_i_72/rzasd/expropt.htm>
_Expression Operators_
"There are several types of operations:

_Unary Operations_

Unary operations are coded by specifying the operator followed by one operand. The unary operators are:

+ The unary plus operation maintains the value of the numeric operand.
- The unary minus operation negates the value of the numeric operand. For example, if NUMBER has the value 123.4, the value of -NUMBER is -123.4.
..."

p.s. I use the NNTP interface and Mark's messages [those composed as "new" email messages] do not appear on the newsgroup, so I did not have the choice to reply directly to the Opening Post, only to the followup reply.


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.