GENRANPWD       GENERATE RANDOM PASSWORDS              TAASEHU

 The Generate Random Password  command generates a random password  of a
 specified length  from 5 to 100 bytes.   Options exist to allow digits,
 allow  vowels (AEIOUY), and  allow lower case.   No adjacent characters
 will ever be  the same.   The first character is  always an upper  case
 letter  A-Z that is  not a  vowel.   The second  character is  always a
 digit if digits are allowed.

 A typical set of commands would be:

              DCL        &RTNPWD *CHAR LEN(100)
              DCL        &PWD10 *CHAR LEN(10)
               .
              GENRANPWD  RTNPWD(&RTNPWD) PWDLEN(8) ALWDGT(*YES) +
                           ALWVOWELS(*NO) ALWLWR(*NO)
              CHGVAR     &PWD10 &RTNPWD

 A typical password returned would be:

           X39B6D17

 The  first  character  will  always be  an  upper  case  letter  (not a
 vowel).  The second  character will be a  digit if digits are  allowed.
 The remaining characters are random values (not vowels) nor digits.

 If  your QPWDLVL  system value  is '0',  passwords must  be upper  case
 characters  and you  must specify  ALWLWR(*NO).   You may  allow vowels
 and/or digits.

 A test was  made involving  8 character passwords  allowing digits,  no
 vowels, and no lower  case.  50,000 passwords were  generated without a
 duplicate.

 GENRANPWD escape messages you can monitor for
 ---------------------------------------------

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

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

    RTNPWD        The  return password  which  is required  and  must be
                  declared   as  *CHAR  LEN(100).     If  your  required
                  passwords  are  shorter,  you  must  move  the  return
                  value to a shorter variable.

    PWDLEN        The  length of  the  password to  be  generated.   The
                  default  is 8.  It must be  a value between 5 and 100.

    ALWDGT        A *YES/*NO value  for whether to  allow digits in  the
                  return password.

                  *YES  is  the   default  in  which  case   the  second
                  character  of  the password  will  always  be a  digit
                  (0-9).    The   remaining  characters  are   generated
                  randomly  and  may  contain  digits  and  may  be  all
                  digits.

                  *NO may  be specified to prevent  digits from existing
                  in the return password.

    ALWVOWELS     A   *YES/*NO  value   for  whether   to  allow  vowels
                  (AEIOUY) in the return password.

                  *NO is  the default  to prevent  vowels from  existing
                  in  the   return  password.     Preventing  vowels  is
                  generally  desirable  to avoid  generating  a password
                  that is a name or an inappropriate value.

                  *YES may be  specified to allow  vowels in the  return
                  password.

    ALWLWR        A  *YES/*NO value  for  whether  to allow  lower  case
                  (a-z) in the return password.

                  *NO   is  the  default   to  cause   only  upper  case
                  characters in the return password.

                  *YES may be specified  to allow lower case  characters
                  in the return  password.  The first character  will be
                  an  upper case  character that  is not  a vowel.   The
                  second  character will  be a digit  if ALWDGT(*YES) is
                  specified.   The  remaining characters  are  generated
                  randomly  and   may  contain   lower  or   upper  case
                  characters.   Specifying *YES does  not guarantee that
                  the password will contain a lower case character.


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

 Because GENRANPWD returns a  value, the command may  only be used in  a
 CL program.

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

 The following TAA Tools must be on your system:

      GENRANNBR       Generate random number
      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
    ------        ----    ---------      ----------    ----------

    GENRANPWD     *CMD                   TAASEHU       QATTCMD
    TAASEHUC      *PGM       CLP         TAASEHUC      QATTCL

Added to TAA Productivity Tools October 15, 2008


Home Page

Powered by AS/400Powered by AS/400 Last modified on January 12, 2010 © 1995, 2010 - Jim Sloan, Inc.