Domain: SYSFILE information
The SYSCMD( ) function supplies the name of the file (alternative: a library element or a list variable) assigned to the system file SYSCMD. The function can be used to choose between the SYSFILE environment of the procedure and the SYSFILE environment of the task.
Format
SYSCMD( ) |
SYSTEM-FILE-CONTEXT = *OWN / *CALLER |
Result type
STRING
Input parameters
SYSTEM-FILE-CONTEXT =
Designates the SYSFILE environment, see also "Defining the SYSFILE environment ".
SYSTEM-FILE-CONTEXT = *OWN
The SYSFILE environment is that of the procedure.
SYSTEM-FILE-CONTEXT = *CALLER
The SYSFILE environment is that of the caller’s task.
Result
The format of the output corresponds to the output of the /SHOW-SYSTEM-FILE-ASSIGNMENT command (see the “Commands” manual [3]). If SYSCMD is read from a procedure (i.e. SYSCMD is assigned to a file, a library element or a list variable), then the type of procedure call is also displayed (for /INCLUDE-PROCEDURE with INCLUDE, for /CALL-PROCEDURE with PROCEDURE).
File (call type)
Name of the file that SYSCMD is assigned to.
*LIB-ELEM(library,element(version),type) (call type)
Library element (designated by the name of the library, the name of the element with its version and the element type) that SYSCMD is assigned to.
*VAR(variable) (call type)
List variable that SYSCMD is assigned to.
*PRIMARY
The primary assignment applies to SYSCMD (terminal in the dialog or the SPOOLIN file in batch mode).
*PRIMARY (DIALOG-BLOCK)
The primary assignment applies to SYSCMD (like *PRIMARY except that the query is was made in a dialog block).
Error message
SDP0435 DESIRED INFORMATION NOT AVAILABLE
Example
In dialog:
/C = SYSCMD() /SHOW-VARIABLE C C = *PRIMARY
In the dialog block:
/begin-block %BEGIN-BLOCK/a=syscmd() %BEGIN-BLOCK/show-variable a %BEGIN-BLOCK/end-block A = *PRIMARY (DIALOG-BLOCK)
In procedures:
The file C.PROC and the list variable PROC-1 each contain the following commands:
/A = SYSCMD() /SHOW-VARIABLE A
Calls
/CALL-PROCEDURE C.PROC /INCLUDE-PROCEDURE *VAR(PROC-1)
Output:
A = :2OSG:$USER1.C.PROC (PROCEDURE) A = *VAR(PROC-1) (INCLUDE)