TAA Tools

The Sort CLP DCL  command sorts the DCL statements within  CL source by
variable  name or  by variable  name within  DCL type.   This  allows a
consistent approach for how source is kept on your system.

A typical command would be:

             SORTCLPDCL  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
file.  A single member or all members in a file may be processed.

Before  updating  your  actual  source,  you  should  use  the  OUTSRCF
parameter  to try  the function to  a test  member.   While sorting the
DCLs may  sound desirable, some  users will  not want  the sequence  of
their source changed.

No reformatting  of the source  occurs.   Each statement appears  as it
exists  in the input file.   See the  later discussion of  how the DCLs
are processed.

The  default  is  to  sort  the  DCLs  into  alphabetical  sequence  by
variable  name.   An option  exists  to sort  by  variable name  within
source type.   With this option, the sequence  is *CHAR, *DEC, and then

The  source  statements  are  re-numbered (1.00,  2.00  etc),  when the
source is  written.  The  'change date' with  each source statement  is
not changed.

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

Source processing

The following rules apply:

  **   Valid CL source must exist.

  **   Any comments  which appear before  the first DCL  statement will
       be output in the same order.

  **   Any   PGM  or  DCLF   statement  will  appear   before  any  DCL
       statements in the  output.   If the DCLF  statement is  embedded
       with other  DCLs, any  comments immediately  following the  DCLF
       statement may not sort correctly.

  **   The first  DCL statement found causes  the special processing to

  **   The first  statement  which  contains a  command  following  the
       last  DCL signals  the  end  of  the special  processing.    The
       remaining statements  are just output.   If a  DCL appears after
       this  point (this would not be valid  for a CL program), the DCL
       is ignored.

  **   If a blank record  or a record that  contains only a comment  is
       found while  processing DCL statements,  it is assumed  that the
       record  belongs  with  the  previous  DCL  and  will  be  sorted
       accordingly.  If you  have a series  of comments that begin  the
       source processing after  the last DCL, they will  be sorted with
       the last DCL.

  **   In  order to  sort a  DCL  statement, the  command name  and the
       variable name must exist  in the first or  only record of a  DCL
       statement.   Continuation records are  valid and will  be sorted
       properly  as long as  the DCL  command and variable  name appear
       in the first record.

       If  SEQ(*TYPE) is specified, the TYPE  value must also appear in
       the first record.

  **   The sort on variable names  occurs on the name itself.   Thus if
       you have specified:

                  DCL        VAR(&ZZZ) TYPE(*CHAR) LEN(3)
                  DCL        &WWW TYPE(*CHAR) LEN(5)

       the &WWW variable would appear first.

Command parameters                                    *CMD

   MBR           The  member to have  its DCL  statements sorted.   The
                 special  value *ALL  exists to  sort all members  in a
                 source file.  Only the  members of source type CLP  or
                 CLLE will be processed.

   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
                 maximum record length of 240 bytes.

   OUTSRCF       The qualified  file name  of the  output source  file.
                 The  file  defaults  to  *INPSRCF meaning  the  sorted
                 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  that is  equal or  greater
                 than the input source file.

                 You must have *OBJMGT authority to the file.

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

                 If all  members in  a file  are being  processed 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.

   SEQ           The  sequence of  the  sort.   The  default  is  *NAME
                 which  means  the  DCLs  will be  sorted  by  variable

                 *TYPE  may be specified  to sort the  DCLs by variable
                 name within  type.    The  sequence of  the  types  is
                 always *CHAR, *DEC, and then *LGL.


See the previous section on the handling of DCL statements.


The following TAA Tools must be on your system:

     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
   ------        ----    ---------      ----------    ----------

   SORTCLPDCL    *CMD                   TAACLQR       QATTCMD
   TAACLQRC      *PGM       CLP         TAACLQRC      QATTCL
   TAACLQRR      *PGM       RPG         TAACLQRR      QATTRPG

Added to TAA Productivity tools December 1, 1996

Home Page Up to Top