TAA Tools

The Indent  CLP DO Groups  command provides for  a method of  indenting
CLP  source  DO groups  in  a  source member.    The  source itself  is
indented.   The DO  command may appear  by itself or  be embedded in an
IF, MONMSG, or ELSE  command.  This can  simplify viewing CL source  as
the DO groups clearly standout.

The DOWHILE, DOUNTIL, and DOFOR commands are also supported.

A typical command would be:

             INDCLPDO    MBR(xxx) INPSRCF(yyy)

The member  would be written to  a temporary file and  then copied back
to  the original  member.   You  may optionally  output to  a different

By default,  each  DO group  is indented  2  positions.   The  INDSPACE
parameter controls the amount of indentation.

If  you  have  indented  the  source  and  then  decide  to  return  to
non-indented source, specify INDSPACE(0).

Statements  which have continuation characters  at the end  of a record
may  have  the  format   changed  by  INDCLPDO.     To  operate  on   a
multi-record  statement, INDCLPDO  first  creates a  work  area of  the
source  records that make  up a statement  and then reformats  the data
to  the output  record.  Consequently,  a different  form of formatting
may appear.

If you have  an unbalanced set  of DOs and  ENDDOs, an error  condition
is noted and the source is not changed.

You may add an option for INDCLPDO to PDM with the ADDPDMOPT tool.

Relationship with other commands

   PRTCLPDO      The  Print CLP  DO  command does  indenting, but  only
                 prints  the   results.    The  source  member  is  not
                 changed.   INDCLPDO  indents  the  source  within  the

   FIXCLPSRC     The  Fix CLP  Source command  inserts  keywords as  if
                 you   had   prompted  for   each   statement.     Some
                 reformatting  does   occur  with   INDCLPDO,  but   no
                 keywords are added.

   SORTCLPDCL    The Sort  CLP DCL command  sorts the DCL  commands and
                 rewrites  the  member.   The  sequence  of the  source
                 changes,  but not  the statements.   INDCLPDO does not
                 change the sequence of the statements.

Formatting and indentation rules

If the  source file  is  92 bytes  (80 bytes  of  source), the  default
maximum  width of  formatting  will be  71 to  fit  on an  80  wide SEU
screen.    You  may  specify  a  larger  width  by  using the  MAXWIDTH

For source files  greater than  92 bytes  in width, the  full width  of
the data  portion is used  unless a smaller  value is specified  by the
MAXWIDTH parameter.

For  example, a 112  byte wide  source file has  room for 100  bytes of
data plus 6 bytes for the sequence  number and 6 bytes for the  'change
date'.  All 100 bytes  of the data portion would be used  to format the

By default,  each command within a  DO group is indented 2  bytes.  The
INDSPACE parameter controls the amount of indentation.

The  maximum amount  of indentation allowed  is 30 bytes  less than the
MAXWIDTH value.   This means that  no command will  begin at less  than
30 bytes  from the right margin  regardless of how much  indentation is
caused  by nested  DO groups  or the INDSPACE  parameter.   This allows
room to fit a  reasonable portion of the  remainder of the  statements.

The 'change  date' of  the individual  statements is  not changed.   If
additional statements  are output because of  reformatting, the 'change
date' of the most current line in the statement is used.

By default, the  sequence numbers  of the  statements are  re-numbered.
An option exists to  re-use the same sequence numbers.   See the SEQNBR

