CONDENSE

CONDENSE


Addition:

... NO-GAPS

Note

As with any string processing statement, all the operands are processed here as type C fields (regardless of type). No internal conversion is performed.

Effect

Shifts the field c to the left, so that sequences of blanks are reduced to exactly one blank.

Example

DATA NAME (30). 
		NAME(10)	= 'Dr.', 
		NAME+10(10) = 'Michael', 
		NAME+20(10) = 'Hofmann'. 
CONDENSE NAME. 
WRITE NAME.

produces the output:

Dr. Michael Hofmann

Example

DATA: BEGIN OF NAME, 
		TITLE(8)	 VALUE 'Dr.', 
		FIRST_NAME(10) VALUE 'Michael', 
		SURNAME(10)	VALUE 'Hofmann', 
	END   OF NAME. 
CONDENSE NAME NO-GAPS.

The contents of NAME is now "Dr.MichaelHofmann".

Since the field string NAME is interpreted and handled like a type C field, the CONDENSE statement treats it as a whole and ignores any sub-fields. The contents of the sub-field would therefore now be as follows:

NAME-TITLE = 'Dr.Micha'
NAME-FIRST_NAME = 'elHofmann '
NAME-SURNAME = ' '

Note

Do not use CONDENSE to manipulate field strings that include fields not of type C. This could result in the sub-fields containing characters of a different (i.e. incorrect) type.

Related

SHIFT, CONCATENATE, REPLACE, SPLIT

The runtime required to condense three fields is about 20 msn (standardized microseconds). The variant ... NO-GAPS needs about 12 msn.