2.8 Now you see it and now you don't. $OLDPASS and $NEWPASS have seemingly been around since day one of MPE. For many, their only experience with these system files has been as part of the COMPILE/PREP/SAVE process on Classic MPE systems. Today they remain an under-used convenience feature of MPE/iX.
From Leonard Berkowitz:
These are system-defined temporary files. $NEWPASS is the reference for creating a new file and $OLDPASS is the reference for reading an existing file. The file is opened with the name $NEWPASS, but closed with the name $OLDPASS. Thus, after creating $NEWPASS, the LISTFTEMP command will show only $OLDPASS.
Here's an example that will illustrate this. It uses CM KSAM COPYLIB to clean out deleted records:
FCOPY FROM=COPYLIB;TO=$NEWPASS;NEW
FCOPY FROM=$OLDPASS;TO=COPYLIB
The first line will FCOPY all good records, and only good records, from COPYLIB into a temporary file $NEWPASS.
The second line will FCOPY these good records back into COPYLIB, resetting the EOF to the number of records in $OLDPASS (nee $NEWPASS)
In another example, I have a job that logs into a production account. For testing, I need to run this job so it logs into a different account. I have read access to the production job library, but I cannot write to it.
:EDITOR
TEXT PRODJOB.JOB.PROD
CHANGE "PROD","DEV",1
KEEP $NEWPASS,UNN;:STREAM $OLDPASS
EXIT
I could have separated the KEEP and the :STREAM onto two lines in the Editor, but I wanted to emphasize the quick transition from $NEWPASS to $OLDPASS.
$NEWPASS and $OLDPASS are very useful to create quick temporary files without having to think about names. Of course successive writing to $NEWPASS will blow away $OLDPASS.
You can also use $oldpass and $newpass in command files or UDCs when you need a temporary file. It is a little tricky though because after redirecting the first record to $newpass, you must append subsequent records to $oldpass. For example, a little command file to do a "SHOW .... ALL" on the supplied database:
parm db
echo show !db all > $newpass
echo exit >> $oldpass
dbutil.pub.sys < $oldpass