Library /sys$common/syshlp/helplib.hlb  —  Lexicals  F$FAO  Examples
    1.$ COUNT = 57
      $ REPORT = F$FAO("NUMBER OF FORMS = !SL",COUNT)
      $ SHOW SYMBOL REPORT
        REPORT = "NUMBER OF FORMS = 57"

      In this command procedure, the FAO directive !SL is used in
      a control string to convert the number equated to the symbol
      COUNT to a character string. The converted string is inserted
      into the control string.

      Note that COUNT is assigned an integer value of 57. The F$FAO
      function returns the ASCII string, "NUMBER OF FORMS = 57", and
      assigns the string to the symbol REPORT.

    2.$ A = "ERR"
      $ B = "IS"
      $ C = "HUM"
      $ D = "AN"
      $ PHRASE = F$FAO("TO !3(AS)",A,B,C+D)
      $ SHOW SYMBOL PHRASE
      $ PHRASE = "TO ERRISHUMAN"

      In this command procedure, the !AS directive is used to insert
      the values assigned to the symbols A, B, C, and D into the
      control string.

      Because the specified repeat count for the !AS directive is 3,
      F$FAO looks for three arguments. The arguments in this example
      include the symbol A ("ERR"), the symbol B ("IS"), and the
      expression C+D ("HUMAN"). Note that the values of these string
      arguments are concatenated to form the string "ERRISHUMAN".

    3.$ A = "ERR"
      $ B = "IS"
      $ C = "HUMAN"
      $ PHRASE = F$FAO("TO !#(#AS)",3,6,A,B,C)
      $ SHOW SYMBOL PHRASE
      $ PHRASE = "TO ERR   IS    HUMAN "

      In this command procedure, the F$FAO function is used with
      the !AS directive to format a character string. The first
      number sign (#)  represents the repeat count given by the
      first argument, 3. The second number sign represents the field
      size given by the second argument, 6. The next three arguments
      (A,B,C) provide the strings that are placed into the control
      string each time the !AS directive is repeated.

      Each argument string is output to a field having a length of
      6 characters. Because each string is less than 6 characters,
      each field is left-justified and padded with blank spaces. The
      resulting string is assigned to the symbol PHRASE.

    4.$ OFFSPRING = 1
      $ REPORT = F$FAO-
      ("There !0UL!1%Cis!%Eare!%F !-!UL !-!0UL!1%Cchild!%Echildren!%F here",OFFSPRING)
      $ SHOW SYMBOL REPORT
      $ REPORT ="There is 1 child here"

      In this command procedure, the !0UL directive evaluates the
      argument OFFSPRING but does not insert the value in the output
      string. The !n%C directive inserts the character string "is"
      into the output string because its value and the value of the
      argument OFFSPRING match. The directives !-!UL evaluate the
      argument a second time so that the correct character string can
      be inserted in the proper place in the output string. The !%F
      directive marks the end of each plurals statement. The F$FAO
      function returns the ASCII string "There is 1 child here" and
      assigns the string to the symbol REPORT.
Close Help