Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to control the elapsed time for a stc

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Philippe

New User


Joined: 10 Jan 2008
Posts: 17
Location: France

PostPosted: Thu Aug 09, 2018 5:54 pm    Post subject: How to control the elapsed time for a stc
Reply with quote

Hi all,

do you know how I can control the elapsed time for a stc ?
For example, I want to stop a particular stc (as I can do for a batch job with the time parameter) each time it runs more than 1 hour.

Thanks for your replies !

Philippe
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8378
Location: Dubuque, Iowa, USA

PostPosted: Thu Aug 09, 2018 7:28 pm    Post subject:
Reply with quote

The TIME parameter for a batch job does NOT impact elapsed time -- it controls CPU time. You could set a TIME parameter on the started task but again it will impact CPU time and not elapsed time.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1292
Location: Israel

PostPosted: Thu Aug 09, 2018 8:02 pm    Post subject:
Reply with quote

When you say "I want to stop...", do you mean a physical person (you or an operator) looking at the clock, or the program running in the STC checking for elapsed time ?

Is the program (running in the STC) available to check from time to time if a STOP command has been issued ?

This link could be useful: Communicating with a program.
Back to top
View user's profile Send private message
phunsoft

New User


Joined: 19 Jul 2018
Posts: 11
Location: Switzerland

PostPosted: Thu Aug 09, 2018 8:37 pm    Post subject:
Reply with quote

Marso wrote:
Is the program (running in the STC) available to check from time to time if a STOP command has been issued ?


If the program can be changed, I'd suggest you add some code to attach a subtask. That subtask will do an STIMER WAIT,DINTVL==C'01000000'. When the hour is over, the code will continue to run and can communicate the main task to terminate now.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2459
Location: Netherlands, Amstelveen

PostPosted: Fri Aug 10, 2018 8:05 am    Post subject:
Reply with quote

You can use System Automation.
Back to top
View user's profile Send private message
Philippe

New User


Joined: 10 Jan 2008
Posts: 17
Location: France

PostPosted: Fri Aug 10, 2018 7:00 pm    Post subject: Reply to: How to control the elapsed time for a stc
Reply with quote

Hi guys,

thanks for the replies.
I talked about the Time on the Jobparm which works with the elaps time. The System Automation option is intersting and I will work around that.
I'm talking about an automatic method to stop a stc without any human action.

Philippe
Back to top
View user's profile Send private message
phunsoft

New User


Joined: 19 Jul 2018
Posts: 11
Location: Switzerland

PostPosted: Fri Aug 10, 2018 8:17 pm    Post subject: Re: Reply to: How to control the elapsed time for a stc
Reply with quote

Philippe wrote:
I talked about the Time on the Jobparm which works with the elaps time.

The TIME parameter on the /*JOBPARM does indeed monitor elapsed time. JES2 will write WTOs when the job runs longer, that's it. It will not stop anything. So you would still need automation to catch the message and issue whatever command is needed to stop the STC.

Unfortunately, TIME on the /*JOBPARM is ignored for STCs. This is probably the reason you started this thread.

So, you seem to have automation, thus catching the message and do what is needed should not be a big deal. Maybe you can run the program as job instead of as STC?

There are only a few reasons why a program must run as STC. One would be it the program must run under the master subsystem (SUB=MSTR).
Back to top
View user's profile Send private message
Willy Jensen

Active User


Joined: 01 Sep 2015
Posts: 219
Location: Denmark

PostPosted: Sat Aug 11, 2018 12:18 am    Post subject:
Reply with quote

If you choose an external controller you must cancel the timer if the STC stops by itself before the time limit. Otherwise you might get a premature cancel for the next STC start.
I thought about various options, like using the JES2 automatic commands, but that doesn't handle crossing midnight very well as far as I can tell.

@Peter, re "add some code to attach a subtask. That subtask will do an STIMER WAIT,DINTVL==C'01000000" etc. Wouldn't it be more generally usable if you have a main task attaching the STC program and having the main task waiting for either a time-out, or termination of the STC task?
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1595
Location: Chennai

PostPosted: Sat Aug 11, 2018 5:41 am    Post subject:
Reply with quote

Here is one way to do it through JES2 automatic commands. It can go upto 7 days delay, not more than that. - This is JES2 automatic commands limitation.

1. Get the started task details
2. Generate JES2 automatic commands
3. Issue and check for access errors if any on system log.

Include this step as the first step of the started task
Code:
//CANCELR  EXEC PGM=IKJEFT01,PARM='%CANSTC 5'    <-- this task would be stopped after 5 minutes.   
//SYSPROC  DD   DSN=WELLS.REXX.PDS,DISP=SHR       
//SYSTSPRT DD   SYSOUT=*                           
//SYSPRINT DD   SYSOUT=*                           
//SYSUDUMP DD   SYSOUT=*                           
//SYSOUT   DD   SYSOUT=*                           
//SYSTSIN  DD   *                                 
/*                                               

The member WELLS.GREEN.PDS(CANSTC) has,
Code:
/*REXX*/                                                               
/* SECTION 1: GET THE STARTED TASK DETAILS */                           
ASCB = C2D(STORAGE(224,4))                                             
ASSB = C2D(STORAGE(D2X(ASCB+336),4))                                   
JSAB = C2D(STORAGE(D2X(ASSB+168),4))                                   
JBNM = STORAGE(D2X(JSAB+28),8)                                         
JBID = STORAGE(D2X(JSAB+20),8)                                         
JESN = SUBSTR(JBID,4,5)                                                 
                                                                       
