using System.*.
using System.IO.*.
using System.IO.Compression.*.
using System.IO.Compression.FileSystem.*.
block-level on error undo, throw.
define variable zipFilePath as character no-undo.
define variable archive     as class     ZipArchive                                                                                 no-undo.
define variable zipEntries  as class     "System.Collections.ObjectModel.ReadOnlyCollection<System.IO.Compression.ZipArchiveEntry>" no-undo.
define variable zipEntry    as class     ZipArchiveEntry                                                                            no-undo.
define variable iLoop       as integer   no-undo.
zipFilePath = "2024-04-06.zip".
if File:Exists(zipFilePath) then
do:
   
   archive = ZipFile:OpenRead(zipFilePath).
   
    if valid-object(archive) then
        message "ZIP file is valid"
            view-as alert-box information title "ABL ZIP Check".
    else
        message "Error: ZIP file not valid"
            view-as alert-box error title "ABL ZIP Check".
       
    zipEntries = archive:Entries.
   
    do iLoop = 1 to zipEntries:count :
       
        zipEntry = zipEntries:Item[iLoop - 1].
        message zipEntry:name  truncate((zipEntry:CompressedLength / zipEntry:length) * 100,2) "% Compressed".
        pause 0.
    end.
end.
else
    message "Error: ZIP file not found." view-as alert-box error title "ABL ZIP Check".
finally:
    if valid-object(archive) then
        delete object    archive.
    if valid-object(zipEntries) then
        delete object zipEntries.
       
    if valid-object(zipEntry) then
        delete object zipEntry.
   
end finally.