PCVTCLSRC Command for IBM ISeries AS/400 AS400

Introduction

PCVTCLSRC converts records in a CL source member (type CLP or CLLE) to a standard format. This is one of the commands in our ISeries utilities library (click this URL for full contact and pricing details).

The formatting performed is relatively simple. Firstly, all stand-alone comments (not associated with any CL statement) are preserved intact. Secondly, all CL statements are formatted as if you had prompted them with F4 in SEU then pressed ENTER. That is, lower-case is capitalised, all parameter names are inserted, and the code itself is column-aligned (without indentation for nested logic).

For example, the input line:

next: CRTPF QTEMP/XXX rcdlen(30)           /* Create work file */
is converted to:
NEXT:                     CRTPF      FILE(QTEMP/XXX) RCDLEN(30) /* Create work file */

Some developers try to format CL source for readability while others don’t bother. The PCVTCLSRC utility enables you to standardise your CL source on a permanent or one-off basis. For example, PCVTCLSRC has been used to temporarily convert a large body of CL source so that it could be scanned for particular keywords as part of Y2K-compliance verification. This scan would have been much more difficult without consistently formatted source.


Examples

PCVTCLSRC FILEI(GLSRC/QCLSRC) MBRI(GL010) FILEO(TEMPLIB/QCLSRC) MBRO(*MBRI)

Command above prepares member GL010 in file TEMPLIB/QCLSRC as a formatted version of the input member GL010 in GLSRC/QCLSRC. The latter member is not updated in any way.

PCVTCLSRC FILEI(GLSRC/QCLSRC) MBRI(CL010) MBRO(CL010NEW)

Command above prepares member GL010NEW in file GLSRC/QCLSRC as a formatted version of the input member GL010 in the same file. Member GL010 is not updated in any way.


Restrictions

1) PCVTCLSRC is a reasonably powerful command. Any bugs could result in CL code being mangled or lost. To provide some measure of protection, the command checks that the output is not overwriting anything i.e. the output source member must not exist or, if it exists, must be empty.
2) Only one source member at a time is converted. If you have lots of source members to convert, you should write a CLP that automatically processes many members e.g. using DSPFD *MBRLIST to generate a temporary OUTFILE which you then process.

IBM rebranded the AS/400 - some users called it AS400 - to ISeries several years ago. All 3 names - ISeries, AS/400, AS400 - refer to exactly the same system.