7.67.52015-05-06

Store two lines of input data on one line of the data page

This sample is a user-defined emulation that reads two lines of input data, concatenates them, and stores them as a single line in the data page buffer. It terminates a data page when it encounters a form feed character. The emulation relies on two global variables:

Variable:

Type:

Initialized to:

Description:

&second

Boolean

False

The emulation uses this to determine when the current line is a second line of data. It is True when the current line is a second line of data.

&line

string

““ (the empty string)

Holds the contents of a first line of data.

Code:

% ====================================================
% STORE TWO LINES OF DATA ON ONE LINE OF THE DATA PAGE
% ====================================================
search(&str,'\014')
 set(&current.line,&current.line + 1)
 store(&current.line,&str)
 doform()
 set(&second,false)
 clearpage()
endsearch()

if(&second)
 store(&current.line,&line + &str)
elseif()
 set(&line,&str)
 set(&current.line,&current.line + 1)
endif()

set(&second,not(&second))
if(ge(&current.line,&current.lpp))
 doform()
 clearpage()
 set(&second,false)
endif()

Notes: