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



This is one good reason to use file I/O with Qualified Data structures,
IMO. When you declare an external DS, all field types are retained from
your reference file. No DB field mapping needs to occur, theoretically
making your app a little more efficient.

Eric DeLong

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Douglas Handy
Sent: Wednesday, October 22, 2008 6:06 AM
To: RPG programming on the AS400 / iSeries
Subject: Re: Packed and zoned decimal problem

David,

Could someone explain the last definition? If I were to pass myzone by
reference to a procedure, it's the packed version that gets passed.
How should I pass this zone?


The definition of a field in an externally described file is its format
in that file. If the field is not also named in a data structure or
stand-alone D spec, then the compiler may use a different format for the
field. In general, both packed and zones fields will be stored
internally as packed. One reason it does this is, at least on the CISC
boxes, I believe performance of the arithmetic operations was better
when both operands were packed. But aside from performance, consider
what happens when the same field name exists in multiple files used by a
program. As long as the number of digits and decimal positions is the
same in each file, you can do that even when some files declare it as
zoned and others as packed. The reason that works is the field is moved
from its external definition to the program variable assigned to hold
that value, and that program variable is packed.

In order to force a program variable to be a particular format, name it
on a D spec and signify the type, or include the variable in a data
structure.
An easy way to do the later is to use an externally described DS based
on the file you are using. This forces each of the fields in the
program to use the same format as the external definition. Note however
that if multiple files have the same field name, you can't have that
name appear in multiple data structures because the program variable
must exist in only one memory location.

Doug
--
This is the RPG programming on the AS400 / 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.




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.