HP OpenVMS Systems

ask the wizard
Content starts here

Formatting ($fao) integers for display?

» close window

The Question is:

Is there a simple way to format numbers with commas (9,999,999) for a DCL
 command procedure output report? Maybe using the F$FAO lexical?

The Answer is :

  No capabilities to format integers through the insertion of commas or
  periods (or other characters) presently exist within the OpenVMS system
  service sys$fao, nor within the associated f$fao DCL lexical function.
  Explicit DCL code to format the integer, or the creation and the use of
  an executable image that accepts and processes the input integer and
  provides the resulting string via DCL symbol(s), will be required.
  The OpenVMS Wizard will log a request to enhance OpenVMS.
  The following DCL loop will provide the required comma insertions..
    $L = L - 3
    $IF L.GT.0
    $ X = F$EXT(0,L,X) + "," + f$EXT(L,99,X)
    $ GOTO loop
  ...as will the following C code...
    #include [locale.h]
    #include [stdio.h]
    #include [stdlib.h]
    main(int argc, char** argv){
  Please note that the C code include statement syntax is incorrect,
  having been deliberately altered to permit display via web browsers.
  (Replace the square brackets with angle brackets before compilation.)

answer written or last revised on ( 3-JAN-2001 )

» close window