Here is some code I have just updated, for years it was much simpler but had some limitations I decided to overcome. There are some alternate code paths I had toyed with that are still in the code but commented out.
/* Open directory in wps */
call RxFuncAdd 'Sysopenobject', 'RexxUtil', 'Sysopenobject'
/* say arg(1) */
MyArg = Arg(1)
If Left( MyArg,1 ) = '"' then
Parse var MyArg '"' MyArg
If right( MyArg,1 ) = '"' then
Parse var MyArg MyArg '"'
env = 'OS2ENVIRONMENT'
temploc = value('temp',,env)'\unzip'
/* say 'temploc' temploc */
curdir = directory(.)
/* say curdir */
zipfile = FILESPEC("name",MyArg)
/* say zipfile */
curdrive = FILESPEC("drive",curdir)
/* say curdrive */
zipdrive = FILESPEC("drive",MyArg)
/* say zipdrive */
If zipdrive = "" Then do
zipdrive = curdrive /* '\' */
/* say zipdrive */
zippath4 = FILESPEC("path",MyArg)
/* say 'zippath4' zippath4 */
zippath4 = zippath4' '
parse var zippath4 zippath1 '\ '
/* say 'zippath1' zippath4 */
zippath3 = directory(zippath1)
/* say 'zippath3' zippath3 */
zippath2 = directory(.)
/* say 'zippath2' zippath2 */
zippath = FILESPEC("path",zippath2'\dummy.zip')
/* say 'zippath' zippath */
/* if zippath = '\' then zippath = '' */
/* say zippath */
end
Else
zippath = FILESPEC("path",MyArg)
/* say 'zippath' zippath */
if zippath = "\\" then zippath = '\'
else nop /* do
zippath = ' 'zippath' '
parse var zippath ' \' zippath '\ '
zippath = '\\"'zippath'"\'
say zippath
end
*/
fullpath = zipdrive||zippath||zipfile
fullpath = '"'||fullpath||'"'
/* say 'fullpath' fullpath */
zipdir = SysTempFileName(zipfile'.???')
/* say 'zipdir' zipdir */
error = SysMkDir(temploc)
/* say 'error' error */
unzipdir = temploc||'\'||zipdir
/* say 'unzipdir' unzipdir */
error=SysMkDir(unzipdir)
/* say error */
/*
rc=sysopenobject(unzipdir,icon,details)
rc=sysopenobject(unzipdir,icon,details)
*/
rc = SysSetObjectData(unzipdir, "OPEN="||details)
/* say 'rc' rc */
fileit = directory(unzipdir)
/* say 'fileit' fileit */
unzip fullpath
curdir = directory(curdir)
/* pause */
exit