Chapter Contents

Previous

Next
intractv

intractv



Indicate Interactive Execution

Portability: SAS/C extension


SYNOPSIS
DESCRIPTION
RETURN VALUE
CAUTION
EXAMPLE


SYNOPSIS

#include <lclib.h>

 int intractv(void);


DESCRIPTION

intractv indicates whether a program is executing interactively. The time-sharing flag is stored in byte 29 of the environment descriptor block.

Execution under OS/390-batch, including execution of the TSO terminal monitor program, is not interactive. TSO executes programs interactively. CMS execution is normally interactive. However, if there is no interactive console associated with the executing program, a C program under CMS is considered noninteractive. Consult the systems programmer at your local site to determine under what conditions a program is considered noninteractive for CMS.


RETURN VALUE

Except for USS programs called with exec -linkage, intractv returns a nonzero integer if a program is executing interactively; otherwise, it returns 0 .

For a program called with exec -linkage, intractv returns whether or not a TSO terminal is accessible. Therefore, in most cases of exec -linkage, intractv returns 0 ; however, for a program invoked via the oeattach or oeattache function under TSO, interactive returns nonzero.


CAUTION

See "Caution" under The L$UENVR Routine.


EXAMPLE

#include <lclib.h>
#include <stdio.h>
#include <string.h>

FILE *in_file;
char *sys_file;

      /* Issue prompt only if running interactively.           */
   if (intractv()) {
      printf("Enter data:");
      fflush(stdout);

      /* Perform other functions to read data in interactively.*/
      .
      .
      .
   }
      /* Otherwise, obtain input from DATA file.               */
   else {
      if (memcmp(sysname(), "CMS", 3) == 0)
         sys_file = "DATA FILE A1";
      else
         sys_file = "SYSIN";
      in_file = fopen(sys_file, "r");
   }


Chapter Contents

Previous

Next

Top of Page

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