5 ASSEMBLING AND RUNNING PROGRAMS
5.3 Creating and Using Object Modules
The procedures in this section are used to assemble, fully resolve (using the Binder), and execute Assembler Language programs.
The COMP procedure provides the user with a one-step procedure to assemble source code for diagnostic messages; and, if assembly is successful, to prepare the input for further processing (e.g., the LKGO procedure). This procedure stores the output of the Assembler into a temporary data set to be used later in the job and then deleted.
Symbolic Parameters for ASMHCOMP
Required |
Value to be supplied |
None |
None |
Optional |
Value to be supplied |
OPTIONS=parms |
Assembler parameters |
LIBNAME='aaaaiii.dsname' |
Dsname of first user-defined macro library |
LIBDISK=fileser |
Volume for first library; required only if the data set is not cataloged |
LIBSTOR=type |
Unit name for first library; FILE is the default |
ALTNAME='aaaaiii.dsname' |
Dsname of second user-defined macro library |
ALTDISK=fileser |
Volume for second library; required only if the data set is not cataloged |
ALTSTOR=type |
Unit name for second library; FILE is the default |
The internal stepname for the ASMHCOMP procedure is COMP.
Example 1:
To assemble source code only.
//stepname EXEC ASMHCOMP //COMP.SYSIN DD * (source program)
Example 2:
To assemble source code containing user-defined macros that are located in the user's macro library which resides on the MSS.
//stepname EXEC ASMHCOMP,LIBNAME='aaaaiii.dsname' //COMP.SYSIN DD * (source program)
Example 3:
To assemble source code, printing the full cross-reference table and keeping the source symbol table (SYM) in the object module for later use by TSO TEST. The TEST option must be specified for both the Assembler and the Binder. This option must not be specified if the program is to be executed as a batch job (using ASMHLKGO, ASMHLDGO, or ASMHCALL).
//stepname EXEC ASMHCOMP,OPTIONS='XREF(FULL),TEST' //COMP.SYSIN DD * (source program)
Use of the TEST facility is described in the TSO Extensions Command Language Reference, SC28-1881.
The LKGO procedure performs the following:
· fully resolves the program to prepare a load module for execution
· executes the load module
It provides the user with the DD statements needed to use the printer (SYSOUT) and the SORT/MERGE messages data set (SORTMSGS). The user must provide additional JCL for any I/O units (data sets) used. Section 6.4 discusses specifying user-defined libraries with LKGO.
There must be one GO.ddname DD statement describing each data set used. DD statements to override ddnames within the procedure must precede those for ddnames to be added to the procedure. If more than one DD statement is being overridden, the override statements must be in the same order as the existing DD statements in the procedure. See the manual Batch Processing and Utilities at NIH for a description of the format of DD statements.
Symbolic Parameters for ASMHLKGO
Required |
Value to be supplied |
None |
None |
Optional |
Value to be supplied |
OPTIONS=parms |
Binder parameters |
CORE=nnnK |
Region for GO step; 512K is the default |
LIBNAME='aaaaiii.dsname' |
Dsname of first user-defined library |
LIBDISK=fileser |
Volume for first library; required only if the data set is not cataloged |
LIBSTOR=type |
Unit name for first library; FILE is the default |
ALTNAME='aaaaiii.dsname' |
Dsname of second user-defined library |
ALTDISK=fileser |
Volume for second library; required only if the data set is not cataloged |
ALTSTOR=type |
Unit name for second library; FILE is the default |
The stepnames within the ASMHLKGO cataloged procedure are LOAD for the Binder step and GO for the run step.
Example 4:
To assemble the main program and execute it. The OPTIONS parameter in the run step requests the Binder option XREF.
//stepname EXEC ASMHCOMP //COMP.SYSIN DD * (source program) //stepname EXEC ASMHLKGO,OPTIONS=XREF //GO.ddname DD etc. (as many as needed) //GO.SYSIN DD * (if needed) (data)
Example 5:
To assemble the main program and one subroutine and execute it. The CORE parameter supplies a region size for the GO step.
//stepname EXEC ASMHCOMP //COMP.SYSIN DD * (source for main program) //stepname EXEC ASMHCOMP //COMP.SYSIN DD * (source for subroutine) //stepname EXEC ASMHLKGO,CORE=nnnK //GO.ddname DD etc. (as many as needed) //GO.SYSIN DD * (if needed) (data)
The OBJ procedure is used to assemble source code and store the resultant object module into a sequential data set. The output of this procedure must be processed by the Binder before it can be run. The LKGO procedure may be used to fully resolve and execute the object module(s) created by the OBJ procedure(s).
Symbolic Parameters for ASMHOBJ
Required |
Value to be supplied |
NAME='aaaaiii.dsname' |
Dsname of object module to be stored |
Optional |
Value to be supplied |
DISK=fileser |
Required only for a data set written to a dedicated disk |
STORAGE=type |
Unit name for the object module; FILE is the default |
OPTIONS=parms |
Assembler parameters |
STATUS=status |
Specifies whether the output data set is old or new; NEW is the default |
SIZE=primary |
Primary space allocation for object module; default is 500 (enough for approximately 500 source statements) |
UNITS=type |
Allocation units for object module; the default is blocks of 1024 bytes |
LIBNAME='aaaaiii.dsname' |
Dsname of first user-defined macro library |
LIBDISK=fileser |
Volume for first library; required only if the data set is not cataloged |
LIBSTOR=type |
Unit name for first library; FILE is the default |
ALTNAME='aaaaiii.dsname' |
Dsname of second user-defined macro library |
ALTDISK=fileser |
Volume for second library; required only if the data set is not cataloged |
ALTSTOR=type |
Unit name for second library; FILE is the default |
The internal stepname for the ASMHOBJ procedure is COMP.
Example 6
To assemble and save the object module.
//stepname EXEC ASMHOBJ,NAME='aaaaiii.dsname'
//COMP.SYSIN DD *
(source program)
Example 7:
To assemble and save into an existing data set. Former contents will be destroyed.
//stepname EXEC ASMHOBJ,STATUS=OLD, // NAME='aaaaiii.dsname' //COMP.SYSIN DD * (source program)
Example 8:
To assemble and save overriding the default for primary space allocation. If there are more than 500 source statements, the 'primary' value should be roughly equal to the number of statements in the program.
//stepname EXEC ASMHOBJ,SIZE=primary, // NAME='aaaaiii.dsname' //COMP.SYSIN DD * (source program)
To execute a program which has been stored by a OBJ procedure, use the ASMHLKGO procedure. The user must supply a //LOAD.SYSLIN DD statement describing the data set containing the program which was assembled and stored.
Example 9:
To assemble, fully resolve, and run. The object module saved as "aaaaiii.dsname1" from the OBJ procedure is used as input for the Binder step.
//stepname EXEC ASMHOBJ,NAME='aaaaiii.dsname1' //COMP.SYSIN DD * (source program) //stepname EXEC ASMHLKGO //LOAD.SYSLIN DD DSN=aaaaiii.dsname1,DISP=SHR //GO.ddname DD etc. (as many as needed) //GO.SYSIN DD * (if needed) (data)
Example 10:
To execute a main program and subroutines that have been created as separate data sets by the OBJ procedure. The user must supply a DD statement for each data set that contains a program or subroutine and insure that the main program is defined first.
//stepname EXEC ASMHLKGO //LOAD.SYSLIN DD DSN=aaaaiii.dsname1,DISP=SHR // DD DSN=aaaaiii.dsname2,DISP=SHR // DD DSN=aaaaiii.dsname3,DISP=SHR //GO.ddname DD etc. (as many as needed) //GO.SYSIN DD * (if needed) (data)
Example 11:
To execute a program where the main program is to be assembled and the subroutines have been stored by the OBJ procedure in two data sets. These data sets will be concatenated with the data set created by the COMP step.
//stepname EXEC ASMHCOMP //COMP.SYSIN DD * (source program) //stepname EXEC ASMHLKGO //LOAD.SYSLIN DD // DD DSN=aaaaiii.dsname1,DISP=SHR // DD DSN=aaaaiii.dsname2,DISP=SHR //GO.ddname DD etc. (as many as needed) //GO.SYSIN DD * (if needed) (data)
The LDGO procedure combines the Binder and run steps into one. The Loader will accept object modules and load modules. It will also search libraries defined by the SYSLIB DD statement within the procedure if unresolved external references remain after processing the primary input defined by the SYSLIN DD statement within the procedure. DD statements are provided for use of the printer (SYSOUT).
The LDGO procedure should be used during the early stages of program development (debugging); it is particularly recommended for the development of small and medium-sized programs. Using LDGO is often more economical than using LKGO, but a dump from a LDGO run may not be sufficient to resolve a problem. If so, the job may have to be rerun using the Binder (LKGO).
Additional technical information on the use of the Loader can be found in the manual Batch Processing and Utilities at NIH.
Symbolic Parameters for ASMHLDGO
Required |
Value to be supplied |
None |
None |
Optional |
Value to be supplied |
OPTIONS=parms |
Loader and GO parameters |
CORE=nnnK |
Region for GO step; 300K is the default |
EPT=entry |
Entry point for the main program; no default is supplied |
LIBNAME='aaaaiii.dsname' |
Dsname of first user-defined macro library |
LIBDISK=fileser |
Volume for first library; required only if the data set is not cataloged |
LIBSTOR=type |
Unit name for first library; FILE is the default |
ALTNAME='aaaaiii.dsname' |
Dsname of second user-defined macro library |
ALTDISK=fileser |
Volume for second library; required only if the data set is not cataloged |
ALTSTOR=type |
Unit name for second library; FILE is the default |
The internal stepname for the ASMHLDGO procedure is GO.
Example 12:
To assemble the main program and execute it. The OPTIONS parameter in the run step requests the Loader option XREF.
//stepname EXEC ASMHCOMP //COMP.SYSIN DD * (source program) //stepname EXEC ASMHLDGO,OPTIONS=XREF //GO.ddname DD etc. (as many as needed) //GO.SYSIN DD * (if needed) (data)