TAA Tools
CHKS38CMD       CHECK CL SOURCE FOR USE OF S/38 COMMANDS     TAACMDA

The CHKS38CMD  command checks a  source member to  see if the  commands
used contain only S/38 supplied commands.

For  example,  to  check  the  member  PAYROLLC in  QCLSRC,  you  would
specify:

      CHKS38CMD    MBR(PAYROLLC)

The CHKS38CMD could be used for the following functions:

  **   If  you ship  code to  S/38s and  want to  ensure that  the code
       only  contains commands  that  can  be  executed  on  the  other
       systems.

  **   If you want  to find the user written  commands within your S/38
       CL source.

  **   If  you want  to enforce  a standard  relative to  what commands
       can appear in S/38 CL programs.

Any commands not found  in the array provided  will cause a listing  to
occur.  The  listing will contain the source statement  where a command
was  found that  does not  exist in  the array.   The  listing includes
summary counts of  the records and  commands found.   An option  exists
to always print a summary listing.

The S/38 commands are in  an array within an RPG program.   The program
contains an entry  for every S/38 command shipped  in Release 8 of S/38
(the  last release).   You may add commands  (eg user written commands)
that you  do not  want to  be flagged.   You may  also subtract  system
commands that you do want to be flagged.

CHKS38CMD is  not a 100%  match with CL  syntax.  The vast  majority of
cases   are  processed  correctly.     See  the   later  discussion  of
exceptions.  The program  assumes that valid CL  syntax is being  used.

Special handling occurs  for the commands IF, ELSE and  MONMSG as these
commands may have an embedded command which is also checked.

A standard source file (80 bytes of text) must be used.

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

   MBR           The  member to be  processed.  The  special value *ALL
                 may be entered  in which  case all members  in a  file
                 will be checked.   If the file contains  many members,
                 this command should be submitted to batch.

   SRCFILE       The  qualified file  source file  name to  be checked.
                 The  file name defaults  to QCLSRC.   The library name
                 defaults to *LIBL.

   PRINT         Print every  member  or  only those  with  exceptions.
                 *EXCPT  is the  default  to print  only those  members
                 with  exceptions.   Every  listing includes  the total
                 number  of  statements  and  the  number  of  commands
                 found.   If this  is needed  for all  members, specify
                 *ALL.   If *EXCPT  is specified and  no exceptions are
                 found, a  completion message  is sent  (no listing  is
                 produced).

If  any exceptions  exist,  the command  will  complete and  then  send
CPF9898 as an escape message.

Output listing
--------------

The listing describes:

  **   Number  of statements read  which is a  count of the  records in
       the member.

  **   Number  of exceptions  found.   For each  exception there should
       be one source statement printed.

  **   Number of  total  commands.   This  is  the number  of  commands
       sensed.   Not every statement  may contain a command  because of
       continuation  lines or a statement  may be only a  comment.  The
       commands like  IF, ELSE  and MONMSG  normally  have an  embedded
       command which will also be counted.

  **   Number  of 'primary  commands'.   This  counts  one per  command
       found, but does not count the embedded commands.

  **   Number  of  IF/ELSE/MONMSG commands.    The sum  of  this number
       plus 'primary commands'  may not  equal 'Total  commands'.   For
       example, a MONMSG command may not have an embedded command.

Exceptions
----------

  **   Commands in the SBMJOB RQSDTA parameter are not checked.

  **   Any IF  or ELSE commands  that do not  have an embedded  command
       will be flagged.  This may not be an exception in your code.

  **   Most  cases where a  command name  is split over  two statements
       will be flagged.  For example, the following will be flagged:

              DSPSYSS+
                  TS

  **   The  IF  command  is  properly  handled  in  most  cases.    One
       exception is  when  an  expression  contains a  test  against  a
       literal which  contains a parenthesis  as well as  other values.
       For example, the following would be flagged:

            IF  (&A *EQ '((' ) CHGVAR &B &Z
            IF  (&A *EQ 'CMD(' ) CHGVAR &B &Z

       The following would not be flagged

            IF  (&A *EQ '(' ) CHGVAR &B &Z
            IF  (&A *EQ ')' ) CHGVAR &B &Z

  **   The  MONMSG command  has an  optional parameter  CMPDTA followed
       by the  optional EXEC  parameter  which names  a command  to  be
       executed.   The checking will only  occur when the  keyword EXEC
       is  specified.   Thus  if  you  have a  MONMSG  as  follows, the
       CHGVAR embedded command will not be checked:

           MONMSG    CPF0000  XXXXXX  (CHGVAR &X &Y)
           MONMSG    CPF0000  XXXXXX  CHGVAR &X &Y

       The following CHGVARs will be checked:

           MONMSG    CPF0000  EXEC(CHGVAR &X &Y)
           MONMSG    MSGID(CPF0000)  EXEC(CHGVAR &X &Y)
           MONMSG    MSGID(CPF0000)  CMPDTA(XXX) EXEC(CHGVAR &X &Y)
           MONMSG    CPF0000 XXX EXEC(CHGVAR &X &Y)

Exception conditions noted in the listing
-----------------------------------------

There are 3 exception conditions that  may appear and are described  in
the left most column of the listing.

  **   'Not found'.  This means the command is not in the array.

  **   'GT 10 char'.   The command name given exceeds  10 characters in
       length.    This exception  condition  is  not  acceptable in  CL
       syntax.

  **   'IF/ELSE  err'.    This  is produced  if  the  CHKS38CMD program
       cannot find an embedded command  on an IF or ELSE command.   For
       example, this  would be the  case if the IF  statement contained
       a test for a parenthesis in addition to another value.

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

The following TAA Tools must be on your system:

         EDTVAR          Edit variable
         SNDCOMPMSG      Send completion message
         SNDESCMSG       Send escape message

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

None, the tool is ready to use.

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

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

   CHKS38CMD     *CMD                      TAACMDA        QATTCMD
   TAACMDAC      *PGM          CLP         TAACMDAC       QATTCL
   TAACMDAR      *PGM          RPG         TAACMDAR       QATTRPG
   TAACMDAR2     *PGM          RPG         TAACMDAR2      QATTRPG

       The  array in  the TAACMDAR2  program can be  changed to  add or
       delete  commands.    For   example,  you  could  delete   system
       commands you  want flagged  and add your  own commands  that you
       do  not want flagged.   To delete  a command, just  blank it out
       in the array  (i.e.  the  search is  for an equal  value in  the
       array).  You can add new commands to the end of the array.
					

Added to TAA Productivity tools April 1, 1995


Home Page Up to Top