(view source code of chksize.rex as plain text)
/* ChkSize.rex, Version 2.00 for OS/2 and Windows *//* Display blank line */Say/* Initialize RexxUtil */If RxFuncQuery( "SysLoadFuncs" ) <> 0 Then Do
Call RxFuncAdd "sysloadfuncs", "RexxUtil", "sysloadfuncs"
Call sysloadfuncsEnd/* Read command line parameters */Parse Upper Arg commandline
/* Check parameters' validity */Parse Value commandline With '"'filespec'"' cmpsize dummy
If filespec = "" Then Parse Value commandline With filespec cmpsize dummy
/* Check for the correct number of parameters */If dummy <> "" Then Call Syntax
If cmpsize = "" Then Call Syntax
/* Second parameter should be a whole number */If DataType( cmpsize, "W" ) <> 1 Then Call Syntax
/* Check if specified file exists */Call SysFileTree filespec, "files.", "F"
/* If it doesn't exist, or if wildcards were used, *//* or if a directory was specified, display help */If files.0 <> 1 Then Call Syntax
Parse Upper Value files.1 With . . actsize . file
file = Strip( file )
If FileSpec( "N", file ) <> FileSpec( "N", filespec ) Then Call Syntax
/* Compare actual and specified file size */SelectWhen actsize = cmpsize Then Do
say "Sizes match exactly"
errorlevel = 0
EndWhen actsize > cmpsize Then Do
say "Actual file size exceeds specified size"
errorlevel = 1
EndWhen actsize < cmpsize Then Do
say "Actual file size less than specified file size"
errorlevel = 2
EndOtherwise errorlevel = 3
End/* Normal program termination, use errorlevel to return result */Exit errorlevelSyntax: Procedure
Say "ChkSize, Version 2.00 for OS/2 and Regina Rexx"
Say "Checks if file size matches specified file size and returns an"
Say "errorlevel accordingly"
SaySay "Usage : CHKSIZE <filespec> <minimum_size>"
SaySay "Returns : Errorlevel 1 if greater than specified file size"
Say " Errorlevel 0 if equal to specified file size"
Say " Errorlevel 2 if smaller than specified file size"
Say " Errorlevel 3 if invalid parameters were specified"
SaySay "Do not use wildcards in <filespec>."
Say "<filespec> must be enclosed in double quotes if it contains spaces."
SaySay "Written by Rob van der Woude"
Say "http://www.robvanderwoude.com"
Exit 3
Returnpage last modified: 2025-10-11; loaded in 0.0056 seconds