Previous Topic: &OVERLAY

Next Topic: &SELSTR


&REMSTR

The &REMSTR built-in function is used to split a section of data into two parts and assign the second part of the data to a target variable. The location at which the data is split is determined by the specification of a single character, which acts as a delimiter for the split operation. The only functional difference with an &CONTROL DBCS, DBCSN or DBCSP option in effect, is that the designated split character is a single byte character or a double byte character. With the &CONTROL NODBCS option in effect, only a single byte character is specified.

If the designated split character is a single byte character, the split can only occur where the character exists in a single byte section of the data. If the designated split character is a double byte character, the shift out and shift in characters are removed from the character, and the split can only occur where the split character is found in a double byte section of the data.

If the split occurs in a double byte section of data, a shift out character is added to the start of the resultant data, if required, to preserve the integrity of the DBCS string.

Examples: &REMSTR

&CONTROL NODBCS &A = &REMSTR (C) ABCDEF

results in

&A = DEF
&CONTROL DBCS&A = &REMSTR (C) ABCDEF

results in

&A = DEF

The &CONTROL NODBCS operation is identical to the &CONTROL DBCS operation.

&CONTROL NODBCS&A = &REMSTR (<.D>) ABC<.C.D.E>

This operation results in a syntax error, because a double byte character can only be specified if an &CONTROL DBCS, DBCSN or DBCSP option is in effect.

&CONTROL DBCS&A = &REMSTR (<.C>) ABC<.C.D.E>

results in

&A = <.D.E>

Note: A shift out has been added before the double byte character .D to maintain integrity of the DBCS string.