Salesforce

Sample VST code to monitor extents utilization

« Go Back

Information

 
TitleSample VST code to monitor extents utilization
URL NameSample-VST-code-to-monitor-extent-utilization
Article Number000121996
EnvironmentProduct: OpenEdge
Version: 10.x, 11.x
OS: All supported platforms
Other: VST
Question/Problem Description
Sample VST code to check Storage Area extent utilization
Which extent that contains the area’s HWM?
Which extent is in use currently?
When to add extents before the variable extent starts growing
How full a fixed extent is, before the variable extent starts growing
Are variable extents in use?


 
Steps to Reproduce
Clarifying Information
Error Message
Defect Number
Enhancement Number
Cause
Resolution
The _areastatus VST does not adequately describe a Type II Storage Area. For further clarification refer to Article  VST's to monitor space in a Type II Storage Area?  

The following sample _areastatus VST code can be used for Type I and Type II Storage areas to simply determine which extent the current High Water Mark is at. By monitoring extent usage whilst the system is online, particularly in virtual instance environments, more disk space can be allocated when it becomes necessary to add further extents to storage areas. 

The sample code below reports the following on extent utilization and can be further customized to requirement:
  • Area Num: Storage area number.
  • Area Status: Storage area name.
  • Total Blocks: Total number of blocks in the storage area.
  • High Water: High Water Mark of the storage area.
  • Pct Free: Percentage free blocks in the storage area.
  • Num Exts: Total number of extents in the storage area.
  • Last Ext: The current extent which is in use in the storage area (HWM).
  • Ext Left: Number of extents which are touched in the storage area. This value 0 means the variable extent in that area is already in use.
  • ext-warning: A warning that if the variable extent is already in use.
    • "****"- Warning: variable extent already in use.
    • "*"- Warning: last full extent in use 
 
def var vlast-ext as char format "x(14)" no-undo.
def var last-string as char no-undo.
def var last-ext-num as int no-undo.
def var ext-left as int no-undo.
def var ext-warning as char format "x(4)" no-undo.


for each _areastatus no-lock
 where _areastatus-areanum >= 6 AND not _areastatus._areastatus-areaname begins "After Image":
 vlast-ext = _areastatus._areastatus-lastextent.
 if length(vlast-ext) > 14
  then do while index(vlast-ext,"/") ne 0:
  vlast-ext = substring(vlast-ext,
  index(vlast-ext,"/") + 1).
 end.
 last-string = substring(vlast-ext,index(vlast-ext,".") + 1).
 if last-string = "db"
  then last-ext-num = 1.
 else last-ext-num = int(substring(last-string,2)).
  assign
  ext-left = (_areastatus._areastatus-extents - last-ext-num)
  ext-warning = (if ext-left = 0 then "****"
 else if ext-left = 1 then "*"
 else "").
 display
 _areastatus._areastatus-areanum format ">>>9" column-label "Area!Num"
 _areastatus._areastatus-areaname format "x(32)" column-label "Area!Name"
 _areastatus._areastatus-totblocks column-label "Total!Blocks" format ">,>>>,>>>,>>9"
 _areastatus._areastatus-hiwater column-label "High!Water" format ">,>>>,>>>,>>9"
 ((_areastatus._areastatus-totblocks - _areastatus._areastatus-hiwater) /
 _areastatus._areastatus-totblocks * 100) format ">>9.99%" column-label "Pct!Free"
 _areastatus._areastatus-extents format ">>>9" column-label "Num!Exts"
 vlast-ext format "x(64)" column-label "Last!Ext"
 ext-left column-label "Ext!Left" format ">>>9"
 ext-warning no-label with no-box.
end.

The above code displays the following information.
Area                         Total   High-     Pct  Num Last            Ext
 Num AreaStatus-Areaname    Blocks   Water    Free Exts Ext            Left ext-warning
---- --------------------- ------- ------- ------- ---- -------------- ---- -----------   
   7 Employee                   94      17  81.91%    2 sample_7.d1       1 *
   8 Inventory                 318     306   3.77%    2 sample_8.d2       0 ****
   9 Cust_Data                 109      42  61.47%    3 sample_9.d1       2
  10 Cust_Index                 94      21  77.66%    2 sample_10.d1      1 *
  11 Order                     731     642  12.18%    5 sample_11.d2      3
  12 Misc                       94      26  72.34%    2 sample_12.d1      1 *



 
Workaround
Notes
Keyword Phrase
Last Modified Date11/20/2020 7:09 AM

Powered by