TAA Tools
GENPRMNBR       GENERATE PRIME NUMBERS                 TAANBRE

The Generate Prime Numbers  command writes one record per  prime number
to the  PRIMEP file.  Each number  is 7 digits in a  packed field named
PRIME.    A  range  of  prime  numbers  may  be  generated  from  2  to
9,999,999.   Prime numbers may  be helpful  in different  applications.
The  algorithm used is  a modified  Sieve of  Eratosthenes.   The model
outfile is TAANBREP with a format name of PRIMER.

A typical command would be:

             GENPRMNBR  MIN(2) MAX(25000) MAXCOUNT(*ALL)
                          OUTLIB(QTEMP)

There  would be one record created for  each of the 2,762 prime numbers
found in the MIN/MAX range.   You could print the prime numbers with  a
command such as:

             PRTDB2   FILE(QTEMP/PRIMEP) NBRRCDS(*MAX)

GENPRMNBR escape messages you can monitor for
---------------------------------------------

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

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

   MIN           The minimum  number to begin with.   The default  is 2
                 and  the  value  must be  less  than  9,999,999.   The
                 value does not have to be a prime number.

   MAX           The maximum  number  to  end with.    The  default  is
                 25,000 and  cannot exceed 9,999,999.   The  value does
                 not have to be a prime number.

   MAXCOUNT      The maximum  number of prime  numbers to write  to the
                 PRIMEP  file.    The  default is  *ALL  for  all prime
                 numbers between the MIN  and MAX range.  A  value less
                 than  the  number  that  could  be  generated  may  be
                 specified in a range of 1 to 664,579.

                 For  example,  you could  request the  first  10 prime
                 numbers  between   MIN(5000)  and   MAX(6000).     The
                 completion  message  will  describe   how  many  prime
                 numbers  are available between  the range.   It is not
                 an error to  request a  number that is  less than  the
                 total number that could be generated in the range.

   OUTLIB        The library  where the PRIMEP  file exists.   *LIBL is
                 the default,  but may only be used  if the PRIMEP file
                 exists.

                 A specific library or *CURLIB may be specified.

                 The  model outfile is  TAANBREP with a  format name of
                 PRIMER.

   OUTMBR        The member of the PRIMEP  file to be used.   PRIMEP is
                 the default.   A specific member name may  be used and
                 will be added if it does not already exist.

   REPLACE       A  *YES/*NO  parameter  that  determines  whether  the
                 data in an existing PRIMEP file will be cleared.

                 *NO is the  default which will cause  an error if  the
                 PRIMEP file has data.

                 *YES may be specified to clear any existing data.


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

None.

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

The following TAA Tools must be on your system:

     DUPTAADBF       Duplicate TAA data base file
     EDTVAR          Edit variable
     SNDCOMPMSG      Send completion message
     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
   ------        ----    ---------      ----------    ----------

   GENPRMNBR     *CMD                   TAANBRE       QATTCMD
   TAANBREC      *PGM       CLP         TAANBREC      QATTCL
   TAANBRER      *PGM       RPGLE       TAANBRER      QATTRPG
   TAANBREP      *FILE      PF          TAANBREP      QATTDDS
					

Added to TAA Productivity tools January 1, 2008


Home Page Up to Top