Application programming on z/OS
Previous topic | Next topic | Contents | Glossary | Contact z/OS | PDF


HLL relationship between JCL and program files

Application programming on z/OS

Symbolic file names can help isolate your program from changes.

By using symbolic names in JCL, we learned how to isolate a COBOL program from changes in data set name and data set location. The technique of referring to physical files by a symbolic file name is not restricted to COBOL; it is used by all HLLs and even in Assembler language. See Figure 1 for a generic HLL example of a program that references data sets through symbolic file names.

Isolating your program from changes to data set name and location is the normal objective. However, there could be cases when a program needs to access a specific data set at a specific location on a direct access storage device (DASD). This can be accomplished in Assembler language and even in some HLLs.

The practice of "hard-coding" data set names or other such information in a program is not usually considered a good programming practice. Values that are hard-coded in a program are subject to change and would therefore require that the program be recompiled each time a value changed. Externalizing these values from programs, as with the case of referring to data sets within a program by a symbolic name, is a more effective practice that allows the program to continue working even if the data set name changes.

Figure 1. HLL Relationship between JCL and program files
 //MYJOB    JOB
 //STEP1    EXEC CLG
 ...
    OPEN FILE=INPUT1
    OPEN FILE=OUTPUT1
    READ FILE=INPUT1
 ... 
    WRITE FILE=OUTPUT1
 ...
    CLOSE FILE=INPUT1
    CLOSE FILE=OUTPUT1
 /*
 //GO.INPUT1  DD DSN=MY.INPUT,DISP=SHR
 //GO.OUTPUT1 DD DSN=MY.OUTPUT,DISP=OLD




Copyright IBM Corporation 1990, 2010