/* Strip a REXX script of tokenized REXX extended attributes.
 * Only check if file exists if parameter was given. Run silent on success.
 * Author: Kenneth Porter (72420.2436@compuserve.com)
 */

/* make sure we got a real workfile */
parse arg filename

fullfilename = ""
if "" \= filename then fullfilename = stream(filename,'C','QUERY EXISTS')
if "" == fullfilename then
do
    say '"' || filename || '" not found'
    exit 1
end

/* make the system call available */
CALL RxFuncAdd 'SysPutEA', 'RexxUtil', 'SysPutEA'

/* say 'Stripping REXX binary' */

/* strip the four REXX-related extended attributes that contain
the compiled version of the script */
success = SysPutEA(filename,'REXX.METACONTROL','')
success = SysPutEA(filename,'REXX.LITERALPOOL','')
success = SysPutEA(filename,'REXX.VARIABLEBUF','')
success = SysPutEA(filename,'REXX.TOKENSIMAGE','')

exit success
