Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Select jobs between interval-more of an aptitude question :S

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics
View previous topic :: :: View next topic  
Author Message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1445
Location: Azeroth

PostPosted: Tue Feb 03, 2015 1:24 am    Post subject: Select jobs between interval-more of an aptitude question :S
Reply with quote

Hi,

There is an input file which has the below details.
Code:
Jobname,  start-date & time,   end-date & time,   start-timepart,   end-timepart,   elapsed-time

I am trying to find the list of jobs that were active during the time frame from 09:00 to 16:00.
Could you please help me with the algorithm of how to solve this.

I tried something like...
Code:
If elapsed-time > 17 hours then write the record to output;     /* 24 hours minus the 7 hour window */

else if (end-timepart > start-timepart) then            /* we are checking jobs that did not run through midnight */
   do ( if end-timepart > 09:00 and start-timepart < 16:00 then write the record to output; )

I am unable to handle the logic for jobs that run through midnight into the following day. Could you please help.

Thanks & Regards,
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Tue Feb 03, 2015 1:54 am    Post subject: Reply to: Select jobs between interval-more of an aptitude q
Reply with quote

Code:
   ( Start within period )
OR ( End within period )
OR ( Start before period
    AND ( ( End after period )
         OR
          ( End not reached yet ) )
Back to top
View user's profile Send private message
steve-myers

Active User


Joined: 30 Nov 2013
Posts: 460
Location: The Universe

PostPosted: Tue Feb 03, 2015 2:09 am    Post subject:
Reply with quote

Presumably your real input data is SMF.

SMF is difficult because if the job started before your start time and ended after your start time there may not be anything in SMF. Another issue with SMF is the data contains dates and times as paired, but otherwise separate fields.

In any event, if I were dealing with real SMF data and had your task I'd try to write something like this, in high level analysis rather than real code.

If job start date/time < date/time interval start & job end date/time >= date/time interval end then job was active for the entire interval.

If job start date/time < date/time interval start & job end date/time < date/time interval end the job was active for the time from interval start to job end date/time.

If job start date/time >= date/time interval start & job end date/time <= date/time interval end then job was active in the interval from job start to job end.

If job start date/time >= date/time interval start & job end date/time > date/time interval end then job was active from job start to interval end.

It might make your analysis easier if you think in those cases rather than write some compound, complex IF statement no one will be able to figure out without hours of skull sweat.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1445
Location: Azeroth

PostPosted: Tue Feb 03, 2015 8:00 pm    Post subject:
Reply with quote

Hi Bill and Steve,

Thanks for the suggestions. I went with Bill's algorithm & implemented the begin or end within duration condition and the job seems to work OK for now.
Also included a condition to discard records that have no start or end time.

Quote:
It might make your analysis easier if you think in those cases rather than write some compound, complex IF statement no one will be able to figure out without hours of skull sweat

This program is only for the analysis study, that I am tasked to perform. I doubt anyone would use this code besides me.
Also there are thousands of records to sift through and a program is the only way.

The below lines of code in SAS seems to work.
Code:
  IF MISSING(READTIME_TM) THEN DELETE;
  IF MISSING(TERMTIME_TM) THEN DELETE;

  /* WE ARE FINDING JOBS THAT WERE ACTIVE FROM 09:00 TO 16:00 */
  IF EXECTM > = '17:00:00'T THEN OUTPUT;  /* 24 HOURS - THE INTERVAL */
  ELSE IF TERMTIME_TM > READTIME_TM THEN DO;
     IF TERMTIME_TM > '09:00:00'T AND
        READTIME_TM < '16:00:00'T THEN OUTPUT;
  END;
  ELSE DO;        /* CHECK IF THE JOB HAS BEGUN OR END WITHIN PERIOD */
    IF ((READTIME_TM > '09:00:00'T AND
            READTIME_TM < '16:00:00'T) OR
        (TERMTIME_TM > '09:00:00'T AND
            TERMTIME_TM < '16:00:00'T))
      THEN OUTPUT;
  END;


Thanks & Regards,
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 -> All Other Mainframe Topics All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Two Selects in a single select query Rohit Umarjikar DB2 1 Fri Nov 04, 2016 8:46 pm
No new posts How to show message using batch jobs madprasy TSO/ISPF 7 Fri Sep 09, 2016 6:55 pm
No new posts Fault Analyzer - listings question. egrove IBM Tools 4 Thu Aug 11, 2016 5:31 pm
No new posts dataset copy question - REPRO or some... atulxp TSO/ISPF 2 Wed Aug 03, 2016 10:56 pm
No new posts Don't allow CICS to submit batch jobs prino JCL & VSAM 5 Mon Jul 25, 2016 3:26 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us