FOR REMOVAL Phrase

For sequential multivolume files, the addition of the FOR REMOVAL phrase to the REEL or UNIT phrase causes the current volume to be rewound and unloaded. The system is then notified that the volume is logically removed from this run unit. The volume can be addressed again, however, after the file has been closed by a CLOSE statement without the REEL or UNIT phrase, and then reopened.

The use of the FOR REMOVAL phrase is optional for sequential single volume files open for input. It is syntax-checked only, and performs no function at run time.

IBM Extension

For sequential multivolume files, the system will always rewind and unload the volume when the REEL or UNIT phrase is specified on the CLOSE statement, even if the FOR REMOVAL phrase is not included.

A file will be closed implicitly if the end of the run unit is reached, or if the program is cancelled, before a CLOSE statement without a REEL or UNIT phrase has been processed. If this occurs, then the current volume will be left positioned as defined by the ENDOPT keyword held in the system description of the file. This keyword, which may take the values LEAVE, REWIND, or UNLOAD, is set up when the file description is created by the CRTTAPF command. It may be changed using the CHGTAPF command, or overridden using the OVRTAPF command.

End of IBM Extension