Receiving field-by-field

Receiving data field-by-field is the easiest way of receiving data.

In the simplest case you would issue a FEPI RECEIVE command without specifying an INTO data area. FEPI gets the data from the back-end system and builds the resulting screen image internally. The cursor position is returned by the CURSOR option. Information about the number of lines, columns, and fields in the screen image is returned by the LINES, COLUMNS, and FIELDS options.

To get the data, you issue the FEPI EXTRACT FIELD command for each individual field that you want. As well as the data, you can find out the attribute settings for the field, and its length and position. The attribute values are defined in the DFHBMSCA copy book, as is used with BMS. You can issue as many FEPI EXTRACT FIELD commands as you need, for whichever fields you want. You can issue more than one for each field, for example, if you want to get the data and attributes separately. It is generally preferable to use the FIELDLOC option rather than FIELDNUM. There may be spurious attributes between each displayed field which make determining field numbers difficult.

A sample program illustrates the techniques used; see FEPI sample program: Screen image RECEIVE and EXTRACT FIELD.