Previous Topic Next topic Print topic


Edit-Directed Input

The EDIT option of the GET statement specifies edit-directed input.

The GET EDIT statement uses a format list to control scanning of the input stream and conversion of fields. Each field is first converted under control of a data format and the converted value is then assigned to the corresponding list variable. An additional conversion may occur as part of that assignment.

For a description of each data format conversion, see the section Format Controlled Conversion in the chapter Data Type Conversions, and for a description of format-list evaluation, see the section FORMAT Statement.

GET FILE(F) EDIT(A,B,C) (E(14,3),SKIP,F(10)); 
GET FILE(F) EDIT(D) (A(10));

In this example, A is assigned the field converted by E (14,3) , a new line is read by SKIP, B is assigned the field converted by F (10) , and C is assigned the next field converted by E (14, 3). The SKIP is not evaluated a second time, because no variables remain in the list. D receives a value from the field converted by A (10) . That field is the 10 characters that immediately follow the second field that was converted by E (14, 3) and assigned to C. Note that the A-Format is used without a field width to read a variable-length line, as discussed in the section A-Format in the chapter Data Type Conversions.

When multiple (input-list) (format-list) pairs are specified, this is equivalent to specifying all the input items consecutively in one list, then all the format items consecutively in one list.

Previous Topic Next topic Print topic