TAA Tools
SCNSPLF         SCAN SPOOLED FILE                      TAASPOP

The Scan  Spooled File command  scans a spooled  file for a  string and
returns  a  count  of  how  many  strings  were found.    Other  return
variables  exist for the line  of data where the  scan value was found,
the position within the  line, and the page  number.  These values  are
returned  as arrays  of up  to 100  values.   Only the  first  time the
string is found on a print line is considered.

Only  spooled files that  may be  processed by CPYSPLF  are valid (this
excludes AFP  spooled files).   The  spooled file  width cannot  exceed
256 bytes.

A typical series of commands would be:

             DCL        &RTNCNT *DEC LEN(3 0)
             DCL        &RTNLIN *CHAR LEN(25600)
             DCL        &RTNPAG *CHAR LEN(700)
             DCL        &RTNPOS *CHAR LEN(300)
              .
             SCNSPLF    FILE(xxx) SCNVAL(ABC) SPLNBR(*LAST) +
                          RTNCNT(&RTNCNT) RTNLIN(&RTNLIN) +
                          RTNPAG(&RTNPAG) RTNPOS(&RTNPOS)

Both the scan value  and the spooled file lines  are converted to upper
case  before scanning.   If  the value ABC  was found,  the information
would be placed  in the arrays  for RTNLIN, RTNPAG, and  RTNPOS.   Each
array has  room for  100 entries.   The  following are  the lengths  of
each element (character values):

  **   RTNLIN 256

  **   RTNPAG 7

  **   RTNPOS 3

If more than  100 values are found, the  RTNCNT will reflect the actual
count, but the arrays will hold the first 100 values.

To process the RTNLIN value, you could consider the following code:

             DCL        &PX *DEC LEN(5 0)
             DCL        &LINE *CHAR LEN(256)
             DCL        &RTNCNT *DEC LEN(5 0)
              .
             CHGVAR     &COUNT 0
             CHGVAR     &PX -255
 LINES:      CHGVAR     &COUNT (&COUNT + 1)
             IF         (&COUNT *LE &RTNCNT) DO /* LE rtn count */
             CHGVAR     &PX (&PX +  256)
             CHGVAR     &LINE %SST(&RTNLIN &PX 256)
                        /*************************************/
                        /*                                   */
                        /*    Your processing of the         */
                        /*    &LINE variable.                */
                        /*                                   */
                        /*************************************/
             GOTO       LINES
             ENDDO      /* LE return count */

Similar  code could  be used for  RTNPAG and RTNPOS  with the different
values for 255 and 256.

The PAGRNG  parameter lets  you scan  up to  5 page  ranges within  the
spooled file.

The  SCNPOSRNG   parameter  allows   you  to  scan   within  designated
positions  of the spooled lines.   Only scan values  found within those
positions will be considered.

SCNSPLF escape messages you can monitor for
-------------------------------------------

      TAA9891    No scan values were found
      TAA9892    The print width cannot exceed 256 bytes

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

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

   FILE          The name of the spooled file to be scanned.

   SCNVAL        The scan  value.   Up  to  20  bytes may  be  entered.
                 Both the  scan value  and the  spooled file lines  are
                 converted to upper case before scanning.

   JOB           The  qualified job  name of the  job with  the spooled
                 file.  The default is * meaning the current job.

   SPLNBR        The file number  of the spooled  file.  This  defaults
                 to  *ONLY.    *LAST  or  a   specific  number  may  be
                 specified.

   PAGRNG        Up  to 5 page  ranges may be  entered to allow  a scan
                 within  specific page ranges  within the spooled file.
                 For example,  you could scan  page 2-3  and 20-21  and
                 ignore the other pages.

                 The default is *ALL to scan all pages.

                 Each  of the  5 page  ranges is  entered as  a  2 part
                 parameter.   The  first part is  the low  page and the
                 second part is  the high  range.  The  values of  each
                 may  be  1  to  9999999.     The  high  range  may  be
                 specified  as  *LAST  meaning  the  last  page in  the
                 spooled  file.    Consider  the  use  of  RTVSPLFA  to
                 determine the number of pages in the spooled file.

                 The low  range  must be  lower than  or  equal to  the
                 high  range.  You  may not  specify a page  range that
                 exceeds  the number of pages in  the spooled file.  No
                 check  occurs  to   see  if  overlapping   ranges  are
                 specified.

   SCNPOSRNG     A  two  part  value   that  determines  the  positions
                 within  the spooled print  line that  will be scanned.
                 The values default to 1  and *LAST meaning the  entire
                 print line will be scanned.

                 If  values such  as  (21 30)  are  entered, only  scan
                 values  found  within  positions  21  and  30 will  be
                 considered.    Scan  values  found  outside  of  these
                 positions will be bypassed.

                 If a  scan value is  found multiple times  between the
                 range specified, only the first value is returned.

   RTNCNT        A return  count of the number of  lines containing the
                 scan  value.   If  a line  contains  one or  more scan
                 values, a  count of  one will be  added.   This is  an
                 optional  return  variable  that   if  used,  must  be
                 specified as *DEC LEN(5 0).

                 If  more than  100  scan values  are found,  the count
                 will describe  how many  exist, but  the other  return
                 values will contain only the first 100 found.

   RTNLIN        An array  of the  lines where  the scan  value exists.
                 Each  line  returned is  256  bytes.   Up  to  100 are
                 returned.  If  a line contains  multiple scan  values,
                 the line will  exist only once.   This is  an optional
                 return  variable that  if used,  must be  specified as
                 *CHAR LEN(25600).

   RTNPAG        An  array  of the  page numbers  where the  scan value
                 exists.  Each  page number is 7  bytes in length.   Up
                 to  100  will  be   returned.    If  a  line  contains
                 multiple  scan values, the page  number will exist for
                 the associated  RTNLIN value.    This is  an  optional
                 return variable  that if  used, must  be specified  as
                 *CHAR LEN(700).

   RTNPOS        An  array  of positions  within  the  lines where  the
                 scan value  exists.    Each position  is  3  bytes  in
                 length.   Up  to 100  will  be returned.    If a  line
                 contains   multiple  scan   values,  only   the  first
                 position  where  the  scan  value  was  found  will be
                 placed in  the  array.   This  is an  optional  return
                 variable  that if  used,  must be  specified as  *CHAR
                 LEN(300).


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

Only  a spooled file  that can be  processed by the  CPYSPLF command is
supported.  This excludes AFP files.

The page width of a spooled file may not exceed 256 bytes.

The return values will exist for the first 100 scan values found.

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

The following TAA Tools must be on your system:

     EDTVAR          Edit variable
     EXTLST          Extract list
     HLRMVMSG        HLL remove message
     MOVCHRDEC       Move character to decimal
     RSNLSTMSG       Resend last message
     RTVSPLFA        Retrieve spooled file attributes
     RTVSYSVAL3      Retrieve system value 3
     SNDESCINF       Send escape information
     SNDESCMSG       Send escape message
     SNDSTSMSG       Send status message
     TRNVAL          Translate value

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

None, the tool is ready to use.

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

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

   SCNSPLF       *CMD                   TAASPOP       QATTCMD
   TAASPOPC      *PGM       CLP         TAASPOPC      QATTCL
   TAASPOPR      *PGM       RPG         TAASPOPR      QATTRPG
					

Added to TAA Productivity tools October 15, 2008


Home Page Up to Top