You can create CL source, a CL module, and a program in one batch input stream.
The following example shows the basic parts of the input stream. The input is submitted to a job queue using the Submit Job (SBMJOB) command. The input stream should follow this format:
// BCHJOB CRTBNDCL PGM(QGPL/EDUPGM) SRCFILE(PERLIST) // DATA FILE(PERLIST) FILETYPE(*SRC) . . (CL Procedure Source) . // /* // ENDINP
This stream creates a program from inline source. If you want to keep the source inline, a Copy File (CPYF) command could be used to copy the source into a database file. The program could then be created using the database file.
You can also create a CL module directly from CL source on external media, such as tape, using an IBM-supplied device file. The IBM-supplied tape source file is QTAPSRC. Assume, for instance, that the CL source statements are in a source file on tape named PGMA.
The first step is to identify the location of the source on tape by using the following override command with LABEL attribute override:
OVRTAPF FILE(QTAPSRC) LABEL(PGMA)
Now you can consider the QTAPSRC file as the source file on the Create CL Module (CRTCLMOD) command. To create the CL module based on the source input from the tape file, enter the following command:
CRTCLMOD MODULE(QGPL/PGMA) SRCFILE(QTAPSRC)
When the CRTCLMOD command is processed, it treats the QTAPSRC source file like any database source file. Using the override, the source is located on tape. PGMA is created in QGPL, and the source for that module remains on tape.