The EPIScreenRecord

When you create an EPIScreenRecord you instantiate an EPIScreenRecordImpl.

EPIScreenRecord screen = new EPIScreenRecordImpl();
You start a new transaction by passing this record, for example:
EPIInteractionSpec epiSpec = new EPIInteractionSpec();
epiSpec.setFunctionName(“CESN”);
epiSpec.setAID(AIDKey.enter);
epiSpec.setInteractionVerb(EPIInteractionSpec.SYNC_SEND_RECEIVE);
// epiInter is an interaction created elsewhere
epiInter.execute(epiSpec, null, screen);
Note the use of null as the input record.

The screen information is in the screen object. Other screen information, such as cursor position, is returned to your defined EPIInteractionSpec object. You can then request a specific field by index number, which is a number in the range from 1 to the total number of fields on the screen, or you can use an iterator to request all the fields. The fields are indexed in order starting from the top left of the screen proceeding from left to right to the bottom right of the screen. The iterator returns each field in ascending index order.

So for example you can obtain a field using the index number by coding:
EPIFieldRecord field = screen.getField(7);
To use the iterator, code the following:
java.util.Iterator it = screen.getFields();
while (it.hasNext()) {
    EPIFieldRecord field = (EPIFieldRecord)it.next();
    ....
    ....
}
The following is an example of a function that takes a screen record and prints out the screen in a layout suitable for a terminal:
public void printScreen(EPIScreenRecord inscr) {
   int col = 1;
   int row = 1;

   System.out.println(“——————————————————————————————————————”);
 
    for (int i = 1; i <= inscr.getFieldCount(); i++) {
        try {
            EPIFieldRecord f = inscr.getField(i);
            while (f.getTextRow() > row) {
                System.out.print(“\n”);
                row++;
                col = 1;
            }
            while (f.getTextCol() > col) {
                System.out.print(“ ”);
                col++;
            }
            if (f.isDisplay()) {
                System.out.print(f.getText());
                col += f.getText().length();
            }
        }
        catch (ScreenException se) {
        }           
    }
    System.out.print(“\n”);
 
   System.out.println(“——————————————————————————————————————”);
}
After you have accessed and updated the fields, pass the record back as the input record. If you wish, you can use it again as the output record. For example:
epiSpec.setAID(AIDKey.enter); 
epiInter.execute(epiSpec, screen, screen);

Information Information

Feedback


Timestamp icon Last updated: Tuesday, 19 November 2013


https://ut-ilnx-r4.hursley.ibm.com/tg_latest/help/topic/com.ibm.cics.tg.doc//progde/cclaoj2p.html