Once a terminal connection to CICS® has been established, the CclTerminal, CclSession, CclScreen and CclField objects are used to navigate through the screens presented by the CICS server application, reading and updating screen data as required.
// Get access to the CclScreen object
CclScreen* screen = terminal.screen();
for ( int i=1; i ≤ screen->fieldCount(); i++ ) {
CclField* field = screen->field(i); // get field by index
if ( field->textLength > 0 )
cout << "Field " << i << ": " << field->text();
}
// Return PF3 to CICS
screen->setAID( CclScreen::PF3 );
terminal.send( &session );
// Disconnect the terminal from CICS
terminal.disconnect();
for ( int i=1; i ≤ screen->fieldCount(); i++ ) {
CclField* field = screen->field(i); // get field by index
// Find unprotected (i.e. input) fields
if ( field->inputProt() == CclField::unprotect )
…
// Find fields containing a specific text string
if ( strstr(field->text(), "CICS Sign-on") )
…
// Find red fields
if ( field->foregroundColor() == CclField::red )
…
}
Note that the string "Sign-on" in the above sample might need to be changed to meet local conventions. For example, an AIX® server might use the string "SIGNON".