The following is taken from the PmAs installation script:
<WARPIN VERSION=0.9>
<HEAD>
<!--
REXX macros
===========
-->
<REXX NAME="GetPmasPath">
rc=rxFuncAdd('SysLoadFuncs','REXXUTIL','SysLoadFuncs')
rc=SysLoadFuncs()
pmaspath=WirexxGetEnv('PMAS_INI')
if ''=pmaspath then do
irc=SysIni('BOTH','FolderWorkareaRunningObjects','ALL:','Objects')
BootDrive=left(Objects.1,1)
return BootDrive||':\PmAs'
end
else do
cfgpos=lastpos('\CFG',pmaspath)
if 0<>cfgpos then
pmaspath=left(pmaspath,cfgpos-1)
return pmaspath
end
</REXX>
<REXX NAME=CheckFileExists>
rc=rxFuncAdd('SysLoadFuncs','REXXUTIL','SysLoadFuncs')
rc=SysLoadFuncs()
parse arg fname .
archivepath=WirexxGetEnv('WI_ARCHIVE_PATH');
fpath=archivepath||fname
rc=sysfiletree(fpath,'flist','FT')
fmax=flist.0
if 0=fmax then
rc=WirexxShowMessage('Fehlendes Archiv',,
'The required archive '||fname||' could not be found!');
return fname
</REXX>
<!--
Main archive
============
-->
<PCK INDEX=1
PACKAGEID="...."
TITLE="...."
REQUIRES=2
TARGET="=("GetPmasPath")"
BASE
SELECT
>...</PCK>
<!--
Basic data
==========
-->
<PCK INDEX=2
PACKAGEID="..."
EXTERNAL="=("CheckFileExists PaDat111.WPI")"
TITLE="..."
REQUIRES=1
TARGET="=("GetPmasPath")"
BASE
SELECT
>...</PCK>
>...
Some remarks:
- The REXX function GetPmasPath
- There are already earlier versions of PmAs which were not yet
installed using WarpIN, so they are not yet in the WarpIN database.
The location of such an old installation can be found using the
environment variable PMAS_PATH, but WarpIN could not make use of
this information without the REXX extension. GetPmasPath looks for
any existing definition of PMAS_PATH and returns its contents. If
such a variable is not found, it returns a \PmAs directory on the
boot drive as the default installation location. The function is
called just before the two PCK elements are evaluated, creating the
correct TARGET attribute.
- The REXX function CheckFileExists
- The second PCK element refers to a package in an external archive
(EXTERNAL attribute) with the attribute REQUIRED. If the external
archive is not found, WarpIN would issue a very cryptic error
message which would never give the user an idea what the real
problem is. For this reason the filename is first passed to the
CheckFileExists function which issues a more meaningful error message.
- Calling Wirexx* functions
- Both REXX functions make use of REXX functions which are built into
and exported by WarpIN. These can be recognized by the "Wirexx" prefix.
See "Exported REXX functions" for details.
- The WI_ARCHIVE_PATH environment variable
- The CheckFileExists REXX function makes use of the WI_ARCHIVE_PATH
environment variable: This variable is set temporarily by WarpIN
before any REXX code is performed and contains the path where the
first archive file (*.WPI) was found, in order to search for any
EXTERNAL archives in the same path. (Remark: The value of this variable
can only be accessed using the WirexxGetEnv() function, not by other
ways to read environment variables from REXX, because it is only stored
temporarily withing the WarpIN runtime!)