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



Hi again, Arthur.

All this talk of edit code X supposes that you have no decimal positions to worry about. If you do, please ignore all this edit code X talk because you will lose your decimal point.

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Kurt Anderson
Sent: Wednesday, March 25, 2009 1:15 PM
To: 'RPG programming on the IBM i / System i'
Subject: RE: Using an Expression to control a FOR loop

Hi Arthur, here's yet another attempt to prevent you from using the For loop! I have nothing against using the For loop, but it seemed like a challenge to come up with a way to do it w/o the loop.

ColDta = %Editc(%Dec(%Trim(ColDta):LEN_Max: DECPOS_Max):'X');
startPos = LEN_Max - cwdth(#col) + 1; // separated out for clarity
ColDta = %subst( ColDta: startPos );


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Alan Campin
Sent: Wednesday, March 25, 2009 10:54 AM
To: RPG programming on the IBM i / System i
Subject: Re: Using an Expression to control a FOR loop

Would a %Trim fix that problem? The %Dec could be the largest value or a
%Int.The only thing you would have to protect against is a blank.

ColDta = %Editc(%Dec(%Trim(ColDta):5:0):'X');

On Wed, Mar 25, 2009 at 9:33 AM, Arthur Marino <amarino@xxxxxxxxxxxx> wrote:

Because, as I seem to remember, you can't specify a variable as either
of the last 2 parameters in the %dec BIF. And the length (actually max
width) of each of the columns is determined only after passing thru the
.csv file once to interpret the attributes (max width, #of decimals,
etc.) of each column.

Or am I wrong about the last 2 parms of %dec?

Arthur J. Marino
RockTenn Corporation
(631) 297-2276

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Alan Campin
Sent: Wednesday, March 25, 2009 11:23 AM
To: RPG programming on the IBM i / System i
Subject: Re: Using an Expression to control a FOR loop

Why not simply use a %EditC?

ColDta = %EditC(%Dec(COLDTA:5:0):'X');



On Wed, Mar 25, 2009 at 9:01 AM, Arthur Marino <amarino@xxxxxxxxxxxx>
wrote:

This FOR loop is supposed to prefix the 'varying' character field
"coldta" with zeros so as to right-justify the value in the column's
defined field length. "i" is defined as 5i 0.

for i = 1 to (cwdth(#col)-%len(coldta));
coldta = '0' + coldta;
endfor;

Debug tells me:
cwdth(#col) = 5 (the column's defined field length)
coldta = '134' (%len(coldta)=3, I inserted an explicit calc to be
sure)

"coldta" should wind up being '00134'.

I expect the loop to iterate twice (5 - 3). Yet, it does so only ONCE.
After the 'endfor' i = 2, not 3 as I'd expect, and coldta contains
0134
(only 4 bytes).

When I insert the calc "len = cwdth(#col)-%len(coldta);" and replace
the
expression with "for i = 1 to len", it iterates twice, i = 3 after the
'endfor', and coldta=00134 (5 bytes).

Is there something I'm not getting about the evaluation of the
expression in the FOR loop? It certainly appears that 5 - 3 results in
1, not 2.

Thanks.

Arthur Marino

This message, including its attachments, constitutes an electronic
communication within the meaning of the Electronic Communications
Privacy
Act, 18 U.S.C. Section 2510. This message is the confidential
property of
RockTenn, and disclosure is strictly limited to recipients intended by
the
sender. Unless previously authorized in writing, this message does
not
constitute an offer, acceptance, or agreement of any kind. This
message may
contain confidential attorney-client privileged information and
attorney
work product. If you are not the intended recipient, or responsible
for
delivering e-mail to the intended recipient, you are advised that use,
dissemination, forwarding, printing, or copying of this message is
STRICTLY
PROHIBITED. If you receive this message in error, please notify the
sender
immediately by return e-mail and delete the message entirely from your
system. Sender is not liable for damage caused by viruses transmitted
with
this message, or errors or omissi!
ons in content caused by transmission.
(c) RockTenn, Norcross, GA.
--
This is the RPG programming on the IBM i / System i (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.


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


This message, including its attachments, constitutes an electronic
communication within the meaning of the Electronic Communications Privacy
Act, 18 U.S.C. Section 2510. This message is the confidential property of
RockTenn, and disclosure is strictly limited to recipients intended by the
sender. Unless previously authorized in writing, this message does not
constitute an offer, acceptance, or agreement of any kind. This message may
contain confidential attorney-client privileged information and attorney
work product. If you are not the intended recipient, or responsible for
delivering e-mail to the intended recipient, you are advised that use,
dissemination, forwarding, printing, or copying of this message is STRICTLY
PROHIBITED. If you receive this message in error, please notify the sender
immediately by return e-mail and delete the message entirely from your
system. Sender is not liable for damage caused by viruses transmitted with
this message, or errors or omissi!
ons in content caused by transmission.
(c) RockTenn, Norcross, GA.
--
This is the RPG programming on the IBM i / System i (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.



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.