ALPHA(x,n) 

ALPHA(x,n) is a string function that enables a character x in ASCII or EBCDIC code ( code tables) to be converted to a different one or two-character representation in the DEFAULTMAP ( mapchar_set_name). ALPHA(x,n) is used to define the sort sequence.

The function ALPHA(x,n) uses the MAPCHAR(x,n,i) function internally (where i is the DEFAULTMAP) and also performs a conversion to uppercase letters ( UPPER(x)).

The parameter n is optional and specifies the maximum length of the result.

 

Result of the ALPHA(x,n) function

ALPHA(x,n)

UPPER(MAPCHAR(x,n,DEFAULTMAP))

 

The function ALPHA enables an appropriate sort, e.g. if "ü" is to be treated for as "UE" sorting purposes. The MAPCHAR SET with the name DEFAULTMAP is used.

SELECT...,ALPHA(<column name>) sort,...FROM...ORDER BY sort