Caché MultiValue Basic Reference
[Home] [Back] [Next]
InterSystems: The power behind what matters   
Class Reference   

Returns the command line that invoked the current process.
n Optional — An expression that resolves to an integer used to specify what portion of the command line to return.
The SENTENCE function returns the most recently issued command line. It returns all portions of the command line exactly as specified, including any user-specified comments.
SENTENCE is commonly invoked with no arguments to return the entire command line. The parentheses are mandatory. SENTENCE with no arguments is functionally identical to the @SENTENCE system variable.
You can specify an optional integer argument to limit the value returned to only one portion of the command line. An n value of 0 returns the initial command. For example, PRINT SENTENCE(0) returns “PRINT”. An n value of 1 returns the first command argument. For example, PRINT SENTENCE(1) returns “SENTENCE(1)”. Higher values of n return subsequent arguments and commands on the command line. A value of n larger than the number of commands and arguments on the command line returns the empty string. This optional argument is provided for compatibility with jBASE.
The following examples use the argumentless form of SENTENCE to return the full command line:
  ! Returns:

USER:;PRINT ABS(4-7),SENTENCE(); ! comment
  ! Returns:
  ! 3       ;PRINT ABS(4-7),SENTENCE(); ! comment

USER:;PRINT SENTENCE(),"hello world"; ! comment
  ! Returns:
  ! ;PRINT SENTENCE(),"hello world"; ! comment      hello world
The following examples use the SENTENCE n argument to return a single portion of the command line:
USER:;PRINT ABS(4-7):"cheers",SENTENCE(0); ! comment
  ! Returns:
  ! 3cheers    ;PRINT
USER:;PRINT ABS(4-7):"cheers",SENTENCE(1); ! comment
  ! Returns:
  ! 3cheers   ABS(4-7):
USER:;PRINT ABS(4-7):"cheers",SENTENCE(2); ! comment
  ! Returns:
  ! 3cheers   cheers
USER:;PRINT ABS(4-7):"cheers",SENTENCE(3); ! comment
  ! Returns:
  ! 3cheers ,SENTENCE(3);
USER:;PRINT ABS(4-7):"cheers",SENTENCE(4); ! comment
  ! Returns:
  ! 3cheers !
USER:;PRINT ABS(4-7),"cheers",SENTENCE(5); ! comment
  ! Returns:
  ! 3cheers comment
USER:;PRINT ABS(4-7),"cheers",SENTENCE(6); ! comment
  ! Returns:
  ! 3cheers
See Also