Formatting Variables for Output

Variables of the CHARACTER format (string variables) are printed "as is", with no special formatting. All characters stored in the variable (including spaces) are printed. Some DEF parameters also control the output format. For instance, there is a parameter to force all output to be upper-case.

Variables of all other formats (numeric variables) are formatted for output according to the following options:

Format Option

Comment

Max. digits for integer part

Up to 9 digits. Values that cannot fit within that number of digits generate a runtime error.

Max. digits for fractional part

Up to 9 digits. The number is rounded to that number of fractional digits.

Note: Setting to zero will result in integer-only output.

Min. digits for integer part

If the integer part does not need that number of digits, leading zeros or spaces will be used. Must be less than or equal to the maximum digits.

Min. digits for fractional part

If the fractional part does not need that number of digits, trailing zeros or spaces will be used. Must be less than or equal to the maximum digits.

Leading zeros (Yes / No)

Choose between zeros (if Yes) and spaces (if No), if the minimum number of integer digits is not met.

Trailing zeros (Yes / No)

Choose between zeros (if Yes) and spaces (if No), if the minimum number of fractional digits is not met.

Character for the plus (+) sign

If left blank or set to ~, no sign character will be printed for positive numbers. Otherwise, a sign character will be used (For example, +3.2).

Character for the minus (-) sign

If left blank or set to ~, no sign character will be printed for negative numbers. Otherwise, a sign character will be used (For example, -3.2).

Character for the decimal point

Any character except space (usually a dot)

Use decimal point for integer numbers (Yes / No)

If set to Yes, a decimal point will be printed even for integer values (For example, 2. instead of 2)

Representation of the value 0

Exact string to be used (For example, 0.0) when value is 0 (all other formatting options are ignored).

The following examples assume the following:

Variable Value

Max. int. digits

Max frac. digits

Min. int. digits

Min frac. Digits

Leading zeros

Trailing zeros

Output

6.6666…

4

3

0

0

No

No

6.667

6.6666…

4

1

0

0

No

No

6.7

6.6666…

4

3

2

0

No

No

 6.667

6.6666…

4

3

2

0

Yes

No

06.667

25.0

5

0

1

0

Yes

Yes

25

24.9

5

0

1

0

Yes

Yes

25

25.1

5

4

3

2

Yes

Yes

025.10

25.1

5

4

3

2

No

No

 25.1_

2000.0

3

2

1

0

No

No

Error!

-0.333...

4

3

0

0

No

No

-0.333

Notes:

GPP Compatibility Notes:

In the old GPP, the formats also defined the default modality for variables of this format. In GPP2, formats do not define modality at all (this parameter was removed from the format) and all variables are non-modal by default.

Some functionality may be dependent on the product package. Contact your Reseller if you require a license.