STRUCT
[(n)]
|
This command is used to perform structural indentation of the source code of the Natural object currently in the work area of the editor.
STRUCT |
By default (that is, if
(n) is not specified), indentation is
by 2 positions.
|
STRUCT
(n) |
The parameter (n) may be
supplied to specify the number of spaces used for indentation.
Possible values: 1 - 9. Example: STRUCT (5) |
The following types of statements are affected by the
STRUCT
command:
conditional statement blocks (AT BREAK
,
IF
,
DECIDE FOR
,
etc.),
DO/DOEND
statement blocks,
DEFINE DATA
blocks,
inline subroutines.
This document covers the following topics:
You can have a source program indented so that the indentation of source-code lines reflects the structure of the program.
Note:
Indentation is performed differently for a reporting-mode program
than for a structured-mode program.
You can exclude sections of your program source from structural
indentation by using the special statements /*STRUCT OFF
and
/*STRUCT ON
. These must be entered at the beginning of a
source-code line. The source-code lines between these two statements will
remain as they are when you issue the
STRUCT
command.
Program before being structurally indented:
DEFINE DATA LOCAL 1 EMPL VIEW OF EMPLOYEES 2 PERSONNEL-ID 2 FULL-NAME 3 FIRST-NAME 3 NAME 1 VEHI VIEW OF VEHICLES 2 PERSONNEL-ID 2 MAKE END-DEFINE FIND EMPL WITH NAME = 'ADKINSON' IF NO RECORDS FOUND WRITE 'NO RECORD FOUND' END-NOREC FIND (1) VEHI WITH PERSONNEL-ID = EMPL.PERSONNEL-ID DISPLAY EMPL.PERSONNEL-ID FULL-NAME MAKE END-FIND END-FIND END
The same program after being structurally indented:
DEFINE DATA LOCAL 1 EMPL VIEW OF EMPLOYEES 2 PERSONNEL-ID 2 FULL-NAME 3 FIRST-NAME 3 NAME 1 VEHI VIEW OF VEHICLES 2 PERSONNEL-ID 2 MAKE END-DEFINE FIND EMPL WITH NAME = 'ADKINSON' IF NO RECORDS FOUND WRITE 'NO RECORD FOUND' END-NOREC FIND (1) VEHI WITH PERSONNEL-ID = EMPL.PERSONNEL-ID DISPLAY EMPL.PERSONNEL-ID FULL-NAME MAKE END-FIND END-FIND END