/* SECTION 2: CALCULATE THE TIME FOR CANCELLING THE TASK */             
PARSE ARG CANTIME                                                       
DATE_TODAY = DATE('D')                                                 
MINS_TODAY = DATE_TODAY * 1440  /* CONVERT TO MINUTES 24 * 60 = 1440 */
MINS_CANCEL = MINS_TODAY + TIME('M') + CANTIME  /* TIME OF CANCELLING */
DIFF = MINS_CANCEL - MINS_TODAY                                         
HOURDIFF = (MINS_CANCEL - MINS_TODAY) % 60                             
MINSDIFF  = (MINS_CANCEL - MINS_TODAY) // 60                           
HOURDIFF = RIGHT(HOURDIFF,3,'0')                                       
MINSDIFF = RIGHT(MINSDIFF,2,'0')                                       
                                                                       
SAY 'YOU MENTIONED A DELAY OF ' CANTIME 'MINS'                         
SAY 'TASK' JBNM JESN  ' WILL BE CANCELLED AT' HOURDIFF ||':'||MINSDIFF 
                                                                       
CMD="/$TA,T="||HOURDIFF||"."||MINSDIFF||",''$C S("||JESN||"),JOBMASK=",
    ||STRIP(JBNM)||"''"                                                 
SAY 'JES COMMAND GENERATED=' CMD                                       
                                                                       
/* SECTION 3: ISSUE THE JES COMMAND */                                 
ISFRC = ISFCALLS("ON")                                                 
 IF ISFRC ¬= 0 THEN DO                                                 
    SAY "ISFCALLS RC" ISFRC                                             
     EXIT                                                               
 END                                                                   
 ADDRESS SDSF "ISFEXEC '"CMD"'"                                         
 IF RC ¬= 0 THEN DO                                                     
     SAY "ISFEXEC  RC" RC                                               
     SAY ISFMSG         
     DO  IM = 1 TO ISFMSG2.0                           
         SAY ISFMSG2.IM                               
     END                                               
     EXIT                                             
 END                                                   
 IF RC = 0 THEN SAY 'COMMAND ISSUED SUCCESSFULLY' CMD 
 ELSE SAY 'ERROR: CHECK COMMAND ISSUING SECTION' RC   
 CALL  ISFCALLS "OFF"                                 
EXIT                                         


Output:
Code:
IKJ56644I NO VALID TSO USERID, DEFAULT USER ATTRIBUTES USED               
YOU MENTIONED A DELAY OF  5 MINS                                         
TASK IHSAE001 00167  WILL BE CANCELLED AT 017:05                         
JES COMMAND GENERATED= /$TA,T=017.05,''$C S(00167),JOBMASK=IHSAE001''     
COMMAND ISSUED SUCCESSFULLY /$TA,T=017.05,''$C S(00167),JOBMASK=IHSAE001''
READY                                                                     
END                                                                       


Caveats:
The time parameter for the //CANCELR step can be only in minutes
The number of minutes cannot exceed more than 7 days - JES2 automatic commands limitation.
The job cannot go across year-end to next year. This can be modified by handling julian dates (feeling lazy to handle that now).
The USERID under which the started task runs must have authority to issue commands. OPERCMDS Authority.
If the started task spawns unix processes, check if those are also killed.


Friday & time for sarakku! cheers - omlette du fromage
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2459
Location: Netherlands, Amstelveen

PostPosted: Sat Aug 11, 2018 11:36 am    Post subject:
Reply with quote

Here some info on the CHRON timer in Netview :


http://publib.boulder.ibm.com/tividd/td/netview390/dqal2mst/en_US/HTML/dqal2m18.htm
Back to top
View user's profile Send private message
phunsoft

New User


Joined: 19 Jul 2018
Posts: 11
Location: Switzerland

PostPosted: Mon Aug 13, 2018 1:16 pm    Post subject:
Reply with quote

Willy Jensen wrote:
Wouldn't it be more generally usable if you have a main task attaching the STC program and having the main task waiting for either a time-out, or termination of the STC task?

@Willy: Yes, you can surely write this a general utility.

I was thinking there is a remote possibility the "stc" wants to run as the job step task. If not, your suggestion is preferrable.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2459
Location: Netherlands, Amstelveen

PostPosted: Mon Aug 13, 2018 6:24 pm    Post subject:
Reply with quote

It is also possible to use TWS to stop/start a stc by means of the TWS Automation interface.

So that means a TWS application stops the stc, executes all housekeeping processes and starts the stc.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1595
Location: Chennai

PostPosted: Mon Aug 13, 2018 11:33 pm    Post subject:
Reply with quote

If you have BMC products, then it can be done through combination of Mainview Alarm Manager & Mainview AutoOper.

From Mainview screen JUSEZ, setup an alarm based on jobname and Elapsed variables.
This alarm would write a custom message to SYSLOG.
Then AutoOper would pick up the message and issue the cancel command.

There is a video tutorial of setting up alarms on BMC site. Let me know if you would need it.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts In which program the FILE CONTROL wil... Poha Eater COBOL Programming 2 Thu Jun 28, 2018 9:02 pm
No new posts Run time proc edit Niki JCL & VSAM 7 Fri Jun 08, 2018 5:42 pm
No new posts mapping PLI structure to assembler co... Pedro PL/I & Assembler 3 Fri Jun 01, 2018 2:53 am
No new posts JCL to set Return code when Time Out ... vinu78 JCL & VSAM 6 Wed May 30, 2018 11:27 am
No new posts Cobol program till a given time or fo... ankita agarwal COBOL Programming 7 Fri May 18, 2018 2:24 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us