See Free-Form Statements
for information on the columns available for free-form statements.
In a free-form statement, the operation code does not need to begin in
any specific position within the available columns. Any extenders must appear
immediately after the operation code on the same line, within parentheses.
There must be no embedded blanks between the operation code and extenders.
Following the operation code and extenders, you specify the Factor 1, Factor
2, and the Result Field operands separated by blanks. If any of these items are
not required by the operation, you can leave them out. You can freely use
blanks and continuation lines in the remainder of the statement. Each statement
must end with a semicolon. The remainder of the record after the semicolon
must be blank or contain an end-of-line comment.
eval pos = %scan (',': name);
pos = %scan (',': name);
For each record within a free-form calculation block, positions 6 and 7 must be blank.
The compiler directive must be the first item on the line.
It cannot continue to the next line.
In column-restricted code, the directive can start anywhere from column 7 onward.
To indicate the start of total calculations,
code a fixed-form calculation specification with a control-level specified
in positions 7-8.
In fully free-form mode, this fixed-form statement must be specified in a copy file.
The total calculations can be specified by using free-form
calculation syntax. Since the free-form calculation specification does not
include a control-level entry, calculations to be performed on specific level
breaks should be conditioned by using the statement "IF *INLx;".
items += 1; 1
CL0 Total TAG 2
IF *INL1; 3
EXCEPT orderTotal;
orders += 1;
totalItems += items;
items = 0;
ENDIF;
*..1....+....2....+....3....+....4....+....5....+....6....+....7...+....
read file; // Get next record
dow not %eof(file); // Keep looping while we have
// a record
if %error;
dsply 'The read failed';
leave;
else;
chain(n) name database data;
time = hours * num_employees
+ overtime_saved;
pos = %scan (',': name);
name = %xlate(upper:lower:name);
exsr handle_record;
read file;
endif;
enddo;
begsr handle_record;
eval(h) time = time + total_hours_array (empno);
temp_hours = total_hours - excess_hours;
record_transaction();
endsr;
In column-limited source, you can combine free-form
and traditional calculation specifications in
the same program:
C testb OPEN_ALL flags 10
if *in10;
openAllFiles();
endif;