Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 15 Preparing the Environment, Analyzing Returned Values, and Modifying Changes : How to Analyze the Return and Reason Codes, and Returned Message

How to Analyze the Return and Reason Codes, and Returned Message
After every call to HRNHLLTM you should check the return code to ensure that the operation was successful. The Call Level Interface return code is set in the eighth parameter to HRNHLLTM (HRN-RETURN-CODE in the COBOL examples, CODE in the assembler examples). Possible values of return codes and reason codes and their meanings are listed in Call Level Interface Return Codes and in Call Level Interface Reason Codes.
Evaluation of the Return and Reason Codes
The return and reason codes are evaluated as follows:
If the return code is not zero, either a numeric reason code is returned, or a message string is returned in the seventh parameter (S6BRETURN-DATA in the COBOL examples, DATA in the assembler examples).
If the first byte of the reason code is not zero, a printable message string of length 129 is returned. This message is the ENDMSG—a short error message that typically appears at the bottom of the workbench during an online TIBCO Object Service Broker session.
Capturing the Returned Values
Alternatively, you can use the MESSAGE_LOG tool to capture a message log and place it in a TDS table for later viewing. This is an appropriate technique during application development and debugging. You can also capture relevant parts of the message log and place it in a commarea to pass back to the COBOL program. This requires the ability to predict the error and handle it in your client program, but it is appropriate for error handling in a production system.
Examples
The following two examples show how you can analyze and display the return code, reason code, and returned message.
Analyzing and Displaying in COBOL

 
OSB-STATUS.
DISPLAY 'CHECKING OSB STATUS'.
IF OSB-CALL-OK
NEXT SENTENCE
ELSE
IF REASON-CODE-EXISTS
DISPLAY '***************************************'
DISPLAY '*** Unsuccessful API Call ***'
DISPLAY '***************************************'
DISPLAY 'HRN-RETURN-CODE = ' HRN-RETURN-CODE
DISPLAY 'HRN-REASON-CODE = ' HRN-REASON-CODE
STOP RUN
ELSE
DISPLAY '***************************************'
DISPLAY '*** Unsuccessful OSB Call ***'
DISPLAY '***************************************'
DISPLAY 'HRN-RETURN-CODE = ' HRN-RETURN-CODE
DISPLAY 'HRN-RETURN-DATA = ' HRN-RETURN-DATA
STOP RUN.
OSB-STATUS-EXIT.
EXIT.

 
Analyzing and Displaying in Assembler

 
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
* *
* SUBROUTINE - WRITE OUTPUT *
* *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
S2SHOWRC DS 0H
ST R14,STRLINK2 SAVE LINK REGISTER
*
MVC STROUREC,BLANKS BLANK OUTPUT AREA
MVC STRETURN,RETURNCO COPY 'RETURN CODE='
L R1,HAPRCODE GET RETURN CODE ADDRESS
HEXCHAR 2(R1),STRETCOD,2
*
L R1,HAPRDATA GET REASON CODE ADDRESS
CLI 0(R1),X'00' REASON CODE?
BNE S2SHPUT1 NO, JUST PRINT THE RETURN CODE
*
MVC STREASON,REASONCO COPY 'REASON CODE='
HEXCHAR 2(R1),STREACOD,2
*
S2SHPUT1 DS 0H
ADRMODE 24 USE AMODE(24) FOR PUT REQUEST
PUT (OUTREG),STROUREC
ADRMODE 31 RESTORE AMODE(31)
*
L R1,HAPRDATA GET REASON CODE ADDRESS
CLI 0(R1),X'00' WAS IT REASON CODE?
BE S2SDATAO YES, DONE
*
MVC STRRDATA,RETURNDA COPY 'RETURN DATA='
MVC STRETDAT,0(R1) COPY RETURN DATA
MVC RETDATA(80),BLANKS BLANK OUTPUT AREA
*
ADRMODE 24 USE AMODE(24) FOR PUT REQUEST
PUT (OUTREG),STROUREC
ADRMODE 31 RESTORE AMODE(31)
*
S2SDATAO DS 0H

 

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved