GF: Difference between revisions
Jump to navigation
Jump to search
(Created page with "GF reads and writes strings and numbers. It left justifies strings and right justifies numbers. Strings may be any value not exceeding the specified length. Numbers may includ...") |
Gordon.dye (talk | contribs) mNo edit summary |
||
(2 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
GF | The '''GF (generic floating-point) format specification''' has been added for use by the FORM statement and by the INPUT / PRINT FIELDS. It is the same as [[G]] in that it can be used with either string or numeric data and in all other ways it is identical to [[L]] as used with INPUT and PRINT FIELDS. Note the following code fragment: | ||
00100 PRINT USING " 2*GF 10":333,444.44 | |||
;Outputs: | |||
333 444.44 | |||
GF left justifies strings and right justifies numbers. Strings may be any value not exceeding the specified length. Numbers may include a decimal point at any position and may have an exponent. | |||
The following program demonstrates this: | The following program demonstrates this: | ||
Line 7: | Line 15: | ||
00040 write #1,using 'form gf 14,c': 123456e-20,"X" | 00040 write #1,using 'form gf 14,c': 123456e-20,"X" | ||
This program produces a file with | This program produces a file with three records containing the following, where "bbb" represents three blank spaces: | ||
bbb1234.56X | bbb1234.56X | ||
1234.56bbbX | 1234.56bbbX | ||
bbb1.23456E-15X (the normalized form of the value) | bbb1.23456E-15X (the normalized form of the value) | ||
===See Also=== | |||
The letter G can also be used as a [[Attribute (Screen)#Control Attributes|Control Attribute]]. | |||
<noinclude> | |||
[[Category:Format Specifications]] | |||
</noinclude> |
Latest revision as of 04:36, 5 July 2014
The GF (generic floating-point) format specification has been added for use by the FORM statement and by the INPUT / PRINT FIELDS. It is the same as G in that it can be used with either string or numeric data and in all other ways it is identical to L as used with INPUT and PRINT FIELDS. Note the following code fragment:
00100 PRINT USING " 2*GF 10":333,444.44
- Outputs
333 444.44
GF left justifies strings and right justifies numbers. Strings may be any value not exceeding the specified length. Numbers may include a decimal point at any position and may have an exponent.
The following program demonstrates this:
00010 open #1: "name=xxx,recl=80,replace",internal,outin,relative 00020 write #1,using 'form gf 10,c': 1234.56,"X" 00030 write #1,using 'form gf 10,c': "1234.56","X" 00040 write #1,using 'form gf 14,c': 123456e-20,"X"
This program produces a file with three records containing the following, where "bbb" represents three blank spaces:
bbb1234.56X 1234.56bbbX bbb1.23456E-15X (the normalized form of the value)
See Also
The letter G can also be used as a Control Attribute.