NZ

From Br Wiki
Jump to: navigation, search

The NZ (numeric display, zero suppression) format specification indicates that numeric values of zero are to be suppressed on output. NZ can be used with FORM statements for internal, external and display files, and it can be used with the full screen processing statements.

Input characteristics

When used for input, NZ is treated as N. (See the N format specification discussion for more information.)

Output characteristics

When both are used for output of numeric data, NZ operates the same as GZ. If the value of a number is zero, blanks are output instead. If the value of a number is not zero, output is like N format. Printed values are right justified, padded with blanks on the left and rounded to the specified number of decimal points. If you want leading zeros to print (not be suppressed), use PIC (###).

Output from the following example would be a blank line:

00010 PRINT USING 20: 0
00020 FORM NZ 4.2

NZ can efficiently take the place of simple PIC constructions. The following two FORM statements are equivalent except that the first is shorter to code, it stores more efficiently and it executes more quickly:

00010 FORM NZ 10.2,NZ 10
00020 FORM PIC( - - --. -) PIC( - - - - -)