I have a RPG program A and a CL program B. A calls B with a data structure as entry parameter. This data structure contains characters as well as packed decimals. The entry parameter in B is declared as a character variable, so when the entry parameter is passed in from A, the decimal values end up in their hex-decimal format. I need their original decimal values in B. Is there any way to convert these hex character strings back to decimal in B?
Share
You don’t need to convert. Define the decimal field over the appropriate location in your data structure.
The *DEFINED storage method works well when the position is fixed. In a situation where the location may vary, then use *BASED storage.
In this example there is a numeric value in a position determined by a format parameter. The value will be incremented by 1 or two.
See Variables in CL commands