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



Buss Fenner wrote on 01/22/2013 09:43:45 AM:

From: "Buzz Fenner" <bfenner@xxxxxxxxxxxxxxxx>
To: <rpg400-l@xxxxxxxxxxxx>,
Date: 01/22/2013 09:44 AM
Subject: Re: truncating a decimal value in /Free (Hijacked &
Solved...the hijacked that is)
Sent by: rpg400-l-bounces@xxxxxxxxxxxx

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




--
This is the RPG programming on the IBM i (AS/400 and 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.


Please see the following examples which might be an option for you.

*? Indicator definitions
D p_dsInd s * inz(%addr(*in))
D dsInd ds based(p_dsInd)
D nSflDspCtl1_01...
D n overlay(dsInd:01)
D nSflDsp1_02 n overlay(dsInd:02)
D nProtectOption_10...
D n overlay(dsind:10)
D nAllErrors_50_89...
D 39a overlay(dsInd:50)
D nHasErrors_50 n overlay(dsInd:50)
D nSflErrors_60_89...
D 29a overlay(dsInd:60)
D nErrSflRcd_60 n overlay(dsInd:60)
D nErr_dfOption_61...
D n overlay(dsInd:61)
D nHelpKeyPressed_90...
D n overlay(dsInd:90)
D nAllowDelete_92...
D n overlay(dsInd:92)


Resetting all of the indicators for nSflErrors_60_89 to *OFF (indicators
60 thru 89)

nSflErrors_60_89 = *all'0';

The value of the indicators can be set also via the following statement
(indicators 60 thru 64)

%subst(nSflErrors_60_89:1:5) = '10101';

Or of course just setting (indicator 61)

nErr_dfOption_61 = *On;



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.