Locale Categories

A locale category tells PATROL which locale to use with specific functions. The TIME locale category, for example, affects the following functions: asctime(), date(), and convert_locale_date(). These functions are referred to as TIME functions. If you set TIME to the ja_JP.SJIS locale, the TIME functions read, write, and display text in the ja_JP.SJIS locale.
The following table lists the locale categories.


Specifies the locale of the agent. CTYPE functions manipulate text strings. For more information, see CTYPE Locale Category.

Functions: code_cvt(), grep(), index(), length(), lines(), ntharg(), nthargf(), nthline(), nthlinef(), num_bytes(), rindex(), substr(),
tail(), tolower(), toupper(), trim()


Specifies the locale that PATROL uses to display messages. MESSAGES functions display messages to the user. For more information, see MESSAGES Locale Category.

Default Locale: Same as CTYPE

Functions: msg_check(), msg_get_format(), msg_get_severity(), msg_printf(), msg_sprintf(), dcget_text(), dget_text(), get_text(), text_domain()


Specifies the locale of the date and time format that you want to use with a PSL function. TIME functions read, write, format, or parse a date and time string. For more information, see TIME Locale Category.

Default Locale: Same as CTYPE

Functions: asctime(), date(), convert_locale_date()


Specifies the locale of text that you want to write, read, or display. CODECVT functions execute commands and read and write text. For more information, see CODECVT Locale Category.

Default Locale: Same as CTYPE

Functions: cat(), execute(), fopen(), popen(), read(), readln(), system, write()

The set_locale() function is the tool that you use to check and change the locale of a locale category. For example, asctime() can return a date or time in any locale. If you want it to return the date in the ja_JP.eucJP locale, use set_locale() to verify the TIME locale category. If set_locale() says that TIME is set to ja_JP.SJIS, use set_locale() again to change the locale of TIME to ja_JP.eucJP. For more information about set_locale(), see set_locale().

CTYPE Locale Category

The CTYPE locale category specifies the native locale of the PATROL Agent. You can use set_locale() to read the locale of CTYPE, but you cannot change it. CTYPE is the only nonwritable locale category. 

The agent can process only text that is in the locale of the CTYPE locale category so all string functions follow the rules of the CTYPE locale. Using the sort() function, for example, sorts a list of strings as they exist in the CTYPE locale. 

The value of CTYPE also serves as the default value of the other locale categories. When a PSL script executes, the initial value of the other locale categories is equal to the value of CTYPE.


CTYPE PSL functions support multiple-byte characters. See Multiple-Byte Characters. 

MESSAGES Locale Category

The MESSAGES locale category specifies the locale that PATROL uses to display messages to the user. An internationalized PSL script does not display messages directly to the user. Instead, the script has a message catalog for each locale that it supports. When the script displays a message, it uses an ID number to retrieve the message string from a catalog and displays the message to the user. The locale of MESSAGES tells PATROL which message catalog to use. For example, if the user reads the Chinese Simplified locale, the script verifies whether MESSAGES is set for the Chinese Simplified locale before displaying any messages.

CODECVT Locale Category

The CODECVT locale category specifies the locale of input and output text. Input text is text that PATROL reads from a channel or file, but it is also text that a command returns. Output text is text that PATROL writes to a channel or file.

Codeset Conversion

PATROL converts the codeset of any text identified by the CODECVT locale category if it does not match the locale of the agent (or CTYPE locale category). The conversion process is nearly automatic. The only step that you must perform in the conversion process is to verify that the CODECVT locale category is set correctly before using a CODECVT function.


You can only convert between codesets that represent the same language such as converting between ja_JP.eucJP and ja_JP.SJIS for Japanese or between zh_TW.big5 and zh_TW.eucTW for Chinese. 

For example, say that a PSL script exists on a different computer from the PATROL Agent. The operating system that hosts the script uses the ja_JP.SJIS locale, and the operating system for the agent uses ja_JP.eucJP. When the script executes the system() function, it returns an operating system message in the ja_JP.SJIS locale. In this example, you need to verify that the CODECVT locale category is set for ja_JP.SJIS before using system(). PATROL automatically converts the message string to the CTYPE or ja_JP.eucJP locale so that the agent can read the message.

Registered Locale for a Channel

The popen() and fopen() functions play a special role in locale conversion. These functions open a channel through which PATROL can input and output text. When you use popen() or fopen() to open a channel, the locale of the CODECVT locale category becomes the registered locale for the channel. A registered locale means that you cannot change the locale of the channel, but you can close the channel and open a new one with a different registered locale. If the registered locale is different from the CTYPE locale, PATROL automatically converts text during read and write operations to the channel.

TIME Locale Category

The TIME locale category specifies the date and time format of a text string that is returned from one of the following PSL functions: asctime(),date(), and convert_locale_date().

Where to go from here

Introduction to Internationalized PSL Scripts

Was this page helpful? Yes No Submitting... Thank you