ICC$HEL (IHEL)

This is the C++ Hello World sample. This example writes a simple message to the CICS® terminal and shows how to get started with CICS OO programming.

Overview of the foundation classes is a more formal introduction and you should read it before you attempt advanced OO programming.

Running the sample applications

The sample programs are supplied as source code in library CICSTS54.CICS.SDFHSAMP and before you can run the sample programs, you need to compile, pre-link and link them. To do this, use the procedure ICCFCCL in data set CICSTS54.CICS.SDFHPROC.

ICCFCCL contains the Job Control Language needed to compile, pre-link and link a CICS user application. Before using ICCFCCL you may find it necessary to perform some customization to conform to your installation standards. See also Compiling programs.

Sample programs such as ICC$BUF, ICC$CLK and ICC$HEL require no additional CICS resource definitions, and should now execute successfully.

Other sample programs, in particular the DTP samples named ICC$SES1 and ICC$SES2, require additional CICS resource definitions. Refer to the prologues in the source of the sample programs for information about these additional requirements.

C++ sample

The source for this program can be found in sample ICC$HEL. There are a series of program fragments interspersed with commentary.
#include "icceh.hpp"
#include "iccmain.hpp"

The first line includes the header file, ICCEH, which includes the header files for all the CICS Foundation Class definitions. Note that it is coded as "icceh.hpp" to preserve cross-platform, C++ language conventions.

The second line includes the supplied program stub. This stub contains the main function, which is the point of entry for any program that uses the supplied classes and is responsible for initializing them correctly. (See main function for more details). You are strongly advised to use the stub provided but you may in certain cases tailor this stub to your own requirements. The stub initializes the class environment, creates the program control object, then invokes the run method, which is where the application program should 'live'.
void IccUserControl::run()
{
The code that controls the program flow resides not in the main function but in the run method of a class derived from IccControl (see IccControl class). The user can define their own subclass of IccControl or, as here, use the default one – IccUserControl, which is defined in ICCMAIN – and just provide a definition for the run method.
    IccTerminal* pTerm = terminal();
The terminal method of IccControl class is used to obtain a pointer to the terminal object for the application to use.
    pTerm->erase();
The erase method clears the current contents of the terminal.
    pTerm->send(10, 35, "Hello World");
The send method is called on the terminal object. This causes "Hello World" to be written to the terminal screen, starting at row 10, column 35.
    pTerm->waitForAID();
This waits until the terminal user hits an AID (Action Identifier) key.
    return;
}

Returning from the run method causes program control to return to CICS.

                                  Hello World