Processing SQL statements
You must run your program through the Db2® preprocessor or coprocessor, which processes SQL statements, either before or as part of the compilation. In this section, we describe how and when each compiler uses the Db2 preprocessor or coprocessor. Then you can choose the right method so that you can debug the program with z/OS® Debugger.
- If you are preparing a COBOL program using a compiler earlier than Enterprise COBOL for z/OS and OS/390® Version 2 Release 2 , use the Db2 precompiler. Then compile your program as described in the appropriate section for your programming language.
- If you are preparing a COBOL program using Enterprise COBOL for z/OS and OS/390 Version 2 Release 2 or later, do one
of the following tasks:
- Use the Db2 precompiler. Then compile your program as described in the appropriate section for your programming language.
- Use the SQL compiler option so that the SQL statements are processed
by the Db2 coprocessor during
compilation. Save the program listing if you compiled with the
NOSEPARATE
suboption of theTEST
compiler option or the separate debug file if you compiled with theSEPARATE
suboption of theTEST
compiler option.
- If you are preparing a PL/I program using a compiler earlier than Enterprise PL/I for z/OS and OS/390 Version 3 Release 1, use the Db2 precompiler. Then compile your program as described in the appropriate section for your programming language.
- The following table describes your options for specific PL/I compilers.
If you are using any of the following PL/I compilers: Choose one of the following tasks: - Enterprise PL/I for z/OS and OS/390 Version 3 Release 1 through Version 3 Release 4
- Enterprise PL/I for z/OS, Version 3.5 or later, and
you do not specify the
SEPARATE
suboption of theTEST
compiler option
- Use the Db2 precompiler. Save the program source files generated by the Db2 precompiler, which z/OS Debugger uses to debug your program. Then compile your program as described in the appropriate section for your programming language.
- Use the PP(SQL:('option,...')) compiler option so that the SQL statements are processed by the Db2 coprocessor during compilation. Save the program source file that you used as input to the compiler.
- If you are preparing a program using Enterprise PL/I for z/OS, Version 3.5 or later, and
you specify the
SEPARATE
suboption of theTEST
compiler option, do one of the following tasks:- Use the Db2 precompiler. Compile the program source files generated by the Db2 precompiler with the appropriate compiler options, as described in Choosing TEST or NOTEST compiler suboptions for PL/I programs, select scenario B. Save the separate debug file created by the compiler.
- Use the PP(SQL:('option,...')) compiler option so that the SQL statements are processed by the Db2 coprocessor during compilation. Save the separate debug file created by the compiler.
- If you are preparing a C or C++ program using a compiler earlier than C/C++ for z/OS Version 1 Release 5, use the Db2 precompiler. Save the program source files generated by the Db2 precompiler, which z/OS Debugger uses to debug your program. Then compile your program as described in the appropriate section for your programming language.
- If you are preparing a C or C++ program using C/C++ for z/OS Version 1 Release 5 or later,
do one of the following tasks:
- Use the Db2 precompiler. Save the program source files generated by the Db2 precompiler, which z/OS Debugger uses to debug your program. Then compile your program as described in the appropriate section for your programming language.
- Specify the SQL compiler option so that the SQL statements are processed by the Db2 coprocessor during compilation. Save the program source file that you used as input to the compiler.
- If you are using an assembler program, first run your program through the Db2 precompiler, then assemble your program using the output of the Db2 precompiler. Generate a EQALANGX file from the assembler output and save the EQALANGX file.
Important: Ensure that your program source, separate debug file, or program listing is stored in a permanent data set that is available to z/OS Debugger.
To enhance the performance of z/OS Debugger, use a large block size when you save these files. If you are using COBOL or Enterprise PL/I separate debug files, it is important that you allocate these files with the correct attributes to optimize the performance of z/OS Debugger. Use the following attributes for the PDS that contains the COBOL or PL/I separate debug file:
- RECFM=FB
- LRECL=1024
- BLKSIZE set so the system determines the optimal size
Refer to the following topics for more information related to the material discussed in this topic.
- Related references
- DB2® UDB for OS/390 Application Programming and SQL Guide