Started Task written in C ?

2005-06-06 Thread Michael Knigge

All,

is it possible to write a started task in C? Ok, surely I know it is 
possible to write a program that never ends ;-), but I need to "catch" 
the operator command for stopping the started task ("/P" command if I 
remember correctly).


Can this be done? Maybe with "signal()" ?

Thank you,
  Michael

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: Started Task written in C ?

2005-06-06 Thread Wolfgang Rupprath
Hi Michael,

we have implemented a started task in C. There are two functions in the
C library that deal with operator commands, __console() and
__console2(). Both functions will block when you try to intercept MODIFY
or STOP commands, so they should be placed in a special application
thread to have the main thread available to process your application
logic. 

See the C/C++ Run-Time Library Reference for details.

Wolfgang

-Original Message-
From: IBM Mainframe Discussion List [mailto:[EMAIL PROTECTED] On
Behalf Of Michael Knigge
Sent: Monday, June 06, 2005 9:38 AM
To: IBM-MAIN@BAMA.UA.EDU
Subject: Started Task written in C ?

All,

is it possible to write a started task in C? Ok, surely I know it is 
possible to write a program that never ends ;-), but I need to "catch" 
the operator command for stopping the started task ("/P" command if I 
remember correctly).

Can this be done? Maybe with "signal()" ?

Thank you,
   Michael

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: Started Task written in C ?

2005-06-06 Thread Michael Knigge

we have implemented a started task in C. There are two functions in the
C library that deal with operator commands, __console() and
__console2(). Both functions will block when you try to intercept MODIFY


Thank you very much - I will throw an eye on them

Bye
  Michael

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: Started Task written in C ?

2005-06-06 Thread Shmuel Metz (Seymour J.)
In <[EMAIL PROTECTED]>, on 06/06/2005
   at 09:38 AM, Michael Knigge <[EMAIL PROTECTED]> said:

>is it possible to write a started task in C?

With a small amount of CIB support in HLA, yes. Note, however, that
you can also direct STOP and MODIFY commands to batch jobs, so you may
not need to have an STC.
 
-- 
 Shmuel (Seymour J.) Metz, SysProg and JOAT
 ISO position; see  
We don't care. We don't have to care, we're Congress.
(S877: The Shut up and Eat Your spam act of 2003)

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: Started Task written in C ?

2005-06-07 Thread SUBSCRIBE IBM-MAIN WangRong
Hi Wolfgang,

Can you provide s short segment of source about how to use these two
functions? I just tried to use __console() send message to console but got
nothing.
 Thx!

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: Started Task written in C ?

2005-06-07 Thread Wolfgang Rupprath
Hi all,
 
> Can you provide s short segment of source about how to use these
two
> functions? I just tried to use __console() send message to console but
got
> nothing.
>  Thx!

here is a small test program using the __console() function to display a
message on the console and/or the system log, then wait for either a
MODIFY or a STOP command and then terminate.

I don't have a running program for the __console2() function. We simply
did not need the enhanced capabilities of routing code specifications
etc., so we settled with the __console().

Wolfgang 

- cut here -
#include 
#include 
#include 
#include 

static char szHelloMessage[] = "TEST Program for console() started" ;

extern int main ( int argc , char *argv[] )
{
   struct __cons_msg  consoleMessage;
   int rc;
   char caCommandString[200];
   int  iConsoleCommand;

   consoleMessage.__format.__f1.__msg_length = strlen(szHelloMessage);
   consoleMessage.__format.__f1.__msg= szHelloMessage;

   printf ( "Calling __console() function\n" );

   rc = __console(&consoleMessage,caCommandString,&iConsoleCommand);

   if ( rc == 0 )
   {
  switch ( iConsoleCommand )
  {
 case _CC_modify:
printf ( "Modify command received, CMD = %s\n" ,
 caCommandString );
break;

 case _CC_stop:
printf ( "Stop command received\n" );
break;

 default:
printf ( "Invalid command type received from __console(),"
 " type = %d\n" , iConsoleCommand );
break;
  }
   }
   else
   {
  printf ( "Call to __console() failed, errno = %d\n" , errno );
   }
}

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html