Skip to main content

get_binary_width_from_digits

Function get_binary_width_from_digits 

Source
pub fn get_binary_width_from_digits(digits: u16) -> u16
Expand description

Map a COBOL PIC digit count to the corresponding USAGE BINARY storage width in bits (NORMATIVE).

Follows the COBOL standard mapping:

  • 1-4 digits -> 16 bits (2 bytes, halfword)
  • 5-9 digits -> 32 bits (4 bytes, fullword)
  • 10-18 digits -> 64 bits (8 bytes, doubleword)

§Arguments

  • digits - Number of digit positions declared in the PIC clause

§Returns

The storage width in bits: 16, 32, or 64.

§See Also