Tutorial Toolkit Function Descriptions > User Interface > Error Message Handling
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''">   
Error Message Handling
A consistent method is provided to handle error messages in PCL through the message facility. It is based around a set of utilities and a unified index to a separate database (messages.database) which contains the actual text strings corresponding to each unique error code (1->2**31). Also provided with the message facility is a set of forms to display the errors (Use msg_to_form to invoke this for internally generated errors). Since the user cannot add to the text strings in messages.database, user_message is provided to allow access to the same forms.
 
appcode
( status )
Description:
Return the multiple of 1000000 ignoring the remainder of status. Used to determine the application which originated the error status code.
Input:
INTEGER
status
Application error status code.
Output:
INTEGER
<Return Value>
Return status of operation.
Example:
Please see appcode (p. 309) in the MSC Acumen Toolkit - Code Examples.
 
app_db_err_msg
( domesg, db_routine, caller, status, id )
Description:
Handle a database error.
Input:
LOGICAL
domesg
Error message flag: If TRUE, this routine will issue a message if an error is encountered.
STRING
db_routine[]
Name of the database routine that detected the error.
STRING
caller[]
Name of the routine that called the database routine.
INTEGER
status
Database status code.
INTEGER
id
Id of item causing the error.
Output:
none
Example:
Please see app_db_err_msg (p. 304) in the MSC Acumen Toolkit - Code Examples.
 
msg_format_string
( msgcode, ints, reals, chars, string )
Description:
PCL interface to Message Utility for getting message into string(s).
Input:
INTEGER
msgcode
Message code to look up.
INTEGER
ints()
Integer array for formatting.
REAL
reals()
Real array for formatting.
STRING
chars[]
Character array start for formatting.
Output:
STRING
string[]
String containing the resulting message.
INTEGER
<Return Value>
This function returns the number of characters in the string returned in the output value string.
Example:
Please see msg_format_string (p. 320) in the MSC Acumen Toolkit - Code Examples.
 
msg_get_application
( msgcode )
Description:
Get Application code embedded in a message code.
Input:
INTEGER
msgcode
Message code to look up.
Output:
INTEGER
<Return Value>
Application code extracted from msgcode.
Example:
Please see msg_get_application (p. 322) in the MSC Acumen Toolkit - Code Examples.
 
msg_string_more
( string )
Description:
Get next piece of message string.
Input:
none
Output:
STRING
string[]
Return string containing up to the total number of characters in the message string. The string can be declared to any length.
INTEGER
<Return Value>
Number of characters left.
Example:
Please see msg_string_more (p. 323) in the MSC Acumen Toolkit - Code Examples.
 
msg_to_file
( msgcode, msgtype, appcode, ints, reals, chars, maxout, unit )
Description:
Output a message to a PCL fio unit.
Input:
INTEGER
msgcode
Message code to look up.
INTEGER
msgtype
Message type.
INTEGER
appcode
Application code for calling application.
INTEGER
ints()
Integer array for formatting.
REAL
reals()
Real array for formatting.
STRING
chars[]
Character array (Fortran style) for formatting.
INTEGER
maxout
Maximum output size in string.
INTEGER
unit
Channel from TEXT_OPEN call.
Output:
INTEGER
<Return Value>
Number of characters left.
Example:
See example for msg_string_more, 117. See also msg_to_file (p. 324) in the MSC Acumen Toolkit - Code Examples.
 
msg_to_string
( msgcode, msgtype, appcode, ints, reals, chars, string )
Description:
Interface to Message utility to retrieve Message from message database.
Input:
INTEGER
msgcode
Message code to look up.
INTEGER
msgtype
Message type.
INTEGER
appcode
Application code for calling application.
INTEGER
ints()
Integer array for formatting.
REAL
reals()
Real array for formatting.
STRING
chars[]
Character array for formatting.
Output:
STRING
string[]
String to return first part of message in to.
INTEGER
<Return Value>
Number of characters left in string.
Example:
Please see msg_to_string (p. 326) in the MSC Acumen Toolkit - Code Examples.
 
user_message
( type, appcode, appname, message )
Description:
Display a user message with the MSC.Patran user interface and possibly wait for and return a reply. The “type” determines whether the message is displayed in a form or simply output to the history window. The “type” also determines what buttons are available in the form. The “appcode” is a number assigned by the programmer which can be used in conjunction with ui_answer_message and ui_override_message to supply the message response during session file playback. Use of duplicate application codes will not generally cause problems but it is better if they are unique.
Input:
STRING
type[]
Type of message format desired. May be:
“Info” Informative message
“Warn” Warning message
“Error” Error/Fatal message
“Ack” Acknowledgment message
“Q_YN” -Yes/No Query w/o default
“Q_YN_Y” -Yes/No Query Yes default
“Q_YN_N” -Yes/No Query No default
“Q_YNY” -Yes/No/YesAll Query w/o default
“Q_YNY_N” -Yes/No/YesAll Query No default
“Q_YNYN” -Yes/No/YesAll/NoAll Query w/o default
“Q_YNYN_Y” -Yes/No/YesAll/NoAll Query Yes default
“Q_YNYN_N” -Yes/No/YesAll/NoAll Query No default
“C_YN” -Yes/No Critical w/o default
“C_YN_Y” -Yes/No Critical Yes default
“C_YN_N” -Yes/No Critical No default
“C_YNY” -Yes/No/YesAll Critical w/o default
“C_YNY_N” -Yes/No/YesAll Critical No default
“C_YNYN” -Yes/No/YesAll/NoAll Critical w/o default
“C_YNYN_Y” -Yes/No/YesAll/NoAll Critical Yes default
“C_YNYN_N” -Yes/No/YesAll/NoAll Critical No default
INTEGER
appcode
Application message code, unique value.
STRING
appname[]
Name of the application generating the message.
INTEGER
message[]
Message to display.
Output:
INTEGER
<Return Value>
1=Yes, 2=No, 3=Yes All, 4=Abort, 5=No All.
Example:
Please see user_message (p. 390) in the MSC Acumen Toolkit - Code Examples.
 
notemessage.text
( label, message )
Description:
Simple note message form with Ok button.
Input:
STRING
label[]
Form label.
STRING
message[]
Message text (Include \n for new line).
Output:
none
Example:
Please see notemessage.text (p. 328) in the MSC Acumen Toolkit - Code Examples.