There are those times when you want to use a command list (clist) to invoke the COBOL compiler.
Below is an example of a Z/OS clist to do exactly that.
[codesyntax lang=”text”]
PROC 1 MEM CONTROL LIST FREE FI(SYSUT1) FREE FI(SYSUT2) FREE FI(SYSUT3) FREE FI(SYSUT4) FREE FI(SYSUT5) FREE FI(SYSUT6) FREE FI(SYSUT7) FREE FI(SYSPRINT) FREE FI(SYSIN) FREE FI(SYSLIN) ALLOC F(SYSPRINT) DA(PDS.SPRT(&MEM)) SHR ALLOC F(SYSIN) DA(PDS.COBOL(&MEM)) SHR REUSE ALLOC F(SYSLIN) DA(PDS.OBJ(&MEM)) OLD REUSE ALLOC F(SYSUT1) NEW SPACE(5,5) TRACKS UNIT(SYSDA) ALLOC F(SYSUT2) NEW SPACE(5,5) TRACKS UNIT(SYSDA) ALLOC F(SYSUT3) NEW SPACE(5,5) TRACKS UNIT(SYSDA) ALLOC F(SYSUT4) NEW SPACE(5,5) TRACKS UNIT(SYSDA) ALLOC F(SYSUT5) NEW SPACE(5,5) TRACKS UNIT(SYSDA) ALLOC F(SYSUT6) NEW SPACE(5,5) TRACKS UNIT(SYSDA) ALLOC F(SYSUT7) NEW SPACE(5,5) TRACKS UNIT(SYSDA) CALL 'IGY410.SIGYCOMP(IGYCRCTL)' 'VBREF' WRITE RETURN CODE IS &LASTCC
[/codesyntax]
Notice that three partitioned data sets are being used in this clist. Pds.sprt is used to contain the compiler listing. Pds.COBOL houses the source code used as input to the compiler. Pds.obj houses the object produced by the compile process which can subsequently be used as input to the linkage editor.
As you may have observed the MEM variable identifies the member of the pds.cobol member that is to be used as input to the compile process. That same MEM variable is used to identify the listing and object output respectively.
Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.