Chapter Contents

Previous

Next
execid

execid



Parse a Line of Input as a Subcommand

Portability: SAS/C extension


SYNOPSIS
DESCRIPTION
RETURN VALUE
CAUTIONS
IMPLEMENTATION
EXAMPLE


SYNOPSIS

#include <exec.h>

char *execid(char **cmdbuf);


DESCRIPTION

The execid function parses a line of input as a subcommand, according to system-specific conventions. cmdbuf is a pointer to the address of the line of input. When execid returns, *cmdbuf is altered to address the first operand of the subcommand or the null character ending the string. The return value from execid is a pointer to the subcommand name.

The execid function can enforce syntax conventions of the host system. This is useful particularly in TSO applications. For example, under TSO, execid checks to see if the subcommand begins with the '%' character, and then treats it as an implicit EXEC command if it does. In such cases, execid can preempt processing of the subcommand. If it does, it returns a command name of "*EXEC" to indicate that processing of the subcommand has been preempted, that a new EXEC may have been invoked, and that the program should get another line of input.

If the PCF-II product is installed on TSO, execid also processes the PCF-II X command and returns "*EXEC" on completion of PCF-II processing.

Under OS/390 and CMS, execid uppercases the input command name in accordance with TSO and CMS conventions. Under the USS shell, the command name is not uppercased, in accordance with UNIX conventions.


RETURN VALUE

The execid function returns a pointer to the subcommand name if the call is successful or 0 if it failed.

A 0 return code from execid always means that the program should expect subsequent input to come from a CLIST or an EXEC. (The next execget that reads from the terminal always returns "*ENDEXEC" .)


CAUTIONS

Whether execid is valid for a program without an environment name defined is system-dependent.

The execid function does no validation of the subcommand name. It is the responsibility of the program to decide whether to accept the subcommand.

Under TSO, if execid is not called for a subcommand, the CLIST variable & SYSSCMD does not contain the current subcommand name.


IMPLEMENTATION

The use of execid is optional. However, the environmental integration it provides may be helpful in TSO applications.

Under TSO, execid calls the IKJSCAN service routine to extract the subcommand name. If IKJSCAN indicates that the % prefix was used, execid calls the EXEC command to process an implicit CLIST request and returns "*EXEC" to indicate this.


EXAMPLE

#include <exec.h>

char *cmdname, *operands;
cmdname = execid(&operands);

Note:    Also see the comprehensive SUBCOM example.  [cautionend]


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.