Rewritten May 2024
ALIAS=oldsbr:newsbr
The ALIAS directive allows you to redirect Xcall oldsbr to Xcall newsbr—i.e. to treat oldsbr as an alias for newsbr.
An example of this in nearly every A-Shell installation is SPOOL being aliased to EZSPL via the following:
ALIAS=SPOOL:EZSPL
(EZSPL is an enhanced, upward compatible version of the original SPOOL subroutine. Rather than implement both variations separately, A-Shell includes only EZSPL and redirects Xcall SPOOL to Xcall EZSPL via this alias method.)
Comments
The maximum number of ALIAS directives is 50.
The oldsbr and newsbr names must be six or fewer characters.
The ALIAS scan occurs only once per {V}Xcall statement, i.e. the newsbr name is not re-scanned for another ALIAS match. So if you have ALIAS=A,B and ALIAS=B,C the statement Xcall A will redirect to B (not C), but Xcall B will redirect to C.
If newsbr and oldsbr are the same, then the ALIAS effectively redirects the call from the internal/embedded subroutine to the external (SBX) version. See History below.
ALIAS applies to VXcall as well as Xcall, and to internal subroutines as well as external (SBX) routines—again, provided the names are six or fewer characters.
ALIAS can be used to effectively disable a subroutine by redirecting it to a subroutine that does nothing such as PRIV.
The ALIAS mechanism only makes sense if the two subroutines have compatible parameter lists. If you need a subroutine which is similar to one we already offer but with different parameters, you can probably create your own SBX version as a wrapper to the existing one. See SBX Subroutines for details on writing your own subroutines.
To add functionality to an existing internal Xcall subroutine via a wrapper, you can use ALIAS to redirect calls to an SBX of a different name (the wrapper), and then within that SBX you can Xcall the original internal subroutine via a second ALIAS. For example, to create a wrapper for an internal subroutine A, you might start with ALIAS=A,AX and ALIAS=AY,A so that Xcall A is redirected to AX.SBX. Within your AX.SBX wrapper you can then call the original embedded A subroutine via Xcall AY,relying on the second ALIAS to redirect Xcall AY to the original A subroutine, and the fact that the ALIAS table is only scanned once per Xcall so the redirection from AY to A is final.
History
2024 May, A-Shell 7.0.1759.1: Support the case where oldsbr and newsbr are identical to replace an internal subroutine with an external SBX version under the same name. Previously this would have done nothing.