Originally posted by ladymuck
View Post
IEFBR14 is the mysterious IBM utility program that is usually used to create or delete files. How does IEFBR14 create and delete files? It Doesn't! IEFBR14 is simply an assembler program that consists of the following source code:
Code:
SR 15,15 CLEAR RETURN CODE BR 14 RETURN TO CALLER
The code in IEFBR14 is the minimum, although not the most efficient, that will create a 'do nothing' program and still satisfy the IBM standard calling convention. The instruction, 'SR 15,15' simply clears general register 15 to zero. Register 15 is the register where MVS expects the return code from a terminating program. The instruction 'BR 14' transfers control to the address stored in general register 14, which by convention, is the return address in the calling program. The calling program is normally the MVS initiator that was selected by the MVS task scheduler to process the job. Note that the program IEFBR14 takes it's name from the 'BR 14' instruction. So how does IEFBR14 facilitate the creation and/or deletion of a file? Before MVS initiates a task step, the allocation services address space (ALLOCAS) is called to allocate any data sets specified in the step's JCL. Since it is allocation services that creates new data sets, the creation is done before control is transferred to IEFBR14. Similarly, unallocation services (also ALLOCAS) is called when a step ends to perform the requested disposition of all allocated data sets according the 'DISP=...' parameter of the DD statement. Since all prgrams initiated by JCL are serviced by allocation and unallocation services, ANY program can be used to create and/or delete files. Some installations utilize console message and/or memory dump programs that execute conditionally based on a previous steps' return codes. By adding transient and/ or GDG datasets to the abend step with a disposition of '(SHR,DELETE,DELETE)' can eliminate the need for manual intervention in cleaning up the job's data set environment before the job can be successfully restarted.
Comment