text string ‘ERROR$EOF’ to indicate an end of file condition.
T1=TEXT/'UNC$LIBRARY' T2=TEXT/CAM,T
4.21.24 Conversion Modifiers
The conversion modifiers CONVI, CONVF, and CONVE allow you to specify explicitly the format of the string to which a scalar is to be converted. They can be used in text statements in sequences with the following format:
CONVI
CONVF, scalar, n, additional specifications CONVE
Scalar specifies the scalar to be converted. It can be a scalar symbol or a literal number. n specifies the
number of characters in the generated string. Its maximum legal value is 20. The additional specifications, if any, vary depending on which modifier is used, as explained in the following sections.
4.21.24.1 CONVI,scalar, n
CONVI (convert to integer) indicates that the specified scalar is to be converted to a string composed of n characters. The scalar is truncated before being converted; that is, its fractional part, if any, is deleted. The resulting string represents an integer value. The string is right adjusted; that is, the nth (rightmost)
character represents the units digit of the scalar. A minus sign precedes the numeric characters if the original scalar is negative. No sign is included for a positive scalar. If fewer than n characters are required to represent the scalar, the unused positions to the left are filled with blanks. If more than n characters are required (including the minus sign for a negative scalar), n asterisks are generated as an error indication. Examples:
A = 23 B = -7 C = 125.9
TEXT definition Generated string
T1=TEXT/CONVI,A,2 23 T2=TEXT/CONVI,A,3 b23 T3=TEXT/CONVI,A,4 bb23 T4=TEXT/CONVI,B,3 b-7 T5=TEXT/CONVI,B,2 -7 T6=TEXT/CONVI,C,4 b125 T7=TEXT/CONVI,C,3 125 T8=TEXT/CONVI,C,2 **
Two asterisks are generated for T8 as an error indication because the specified number of characters, 2, is not large enough to represent the scalar 125.
4.21.24.2 CONVF, scalar, n, d
CONVF (convert to fixed point) indicates that the specified scalar is to be rounded to d decimal places and converted to a string composed of n characters. The string contains a decimal point followed by d
fractional digits. The string is right adjusted; that is, the nth (rightmost) character of the string represents the dth digit of the fraction. (If d is 0, the nth character is the decimal point). If the scalar is negative, a minus sign precedes the numeric characters. No sign is included for a positive scalar.
If fewer than n characters are required to represent the scalar, the string is filled to the left with blanks. If more than n characters are required (including the decimal point and the minus sign for a negative scalar),
n asterisks are generated as an error indication.
Examples:
A = 12.3456 B = -7.654321
TEXT definition Generated string
T1=TEXT/CONVF,A,7,4 12.3456 T2=TEXT/CONVF,A,8,4 b12.3456 T3=TEXT/CONVF,A,8,3 bb12.346 T4=TEXT/CONVF,A,10,5 bb12.34560 T5=TEXT/CONVF,B,9,6 -7.645321 T6=TEXT/CONVF,B,10,4 bbb-7.6453 T7=TEXT/CONVF,B,6,4 ******
4.21.24.3 CONVF, scalar,n,d,sign option, decimal option,zero option
This expanded format for CONVF allows you to specify three options for controlling the inclusion or omission of the sign, decimal point, and leading and trailing zeros. These options could be useful when the exact format of the string is important; for example, when the string is being used with INSERT to generate a punched tape block. The permissible values for these options are:
sign option = 0 Include a minus sign for a negative scalar, no sign for a positive scalar.
= 1 Always include the sign - plus for a positive scalar, minus for a negative scalar.
decimal option = 0 Include a decimal point. = 1 Don't include a decimal point.
zero option = 0 Convert leading zeros to blanks. = 1 Omit no zeros.
= 2 Omit trailing zeros.
= 3 Omit leading zeros and left adjust.
When the zero option is 2, 3, 4 or 5 and zeros are omitted, the number of characters in the generated string is less than the specified number by the number of zeros omitted. You must specify all three options or none of them; either three or six entries must follow CONVF. If you don’t specify the options, the assumed value for each option is zero.
Examples:
A = 12.0
T1 = TEXT/CONVF,A, 8, 4, 0, 0, ZOP
The following shows the strings generated for various values of the variable ZOP: ZOP String
0 b12.0000 Blank leading zeros. 1 012.0000 Omit no zeros. 2 012. Blank trailing zeros.
3 12.0000 Omit leading zeros, left adjust.
4 12. Omit leading and trailing zeros, left adjust.
5 12.0 Omit leading and trailing zeros, left adjust, output one zero right
The following example shows CONVF being used to generate a punched tape block to be output via an INSERT statement. The block is to contain:
1. Word address N.
2. Block number. 3 digits, no zeros omitted. FIL symbol is BLKNO. 3. Word address X.
4. X coordinate. 6 digits (4 fractional). Omit trailing zeros, FIL symbol is XVAL. 5. Word address Y.
6. Y coordinate. Same format as X. FIL symbol is YVAL. Table 5-. $ (End of Block code)
T1 = TEXT/’N’, CONVF, BLKNO, 3,0,0,1,1,$ ‘X’, CONVF, XVAL, 8, 4, 0,1, 2, $
‘Y’,CONVF,YVAL,8,4,0,1,2,’$’
For BLKNO = 23, XVAL = 11.2375, and YVAL = 4.672, the following string is generated: N023X112375Y04672$
4.21.24.4 CONVE, scalar, n, d
Specifically, the string generated by CONVE consists of the following: 1. An optional minus sign if the scalar is negative. No sign is
included for a positive scalar. 2. A decimal point.
3. A fraction equal to or greater than .1 and less than 1 rounded to d decimal places.
4. A plus or minus sign indicating the sign of the exponent. Table 6-. A two digit exponent.
The string is right adjusted; that is, the nth (rightmost) character of the string represents the units digit of the exponent. If fewer than n characters are required, the string is filled to the left with blanks. If more than n characters are required, asterisks are output as an error indication. The number of characters n should normally be at least 5 greater than d to include positions for the sign, decimal point, exponent sign, and exponent. Examples: A = .01236 B = -.01236 C = .1236 D = 1.236 E = 12360.4
TEXT definition String
T1=TEXT/CONVE, A, 12, 6 bb.123600-01 T2=TEXT/CONVE, B, 12, 6 b-.123600-01 T3=TEXT/CONVE, C, 11, 4 bbb.1236+00 T4=TEXT/CONVE, D, 11, 4 bbb.1236+01 T5=TEXT/CONVE, E, 11, 6 b.123604+05
4.21.24.5 OMIT, scalar
The OMIT,scalar option is only valid with the INSERT or PPRINT commands. OMIT will remove the leading blank space inserted when converting a scalar to a sting. Once OMIT is given it applies to all scalars in the command.
Examples:
A = 1.2 B = 2.5
INSERT/’ OUTPUT X’,A,’ Y’,B,’ $’ N001 OUTPUT X 1.2 Y 2.5 $
INSERT/’ OUTPUT X’,OMIT,A,’ Y’,B,’ $’ N001 OUTPUT X1.2 Y2.5 $