Steps for rebinding a changed compile unit using c89

Before you begin: Rebuild an application after making a change to a single source file.

Perform the following steps to rebind a changed compile unit using c89:

  1. Recompile the single changed source file. Use the compile time option CSECT so that each section is named for purposes of rebindability. For example, assume that you have made a change to unit1.c. Recompile unit1.c by using c89 as follows:
    c89 -o unit1.o -W c,"CSECT(myprog)" unit1.c

    _______________________________________________________________

  2. Rebind only the changed compile unit into the executable program, which replaces its corresponding binder sections in the program object:
    cp -m myprog myprog.old
    c89 -o myprog unit1.o myprog

    The cp command is optional. It saves a copy of the old executable in case the bind fails in such a way as to damage the executable. myprog is overwritten with the result of the bind of unit1.o. Like-named sections in unit1.o replace those in the myprog executable.

    _______________________________________________________________

An example of a makefile that performs a similar build:
_C89_EXTRA_ARGS=1
.EXPORT : _C89_EXTRA_ARGS     1 
SRCS = unit0.c unit1.c unit2.c       2 
myprog.PRECIOUS : $(SRCS)   3 
        @if [ -e $@ ]; then OLD=$@; else OLD=; fi;\
        CMD="$(CC) -Wc,csect $(CFLAGS) $(LDFLAGS) -o $@ $? $$OLD";\  4 

        echo $$CMD; $$CMD;
        -@rm -f $(?:b+"$O")              
 1 
allow filenames with non-standard suffixes
 2 
list of source files
 3 
do not delete myprog if the make fails
 4 
compile source files newer than the executable, and bind

The attribute .PRECIOUS prevents such parts from being deleted if make fails. $? are the dependencies which are newer than the target.

Note:

For a complete description of all c89 options see c89 — Compiler invocation using host environment variables. For a description of make, see z/OS UNIX System Services Command Reference and for a make tutorial, see z/OS UNIX System Services Programming Tools.

Advantage

Rebinds are fast because most of the program is already bound. Also, none of the intermediate object modules need to be retained because they are available from the program itself.