msg_sprintf()

Return message text from a message catalog.

Syntax

msg_sprintf(message_ID, [argument_1, argument_2...argument_N])

Parameter

Parameter

Definition

message_ID

integer that identifies a message that you want this function to return

argument_1... argument_N

values that replace variables or control characters in the text of the message

Description

The msg_sprintf() function returns the text of a message. This function is very similar to sprintf(), but msg_sprintf() returns information from the message catalog while sprintf() returns information that you supply. 

The parameters that you use with msg_sprintf() supply information that the message catalog cannot provide. Themessage_ID identifies which message you want to return. The optional arguments provide values for variables or control characters that exist in the message text. For example, the %d character sequence represents a signed decimal. If a message contains %d in its text, you must supply a signed decimal value as an argument to msg_sprintf(). When this function returns the message, the decimal (provided by you) replaces the %d. The variables and control characters in these messages follow the same rules as the format parameter of the sprintf() function. See sprintf()

When msg_sprintf() cannot find a message ID or message catalog, it returns the following error message:

CATALOG: XXX/XXX, MSGNUM: XXX

The operations of the msg_sprintf() function can occur on a PATROL Console or PATROL Agent. Calling msg_sprintf() from a menu command on the console, for example, would run this function on the console. Calling it from a PSL script in the agent, on the other hand, would run this function on the agent. For this reason, you have to make the message catalog available to the component that runs the msg_sprintf() function.

Note

This function provides support for internationalized PSL scripts. For more information about internationalization, see Internationalized PSL Scripts.

Example

The following example shows the msg_sprintf() function:

variable_1=msg_sprintf(BMC_KM_ORACLE_ALL_OK,threads_num,host_name);

The BMC_KM_ORACLE_ALL_OK argument is the ID for the following message:

Everything is OK. Total %d threads on host %s.

The msg_sprintf() function replaces the %d and %s characters with the values from the threads_num and host_name variables. It then returns the preceding message and stores it in variable_1.

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

Comments