Chapter Contents

Previous

Next
opcmd

opcmd



Initialize Operator Command Interface

Portability: SASC


SYNOPSIS
DESCRIPTION
RETURN VALUE
PORTABILITY
EXAMPLE
SEE ALSO


SYNOPSIS

#include <lcsignal.h>
void opcmd(unsigned int cibctr);


DESCRIPTION

opcmd requests that a SIGOPER signal be generated whenever the MVS operator issues a modify or stop command for the program. The SIGOPER signal will also be raised if the operator included a parameter in the start command that started the program. This is in addition to any parm that may have been placed in the started task PROC which is handled as usual by passing as an argument to main. It is not necessary for the program to be run as a started task to use this facility, but only started tasks will receive start parms.

cibctr specifies the number of Command Input Buffers (CIBs) to be chained before rejecting modify commands. This value can be from 0 to 255. If set to 0, no modify commands will be accepted, but STOP commands will still be processed.

The SIGOPER signal is asynchronous, so it is discovered only when a function is called or returns.


RETURN VALUE

None.


PORTABILITY

opcmd is not portable.


EXAMPLE

This example waits for operator commands and shuts down when the stop command is received:

#include <oswto.h>                                                     
#include <stdlib.h>                                                    
#include <signal.h>                                                    
#include <lcsignal.h>                                                  
static void OperMsg(int);                                              
static int shutdown = 0;                                               
                                                                       
void main(void)                                                        
{                                                                      
   signal(SIGOPER, &OperMsg); /* Catch SIGOPER signal.             */  
   opcmd(5);                  /* enable operator command service   */  
   while(!shutdown)                                                    
     sigpause(0);                                                      
}                                                                      
                                                                       
/*-------------------------------------------------------------------+ 
| SIGOPER handler                                                    | 
+-------------------------------------------------------------------*/ 
static void OperMsg(int signum)                                        
{                                                                      
OPER_t *info;                                                          
                                                                       
   info = siginfo();                                                   
   switch (info->type)                                                 
   {                                                                   
     case OPER_start:                                                  
       WTP("Start parm received: %s\n", info->request);             
       break;                                                          
     case OPER_stop:                                                   
       WTP("Stop received.\n");                                     
       shutdown = 1;                                                   
       break;                                                          
     case OPER_modify:                                                 
       WTP("Modify received: %s\n", info->request);                 
       break;                                                          
   }                                                                   
   signal(SIGOPER, &OperMsg); /* Catch SIGOPER signal.         */      
   return;                                                             
}


SEE ALSO

SIGOPER in Chapter 5, "Signal-Handling Functions"


Chapter Contents

Previous

Next

Top of Page

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