I updated the PROC with the DISK_MON Workload Object with an extra Job to get the Bytes Available.
The extra job OTHER uses the LCSF Command:
LCSF (APPL EQ 'DISKMON') AND (WOBTYPE EQ 'HM')
NOTE: Change APPL 'DISKMON' in the LCSF command to the name of your APPL.
This will return something similar to:
20170823 075236+0400 . . /MAIN/DISKMON.5/DISKMON STATE COMPLETE Conditions(COMPLETE) Status("Avail=30804529152, Used=2252")
SystemStatus("Avail=30804529152, Used=2252") Jobno(240060) Agent(NT_WKSP000550DD) Account(?) ASeq(0005) Scheduled (07.49.40 WED
23 AUG 2017) UpdatedOn(07.49.47 WED 23 AUG 2017) StartTime(07.49.46 WED 23 AUG 2017) EndTime(07.49.46 WED 23 AUG 2017) Cmpc(CC 0)
AvgRT(6) Type(HM) Event(<PREFIX>.DISKMON)
I only took the last line since that is the latest run, then parsed out Available bytes.
Calculated GB by dividing by 1024, 3 times, the last division (%) only took the integer part (round down).
On the system I tested with I have 28GB available on the D: drive.
Ran 2 tests:
- Test #1 - With 30GB required space
- Test #2 - With 25GB required space
The results are listed below:
Test #1- Space NOT Available
>>> FREEGB = 28
>>> REQUIREDGB = 30
>>> RUN .NET CLEANUP JOB.
***
Test #2 - Space Available
>>> FREEGB = 28
>>> REQUIREDGB = 25
>>> REQUIRED SPACE AVAILABLE TO START BATCH JOBS.
***
I have attached the PROC, I left in the SAY statements but commented them out. SEND statements should also be removed after testing is complete.
This solution has only been tested on Windows but should work for Linux/UNIX without any changes.
Let me know if this is what you were looking for or if you have any questions.