IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Rexx code for Dynamic Checking


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Fahad

New User


Joined: 30 Jan 2014
Posts: 4
Location: Pune

PostPosted: Thu Jan 30, 2014 4:05 am
Reply with quote

Below is the code to check Storage group and this will submit Job to create free space if the free space is less than 45% in Storage group(static).

My requiremnt:- I want dynamic checking. The moment it reaches 45%. It has to submit Job or else It has to check atleast every 30 min of the day(0hr-24hr). Note:-I will Schedule the code to run daily.

Can anyone please advice and correct this code as per my requirement. I am a beginner.

Thanks in advance!!!

Code:
 /*Check Storage group SGTMM and submit migration job if free space is less than 45% */
 mainpara:                                                               
         dd1='PPSG.SGTMM90.MONITOR.OUTPUT'                               
         call init_para dd1                                             
 exit(0)                                                                 
 return;                                                                 
                                                                         
 init_para:                                                             
 PARSE ARG dcolrpt                                                       
       count=1                                                           
        LARGEXT=0                                                       
        "ALLOC DD(INFILE) DSN('"dcolrpt"') SHR"                         
        "EXECIO * DISKR INFILE (STEM RECORD. finis"                     
                                                                         
        IF RC<>0 OR RECORD.0=0 THEN EXIT 13                             
       tot=0                                                           
       DO WHILE COUNT <= RECORD.0                                       
         VOLNAME=SUBSTR(RECORD.count,25,6)                             
         freekb=c2d(SUBSTR(RECORD.count,37,4))                         
         allocated=C2D(SUBSTR(RECORD.count,41,4))                       
         freeperc=(freekb/(freekb+allocated))*100                       
         tot=freeperc + tot                                             
         COUNT=COUNT + 1                                               
       END                                                             
      rows=count-1                                                     
      freeprct=tot/rows                                                 
      if (freeprct < 45) then                                           
      do                                                               
      dsna="'WIP12.JCL.LIB(HHSMDMIG)'"                                 
      address tso                                                       
      "submit" dsna                                                     
      say 'Lesser than 45 and freeprct=' freeprct                       
      end                                                               
      else                                                     
      do                                                       
      say 'Greater than 45 and freeprct=' freeprct             
      end                                                     
      "free dd(INFILE)"                                       
return             


De-Coloured and Code'd
Back to top
View user's profile Send private message
sureshpathi10

Active User


Joined: 03 May 2010
Posts: 154
Location: Kuala Lumpur

PostPosted: Thu Jan 30, 2014 7:17 am
Reply with quote

Fahad wrote:
I want dynamic checking. The moment it reaches 45%. It has to submit Job

In this case, your program has to run simultaneously(24/7) to check whether it reaches 45% or not. You may add infinite loop to call to "init_para" in your program to achieve this.

Fahad wrote:
or else It has to check atleast every 30 min of the day(0hr-24hr). Note:-I will Schedule the code to run daily.

why can't you schedule your program to run every 30 mins?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Jan 30, 2014 8:11 am
Reply with quote

Hello,

It is a Very Bad Practice to implement an infinite loop in your process . . .

My clients will not permit this to run on their systems.

As mentioned, you should set this up by the system schedule.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Thu Jan 30, 2014 4:45 pm
Reply with quote

Hello Fahad,

Code:
 "ALLOC DD(INFILE) DSN('"dcolrpt"') SHR"


This line in your code possibly says that you are reading a report created from DCOLLECT.
DCOLLECT is a snapshot of system DASD when the DCOLLECT was performed.

So even if you run this REXX 10 times / hour you would be getting the same output, since your input file is static(DCOLLECT)

If you are planning to run it multiple times per day, then you need to run the DCOLLECT job as well multiple times.

My personal opinion is running DCOLLECT once in 30 mins is a bad practice, I guess the DCOLLECT itself would run more than 20 minutes per run.
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Thu Jan 30, 2014 8:04 pm
Reply with quote

Quote:
code to check Storage group

Aren't you trying to replicate some of the function of SMS? To get your %45, can't you just tweak some SMS settings (sorry, I do not know the details).
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
No new posts run rexx code with jcl CLIST & REXX 15
Search our Forums:

Back to Top