Return to the RPG Tips
Convert an 8 character string that contains a number that may or may not have adecimal position.
You could use the atof procedure available in the QC2LE binding directory. This is an example prototype: dc2f pr 8f extproc('atof') dstring * value options(*string) It is called this way: eval int=c2f(%trim(amount1)) Where amount1 is a char field. OR Examples: 12345.78 or 123 or 1.23456, etc. I need to convert this to a number (10,5). H Bnddir('QC2LE') DftActGrp(*NO) d atof PR 8f Extproc('atof') d char 30 CONST dCharValue s 30 INZ('12345.678 ') d Float s 8f INZ dPacked s 10p 5 INZ c Eval Float = atof(CharValue) c Eval Packed = Float c Eval *INLR = *ON
[report a broken link by clicking here]