Figure 1 shows how to call Error_Extract to return error
information for an asynchronous call to a conversation service:
Figure 1. Example Use of Error_Extract Service, Asynchronous (figure continued)/*******************************************************************/
/* Call the APPC/MVS LU6.2 Allocate service. Specify a */
/* Notify_type of ECB to request asynchronous processing. */
/*******************************************************************/
CALL ATBALLC(Conversation_type,
Sym_dest_name,
Partner_lu_name,
Mode_name,
TP_name_length,
TP_name,
Return_control,
Sync_level,
Security_Type,
User_ID,
Password,
Profile,
User_token,
Conversation_ID,
Notify_type, /* Specifies a value of ECB */
TP_ID,
Return_code);
/*******************************************************************/
/* Check the return code that APPC/MVS returns to the caller. */
/* */
/* * If an error occurred on the call (indicated by an error */
/* return code from APPC/MVS), call the */
/* Error_Extract service to obtain a reason code and error */
/* message, and write the error message to the output stream. */
/* */
/* * If no errors occurred on the call (indicated by an error */
/* return code from APPC/MVS, call a procedure that contains */
/* assembler code to wait on the ECB. If an error occurs */
/* while processing the service, call Error_Extract. */
/*******************************************************************/
IF Return_code ^= atb_ok THEN
BEGIN
CALL Report_error (Conversation_ID) ;
END;
ELSE
BEGIN
CALL Wait_processing (Notify_ECB);
IF Notify_ECB.completion_code > 0 THEN
CALL Report_error (Conversation_ID) ;
END;
RETURN;
Figure 2. Example Use of Error_Extract Service, Asynchronous/*******************************************************************/
/* Call procedure Report_Error to report an error in the call */
/* to the Allocate service. If the call to Report_Error is */
/* successful, it writes the following to the output stream: */
/* * The name of the callable service in error */
/* * The error message from Error_Extract */
/* * Error log data, if it is available */
/*******************************************************************/
Report_Error: Procedure (Conv_id);
BEGIN;
CALL ATBEES3(Conversation_id,
Service_Name,
Service_Reason_Code,
Message_Text_Length,
Message_Text,
Error_Log_Product_Set_ID_Length,
Error_Log_Product_Set_ID,
Error_Log_Information_Length,
Error_Log_Information,
Reason_Code,
Return_Code);
IF Return_code = 0 THEN
BEGIN
DISPLAY (Service_Name) ;
/*****************************************************/
/* If the call to Error_Extract is successful, */
/* write the message text returned by Error_Extract */
/* to the output stream. In this example, only */
/* messages with a length of 126 characters or less */
/* are displayed (126 is the maximum message length */
/* that DISPLAY can handle.) You might want to */
/* display more of the message text with multiple */
/* DISPLAY statements. */
/*****************************************************/
IF Message_Text_Length <= 126 THEN
DISPLAY (Message_Text) ;
/*****************************************************/
/* If the partner TP provided a product set ID, */
/* write it to the output stream. In this example, */
/* we display only the software product name from */
/* the subvector that contains the product set ID. */
/* Your TP can extract parts of the product */
/* set ID as desired. */
/*****************************************************/
IF Error_Log_product_set_ID_length > 0 THEN
CALL Extract_Software_Product_Name (Error_log_product_set_ID,
Product_name_length,
Product_name);
/*****************************************************/
/* Write the software product name to the output */
/* stream. This example program displays up */
/* to 126 characters in the name (it is the maximum */
/* length that DISPLAY can handle). */
/* Your TP might want to display more */
/* characters with multiple DISPLAY statements. */
/*****************************************************/
IF Product_name_length <= 126 THEN
DISPLAY (Product_name) ;
/*****************************************************/
/* If the partner TP or system provided error log */
/* data, write it to the output stream. This example */
/* displays up to 126 characters of log data (it is */
/* the maximum length that DISPLAY can handle). */
/* Your TP might want to display more */
/* characters with multiple DISPLAY statements. */
/*****************************************************/
IF Error_Log_Information_Length > 0 THEN
IF Error_Log_Information_Length <= 126 THEN
DISPLAY (Error_Log_Information) ;
END;
ELSE
DISPLAY ('APPC/MVS Error Extract Service failed') ;
END; /* End of Report_Error procedure */