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



Kurt,

That's a good one..... <g> The problem comes from the expression within the
%EditC bif...

When you have an inline expression, the compiler assigns intermediate
storage to hold the result of the expression as it's being derived.  You are
counting on the compiler to make the right sizing choices  for you.  As you
can see, the compiler doesn't always do well at this.  

If you want this expression to always work as you desire, simply use the
%Dec or %DecH bifs to force the expression to be sized correctly.



Zoned:
D ARBAT 7A
D ABABat 7S 0  Inz( 123456 )
ARBat = %editc( %dec(ABABat + 1 :7:0): 'X' );
 
The result is 0123457
 
Packed:
D ARBAT 7A
D ABABat 7P 0  Inz( 123456 )
ARBat = %editc( %dec(ABABat + 1 :7:0): 'X' );
 
The result is 0123457



Eric DeLong
Sally Beauty Company
MIS-Project Manager (BSG)
940-297-2863 or ext. 1863



-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Kurt Anderson
Sent: Thursday, March 23, 2006 3:14 PM
To: RPG programming on the AS400 / iSeries
Subject: Editing an expression - Zoned vs Packed


Can someone explain to me why editing an expression of a Zoned number
increases the size of the expression while doing the same with a Packed
number doesn't?
 
Zoned:
D ARBAT 7A
D ABABat 7S 0  Inz( 123456 )
ARBat = %editc( (ABABat + 1): 'X' );
 
The result is 012345
 
Packed:
D ARBAT 7A
D ABABat 7P 0  Inz( 123456 )
ARBat = %editc( (ABABat + 1): 'X' );
 
The result is 123457
 
Kurt Anderson
Application Developer
Highsmith Inc.
W5527 State Road 106, P.O. Box 800
Fort Atkinson, WI 53538-0800
TEL (920) 563-9571  FAX (920) 563-7395
EMAIL kjanderson@xxxxxxxxxxxxx
 

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.