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



All of our numeric data in our files is declared packed. I have never had a problem because I always
code the data type rather than let the compiler infer it. My packed numbers are packed even in data
structures.

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Lim Hock-Chai
Sent: Monday, March 31, 2008 2:46 PM
To: RPG programming on the AS400 / iSeries
Subject: RE: Rép. : Packed vs Zoned (was: Classic Traps -- I need your input!)

This global rule that you have in your shop sounds a bit extreme for me. I wonder how other handle
this? (May be prototype is the answer).

My shop does not any have rule on parameter. However, I've heard quite a few programmers here saying
to always use character field as parameter (redefine it and map it if you have to). I do not agree
with it :).



-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Denis
Robitaille
Sent: Monday, March 31, 2008 1:36 PM
To: RPG programming on the AS400 / iSeries
Subject: RE: Rép. : Classic Traps -- I need your input!

We have no field defined as packed in our DDS. All are defined as zone.

For internal variable, we uses an external DS like this:
d e ds extname(myfile) prefix(d_)
based(d1)

And all program variables are define:
d p_var s like(d_var)

And, as a shop rule, we do not use database field as parameters. We will define a variable for that:

p_var = var;
callp pgm(p_var);

So the fields from a file are used only for input/output for that file.
For all other purposes, we use variable with standerdize prefix.


"Lim Hock-Chai" <Lim.Hock-Chai@xxxxxxxxxxxxxxx> 2008-03-31 14:13

Yes. That is what I though you are referring to "A zoned field in a file (In your op, you say a
variable. I just want to make sure you mean a field in the file)". The reason I ask is because your
prescription for this problem is to strictly use zoned (avoid packed variable/field).
Are you saying that all numeric fields in all of your files are defined as zoned? And your always
use the extname for all files declared in the RPG programs to force all those fields to remain zoned?




-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Denis Robitaille
Sent: Monday, March 31, 2008 12:57 PM
To: RPG programming on the AS400 / iSeries
Subject: RE: Rép. : Classic Traps -- I need your input!

Try it. You'll see. In fact, it can get even more confusing.

Here is more details.

You have an externally define file
Fmyfile if e k disk

It has a variable called : pakednbr 5p 0

you compile the program and look at the compile listing, you will see pakednbr define as 5p 0

Now add the following lines to the program
D datastr ds
D pakednbr

recompile the program. Look at the compile listing and voila, the internal definition of pakednbr has
gone from packed to zoned. This causes no problem except if you use the variable has a parameter
somewhere.

to make thing even worst, you get the same situation if pakednbr was define zoned in the DDS of the
file. (packed inside the program except if part of a data structure)

I can not be sure why it is so, but it is so and it burned me in the past.

"Lim Hock-Chai" <Lim.Hock-Chai@xxxxxxxxxxxxxxx> 2008-03-31 10:29

Denis:
I'm not sure why making a variable become part of the data structure would change its attribute from
packed to zoned.

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Denis Robitaille
Sent: Monday, March 31, 2008 7:35 AM
To: RPG programming on the AS400 / iSeries
Subject: Rép. : Classic Traps -- I need your input!

<clip>
2. AN RPG programs works fine, you decide to make a variable that is part of the parameters list part
of a data structure. The variable was defined as packed. After being added to the array, it is now
zoned!!
Your programs start to bomb because it receives bad input. To avoid it, what we did here is to avoied
packed variable all together. The performance impact, if any, is negligeible.
</clip>
--
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.

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

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.