F$CUNITS

From VSI OpenVMS Wiki
Jump to: navigation, search

F$CUNITS is a lexical function that converts values between blocks, bytes, kilobytes, megabytes, gigabytes, and terabytes.

Syntax

F$CUNITS(number [,from-units, to-units])

from-units:

  • BLOCKS
  • B
  • KB
  • MB
  • GB
  • TB

to-units:

  • BLOCKS
  • BYTES (supported only for BLOCKS to BYTES conversions)
  • B
  • KB
  • MB
  • GB
  • TB

Example

$ WRITE SYS$OUTPUT F$CUNITS(1024)
512KB

$ WRITE SYS$OUTPUT F$CUNITS(1024, "BLOCKS")
512KB

$ WRITE SYS$OUTPUT F$CUNITS(1024, "BLOCKS", "BYTES")
512KB

$ write sys$output f$cunits(512,"bytes","blocks")
%DCL-W-CONFLICT, illegal combination of command elements - check documentation
 \BYTES\

$ write sys$output f$cunits(512,"b","blocks")
1BLOCKS

$ write sys$output f$cunits(10000,"blocks","gb")
0GB