Example: Inserting an Exit Point in a Function

This example illustrates the use of a return value for the function to control statement execution:

   ID         idReturn        = ER_SUCCESS;
/**************************************************************
 * Main Processing
 **************************************************************/
   memset( (void *)(&dsInfo), 0x00, sizeof(DSX51013_INFO) );
   idReturn = X51013_VerifyAndRetrieveInformation( lpBhvrCom,
                                                   lpVoid,
                                                   lpDS,
                                                   &dsInfo );
 /** Check for Errors and Company or Job Level Projections **/
 if ( (idReturn == ER_SUCCESS) &&
      (lpDS->cJobCostProjections == _J('Y')) )
 {
    /** Process All Periods between the From and Thru Dates **/
    while ( (!dsInfo.bProcessed) &&
            (idReturn == ER_SUCCESS) )
    {
        /** Retrieve Calculation Information **/
        if ((dsInfo.bRetrieveBalance) && (idReturn == ER_SUCCESS))
        {
           idReturn = X51013_RetrieveAccountBalances( lpBhvrCom,
                                                       lpVoid,
                                                       lpDS,
                                                       &dsInfo );
        }
        if (idReturn == ER_SUCCESS)
        {
           statement;
        }
    } /* End Processing */
 }

/***************************************************************
 * Function Clean Up
 ***************************************************************/
   if ( (dsInfo.hUser) != (HUSER) NULL )
   {
      statement;
   }

   return idReturn;