“It is being called from CL, so it is zoned!”
That was what I told Kimiko-chan.
We were checking how numeric data was being handled in an RPG program on IBM i. Kimiko-chan is the name I gave ChatGPT.
How was the number represented internally? As packed decimal or zoned decimal?
Those are familiar terms to people who work with them. The numeric value may be the same, but the internal representation differs.
During that discussion, I was reasoning that a value passed from CL must be zoned.
In CL, a variable can be declared with the type *DEC. It is a variable for a decimal number.
I had thought that meant zoned decimal.
Three digits, no decimal places. If I declared it that way in CL, surely it would be zoned?
Checking that assumption brought me to a stop.
A variable declared with TYPE(*DEC) on CL’s DCL command is packed decimal.
Oh. (Laughs.)
Here I was, paying attention to packed and zoned data in RPG, while relying on an assumption about the CL program doing the calling.
I needed to look separately at how many digits the number had and how it was represented.
Three digits did not settle the question. What type had actually been declared?
What was the calling program passing, and how did the receiving program treat it? Back to the definitions.
One thing I corrected in this exchange was the definition in my own head: my belief that CL’s *DEC meant zoned decimal.
Even after years of using something, I can still come across a detail I did not know.
And I had stated my mistaken assumption with rather impressive confidence. (Laughs.)
I love AS/400. I love RPG. I have worked with them for a long time.
They still have things to teach me.
I was checking the program’s declarations. My own understanding received a correction first.
Technical note
On CL’s DCL command, TYPE(*DEC) declares a packed decimal variable. The LEN parameter specifies the number of digits and decimal places. The type and the precision both need checking.
References, checked on 23 October 2026:
- IBM: Declare CL Variable (DCL), IBM i 7.6 — describes
*DECas a packed decimal value and documentsLEN.