TAA Tools
FIXCLPSRC       FIX CLP SOURCE                         TAACLPZ

The Fix CLP Source command  fixes the source for one or  all CLP, CLLE,
or  CMD members  in a  file.   The source  is  reformatted in  a manner
similar  to if you had prompted for every  command in SEU.  Both system
and user written commands will be reformatted.

The system  API  QCAPCMD is  used  to insert  the keywords  and  syntax
check the statement.  Reformatting occurs in an RPG program.

Both an input and  output source file may be named.   The default is to
update the data in the same source member such as:

       FIXCLPSRC    MBR(xxx) INPSRCF(yyy) OUTSRCF(*INPSRCF)

For example, if your source looked like:

       CALL         PGMA
    CHGVAR &VARB &VARA

After FIXCLPSRC was run, it would look like:

             CALL       PGM(PGMA)
             CHGVAR     VAR(&VARB) VALUE(&VARA)

The  source  to be  converted  must be  free  of syntax  errors  or the
source will not  be converted.  If  you enter the  source with SEU  and
no errors  occur, FIXCLPSRC is  designed to fix  the source to  make it
appear as if you had prompted for every command.

The  reformatting is first done  to a temporary  file in QTEMP.   If no
errors occur, the data is copied to the output source file.

Formatting of the statements occurs similar to SEU:

  **   The labels are placed beginning in position 2.

  **   The commands begin in position 14.

  **   Keywords are inserted.

  **   The first line of parameters begins at position 25.

  **   Any overflow parameter lines begin at 27.

  **   If the source file  is 92 bytes (80  bytes of data), the  source
       is formatted to fit  within 71 bytes to allow  simple viewing in
       SEU.

FIXCLPSRC may  also be used to  reformat existing source to  a wider or
shorter  record length.  For  example, you may have  your CLP source in
92 byte  source files  and want  to  convert it  to a  120 byte  source
files.   CPYSRCF will copy the  statements, but does not  reformat them
to  match   the  new  record  length.    FIXCLPSRC  will  reformat  the
statements.

There is a minimum  length of 92 byte source  files (80 bytes of  data)
and a maximum length of 240 bytes (maximum size handled by SEU).

The source type CMD is also reformatted by FIXCLPSRC.

Reformatting of comments and labels
-----------------------------------

The command  prompter cannot be used  within SEU to format  a statement
that  contains only a comment,  a label, or  a comment and a  label.  A
similar restriction exists with the API.   If a statement is read  that
does not contain  a command, no  formatting occurs.   FIXCLPSRC outputs
this  type of statement  in the same  format as it  is input.   Thus if
you  have a  source record  that contains  only a  comment, it  will be
output as  it is  input.   Some reformatting  may occur  if the  output
source file is wider or shorter in record length.

An  option exists  (MAXFMTWTH)  to allow  formatting  within a  shorter
length  than the file.  For example,  if the source statement length is
100 (source file length of 112),  the formatting can be made for an  80
wide screen by specifying MAXFMTWTH(80).

Command options
---------------

An option exists  to retain any comments that appear  in positions 1-13
of a  new command.  This allows you to  retain any comments to the left
of the  command  rather  than  have  them appear  at  the  end  of  the
command.

An option  exists to determine  the sequence numbers  used for the  new
source.    The  default is  to  re-number  the  statements (1.00,  2.00
etc.).

Specifying  *SAME causes the same sequence  number to be used.  Because
reformatting may  cause a different  number of  statements to exist  in
the  source member,  some minor  changes  in the  sequence numbers  may
occur.  See the discussion of the SEQNBRS parameter.

An  option exists  to  align a  qualified command  so the  command name
begins in  position  14 (same  as an  unqualified  command).   See  the
discussion of the QLFCMD parameter.

Spooled output
--------------

A spooled  file is  output if  MBR(*ALL) is  specified which will  list
each member  found and if any  errors occurred.  If  a single member is
named, a spooled file is only output if errors are found.

If a command does pass the  validation performed by the API, the  first
record  of  the   statement  is  printed  with  an   error  indication.
Probably reasons are:

  **   The command is unknown.

  **   The keywords do not match what is required.

  **   The command validity checker has found an error.

Source date on each record
--------------------------

