main function

You are recommended to include this code in your application.

It initializes the CICS® Foundation Classes correctly, provides default exception handling, and releases allocated memory after it is finished. You may substitute your own variation of this main function, but this should rarely be necessary.

Source file: ICCMAIN
The stub has three functions:
  1. It initializes the Foundation Classes environment. You can customize the way it does this by using #defines that control:
  2. It provides a default definition of a class IccUserControl, derived from IccControl, that includes a default constructor and run method.
  3. It invokes the run method of the user's control object using a try-catch construct.
The following information is the functional part of the main code:
 int main()                                           1 
 
 {
     Icc::initializeEnvironment(ICC_CLASS_MEMORY_MGMT,     2 
 
                                ICC_FAMILY_SUBSET,
                                ICC_EDF_BOOL);
     try                                                   3 
 
     {
         ICC_USER_CONTROL control;                         4 
 
         control.run();                                    5 
 
     }
     catch(IccException& exc)                              6 
 
     {
         Icc::catchException(exc);                         7 
 
     }
     catch(…)                                            8 
 
     {
         Icc::unknownException();                          9 
 
     }
     Icc::returnToCICS();                                  10 
 
 }
 1 
This is the main C++ entry point.
 2 
This call initializes the environment and is essential. The three parameters have previously been defined to the defaults for the platform.
 3 
Run the user's application code, using try and catch, in case the application code does not catch exceptions.
 4 
Create control object.
 5 
Invoke run method of control object (defined as pure virtual in IccControl.
 6 
Catch any IccException objects not caught by the application.
 7 
Call this function to abend task.
 8 
Catch any other exceptions not caught by application.
 9 
Call this function to abend task.
 10 
Return control to CICS.