On 27/10/2009, at 12:19 AM, Erik Olsson wrote:
I'm passing a struct that contains fields of various datatypes,  
including
packed decimal, from a RPG program to a C++ srvpgm. The issue is  
that the
decimal fields are received on the C++ side as zoned decimal, not as  
packed
decimal. I haven't found anything in the Programmer's guide  
explaining this
behaviour.
Are you sure the numeric fields are decimal in the RPG program? Your  
description implies the packed decimal fields are contained in a data  
structure. The default behaviour for RPG is to define numeric fields  
in a data structure as zoned decimal (because the data structure is  
presumed to be a big character field--historical reasons). Even if the  
packed decimal field is defined elsewhere in the program (e.g.,  
external file description) it will be remapped to zoned decimal by the  
compiler.
If the above is a correct guess at the cause of your problem then  
you'll either need to modify the RPG program and define the fields as  
packed decimal in the data structure or redefine the C/C++ data  
structure with char[] fields and convert them to decimal before use.
Regards,
Simon Coulter.
--------------------------------------------------------------------
   FlyByNight Software         OS/400, i5/OS Technical Specialists
   
http://www.flybynight.com.au/
   Phone: +61 2 6657 8251   Mobile: +61 0411 091 400        /"\
   Fax:   +61 2 6657 8251                                   \ /
                                                             X
                 ASCII Ribbon campaign against HTML E-Mail  / \
--------------------------------------------------------------------
 
As an Amazon Associate we earn from qualifying purchases.
	
 
This mailing list archive is Copyright 1997-2025 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.