Difference between revisions of "F$FAO()"
(Created page with "'''F$FAO()''' converts character and numeric input to ASCII character strings. FAO stands for "formatted ASCII output". =Format= F$FAO (control-string[,argument[,...]]) '''...") |
|||
(4 intermediate revisions by 2 users not shown) | |||
Line 5: | Line 5: | ||
F$FAO (control-string[,argument[,...]]) | F$FAO (control-string[,argument[,...]]) | ||
− | '''Control strings''' tell the system what the resulting string should look like. The full list of control strings is presented below. | + | '''Control strings''' tell the system what the resulting string should look like. The full list of control strings is presented below.<br> |
− | Arguments (optional) are variables whose values to be used for the control string directives. | + | '''Arguments''' (optional) are variables whose values to be used for the control string directives. |
=Full list of control strings= | =Full list of control strings= | ||
Line 16: | Line 16: | ||
! Directive !! Value !! Description | ! Directive !! Value !! Description | ||
|- | |- | ||
− | | !AS|| | + | | style="text-align:center;" |!AS|| style="text-align:center;" | None || Inserts a character string as is: <pre>$ write sys$output f$fao("Welcome back, !AS","John") |
Welcome back, John</pre> | Welcome back, John</pre> | ||
|} | |} | ||
Line 26: | Line 26: | ||
! Directive !! Value !! Description | ! Directive !! Value !! Description | ||
|- | |- | ||
− | | !OB|| | + | | style="text-align:center;" |!OB|| style="text-align:center;" | None || Converts a byte to octal notation: <pre>$ write sys$output f$fao("!OB",9) |
011</pre> | 011</pre> | ||
|- | |- | ||
− | | !OW|| | + | | style="text-align:center;" |!OW|| style="text-align:center;" | None || Converts a word to octal notation: <pre>$ write sys$output f$fao("!OW",9) |
000011</pre> | 000011</pre> | ||
|- | |- | ||
− | | !OL|| | + | | style="text-align:center;" |!OL|| style="text-align:center;" | None || Converts a longword to octal notation: <pre>$ write sys$output f$fao("!OL",9) |
00000000011</pre> | 00000000011</pre> | ||
|- | |- | ||
− | | !XB|| | + | | style="text-align:center;" |!XB|| style="text-align:center;" | None || Converts a byte to hexadecimal notation: <pre>$ write sys$output f$fao("!XB",15) |
0F</pre> | 0F</pre> | ||
|- | |- | ||
− | | !XW|| | + | | style="text-align:center;" |!XW|| style="text-align:center;" | None || Converts a word to hexadecimal notation: <pre>$ write sys$output f$fao("!XW",15) |
000F</pre> | 000F</pre> | ||
|- | |- | ||
− | | !XL|| | + | | style="text-align:center;" |!XL|| style="text-align:center;" | None || Converts a longword to hexadecimal notation: <pre>$ write sys$output f$fao("!XL",15) |
0000000F</pre> | 0000000F</pre> | ||
|- | |- | ||
− | | !ZB|| | + | | style="text-align:center;" |!ZB|| style="text-align:center;" | None || Converts a byte to decimal notation: <pre>$ write sys$output f$fao("!ZB",100) |
100 | 100 | ||
$ write sys$output f$fao("!ZB",257) | $ write sys$output f$fao("!ZB",257) | ||
1</pre> | 1</pre> | ||
|- | |- | ||
− | | !ZW|| | + | | style="text-align:center;" |!ZW|| style="text-align:center;" | None || Converts a word to decimal notation: <pre>$ write sys$output f$fao("!ZW",257) |
257 | 257 | ||
$ write sys$output f$fao("!ZW",65536) | $ write sys$output f$fao("!ZW",65536) | ||
0</pre> | 0</pre> | ||
|- | |- | ||
− | | !ZL|| | + | | style="text-align:center;" |!ZL|| style="text-align:center;" | None || Converts a longword to decimal notation: <pre>$ write sys$output f$fao("!ZL",4294967296) |
0</pre> | 0</pre> | ||
|} | |} | ||
Line 64: | Line 64: | ||
! Directive !! Value !! Description | ! Directive !! Value !! Description | ||
|- | |- | ||
− | | !UB || Integer || Converts a byte to decimal notation without adjusting for negative numbers: <pre>$ write sys$output f$fao("!UB",255) | + | | style="text-align:center;" |!UB || style="text-align:center;" | Integer || Converts a byte to decimal notation without adjusting for negative numbers: <pre>$ write sys$output f$fao("!UB",255) |
255 | 255 | ||
$ write sys$output f$fao("!UB",256) | $ write sys$output f$fao("!UB",256) | ||
Line 71: | Line 71: | ||
255</pre> | 255</pre> | ||
|- | |- | ||
− | |!UW|| | + | | style="text-align:center;" |!UW|| style="text-align:center;" | None ||Converts a word to decimal notation without adjusting for negative numbers: <pre>$ write sys$output f$fao("!UW",-1) |
65535 | 65535 | ||
$ write sys$output f$fao("!UW",65536) | $ write sys$output f$fao("!UW",65536) | ||
0</pre> | 0</pre> | ||
|- | |- | ||
− | |!UL|| | + | | style="text-align:center;" |!UL|| style="text-align:center;" | None ||Converts a longword to decimal notation without adjusting for negative numbers: <pre>$ write sys$output f$fao("!UL",4294967296) |
0 | 0 | ||
$ write sys$output f$fao("!UL",-1) | $ write sys$output f$fao("!UL",-1) | ||
4294967295</pre> | 4294967295</pre> | ||
|- | |- | ||
− | |!SB|| | + | | style="text-align:center;" |!SB|| style="text-align:center;" | None ||Converts a byte to decimal notation with negative numbers converted properly: <pre>$ write sys$output f$fao("!SB",-1) |
-1 | -1 | ||
$ write sys$output f$fao("!SB",256) | $ write sys$output f$fao("!SB",256) | ||
Line 90: | Line 90: | ||
-128</pre> | -128</pre> | ||
|- | |- | ||
− | |!SW|| | + | | style="text-align:center;" |!SW|| style="text-align:center;" | None ||Converts a word to decimal notation with negative numbers converted properly: <pre>$ write sys$output f$fao("!SW",32000) |
32000 | 32000 | ||
$ write sys$output f$fao("!SW",-32000) | $ write sys$output f$fao("!SW",-32000) | ||
Line 99: | Line 99: | ||
1</pre> | 1</pre> | ||
|- | |- | ||
− | |!SL|| | + | | style="text-align:center;" |!SL|| style="text-align:center;" | None ||Converts a longword to decimal notation with negative numbers converted properly: <pre>$ write sys$output f$fao("!SL",65537) |
65537 | 65537 | ||
$ write sys$output f$fao("!SL",4294967294) | $ write sys$output f$fao("!SL",4294967294) | ||
Line 112: | Line 112: | ||
! Directive !! Value !! Description | ! Directive !! Value !! Description | ||
|- | |- | ||
− | |!/||None||Inserts a carriage return and a line feed: <pre>$ write sys$output f$fao("Hello!/Goodbye") | + | | style="text-align:center;" |!/|| style="text-align:center;" | None ||Inserts a carriage return and a line feed: <pre>$ write sys$output f$fao("Hello!/Goodbye") |
Hello | Hello | ||
Goodbye</pre> | Goodbye</pre> | ||
|- | |- | ||
− | |!_||None||Inserts a tab: <pre>$ write sys$output f$fao("Hello!_Goodbye") | + | | style="text-align:center;" |!_|| style="text-align:center;" | None ||Inserts a tab: <pre>$ write sys$output f$fao("Hello!_Goodbye") |
Hello Goodbye</pre> | Hello Goodbye</pre> | ||
|- | |- | ||
− | |!^||None||Inserts a form feed: <pre>$ write sys$output f$fao("Hello!^Goodbye") | + | | style="text-align:center;" |!^|| style="text-align:center;" | None ||Inserts a form feed: <pre>$ write sys$output f$fao("Hello!^Goodbye") |
Hello | Hello | ||
Line 138: | Line 138: | ||
Goodbye</pre> | Goodbye</pre> | ||
|- | |- | ||
− | |!!||None||Inserts an exclamation point (!): <pre>$ write sys$output f$fao("Hello!!") | + | | style="text-align:center;" |!!|| style="text-align:center;" | None ||Inserts an exclamation point (!): <pre>$ write sys$output f$fao("Hello!!") |
Hello! | Hello! | ||
$ write sys$output f$fao("Hello!") | $ write sys$output f$fao("Hello!") | ||
Line 144: | Line 144: | ||
\Hello!\</pre> | \Hello!\</pre> | ||
|- | |- | ||
− | |!%I (as in Irene) || | + | | style="text-align:center;" |!%I (as in Irene) || style="text-align:center;" | None ||Converts a longword integer to a named UIC in the format [group-identifier,member-identifier].| |
<pre>$ write sys$output f$fao("!%I",65540) | <pre>$ write sys$output f$fao("!%I",65540) | ||
[SYSTEM]</pre> | [SYSTEM]</pre> | ||
|- | |- | ||
− | |!%S||None||Inserts an "s" if the most recently converted number is not 1. (Not recommended for use with multilingual products.)| | + | | style="text-align:center;" |!%S|| style="text-align:center;" | None ||Inserts an "s" if the most recently converted number is not 1. (Not recommended for use with multilingual products.)| |
<pre>$ write sys$output f$fao("I have !SL apple!%S",5) | <pre>$ write sys$output f$fao("I have !SL apple!%S",5) | ||
I have 5 apples | I have 5 apples | ||
Line 154: | Line 154: | ||
I have 1 apple</pre> | I have 1 apple</pre> | ||
|- | |- | ||
− | |!%U|| | + | | style="text-align:center;" |!%U|| style="text-align:center;" | None ||Converts a longword integer to a numeric UIC in the format [g,m], where g is the group number and m is the member number. The directive inserts the brackets and the comma.| |
<pre>$ write sys$output f$fao("!%U",65540) | <pre>$ write sys$output f$fao("!%U",65540) | ||
[1,4]]</pre> | [1,4]]</pre> | ||
|- | |- | ||
− | |!nx||None||Left-justifies and blank-fills all data represented by x in a field of n characters wide.| | + | | style="text-align:center;" |!nx|| style="text-align:center;" | None ||Left-justifies and blank-fills all data represented by x in a field of n characters wide.| |
<pre>$ write sys$output f$fao("!10SL",5) | <pre>$ write sys$output f$fao("!10SL",5) | ||
5</pre> | 5</pre> | ||
|- | |- | ||
− | |!n* c||None||Repeats the character represented by c for n times.| | + | | style="text-align:center;" |!n* c|| style="text-align:center;" | None ||Repeats the character represented by c for n times.| |
<pre>$ write sys$output f$fao("!5*a") | <pre>$ write sys$output f$fao("!5*a") | ||
aaaaa</pre> | aaaaa</pre> | ||
|- | |- | ||
− | |!n%C|| | + | | style="text-align:center;" |!n%C|| style="text-align:center;" | None || Inserts a character string when the most recently evaluated argument has the value n. (Recommended for use with multilingual products.) <pre>REPORT = F$FAO("There !0UL!1%Cis!%Eare!%F !-!UL !-!0UL!1%Cchild!%Echildren!%F here",OFFSPRING)</pre> |
|- | |- | ||
− | |!%E|| | + | | style="text-align:center;" |!%E|| style="text-align:center;" | None ||Inserts a character string when the value of the most recently evaluated argument does not match any preceding !n%C directives. (Recommended for use with multilingual products.) <pre>REPORT = F$FAO("There !0UL!1%Cis!%Eare!%F !-!UL !-!0UL!1%Cchild!%Echildren!%F here",OFFSPRING)</pre> |
|- | |- | ||
− | |!%F||None||Marks the end of a plurals statement. <pre>REPORT = F$FAO("There !0UL!1%Cis!%Eare!%F !-!UL !-!0UL!1%Cchild!%Echildren!%F here",OFFSPRING)</pre> | + | | style="text-align:center;" |!%F|| style="text-align:center;" | None ||Marks the end of a plurals statement. <pre>REPORT = F$FAO("There !0UL!1%Cis!%Eare!%F !-!UL !-!0UL!1%Cchild!%Echildren!%F here",OFFSPRING)</pre> |
|- | |- | ||
− | |!%T||0||Inserts the current time: <pre>$ write sys$output f$fao("It's !%T",0) | + | | style="text-align:center;" |!%T|| style="text-align:center;" | 0 ||Inserts the current time: <pre>$ write sys$output f$fao("It's !%T",0) |
It's 12:54:00.68</pre> | It's 12:54:00.68</pre> | ||
|- | |- | ||
− | |!%D||0||Inserts the current date/time: <pre>$ write sys$output f$fao("It's !%D",0) | + | | style="text-align:center;" |!%D|| style="text-align:center;" | 0 ||Inserts the current date/time: <pre>$ write sys$output f$fao("It's !%D",0) |
It's 16-AUG-2018 12:54:08.98</pre> | It's 16-AUG-2018 12:54:08.98</pre> | ||
|} | |} | ||
Line 181: | Line 181: | ||
=See also= | =See also= | ||
* [[Quick guide to F$FAO()]] | * [[Quick guide to F$FAO()]] | ||
+ | |||
+ | [[Category: Lexical Functions]] |
Latest revision as of 05:46, 15 January 2019
F$FAO() converts character and numeric input to ASCII character strings. FAO stands for "formatted ASCII output".
Contents
Format
F$FAO (control-string[,argument[,...]])
Control strings tell the system what the resulting string should look like. The full list of control strings is presented below.
Arguments (optional) are variables whose values to be used for the control string directives.
Full list of control strings
Character string insertion
Directive | Value | Description |
---|---|---|
!AS | None | Inserts a character string as is: $ write sys$output f$fao("Welcome back, !AS","John") Welcome back, John |
Zero-filled numeric conversion
Directive | Value | Description |
---|---|---|
!OB | None | Converts a byte to octal notation: $ write sys$output f$fao("!OB",9) 011 |
!OW | None | Converts a word to octal notation: $ write sys$output f$fao("!OW",9) 000011 |
!OL | None | Converts a longword to octal notation: $ write sys$output f$fao("!OL",9) 00000000011 |
!XB | None | Converts a byte to hexadecimal notation: $ write sys$output f$fao("!XB",15) 0F |
!XW | None | Converts a word to hexadecimal notation: $ write sys$output f$fao("!XW",15) 000F |
!XL | None | Converts a longword to hexadecimal notation: $ write sys$output f$fao("!XL",15) 0000000F |
!ZB | None | Converts a byte to decimal notation: $ write sys$output f$fao("!ZB",100) 100 $ write sys$output f$fao("!ZB",257) 1 |
!ZW | None | Converts a word to decimal notation: $ write sys$output f$fao("!ZW",257) 257 $ write sys$output f$fao("!ZW",65536) 0 |
!ZL | None | Converts a longword to decimal notation: $ write sys$output f$fao("!ZL",4294967296) 0 |
Blank-filled numeric conversion
Directive | Value | Description |
---|---|---|
!UB | Integer | Converts a byte to decimal notation without adjusting for negative numbers: $ write sys$output f$fao("!UB",255) 255 $ write sys$output f$fao("!UB",256) 0 $ write sys$output f$fao("!UB",-1) 255 |
!UW | None | Converts a word to decimal notation without adjusting for negative numbers: $ write sys$output f$fao("!UW",-1) 65535 $ write sys$output f$fao("!UW",65536) 0 |
!UL | None | Converts a longword to decimal notation without adjusting for negative numbers: $ write sys$output f$fao("!UL",4294967296) 0 $ write sys$output f$fao("!UL",-1) 4294967295 |
!SB | None | Converts a byte to decimal notation with negative numbers converted properly: $ write sys$output f$fao("!SB",-1) -1 $ write sys$output f$fao("!SB",256) 0 $ write sys$output f$fao("!SB",127) 127 $ write sys$output f$fao("!SB",128) -128 |
!SW | None | Converts a word to decimal notation with negative numbers converted properly: $ write sys$output f$fao("!SW",32000) 32000 $ write sys$output f$fao("!SW",-32000) -32000 $ write sys$output f$fao("!SW",64000) -1536 $ write sys$output f$fao("!SW",65537) 1 |
!SL | None | Converts a longword to decimal notation with negative numbers converted properly: $ write sys$output f$fao("!SL",65537) 65537 $ write sys$output f$fao("!SL",4294967294) -2 |
Special formatting
Directive | Value | Description |
---|---|---|
!/ | None | Inserts a carriage return and a line feed: $ write sys$output f$fao("Hello!/Goodbye") Hello Goodbye |
!_ | None | Inserts a tab: $ write sys$output f$fao("Hello!_Goodbye") Hello Goodbye |
!^ | None | Inserts a form feed: $ write sys$output f$fao("Hello!^Goodbye") Hello Goodbye |
!! | None | Inserts an exclamation point (!): $ write sys$output f$fao("Hello!!") Hello! $ write sys$output f$fao("Hello!") %SYSTEM-F-BADPARAM, bad parameter value \Hello!\ |
!%I (as in Irene) | None |
$ write sys$output f$fao("!%I",65540) [SYSTEM] |
!%S | None |
$ write sys$output f$fao("I have !SL apple!%S",5) I have 5 apples $ write sys$output f$fao("I have !SL apple!%S",1) I have 1 apple |
!%U | None |
$ write sys$output f$fao("!%U",65540) [1,4]] |
!nx | None |
$ write sys$output f$fao("!10SL",5) 5 |
!n* c | None |
$ write sys$output f$fao("!5*a") aaaaa |
!n%C | None | Inserts a character string when the most recently evaluated argument has the value n. (Recommended for use with multilingual products.) REPORT = F$FAO("There !0UL!1%Cis!%Eare!%F !-!UL !-!0UL!1%Cchild!%Echildren!%F here",OFFSPRING) |
!%E | None | Inserts a character string when the value of the most recently evaluated argument does not match any preceding !n%C directives. (Recommended for use with multilingual products.) REPORT = F$FAO("There !0UL!1%Cis!%Eare!%F !-!UL !-!0UL!1%Cchild!%Echildren!%F here",OFFSPRING) |
!%F | None | Marks the end of a plurals statement. REPORT = F$FAO("There !0UL!1%Cis!%Eare!%F !-!UL !-!0UL!1%Cchild!%Echildren!%F here",OFFSPRING) |
!%T | 0 | Inserts the current time: $ write sys$output f$fao("It's !%T",0) It's 12:54:00.68 |
!%D | 0 | Inserts the current date/time: $ write sys$output f$fao("It's !%D",0) It's 16-AUG-2018 12:54:08.98 |