On Tue, 25 Apr 2017 15:11:09 -0700, Charles Mills ([email protected]) wrote about "Can XLC printf() take "%D(*,*)"?" (in <[email protected]>):
> I'd like to format fixed point decimal (packed, in other words) numbers in a > common subroutine that would be passed the precision and scaling. Can > printf() and friends take '*' and then a passed integer for its (n,p) values > - analogous to the way printf() width and precision may be specified? KC offers this: <https://www.ibm.com/support/knowledgecenter/SSB27U_6.2.0/com.ibm.zos.r12.cbcpx01/pex1.htm> This page contains the following: printf("pd02 = %*.*D(*,*)\n", 20, 5, digitsof(pd02), precisionof(pd02), pd02); This appears to do what you want, but you will need to specify the width and decimal places for the output field too. HTH -- Regards, Dave [RLU #314465] *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* [email protected] (David W Noon) *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
