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



True all regarding the "difficulty" of conversion to free form. However done, the point is that it COULD be done with work... (and a lot of parameters) as done by Linoma and others.

I've even written some SQL code to modify z-add, but I'm not willing to redo what I can get from another source unless I don't like what they've done. I don't want to be that old guy that always says "I could have written that better" and then never do it. I hated that guy.

Thanks though for all the input on this.

I knew I could count on this community to inform.

Duane

-----Original Message-----
From: WDSCI-L [mailto:wdsci-l-bounces@xxxxxxxxxxxx] On Behalf Of Raul A Jager W
Sent: Thursday, April 14, 2016 6:42 PM
To: wdsci-l@xxxxxxxxxxxx
Subject: Re: [WDSCI-L] Conversion to free-form

you can also do:

DOLLARS = %dec(dlrAmt:13:0);
CENTS = dlrAmt - dollars;


On 04/13/2016 02:34 PM, Stephen M. West wrote:
There is not a straight forward replacement in free-format for the
Z-ADD opcode. An example of this is splitting a dollar amount into
the whole dollar value and the cents value and storing them as separate fields.

The following example shows just how simple it is in [old]
fixed-column
RPG:

D DLRAMT S 10s 2 Inz(876.54)
D DOLLARS S 4p 0

D CENTS S 2p 2

C Z-ADD DLRAMT DOLLARS
C Z-ADD DLRAMT CENTS

Now, DOLLARS contains the value 876, and CENTS contains the value .54.

That was easy because Z-ADD opcode does not throw errors when the
receiver is too small to hold the full result. Instead, it truncates
in a way that RPG programmers have been able to exploit. Now so with EVAL.

Now for the [new] free-format RPGLE version.

dcl-s DLRAMT zoned(10:2) inz(876.54);
dcl-s DOLLARS packed(4);

dcl-s CENTS packed(2:2);

DOLLARS = %dec(dlrAmt:13:0);
CENTS = %dec(%subst(%editc(dlrAmt:'X'):9:2):2:0) / 100;

Again, DOLLARS = 876, and CENTS = .54.

That was easy, too ... sort of.

MOVE is worse. There are 18 different types of conversions for MOVE.

Stephen West
Software Engineer

Stillwater Insurance Group
12500 I Street, Suite 100 Omaha, NE 68137
W: (402)599-8325 | C(402)659-0452
Stephen.West@xxxxxxxxxxxxxxxxxxxxxxx


-- Este e-mail fue enviado desde el Mail Server del diario ABC Color --
-- Verificado por Anti-Virus Corporativo Symantec --
--
This is the Rational Developer for IBM i / Websphere Development Studio Client for System i & iSeries (WDSCI-L) mailing list To post a message email: WDSCI-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/wdsci-l
or email: WDSCI-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at http://archive.midrange.com/wdsci-l.

________________________________
________________________________
CONFIDENTIALITY NOTICE: This electronic message transmission is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. If you have received this transmission, but are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of the contents of this information is strictly prohibited. If you have received this e-mail in error, please contact NALC Health Benefit Plan at 703-729-4677 and delete and destroy the original message and all copies.





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.