[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: Name Format Validation



Hello Again Sandra!

   I like these kinds of posts to the Users Group! I'm getting a little
tired of reading about 'Call System Using...' AND SQR Flags... etc... 

Anyway... I'm glad you'll be able to use the routine I sent... Now
concerning PeopleSoft Name Validation (as opposed to Case Converson)...
I didn't have a routine so I created one... it matches closely to
PeopleSofts' Naming Validation (which has some anomolies as I've pointed
out)... The routine has been adequately tested including the PeopleSoft
sample names you've sent... global variable $_PS_intl is used for
international characters (customize to suit your needs)... 

Here's the routine with documentation on the basic validation rules
(it's also attached for your "downloading" convenience):

!**********************************************************************
!*                                                                    *
!*       MODULE:  TDPSNAME.SQC                                        *
!*       AUTHOR:  TONY DELIA.                                         *
!*         DATE:  01/12/1999.                                         *
!*       SYSTEM:  TD SQR UTILITY SERIES.                              *
!*         DESC:  PEOPLESOFT NAME FORMAT VALIDATION.                  *
!*                                                                    *
!**********************************************************************
!*                                                                    *
!*         NOTE:  FOR THE MOST PART THIS MATCHES THE ONLINE 'NAME'    *
!*                VALIDATION WITHIN THE PEOPLESOFT PANELS. THERE MAY  *
!*                BE SOME ODD CONDITIONS THAT MAY RESULT. PEOPLESOFT  *
!*                ALLOWS THE NAMES 'X,.', 'X,,.' AND 'X,,,.' BUT DOES *
!*                NOT ALLOW 'X,,,,.' TO BE ENTERED. THE PURPOSE OF    *
!*                THIS ROUTINE ISN'T TO FUNCTION IDENTICALLY WITH     *
!*                PEOPLESOFT... RATHER TO PERFORM REALISTIC NAME      *
!*                VALIDATIONS. CUSTOMIZE AS NEEDED.                   *
!*                                                                    *
!**********************************************************************
!*                                                                    *
!*        USAGE:  let $w_name = 'SMITH,JOHN R'                        *
!*                do  TD-Psoft-Name($w_name, $okay)                   *
!*                if  $okay   = 'N'                                   *
!*                    show 'Invalid: ' $w_name                        *
!*                end-if                                              *
!*                .                                                   *
!*                #Include 'tdpsname.sqc'                             *
!*                                                                    *
!**********************************************************************
!*                                                                    *
!*                BASIC FORMATTING RULES                              *
!*                                                                    *
!*      Rule #1 - Comma must exist in Name (BUT Not in Pos.1)         *
!*      Rule #2 - Space cannot exist after comma                      *
!*      Rule #3 - Name cannot end in comma                            *
!*      Rule #4 - Validate Character Set                              *
!*                                                                    *
!**********************************************************************
!*                                                                    *
!*     EXAMPLES:  Name                                 Okay?   Rule#  *
!*                -----------------------------------  ------  -----  *
!*                SMITH,JOHN R.                        Y              *
!*                Smith,John R.                        Y              *
!*                JOHN R. SMITH                        N       1      *
!*                ,SMITH                               N       1      *
!*                SMITH, JOHN R.                       N       2      *
!*                SMITH,                               N       3      *
!*                SMITH,JOHN,                          N       3      *
!*                SMITH,JOHN?                          N       4      *
!*                SMITH,JOHN.                          Y              *
!*                1,2                                  Y              *
!*                SMITH,,,.                            Y              *
!*                                                                    *
!*                Notice some of the "oddball" scenarios that pass    *
!*                validation... This occurs directly in PeopleSoft.   *
!*                                                                    *
!**********************************************************************

!**********************************************************************
!*       PeopleSoft Name Validation                                   *
!**********************************************************************
!*       [lastname] [suffix], [prefix] [firstname] [middle/initial]   *
!**********************************************************************

begin-procedure TD-PSoft-Name($PS_name, :$PS_status)

!  Construct Valid Character String - Expand As Needed
if $_PS_values       = ''

   let $_PS_quote    = ''''
   let $_PS_upper    = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
   let $_PS_lower    = 'abcdefghijklmnopqrstuvwxyz'
   let $_PS_number   = '0123456789'
   let $_PS_intl     = ''                     ! International Sample
   let $_PS_special  = ' .-,'         || $_PS_quote

   let $_PS_values   = $_PS_upper     ||
                       $_PS_lower     ||
                       $_PS_number    ||
                       $_PS_intl      ||
                       $_PS_special

end-if

!   Prepare For Validation
let $PS_status       = 'N'
let #len             = length($PS_name)
let #pos             = instr($PS_name, ',', 1)

!   Rule #1 - Comma must exist in Name (BUT Not in Pos.1)
if  #pos > 1

    !   Rule #2 - Space cannot exist after comma
    if substr($PS_name, #pos + 1, 1) <> ' '

       !  Rule #3 - Name cannot end in comma
       if substr($PS_name, #len, 1) <> ','

          !   Rule #4 - Validate Character Set (see above)

          let $PS_status   = 'Y'

          let #pos         = 1

          while #pos      <= #len

              let $PS_char = substr($PS_name, #pos, 1)

              if  instr($_PS_values, $PS_char, 1) = 0

                  let $PS_status  = 'N'       ! Invalid - Set Status
                  let #pos        = #len      ! Break Out of Loop

              end-if

              let #pos = #pos + 1

          end-while

      end-if
   end-if
end-if

end-procedure

!**********************************************************************

Good Luck with your conversion.
 
                               -Tony DeLia

PS - Attention SQRUG Members! More interesting topics please...


Hope, Sandra wrote:
> 
> Tony,
> 
> Thank you.  The routine you sent will help me immensely during our remaining
> data conversions from mainframe.  What I really need to do is ensure the
> name is in the correct format so that the Rotname SQC's can parse the name,
> i.e.,
> 
>   [lastname] [suffix],[prefix] [firstname] [middle name/initial]
> 
> The entry can contain alphabetic characters, spaces, periods, hyphens, and
> apostrophes.  Valid entries might include:
> 
>     O'Brien,Michael
>     Jones IV,James
>     Phillips MD,Deanna Lynn
>     Reynolds Jr.,Dr. John Q.
>     Phipps-Scott,Adrienne
>     Knauft,Gunter
> 
> So far I've included the Rotname3.SQC and if a resulting lastname or
> firstname cannot be determined, the name writes to an error file.
> 
> Sandra Hope
> DynCorp
> hopes@dyncorp.com
> New Phone:   (703) 264-8674
> 
> RESYSTEMIZATION
> PeopleSoft
> 
> > ----------
> > From:         Tony DeLia[SMTP:tdelia@EROLS.COM]
> > Reply To:     SQR-USERS@USA.NET
> > Sent:         Monday, January 11, 1999 10:57 PM
> > To:   Multiple recipients of list SQR-USERS
> > Subject:      Re: Name Format Validation
> >
> > Hi Sandra,
> >    Here's a "quick" routine that will convert names to "PeopleSoft"
> > format...
> >
> > Assuming the variable $name contains 'SMITH,JOE R'...
> >
> > do ULcase-Format ($name)
> >
> > $name will now contain... 'Smith,Joe R'
> >
> > Actually, this isn't really a PeopleSoft 'Name' formatter... I use it
> > for various requirements... addresses for example...
> >
> > 'NEW YORK'         converts to 'New York'...
> > '123 SOUTH STREET' converts to '123 South Street'...
> > '12 N.LAKE ST.'    converts to '12 N.Lake St.'
> >
> > It simply forces any character to uppercase that follows a blank, comma
> > or period (add additional symbols if needed)... The primary use for this
> > routine is converting Mainframe data to PeopleSoft...
> >
> > Here's the routine...
> >
> > !**********************************************************************
> > !*       Upper/Lower Case Formatting                                  *
> > !**********************************************************************
> >
> > begin-procedure ULcase-Format(:$ULstring)
> >
> > let $ULdata      = $ULstring
> >
> > lowercase $ULdata
> >
> > let #ULlen       = length($ULdata)
> > let $ULstring    = ''
> > let #pos         = 1
> >
> > let $ULprev      = ' '
> >
> > while #pos      <= #ULlen
> >
> >    let $ULchar   = substr($ULdata, #pos, 1)
> >
> >    if  instr(' ,.',$ULprev,1) > 0
> >        uppercase $ULchar
> >    end-if
> >
> >    let $ULstring = $ULstring || $ULchar
> >    let $ULprev   = $ULchar
> >    let #pos      = #pos + 1
> >
> > end-while
> >
> > end-procedure
> >
> > !**********************************************************************
> >
> > This routine is simple but effective...
> >
> >                                            -Tony DeLia
> >
> >
> >
> > Hope, Sandra wrote:
> > >
> > > Is there a way to capture the existing PeopleSoft Name format validation
> > > within an SQR so that data being converted or data already converted
> > (via
> > > SQR) goes through the PS name format test ?
> > >
> > > Thanks All.
> > >
> > > Sandra Hope
> > > DynCorp
> > > hopes@dyncorp.com
> > > New Phone:   (703) 264-8674
> > >
> > > RESYSTEMIZATION
> > > PeopleSoft
> > >
> > > Sandra Hope
> > > DynCorp
> > > hopes@dyncorp.com
> > > New Phone:   (703) 264-8674
> > >
> > > RESYSTEMIZATION
> > > PeopleSoft
> >
> > --
> > Tony DeLia
> > AnswerThink Consulting Group
> > PeopleSoft Solutions Practice - Delphi Partners
> > tdelia@erols.com
> >

-- 
Tony DeLia
AnswerThink Consulting Group
PeopleSoft Solutions Practice - Delphi Partners
tdelia@erols.com
!**********************************************************************
!*                                                                    *
!*       MODULE:  TDPSNAME.SQC                                        *
!*       AUTHOR:  TONY DELIA.                                         *
!*         DATE:  01/12/1999.                                         *
!*       SYSTEM:  TD SQR UTILITY SERIES.                              *
!*         DESC:  PEOPLESOFT NAME FORMAT VALIDATION.                  *
!*                                                                    *
!**********************************************************************
!*                                                                    *
!*         NOTE:  FOR THE MOST PART THIS MATCHES THE ONLINE 'NAME'    *
!*                VALIDATION WITHIN THE PEOPLESOFT PANELS. THERE MAY  *
!*                BE SOME ODD CONDITIONS THAT MAY RESULT. PEOPLESOFT  *
!*                ALLOWS THE NAMES 'X,.', 'X,,.' AND 'X,,,.' BUT DOES *
!*                NOT ALLOW 'X,,,,.' TO BE ENTERED. THE PURPOSE OF    *
!*                THIS ROUTINE ISN'T TO FUNCTION IDENTICALLY WITH     *
!*                PEOPLESOFT... RATHER TO PERFORM REALISTIC NAME      *
!*                VALIDATIONS. CUSTOMIZE AS NEEDED.                   *
!*                                                                    *
!**********************************************************************
!*                                                                    *
!*        USAGE:  let $w_name = 'SMITH,JOHN R'                        *
!*                do  TD-Psoft-Name($w_name, $okay)                   *
!*                if  $okay   = 'N'                                   *
!*                    show 'Invalid: ' $w_name                        *
!*                end-if                                              *
!*                .                                                   *
!*                #Include 'tdpsname.sqc'                             *
!*                                                                    *
!**********************************************************************
!*                                                                    *
!*                BASIC FORMATTING RULES                              *
!*                                                                    *
!*      Rule #1 - Comma must exist in Name (BUT Not in Pos.1)         *
!*      Rule #2 - Space cannot exist after comma                      *
!*      Rule #3 - Name cannot end in comma                            *
!*      Rule #4 - Validate Character Set                              *
!*                                                                    *
!**********************************************************************
!*                                                                    *
!*     EXAMPLES:  Name                                 Okay?   Rule#  *
!*                -----------------------------------  ------  -----  *
!*                SMITH,JOHN R.                        Y              *
!*                Smith,John R.                        Y              *
!*                JOHN R. SMITH                        N       1      *
!*                ,SMITH                               N       1      *
!*                SMITH, JOHN R.                       N       2      *
!*                SMITH,                               N       3      *
!*                SMITH,JOHN,                          N       3      *
!*                SMITH,JOHN?                          N       4      *
!*                SMITH,JOHN.                          Y              *
!*                1,2                                  Y              *
!*                SMITH,,,.                            Y              *
!*                                                                    *
!*                Notice some of the "oddball" scenarios that pass    *
!*                validation... This occurs directly in PeopleSoft.   *
!*                                                                    *
!**********************************************************************

!**********************************************************************
!*       PeopleSoft Name Validation                                   *
!**********************************************************************
!*       [lastname] [suffix], [prefix] [firstname] [middle/initial]   *
!**********************************************************************

begin-procedure TD-PSoft-Name($PS_name, :$PS_status)

!  Construct Valid Character String - Expand As Needed
if $_PS_values       = ''

   let $_PS_quote    = ''''
   let $_PS_upper    = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
   let $_PS_lower    = 'abcdefghijklmnopqrstuvwxyz'
   let $_PS_number   = '0123456789'
   let $_PS_intl     = ''                     ! International Sample
   let $_PS_special  = ' .-,'         || $_PS_quote

   let $_PS_values   = $_PS_upper     ||
                       $_PS_lower     ||
                       $_PS_number    ||
                       $_PS_intl      ||
                       $_PS_special

end-if

!   Prepare For Validation
let $PS_status       = 'N'
let #len             = length($PS_name)
let #pos             = instr($PS_name, ',', 1)

!   Rule #1 - Comma must exist in Name (BUT Not in Pos.1)
if  #pos > 1

    !   Rule #2 - Space cannot exist after comma
    if substr($PS_name, #pos + 1, 1) <> ' '

       !  Rule #3 - Name cannot end in comma
       if substr($PS_name, #len, 1) <> ','

          !   Rule #4 - Validate Character Set (see above)

          let $PS_status   = 'Y'

          let #pos         = 1

          while #pos      <= #len

              let $PS_char = substr($PS_name, #pos, 1)

              if  instr($_PS_values, $PS_char, 1) = 0

                  let $PS_status  = 'N'       ! Invalid - Set Status
                  let #pos        = #len      ! Break Out of Loop

              end-if

              let #pos = #pos + 1

          end-while

      end-if
   end-if
end-if

end-procedure

!**********************************************************************