Declaring report initialisation statements


Declare report initialisation statements


!init {

Declare a block of statements to be executed once only, at the start of the report before the first record is read.

Automatic page checking is not performed if the !init statements include print commands. Footnote and heading statements are not executed and sys.PageNumber is not updated, unless a new page is specifically thrown with the newpage command. The need command may however be used within the !init statements to force a new page check.

The driving file is rewound before the !init section is executed, not after. It is therefore possible to position the driving file during the !init section. However, if a temporary driving file is created during the !init section, it should be rewound to the beginning once created.


  • The !title section is similar to !init, but performs automatic page checking.

  • Placing the main body of the program code in subroutines or functions called from within the !init statements effectively allows a program to bypass the normal driving logic. There are occasions when the driving logic is not suitable for the task to be performed. Note however that at least one main statement must always be included, and that Sculptor does not throw new pages automatically within an !init section. See Report driving logic.

  • If the startrec command (which defines the first record to be read from the driving file) is used, it must be placed within the !init or !title statements.

  • If the !init section consists of a single statement the braces may be omitted and the statement placed on the same line as the !init command.

  • Only one !init section may be defined.


!init {
     tmp.StartKey = sys.Arg[4]
     tmp.EndKey = sys.Arg[5]
     startrec key = tmp.StartKey
     endrec key = tmp.EndKey