View previous topic :: View next topic
|
Author |
Message |
Fahad
New User
Joined: 30 Jan 2014 Posts: 4 Location: Pune
|
|
|
|
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 |
|
|
sureshpathi10
Active User
Joined: 03 May 2010 Posts: 154 Location: Kuala Lumpur
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
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 |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
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 |
|
|
|