About NUMSORTCHAR Field Padding

The NUMSORTCHAR numeric pad process default specifies what kind of padding should be applied to fields that contain NUMSORTCHAR data type values, and where. This process default applies only when you have a NUMSORTCHAR data type that uses either a numeric value only, or the <alphaPrefix><numericSuffix> format, where:

  • alphaPrefix is a character prefix consisting of one or more alphabetic characters.
  • numericSuffix is a character suffix consisting of one or more numeric characters.

To fill out any space remaining in a field with the designated padding character, you can apply padding:

  • Before the numeric value, where only a numeric value is specified (LEFTPAD).
  • Between the alphabetic prefix and numeric suffix (PAD), where the <alphaPrefix><numericSuffix> format is used.
  • Before the alphabetic prefix, (LEFTPAD).
    Note:  The LEFTPAD setting takes effect only if:
    • There is no alphabetic prefix.
    • There is an alphabetic prefix, LEFTPAD is set, and PAD is set to null; in other words, if PAD is set to PAD() or PAD(''), with no character specified between parentheses or the single quotation marks.

You can use either type of padding without the other, or you can use both types together. When using both, separate the entries with a comma.

Also, when using both, you can specify different padding characters for PAD and LEFTPAD.

If no padding character is specified, then the default padding characters are used:

  • PAD - Zero (0) is used as the default padding character between the alphabetic prefix and the numeric suffix.  
  • LEFTPAD - A space is used as the left padding character, if applicable.

Formats for Padding Values

Possible padding values include:

  • PAD(x) and/or LEFTPAD(y), where x/y is any alphanumeric character.
  • PAD('x') and/or LEFTPAD('y'), where x/y is any alphanumeric character.

    This option is useful in cases where you want to specify a space as the pad character.

  • PAD() and/or LEFTPAD(), where no pad character is specified.

    Use this option when you do not want to use the any padding at all for one or the other or both.

    Note:  Using this option is different from not specifying one option or the other. In other words, using this option does not result in default padding characters being used. No visible padding character at all is used. If you specify null values for both PAD and LEFTPAD, the LEFTPAD default pad character (a space) is still used.

Examples

If an <alphaPrefix><numericSuffix> format is specified for a field with a length of 10 characters, and the value T455 is entered, by default (with this process default not set), the system displays it as T000000455, with no left padding.

If the same value is entered with this process default set to: Then the field displays this:
PAD(0) T000000455

(Same as default behavior)

PAD() or PAD('')  

[PAD character specified as null, no LEFTPAD specified]

            T455
PAD(z) Tzzzzzz455
LEFTPAD(0)

(No PAD value set)

T000000455

(Same as default behavior)

LEFTPAD(0)

and value in field is numeric only (for example, 455)

0000000455
LEFTPAD()

and value in field is numeric only (for example, 455)

              455

(Same as the default behavior when there is no alphabetic character specified. In this case, the left padding consists of spaces.)

PAD(''), LEFTPAD(0) 000000T455 
PAD(0), LEFTPAD(#) T000000455 

(Same as default behavior, LEFTPAD is ignored in this case.)

Related topics