TAA Tools
SCNOPNQRYF      SCAN FOR OPNQRYF                       TAACLQP

The Scan  for OPNQRYF  command scans  a specified source  file for  the
use of  OPNQRYF.  SCNOPNQRYF  is an option  on the SCN2000  command and
is intended for year 2000 considerations and other uses.

A typical command would be:


You  may  also  scan a  single  member or  a  generic member  name.   A
spooled  file  is  created  with  one  line  for  each  statement  that
contains  the  string  'OPNQRYF'.    The  statement  that  follows  the
OPNQRYF  statement is also listed  to assist you  in determining if any
impact exists.

When attempting  to  determine year  2000 considerations,  the  OPNQRYF
command can be overlooked.   It is possible to  use the QRYSLT, KEYFLD,
GRPFLD,  or  MAPFLD parameters  so  that OPNQRYF  will  give misleading
results in the  year 2000.   Because of the complexity  of the  OPNQRYF
statement, any use of the command should be reviewed manually.

In many  cases it  is impossible to  determine if  there are  year 2000
considerations  by just examining  the OPNQRYF  command.   For example,
the  QRYSLT parameter  may be  built by a  prior command.   This occurs
with the use  of the BLDQRYSLT  command (part of  the QRYF tool)  which
provides a  return variable to be  used for QRYSLT.   A typical OPNQRYF
statement may read:

             OPNQRYF   FILE(xxx) QRYSLT(&QRYSLT) ...

In  addition, some complex  uses of the  OPNQRYF command  may cause the
entire command  to  be built  in a  variable  and then  executed  using
QCMDEXC.   This same  technique may  also be  used in  any HLL  program
(not just  CL).  Or OPNQRYF  may be used in  a CL job stream  (not a CL
program).  Because  of these techniques,  the system PRTCMDUSG  command
cannot be used to find all potential uses of OPNQRYF.

The  output  of  SCNOPNQRYF  is  a  spooled  file  with  one  line  per
statement that  contains the string 'OPNQRYF'.  If  no usage of OPNQRYF
is  found, no  spooled file  is created.   A completion  message states
whether a  spooled file exists.   The  SCNSRC tool is  used to  perform
the scan.

By  reviewing  any generated  spooled  files,  you  can determine  what
source members must be examined in detail.

The  typical kinds of  things you should  look for to  ensure valid use
of OPNQRYF in the year 2000 are:

  **   Does  the QRYSLT  statement  include  any  *GT,  *GE,  *LT,  *LE
       comparisons involving date fields.

  **   Does the KEYFLD parameter contain any date fields.

  **   Does the GRPFLD parameter contain any date fields.

  **   Do any MAPFLD statements contain references to date fields.

Command parameters                                    *CMD

   SRCFILE       The  qualified file  name  of the  source  file to  be
                 scanned.   The default  is QCLSRC.   The library value
                 defaults to *LIBL.  *CURLIB may also be used.

   MBR           The member to  be scanned  for.  *ALL  is the  default
                 to scan all  members of the  source file.   A specific
                 member name  or a generic  member name may  be scanned

                 The  use of  a generic name  causes all  members to be
                 opened and may not be as efficient as required.

Assuming a century for sequencing on 6 character/digit dates

If you have a  6 byte or 6 digit  date field, you can assume  a century
by the use  of MAPFLD statements.  The following  code assumes the date
is a 6 byte field in YYMMDD sequence.

The  MAPFLD statements  generate  a CYYMMDD  value and  place it  in an
unused field in the same data  base record (FLD2 in the example).   You
can only  sequence on a  field in the data  base record so  an 'unused'
field  in the application  is used  to hold the  new date format.   The
sequencing field must  be at  least 7  characters to  hold the  CYYMMDD
value.  The file name used in the code is TSTDATP:

                          (YYA '%SST(YMD6 1 2)') +
                          (YYB YYA *ZONED 2 0) +
                          (YYC '(139 - YYB)' *ZONED 3 0) +
                          (YYD YYC *CHAR 3) +
                          (CEN '%SST(YYD 1 1)') +
                          (FLD2 'CEN *CAT YMD6'))
             CALL       PGM(xxx) /* Reads sequenced TSTDATP file */
             CLOF       OPNID(TSTDATP)

The technique  used is to  extract the YY  value, convert it  to zoned,
subtract it from  139, and convert the 3 digit  answer to a 3 character
field.   The high  order digit is then  extracted and concatenated with
the YYMMDD date to produce a CYYMMDD value.

If your  date  is  in packed  format,  you  must first  convert  it  to
character with the %DIGITS function such as:


If  your  date  is in  zoned  format,  you  must  first convert  it  to
character with a MAPFLD statement such as:

                MAPFLD((YYMMDD DECDAT))

If  the  format  of the  date  field  is other  than  YYMMDD,  you must
extract the YY  portion of the  date from the  correct positions.   For
example, if  you have an MMDDYY  format, the first MAPFLD  statement in
the example would be:

                  MAPFLD((YYA '%SST(MDY6 5 2)'))


The string 'OPNQRYF' must appear in a single source statement.

The SCNSRC  command which is used internally has a  limit of a 112 byte


The following TAA Tools must be on your system:

     CHKGENERC       Check generic
     SCNSRC          Scan source
     SNDCOMPMSG      Send completion message
     SNDESCMSG       Send escape message


None, the tool is ready to use.

Objects used by the tool

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

   SCNOPNQRYF    *CMD                   TAACLQP       QATTCMD
   TAACLQPC      *PGM       CLP         TAACLQPC      QATTCL

Added to TAA Productivity tools October 1, 1996

Home Page Up to Top