|
*LIKE DEFINE will simply replicate the definition of the source field. The other situations: defining a field as 4,0 in a 'C' specification means you'll get a packed field. That's just RPG. Likewise, for numeric data structure fields: they are defined as zoned by default. As Bob said, you can change this by specifying 'P' for packed. If you really want a zoned numeric variable, define it in the 'D' specs, not the 'C' specs, and just let the default apply. The thing to watch out for with numeric data structure fields that are defined as zoned is that at program start, these fields contain hex blanks, or 4040404040.... unless you initialize them to some other value. Hex blank, '40', fields are the leading cause of 'Decimal data error' halts. These result from trying to read from or write into zoned or packed numeric fields containing blanks. The FIXNBR (*ZONED) parameter of the CRTBNDRPG compiler or the IGNDECERR(*YES) parm of the CRTRPGPGM compiler can mitigate this to a degree. Fred Underwood North American Stainless (502) 347-6187 mailto:funderwood@xxxxxxxxxxxxxxxxxxxxxxxxxx "Venkateshwar V" <venkateshwar.raman@xxxxxxxxx> Sent by: rpg400-l-bounces@xxxxxxxxxxxx 05/26/2004 08:10 AM Please respond to RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> To <rpg400-l@xxxxxxxxxxxx> cc Subject Numeric Fields. Hi, It is just out of curiosity that I am asking this question. If I define a numeric variable in RPG400 using *LIKE DEFINE (the source field is zones) or Z-ADD *Zeros #X with attributes 4,0 it gets defined as packed. But If I were to define a field as datastructure subfield with same attributes using a datastructure it gets defined as zoned. Can anyone please explain how and why this happens ? Reagrds, Venky _______________________________________________ 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 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.