ARTICLE
WRITE - Cutoff Behavior
This section describes the cutoff behavior of the system, if the target
field length for the statement WRITE TO or
the output length for the statement WRITE is
less than the length required for the predefined
format or the format defined using
format_options .
The following sections explain the steps involved in truncating data.
The result is truncated until it is short enough to fit the available
space.
If the individual formatting options
deviate from the rules shown here, these deviations are described for
the relevant option.
Numeric Data Types
Whole numbers and packed numbers
For data objects of numeric data types ( b , s ), i
int8
and p , the cutoff behavior is as follows:
The thousand separators are omitted from left to right.
If the value is positive, the sign on the right is omitted. If the value
is negative, the minus sign is retained.
( b , s ), i , and p are truncated on the left
and an asterisk ("*") is inserted at the first position for
identification purposes.
Bei int8 kommt es dagegen zur behandelbaren Ausnahme
CX_SY_CONVERSION_OVERFLOW , wenn eine Ziffer abgeschnitten werden
muss.
Beim Typ int8 kommt es zu einer durch ein Pragma ausblendbaren
Warnung von der Syntaxpr�fung, wenn statisch erkennbar ist, dass die
Ausgabel�nge kleiner als die vorgegebene L�nge 20 ist.
Decimal Floating Point Numbers
For data objects of type decfloat16 and decfloat34 , the
cutoff behavior is as follows:
In mathematical notation , the
thousand separators are omitted from left to right.
In mathematical notation , the
decimal points are commercially rounded. In
scientific notation the mantissa
is commercially rounded.
If there is not enough space for the places before the decimal point in
mathematical notation, the system automatically switches to the
scientific notation.
The handleable exception CX_SY_CONVERSION_OVERFLOW is raised.
if the length is not sufficient for the display of at least one whole
number place in the mathematical notation or one position of the
mantissa in the scientific notation,
if the length is not sufficient for the mathematical notation when the
output format SIGN_AS_POSTFIX is used for commercial notation,
if the length is not sufficient for the output format
SCALE_PRESERVING or SCALE_PRESERVING_SCIENTIFIC (where the
scaling is contained),
The predefined output lengths of 24 or 46 are sufficient for the
mathematical notation of 16 or 34 place numbers with an algebraic sign,
a decimal point, and a corresponding number of thousand separators.
Binary Floating Point Numbers
For data objects of type f , the cutoff behavior is as follows:
The number of decimal places is reduced
and the number is rounded accordingly.
If the output length is too short for
scientific notation , asterisks
("*") are displayed instead of the numbers.
Character-Like and Byte-Like Data Types
For data types c , string , n , d , t ,
x and xtring , the cutoff behavior is as follows:
In a 12-hour format set using ENVIRONMENT
TIME FORMAT for data type t , first the space is removed and
then the format is changed to the 24-hour format.
For character-like data fields and time fields of type d and
t , all separators are removed, unless an addition such as
DD/MM/YY or
MM/DD/YY is specified for d .
The right-hand side is cut off.
Time Stamps
For time stamps that are output with the
addition TIME ZONE , the cutoff
behavior for the WRITE statement is as
follows:
All separators in the date and time are removed. The separators in the
date are only not removed if a date formatting mask DD/MM/YY or
similar is also specified.
The space between date and time is removed.
The right-hand side is cut off. .
When the WRITE TO statement is used, the
right-hand side is cut off and the separators are not removed
beforehand.
Example
See WRITE , Cutoff Behavior .
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved