TAA Tools
SORTCMDLST      SORT COMMAND LIST                      TAACMEU

The Sort  Command List  command allows  the sorting of  a simple  list.
The  list  would  normally  be  input  from  a  command  which  allowed
multiple  entries (such  as a  list of library  names) and  you want to
process the names in the list in ascending sequence.

Assume a  command allows  100 libraries  to  be named  for a  parameter
where each library name  can be 10 bytes.  The value  is input into the
&LIST  parameter which is defined to allow  for the 2 byte binary value
preceding the list.   Your coding must 1)  Extract the binary value  to
use  for the  NBRELM parameter  and 2)  Extract the  list beginning  at
byte 3.

A typical series of commands would be:

             DCL        &LIST *CHAR LEN(1002)
             DCL        &NBRELM *DEC LEN(5 0)
             DCL        &INPLST *CHAR LEN(1000)
             DCL        &RTNLST *CHAR LEN(9999)
             DCL        &PCSLST *CHAR LEN(1000)
              .
             CHGVAR     &NBRELM %BIN(&LIST 1 2)
             CHGVAR     &INPUT %SST(&LIST 3 1000)
             SORTCMDLST INPUTLST(&INPUT) NBRELM(&NBRELM) +
                          ELMLEN(10) RTNLST(&RTNLST)
             CHGVAR     &PCSLST &RTNLST

The  &PCSLST value  would have  the sorted list  of library  names left
adjusted.   Each value  would be  10 bytes  in length  (see the  INSBLK
option).  Any unused positions in &PCSLST would be blank.

SORTCMDLST escape messages you can monitor for
----------------------------------------------

None.  Escape messages from based on functions will be re-sent.

Command parameters                                    *CMD
------------------

   INPLST        The list of  elements to be sorted.   A list of  up to
                 9999 bytes may be entered.

   NBRELM        The number of elements in the list.

   ELMLEN        The length of  each element.  It must  be a value of 1
                 to 100.

   INSBLK        A  *YES/*NO  value  for  whether  to  insert  a  blank
                 following  each  element in  the  return  list.    The
                 default is *NO.

                 *YES  may  be  specified  to  insert  a  blank.    The
                 typical  use   of  *YES  is  when  the  list  will  be
                 processed  in  a  call  to  QCMDEXC  and  a  blank  is
                 required between the elements.

   RTNLST        The  sorted return  list.   It  must  be specified  as
                 *CHAR   LEN(9999).     The  elements  would   be  left
                 adjusted and any unused positions would be blank.

Restrictions
------------

The number of elements  multiplied by the length  of an element  cannot
exceed 9999.

An element cannot contain all X'FF' characters.

Prerequisites
-------------

The following TAA Tools must be on your system:

     SNDESCINF       Send escape information
     SNDESCMSG       Send escape message

Implementation
--------------

None, the tool is ready to use.

Objects used by the tool
------------------------

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

   SORTCMDLST    *CMD                   TAACMEU       QATTCMD
   TAACMEUC      *PGM       CLP         TAACMEUC      QATTCL
					

Added to TAA Productivity tools January 15, 2004


Home Page Up to Top