If you want to definie a zoned variable based on a zoned reference variable,
just define the variable as data structure subfield (can be a unqualified
data structure).
Zoned standalone fields are always converted into packed fields.
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
Modernization ? Education ? Consulting on IBM i
Database and Software Architect
IBM Champion since 2020
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
"Train people well enough so they can leave, treat them well enough so they
don't want to. " (Richard Branson)
"Learning is experience ? everything else is only information!" (Albert
Einstein)
-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Justin
Taylor
Sent: Thursday, 31 October 2024 13:45
To: rpg400-l@xxxxxxxxxxxxxxxxxx
Subject: LIKE changing data type
We've encountered a situation where a LIKE() is making a PACKED variable
when the referenced variable is ZONED. This is causing issues when passing
as a parameter.
Dcl-f MyTable;
// MyColumn is zoned(2)
Dcl-s AlsoMyColumn like(MyColumn);
// AlsoMyColumn is packed(2)
My best guess is that it's something to do with the way File specs bring in
fields. In the compiler listing, the generated Input specs show MyColumn
with the "S" for signed (aka zoned), but the field listing at the bottom
shows P(2,0).
As an aside, a data structure works fine (with the File spec removed).
Dcl-ds MyDataStructure extName('MYTABLE') inz End-ds; Dcl-s MyDsColumn
like(MyColumn);
Can anyone shed some light on this?
7.4 TR 10
--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a
message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or
change list options,
visit:
https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.
As an Amazon Associate we earn from qualifying purchases.