Caché MultiValue Basic Reference
SENTENCE
[Back] [Next]
   
Server:docs2
Instance:LATEST
User:UnknownUser
 
-
Go to:
Search:    

Returns the command line that invoked the current process.
Synopsis
SENTENCE([n])
Arguments
n Optional — An expression that resolves to an integer used to specify what portion of the command line to return.
Description
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.
Examples
The following examples use the argumentless form of SENTENCE to return the full command line:
USER:;PRINT SENTENCE()
  ! Returns:
  ! ;PRINT SENTENCE()

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
USER:
See Also