Gen 8.6 Online No Display Procedure ending with Exit State type "Error"
search cancel

Gen 8.6 Online No Display Procedure ending with Exit State type "Error"

book

Article ID: 397688

calendar_today

Updated On:

Products

Gen Gen - Run Time Distributed Gen - Workstation Toolset

Issue/Introduction

What happens when the Online no display Procedure finishes with an Exit State set to one with the type of "Error" ?

For Windows Gen modules with display, the window manager code displays a dialog box with the message from the Exit State displayed.

For Batch packaged modules, messages are written to the TIRMSGF  DD statement along with other "progress type" information like the following:

     CLX6550B EXECUTION BEGINS                                  
     PROCEDURE STEP CALLED          CLX6551B_PS_ICD_DAILY_INTRFC
     EXIT FROM PROCEDURE STEP - MESSAGE ON NEXT LINE            
     Program aborted.  Please check sysout message.             
     EXIT STATE IS WITH ABEND                                   

When the Procedure finishes and a non-error exit state has been set, the message in that DD is 

     CLX6550B EXECUTION BEGINS                                  
     PROCEDURE STEP CALLED          CLX6551B_PS_ICD_DAILY_INTRFC
     EXIT FROM PROCEDURE STEP - MESSAGE ON NEXT LINE            
     This process was completed successfully.                   
     EXIT STATE CAUSES NO FLOWS - END OF JOB                    

There are not any messages like this in the aelog.tmp file or any other file created when running these online packaged executables in Windows.

Does the Dialog Manager write any type of message while it's executing or at the end of executing the Procedure Step program?

If so, where would we find those messages?   If not, is it up to the application code in this one instance to determine what type of exit state has been set when exiting the Procedure?

Along these same lines, in z/OS, the Batch Manager sets a Return Code at the end of execution that is a common way of determining process outcomes on the mainframe.  Does the Dialog Manager set any system type variable in Windows that can be interrogated once the execution finishes which would be the equivalent of the Return Code on the Mainframe?

Resolution

For Windows OnLine No-Display Load Modules, there is no return code returned from the execution.

Even though the aelog.tmp file is generated due to a termination (ie Database failure), the exit state number is not written.

There is a User Exit (TIRTERMA) that can be used to customize the handling of runtime errors.  It is within this user exit that the exit state can be obtained.  There is limited documentation on the use of this exit.  With the use of the header tirterm.h, the value of the exit state can be obtained..

 

The following is example code for TIRTERMA.c that will output the exit state information to a file.

 

/**************************************************************
***                                                         ***
***  CA Gen                                                 ***
***  Copyright (C) 2016 CA. All rights reserved.            ***
***                                                         ***
**************************************************************/
 
/***************************************************************
*                                                              *
*    This is the user termination exit.  It is called          *
*    by the runtime module "TIRFAIL".  It allows the user      *
*    to customize the handling of runtime errors.              *
*                                                              *
*    The supplied default action for this module is to         *
*    return a status code of spaces, indicating that this      *
*    module did nothing and that the default error handling    *
*    provided by TIRFAIL is to be used.                        *
*                                                              *
***************************************************************/
 
#include <tirterm.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
/*
Customized to print most of the fields found in the term_pb
structure
*/
 
void
PRINTSTR(FILE* fp,
        char *field_name,
char *field_string,
int  size)
{
   char msgbuf[128];
   
   fprintf(fp, "%s : ",field_name);
   memset(msgbuf, '\0', 128);
   memcpy(msgbuf, field_string, size);
   fprintf(fp, msgbuf);
   fprintf(fp, "\n");
}
 
void
TIRTERMA(char * rp1,
         char * rp2,
         struct term_pb * pb)
{
    FILE* out_fp = NULL;
char outfile[100];
char msg[128];
int i;
strcpy(outfile, "exit_status.out");
out_fp = fopen(outfile, "w");
sprintf(msg,"Termination Info\n");
fprintf(out_fp, msg);
sprintf(msg,"================\n");
fprintf(out_fp, msg);
 
    PRINTSTR(out_fp, "term_default_msg", pb->term_default_msg, 78);
    PRINTSTR(out_fp, "term_system_printer", pb->term_system_printer, 8);
    PRINTSTR(out_fp, "term_error_action_name", pb->term_error_action_name, 32);
    PRINTSTR(out_fp, "term_action_id", pb->term_action_id, 10);
    PRINTSTR(out_fp, "term_attribute_id", pb->term_attribute_id, 10);
    PRINTSTR(out_fp, "term_status_flag", pb->term_status_flag, 2);
    PRINTSTR(out_fp, "term_last_status", pb->term_last_status, 2);
    PRINTSTR(out_fp, "term_last_statement_num", pb->term_last_statement_num, 10);
    PRINTSTR(out_fp, "term_curr_ab_id", pb->term_curr_ab_id, 10);
    PRINTSTR(out_fp, "term_curr_ab_name", pb->term_curr_ab_name, 32);
    PRINTSTR(out_fp, "term_version_ind", pb->term_version_ind, 8);
    PRINTSTR(out_fp, "term_ief_command", pb->term_ief_command, 80);
    PRINTSTR(out_fp, "term_ief_trancode", pb->term_ief_trancode, 8);
    PRINTSTR(out_fp, "term_exit_state", pb->term_exit_state, 11);
    PRINTSTR(out_fp, "term_exit_infomsg", pb->term_exit_infomsg, 80);
    PRINTSTR(out_fp, "term_user_id", pb->term_user_id, 8);
    PRINTSTR(out_fp, "term_terminal_id", pb->term_terminal_id, 8);
    PRINTSTR(out_fp, "term_printer_id", pb->term_printer_id, 8);
    PRINTSTR(out_fp, "term_dialog_message_num", pb->term_dialog_message_num, 3);
    PRINTSTR(out_fp, "term_dialect_name", pb->term_dialect_name, 8);
    PRINTSTR(out_fp, "term_failure_message_text", pb->term_failure_message_text, 78);
 
sprintf(msg,"term_fail_type: %c\n",pb->term_fail_type);
fprintf(out_fp, msg);
sprintf(msg,"term_error_encountered_sw: %c\n",pb->term_error_encountered_sw);
fprintf(out_fp, msg);
sprintf(msg,"term_view_overflow_sw: %c\n",pb->term_view_overflow_sw);
fprintf(out_fp, msg);
sprintf(msg,"term_eabpcb_cnt: %d\n",pb->term_eabpcb_cnt);
fprintf(out_fp, msg);
sprintf(msg,"term_errinfo_msg_size: %d\n",pb->term_errinfo_msg_size);
fprintf(out_fp, msg);
 
    for (i = 0; i < 24; i++)
    {
        PRINTSTR(out_fp, "term_output_message[]", pb->term_output_message[i], 78);
    }
 
    fclose(out_fp);
    pb->term_status_code = DID_ALL;         /* did everything here, so no need for the aelog.tmp file  */
}

 

 

Additional Information