Command reference / prog

RTVCLSRC

Retrieve CL Source

The Retrieve CL Source (RTVCLSRC) command retrieves the source statements from an original program model (OPM) CL program or an integrated language environment (ILE) CL module. For an ILE CL module, RTVCLSRC can also retrieve the CL source from an ILE program (*PGM) or service program (*SRVPGM) object which contains the specified CL module. In order to retrieve the CL source, *YES must have been specified for the Allow RTVCLSRC (ALWRTVSRC) parameter when the CL source was compiled.

Allowed environments: *ALL. Positional parameters: 4.

Restrictions

Parameters

PGM Program

Specifies the program object from which the original CL source is to be retrieved. This parameter and the Service program (SRVPGM) parameter are mutually exclusive.

Type
*QUAL
Required
Yes
Case
Uppercase
*LIBL
All libraries in the library list for the current thread are searched until the first match is found.
*CURLIB
The current library for the thread is used to locate the program. If no library is specified as the current library for the thread, the QGPL library is used.
Qualified parts (object, then library; write LIBRARY/OBJECT)

Program Program

Type
*NAME
Required
No
Length
10
Case
Uppercase

Library Library

Type
*NAME
Required
No
Default
*LIBL
Length
10
Case
Uppercase

Suggested / special values: *LIBL, *CURLIB

SRCFILE Source file

Specifies the database source file into which the CL source statements are to be written. This file must exist when the command is run.

Type
*QUAL
Required
No
Case
Uppercase
*LIBL
All libraries in the library list for the current thread are searched until the first match is found.
*CURLIB
The current library for the thread is used to locate the source file. If no library is specified as the current library for the thread, the QGPL library is used.
Qualified parts (object, then library; write LIBRARY/OBJECT)

Source file Source file

Type
*NAME
Required
No
Default
QCLSRC
Length
10
Case
Uppercase

Library Library

Type
*NAME
Required
No
Default
*LIBL
Length
10
Case
Uppercase

Suggested / special values: *LIBL, *CURLIB

SRCMBR Source member

Specifies the database source file member into which the CL source statements are to be written. If the member existed before the command was run, it is cleared before any source statements are written into it. If the member did not exist, it is created.

Type
*NAME
Required
No
Default
*PGM
Length
10
Case
Uppercase

Suggested / special values: *PGM

*PGM
If the CL source statements are retrieved from an OPM CL program, the member name will be the same as the program name. If retrieved from an ILE CL module, the member name will be the same as the module name.

REPLACE Replace member

On this system, specifies whether an existing source member may be replaced. IBM i 7.5 RTVCLSRC writes into QCLSRC with SRCMBR(*PGM) and has no REPLACE parameter; here SRCFILE and SRCMBR may name an existing member.

Type
*CHAR
Required
No
Default
*NO
Length
4
Case
Uppercase

Allowed values: *NO, *YES

*NO
An existing member is not replaced: CPF3013 is sent.
*YES
The existing member is cleared and receives the retrieved source.

Examples

RTVCLSRC PGM(JOHN1/TEXT1) SRCFILE(JOHN2) SRCMBR(JOHN3)

Retrieves the source statements from CL program TEXT1 in library JOHN1. The retrieved source statements are placed into source file JOHN2 as member JOHN3. If the original CL source contained INCLUDE commands, the retrieved source will contain the same INCLUDE commands.

RTVCLSRC PGM(MYAPP1) SRCFILE(RTVAPPSRC) RTVINCSRC(*YES)

Retrieves source statements from CL program MYAPP1 (found via library list) into member MYAPP1 of source file RTVAPPSRC. INCLUDE commands are expanded: the retrieved source contains the included statements in place of the INCLUDE commands.

RTVCLSRC PGM(ACCTRCV) MODULE(GETACCT)

Retrieves the CL source statements from module GETACCT within ILE program ACCTRCV (found via library list). The retrieved source is placed into member GETACCT of source file QCLSRC.

IBM command documentation

Generated from os/cl/catalog/RTVCLSRC.json and os/cl/help/RTVCLSRC.json.