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



Thank you.... but this would work correct...if you still wanted to use %Subarr

D IndAddr S * Inz(%Addr(*In))
D IndArray1 S 1 Dim(99)
D Based(IndAddr)
D #ds ds
D in1 like(IndArray2) inz('1')
D in2 like(IndArray2) inz('0')
D in3 like(IndArray2) inz('1')
D IndArray2 1 Dim(3) overlay(#ds)


/Free

%Subarr(IndArray1:30:3) = IndArray2;

/End-free

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Briggs, Trevor (TBriggs2)
Sent: Tuesday, January 22, 2013 11:55 AM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: RE: truncating a decimal value in /Free (Hijacked & Solved...thehijacked that is)

I believe this would have the same issue as Buzz's version. What the
code:

%Subarr(IndArray:30:3) = '101';

Is actually saying is EVAL array IndArray, starting at element 30, for 3
elements, with the value '101', which will cause the right-truncated
value of '1' to be inserted in each element.

Trevor Briggs
Analyst/Programmer
Lincare, Inc.
(727) 431-1246
TBriggs2@xxxxxxxxxxx
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Bill Hopkins
Sent: Tuesday, January 22, 2013 11:08 AM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: RE: truncating a decimal value in /Free (Hijacked &
Solved...thehijacked that is)

Try something likes this

D IndAddr S * Inz(%Addr(*In))
D IndArray S 1 Dim(99)
D Based(IndAddr)


/Free
%Subarr(IndArray:30:3) = '101';
/End-free


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Buzz Fenner
Sent: Tuesday, January 22, 2013 10: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 ...

Follow-Ups:
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.