Command parameters                                    *CMD

   MBR           The  member to be  indented.   The special  value *ALL
                 exists  to indent all members in  a source file.  Only
                 the  members of  source  type  CLP  or  CLLE  will  be

   INPSRCF       The  qualified file  name  of the  input source  file.
                 The  library  value defaults  to *LIBL.    *CURLIB may
                 also be used.  The file  must be a source file with  a
                 record length of  92 to 240 (80 - 228  bytes of data).

   OUTSRCF       The  qualified file  name of  the output  source file.
                 The file  defaults to  *INPSRCF meaning  the  indented
                 source will be  written back to the input  source file
                 member if no errors occur.

                 The  library qualifier defaults  to blank  which means
                 to  use the  same library  as the  INPSRCF.   *LIBL or
                 *CURLIB may also be  used.  The file must be  a source
                 file with a record length

                 You must  have *OBJMGT authority  to the file.   of 92
                 to 240 (80 - 228 bytes of data).

                 If  a single member  is being indented  to a different
                 file (not being updated),  the member must not  exist.

                 If  all members  in a  file  are being  indented to  a
                 different  file, no  members may  exist in  the output
                 source file.   Any  members which  are not  of a  type
                 CLP or  CLLE  will be  identified on  the listing  and
                 will not appear in the output file.

   SEQNBR        The  default is  *RESEQ which  causes  the reformatted
                 source to be sequenced as 1.00, 2.00 etc.

                 The  value  *SAME causes  INDCLPDO  to attempt  to use
                 the same  sequence  numbers as  were input.    Because
                 some  commands are contained  on multiple  records and
                 the  number of output  records may not be  the same as
                 the number of input  records, some changes may  occur.
                 The  sequence  number  of  the first  record  of  each
                 command  is used  as a base.   Each  additional record
                 to be output for  the same command  is bumped by  .01.

                 Thus  for SEQNBR(*SAME),  if  the  first record  of  a
                 command  was 78.00,  the first  record output  for the
                 command  would be  78.00.  Any  additional records for
                 the same command would be 78.01, 78.02 etc.

   INDSPACE      The number of spaces  to indent each nested  DO group.
                 The default  is 2 which means any  commands within the
                 DO  group will  be indented  two spaces to  the right.
                 A number  0-9  may be  specified.    0 means  that  no
                 indenting will occur.

   MAXWIDTH      The  maximum  width  to  be  used  to  format  the  CL
                 statements.   The  default is  *  which means  that if
                 the source  file is  92 bytes  in width  (80 bytes  of
                 data), the maximum  width will be restricted to  71 to
                 allow the  entire statement to  be displayed on  an 80
                 wide  SEU display.  This is  the same default that SEU

                 If the  file  width  is  greater than  92  bytes,  the
                 default  will use  the full  length of  the statements
                 excluding  the  sequence  number  and  'change  date'.
                 For example,  if the  source file  is  created with  a
                 width of  112 bytes,  INDCLPDO will  use 100  bytes to
                 format the data.

                 A  numeric value  may be entered  to cause  other than
                 the default  format length.    The value  entered  may
                 not  exceed the  statement width  of  the source  file
                 excluding  the   12  bytes  of   sequence  number  and
                 'change date'.

Identifying DO Commands

Any  DO  groups  as  separate  commands  (not  embedded  commands)  are
correctly identified.  This includes DOWHILE, DOUNTIL, and DOFOR.

The following describes the checking when the DO is embedded:

   IF            A DO is  only checked if  the combination of left  and
                 right parenthesis  balance.  At that point  a check is
                 made for THEN(DO), DO, or (DO).

                 A  parenthesis within quotes  such as ')'  will not be
                 counted  to  determine  if  the  parenthesis  balance.
                 This allows  programs that scan  for a  parenthesis to
                 be properly evaluated.

   ELSE          A  DO is checked for  by scanning for  CMD(DO), DO, or
                 (DO).   No comment  can appear  between the  ELSE  and
                 the DO.

   MONMSG        A DO  is checked for  by scanning  for EXEC(DO).   The
                 keyword  form  must  be  used.    Because  the  MONMSG
                 command   has  other  parameters  that  appear  before
                 EXEC, it is normal to code the EXEC keyword.


See the previous comments on identifying DO commands.

Valid CLP source must exist.

A single  leading  comment  (before the  command)  is  valid.   If  the
leading  comment ends  after position  14, no  indentation  will occur.
If  the leading  comment exists  and the  command is  not in  the first
record, the command is not considered and will just be output.


The following TAA Tools must be on your system:

     FILEFDBCK       File feed back
     FIXCLPSRC       Fix CLP source
     HLRMVMSG        HLL Remove message
     RTVDBFA         Retrieve data base file attributes
     RTVSYSVAL3      Retrieve system values 3
     SNDCOMPMSG      Send completion message
     SNDESCMSG       Send escape message
     SNDSTSMSG       Send status message


None, the tool is ready to use.

Objects used by the tool

   Object        Type    Attribute      Src member    Src file
   ------        ----    ---------      ----------    ----------

   INDCLPDO      *CMD                   TAACLQQ       QATTCMD
   TAACLQQC      *PGM       CLP         TAACLQQC      QATTCL
   TAACLQQR      *PGM       RPG         TAACLQQR      QATTRPG

Added to TAA Productivity tools December 1, 1996

Home Page Up to Top