The  source date of  each statement  is retained  in the new  output (a
new  source date is not assigned).  There  is an exception if a command
requires  multiple  output   records.    The   source  date  used   for
additional  records will  be set  to be  the same  as the  most current
date within any line of the statement.

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

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

   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
                 reformatted 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  of  92 to  240 (80  - 228
                 bytes of data).

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

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

   ALWLDGCOM     A  *YES/*NO  parameter  that  defaults  to  *YES which
                 allows any comments  to the  left of a  command to  be
                 retained.    The  comment must  be  totally  contained
                 within  the first 13  positions of  the source record.

                 If you  place a  comment in  positions 1-13  before  a
                 command and  then prompt for  the command in  SEU, the
                 string  that is  returned  places the  comment  at the
                 end of the command.

                 *NO  causes any comments  in 1-13 to  be placed at the
                 end of the  command as if  you had prompted with  SEU.

   QLFCMD        How to align a qualified command.

                 *SEU  is the  default to  align as  SEU does  with the
                 library  part beginning in  position 14  followed by a
                 slash and then the command name.

                 *CMD may be  specified to  align the  command name  in
                 position 14  thus allowing  all commands  to begin  in
                 14.    The slash  is  placed in  position  13  and the
                 library name to the left.   If a label exists for  the
                 same line, *CMD  is ignored and the library  part will
                 begin in 14.

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

                 The  value *SAME  causes FIXCLPSRC  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 SEQNBRS(*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.

   MAXFMTWTH     The  maximum  formatting  width  to  be   used.    The
                 default  is  *FILE to  format  the  statements to  the
                 length of the source statements within the file.

                 A  length  can  be specified  between  80  and  240 to
                 format the statement based on a shorter width.

                 For example,  if  your  source  statements  are  wider
                 than 80,  but you want to  format them for an  80 byte
                 wide display, specify MAXFMTWTH(80).

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

  **   The  formatting used is designed  to be similar  to prompting in
       SEU, but slight differences may occur.

  **   The  SEQNBRS  *SAME  option  may  not  produce  the  exact  same
       sequence numbers  because  the number  of records  output for  a
       command  may  differ.    See  the  discussion with  the  SEQNBRS
       parameter.

  **   See  the previous discussion of the  handling of the source date
       assigned to each output statement.

  **   A statement  that contains  only a  comment,  or a  label, or  a
       comment and  a label will  not be reformatted unless  the number
       of output records exceeds one for the statement.

  **   The  source files  named must  have a  record length  between 92
       and 240 bytes.

Use with PDM
------------

PDM allows an  alternative to  define a  user option.   When the  'Work
with  Members  using PDM'  display  occurs,  you  can use  the  special
function keys to create your own option.

When  a user  option is  specified,  you cannot  prompt for  the CRTxxx
command to be submitted.  All  of the command parameters which are  not
passed from PDM, must be in the source.

You must  first consider  where you  want to  place the  options.   The
default is  the QAUOOPT file in  QGPL.  You can see  which options file
is being used by specifying F18 'Change defaults'.

If  you do not want to  use the default, then  you must create your own
file.  A  typical solution would be  to use CRTDUPOBJ to  duplicate the
existing QAUOOPT  file in  QGPL to  a library of  your choice  (use the
same  name of  QAUOOPT).   Then use the  'Change Defaults'  display and
modify the library for the QAUOOPT file.

After you  have selected which  file to  use, the  'Work With  Members'
display should  appear.  You  can use the  F16 key for  'User Options'.
This  will display  the 'Work  with  User-Defined Options'  display and
you will see  the existing options.   To create  a new option,  specify
F6.

A display  will appear named  'Create User-Defined  Options'.  You  can
enter  a  2  character  ID   for  the  option.    You  may  choose  any
characters,  but a typical entry  would be 'FX' (Fix  CLP source).  The
command you key in should be as follows:

          FIXCLPSRC     MBR(&N) INPSRCF(&L/&F)

The variable names (like &L)  are used by PDM to determine  what should
be mapped into the command.

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

The following TAA Tools must be on your system:

     ALCTMPMBR       Allocate temporary member
     HLRMVMSG        HLL Remove message
     RTVPFA          Retrieve physical file attributes
     RTVSYSVAL3      Retrieve system value 3
     SNDCOMPMSG      Send completion message
     SNDESCMSG       Send escape message
     SNDSTSMSG       Send status message

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

None, the tool is ready to use.

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

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

   FIXCLPSRC     *CMD                   TAACLPZ       QATTCMD
   TAACLPZC      *PGM       CLP         TAACLPZC      QATTCL
   TAACLPZC2     *PGM       CLP         TAACLPZC2     QATTCL
   TAACLPZR      *PGM       RPG         TAACLPZR      QATTRPG
					

Added to TAA Productivity tools May 1, 1996


Home Page Up to Top