Overview
Whenever I ask people what does IEFBR14 do, the answer I get almost all the times is "Its an utility program that is used to create or delete datasets and then I ask them; Are you sure ?
Well, Though it appears that IEFBR14 create/delete datasets, Its not true exactly. It is actually done by the system itself, based on what is coded in the "DISP=" parameter. However, a DD name cannot be there in a JOB standalone and it should be always be associated with a step "EXEC" so IBM supplied a dummy program that can be coded along with the DD statements whose DISP= will be used by the system to create new dataset or delete existing one.
Why is it called IEFBR14?
The name contains two parts; IEF and BR14. Almost all the IBM utility programs have a 3 byte prefix such as IEB, IEF, IEH.. For example: utility programs start with IEF are for job management, prefix IEB is for dataset utilities (IEBGENER), prefix IEH for system utilities (IEHLIST) and IEW for program and linkage modules (IEWL - Linkage step in compile JCL). The BR14 stands for assembler instruction BR 14 that means branch to register 14. This assembly instruction by convention means return to caller which is similar to a COBOL program that has STOP-RUN alone in the procedure division.
The next time you run your own COBOL program, add two extra DD statements; one for dataset creation and another one to delete a dataset and make sure the DD names are not used in the program. You will see that the creation and deletion happens after the step is completed just like those DD statements coded with IEFBR14.
For example: In order to delete a dataset called HLQ.A.B.C, using one of these two steps does exactly the same thing.
//STEP0001 EXEC PGM=MYSAMPLE
//DD001 DD DSN=HLQ.A.B.C,
// DISP=(OLD,DELETE)
//*
//STEP0001 EXEC PGM=MYSAMPLE
//STEP0001 EXEC PGM=IEFBR14
//DD001 DD DSN=HLQ.A.B.C,
// DISP=(OLD,DELETE)
//*
Here is a wikipedia entry about IEFBR14 including how the assembly code looks like. IEFBR14 @ Wikipedia
Too easy to understand. Nice job.
ReplyDeleteAnd thanks a lot to share.