FORMAT

FORMAT [(rep)]   parameter dot3.gif (52 bytes)

This document covers the following topics:

For an explanation of the symbols used in the syntax diagram, see Syntax Symbols.

Related Statements: AT END OF PAGE | AT TOP OF PAGE | CLOSE PRINTER | DEFINE PRINTER | DISPLAY | EJECT | NEWPAGE | PRINT | SKIP | SUSPEND IDENTICAL SUPPRESS | WRITE | WRITE TITLE | WRITE TRAILER

Belongs to Function Group: Creation of Output Reports


Function

The FORMAT statement is used to specify input and output parameter settings.

Settings specified with a FORMAT statement override (at compilation time) default settings in effect for the session that have been set by a GLOBALS command, SET GLOBALS statement, or by the Natural administrator.

These settings may in turn be overridden by parameters specified in a DISPLAY, INPUT, PRINT, WRITE, WRITE TITLE, or WRITE TRAILER statement.

The settings remain in effect until the end of a program or until another FORMAT statement is encountered.

A FORMAT statement does not generate any executable code in the Natural program. It is not executed in dependence of the logical flow of a program. It is evaluated during program compilation in order to set parameters for compiling DISPLAY, WRITE, PRINT and INPUT statements. The settings defined with a FORMAT statement are applicable to all DISPLAY, WRITE, PRINT and INPUT statements which follow.

Syntax Description

Syntax Element Description
(rep)
Report Specification:

The notation (rep) may be used to specify the identification of the report for which the FORMAT statement is applicable.

A value in the range 0 - 31 or a logical name which has been assigned using the DEFINE PRINTER statement may be specified.

If (rep) is not specified, the FORMAT statement will be applicable to the first report (Report 0).

For information on how to control the format of an output report created with Natural, see Controlling Data Output (in the Programming Guide).

parameter
Parameter(s):

The parameters can be specified in any order and must be separated by one or more spaces. A single entry must not be split between two statement lines.

Field sensitive parameter settings applied here will only be regarded for variable fields used in a INPUT, WRITE, DISPLAY or PRINT statement of the selected report. They do not apply for text-constants used in any of the mentioned statements.

Example:

DEFINE DATA LOCAL
1 VARI (A4)     INIT <'1234'>        /*     Output 
END-DEFINE                           /*    Produced
FORMAT AD=U                          /*    ---------
WRITE 'Text'           VARI          /*    Text 1234
WRITE 'Text' (AD=U)    VARI          /*    Text 1234
END

See also Applicable Parameters below.

Applicable Parameters

See the Parameter Reference for a detailed description of the session parameters which may be used.

Parameter Description
AD Attribute Definition
AL Alphanumeric Length for Output
CD Color Definition
DF Date Format
DL Display Length for Output
EM Edit Mask
ES Empty Line Suppression
FC Filler Character
FL Floating Point Mantissa Length
GC Filler Character for Group Heading
HC Header Centering
HW Heading Width
IC Insertion Character
ICU Unicode Insertion Character
IP Input Prompting Text
IS Identical Suppress
KD Key Definition
LC Leading Characters
LCU Unicode Leading Characters
LS Line Size
MC Multiple-Value Field Count (Can only be used in reporting mode.)
MP Maximum Number of Pages of a Report, see Note below.
MS Manual Skip
NL Numeric Length for Output
PC Periodic Group Count (Can only be used in reporting mode.)
PM Print Mode
PS Page Size, see Note below.
SF Spacing Factor
SG Sign Position
TC Trailing Characters
TCU Unicode Trailing Characters
UC Underlining Character
ZP Zero Printing

Note:
The parameters MP and PS do not take effect for a specific I/O statement, but apply to the complete output created for the report. If multiple settings for MP and PS are performed, the last definition is used.

See also Underlining Character for Titles and Headers - UC Parameter (in the Programming Guide).

Example

** Example 'FMTEX1': FORMAT                                             
************************************************************************
DEFINE DATA LOCAL                                                       
1 EMPLOY-VIEW VIEW OF EMPLOYEES                                         
  2 NAME                                                                
  2 CITY                                                                
  2 POST-CODE                                                           
  2 COUNTRY                                                             
END-DEFINE                                                              
*                                                                       
FORMAT AL=7    /* Alpha-numeric field output length                     
       FC=+    /* Filler character for field header                     
       GC=*    /* Filler character for group header                     
       HC=L    /* Header left justified                                 
       IC=<<   /* Insert characters                                     
       IS=ON   /* Identical suppress on                                 
       TC=>>   /* Trailing character                                    
       UC==    /* Underline character                                   
       ZP=OFF  /* Zero print off                                 
*                                             
LIMIT 5                                       
READ EMPLOY-VIEW BY NAME                      
  DISPLAY NOTITLE                             
          NAME 3X CITY 3X POST-CODE 3X COUNTRY
END-READ                                      
*                                             
END

Output of Program FMTEX1:

NAME+++++++   CITY+++++++   POSTAL+++++   COUNTRY++++
                              ADDRESS++++              
===========   ===========   ===========   ===========
                                                     
<<ABELLAN>>   <<MADRID >>   <<28014  >>   <<E  >>    
<<ACHIESO>>   <<DERBY  >>   <<DE3 4TR>>   <<UK >>    
<<ADAM   >>   <<JOIGNY >>   <<89300  >>   <<F  >>    
<<ADKINSO>>   <<BROOKLY>>   <<11201  >>   <<USA>>    
              <<BEVERLE>>   <<90211  >>