The N (numeric display) format specification converts a number between its internal format (a bit pattern) and an ASCII character format (a number readable by humans). N is a highly versatile format specification. It can be used with the FORM statements for internal, external and display files, and it can be used with the full screen processing statements.
Conversion errors on G, N, and PIC formats can now be avoided on output to display files when the CONV=parameter is used in the OPEN DISPLAY statement. Also when CONV=is used, PIC processing will first try removing the commas from the output if doing so will prevent an overflow condition.
When N is used for input, the field length must account for a leading minus sign if needed, and a decimal point and decimal places if specified. Fraction length is optional and indicates the number of decimal places to be printed. With INPUT FIELDS and RINPUT FIELDS, the actual number that is input will be rounded to the number of decimal places specified.
Numeric values output with the N format specification will be right justified, padded with blanks on the left, and rounded to the specified number of decimal positions. The following example uses the format specification N 6.2 to format 50.5 and output it to the screen. The total length of the field, including the leading blank and decimal point, is 6:
00010 PRINT USING 20: 50.5 00020 FORM N 6.2
Output from the above example would be as follows (NOTE that there is one leading blank; the output is right justified in the field length specified):
- 1.) The G format specification performs identically to N when it is used with numeric data, but it may be specified when data may be either string or numeric.
- 2.) See the NZ (and GZ) format specifications for information about suppression of zero values on output of numeric data.
- 3.) See PIC Format Specification for additional options on formatting numbers (floating $, inserting commas and other punctuation, etc.).
In Open Window Statements
"N=attributes" is a parameter in Open Window statements which identifies the attributes that are to affect the entire inner portion of the window. However, the attribute specified takes effect only after a PRINT NEWPAGE has been sent to the window. The B (blink) attribute is not available for this parameter.
The letter N can also be used as a screen attribute.