Start of change

Retrieving CL source code

Depending on the CL compiler options used, you can retrieve the CL source code from a CL program or CL module object.

The CL program or CL module must have been created specifying *YES for the Allow RTVCLSRC (ALWRTVSRC) parameter.
The ability to retrieve the CL source from a CL program or CL module can make it easier to diagnose and fix problems in CL code on systems where the original CL source code is not available.
There are CL commands and callable API programs that you can use to determine if the CL program or CL module was created with ALWRTVSRC(*YES).
  • If the program (*PGM) object was created using the Create CL Program (CRTCLPGM) command, you can use the Display Program (DSPPGM) command or the Retrieve Program Information (QCLRPGMI) API to see the value that was specified for the ALWRTVSRC parameter when the program was created.
  • If the module (*MODULE) object was created using the Create CL Module (CRTCLMOD) command, you can use the Display Module (DSPMOD) command or the Retrieve Module Information (QBNRMODI) API to see the value that was specified for the ALWRTVSRC parameter when the module was created.
  • If the CL module was bound into an Integrated Language Environment (ILE) program using the Create Bound CL Program (CRTBNDCL) command or the Create Program (CRTPGM) command, you can use the Display Program (DSPPGM) command with DETAIL(*MODULE) or the List Program Information (QBNLPGMI) API to see the value that was specified for the ALWRTVSRC parameter when the module was created.
  • If the CL module was bound into an ILE service program (*SRVPGM) object using the Create Service Program (CRTSRVPGM) command, you can use the Display Service Program (DSPSRVPGM) command with DETAIL(*MODULE) or the List Service Program Information (QBNLSPGM) API to see the value that was specified for the ALWRTVSRC parameter when the module was created.

The shipped default value for the ALWRTVSRC parameter is *YES. The ability to save the CL source with ILE CL modules was added in the IBM® i 7.1 release of the operating system.

Retrieving CL source from a module in an ILE CL program

RTVCLSRC   PGM(MYCLPGM)  MODULE(MOD1)  SRCFILE(MYLIB/QCLSRC)  

This command retrieves the CL source from module MOD1 in ILE program MYCLPGM. The retrieved CL source is stored in member MOD1 of the source physical file QCLSRC located in library MYLIB.

End of change