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



Try this out...

D P_Indicators s * Inz(%addr(*IN))

D MyIndicators ds based(P_Indicators)
D Qualified
D Values 99a
D Ind n Dim(99) Overlay(Values)

/free


// Set IN range...
%subst(MyIndicators.Values:30:3) = '101';

// Also have array style access...
if MyIndicators.Ind(30);
DSPLY 'Thirty is *ON';
endif;

if MyIndicators.Ind(31) = *Off;
DSPLY 'Thirty One is *OFF';
endif;

Return;
/end-free



-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Buzz Fenner
Sent: Tuesday, January 22, 2013 9:44 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: truncating a decimal value in /Free (Hijacked & Solved...the hijacked that is)

To summarize (and to provide some background) I was faced with the following
coding style during a modification to some RPG III code:

C MOVEA'101' *IN,30

This has been used extensively in my shop for the last 30 years. I'm trying
to show the other guys the advantages of /Free but I wasn't able to do the
same thing with just a single line of code. Posting the problem to the forum
helped me a lot, and it also garnered the usual comments about bad coding
techniques. I'll give you that, but I'm in a bit of an ideological war here
and unless I can reproduce the same results using a single line of code,
I'll lose this battle. So much for background...

Got pointed to a Jon Paris article (thanks!) and came up with the following:

D pIndicators s * inz(%addr(*in))

D indicators ds based(pIndicators)
D ind 1a overlay(indicators) dim(99)

In his original, the array elements were defined as 1n, but I changed it to
what you see. The calc statement became this (since there's no equivalent to
MOVEA in free form):

C %subarr(ind:30:3) = '101';

The compiler balked when the array was defined as 1n, but accepted 1a. I ran
some test data and things looked OK, and I thought my problem was solved,
until I tested more thoroughly.

In short folks, it didn't work. Debugging the statement shows the following:

General Indicators:

... 30 '1' 31 '1' 32 '1' ...

Before the %subarr statement, they were all '0'.

So, I'm back to the drawing board but needed to inform the list so someone
else doesn't try the same thing!

Buzz





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.