/*Process Each Area of the DB*/
FOR EACH _AreaStatus
NO-LOCK:
/*Set the variables*/
ASSIGN iv_LastExtentSize = 0
lv_OnLastExtent = NO.
/*Used to find all the area information like block size*/
FIND _Area WHERE _Area._Area-number = _AreaStatus._AreaStatus-Areanum
NO-LOCK NO-ERROR.
/*Process each Extent for the Data Area*/
FOR EACH _AreaExtent WHERE _AreaExtent._Area-RecID = RECID(_Area)
NO-LOCK:
/*find the actual file information about current area extent*/
FIND _FileList WHERE ENTRY(NUM-ENTRIES(_FileList._FileList-Name, cv_Delimiter),
_FileList._FileList-Name, cv_Delimiter)
= ENTRY(NUM-ENTRIES(_Areaextent._Extent-Path, cv_Delimiter),
_Areaextent._Extent-Path, cv_Delimiter)
NO-LOCK.
/*Check if running on the Last extent*/
IF _FileList-Name = _AreaStatus-LastExtent
THEN DO:
ASSIGN lv_OnLastExtent = YES.
/*busy_flag = "****"*/
/*if _FileList._FileList-Extend = 0 FIXED. Other > 0 Variable*/
IF _FileList._FileList-Extend > 1
THEN DO:
/*There is a need to estmate the last extent size if not already fix preallocated*/
/*iv_LastExtentSize = INT((2 * (1024 * 1024 * 1024)) / _Area._Area-blocksize).*/
iv_LastExtentSize = 2 * (1024 * 1024 * 1024).
ASSIGN /*Apx 2GB - FileArea Used Space to give free about*/
/*iv_LastExtentSize = iv_LastExtentSize - _FileList._FileList-Size.*/
iv_LastExtentSize = iv_LastExtentSize
- (_FileList._FileList-Size * _FileList._FileList-BlkSize).
/*DISP iv_LastExtentSize FORMAT "->>>,>>>,>>>,>>9"
_FileList._FileList-Size FORMAT "->>>,>>>,>>>,>>9"
WITH FRAME ftmp.*/
END.
END. /*IF _FileList-Name = _AreaStatus-LastExtent*/
END. /*FOR EACH _AreaExtent...*/