Center/centre, Compare, Condition – IBM SC34-5764-01 User Manual

Page 200: Compare condition

Advertising
background image

If binary_string is the null string, B2X returns a null string. If the number of binary digits in binary_string is
not a multiple of four, then up to three 0 digits are added on the left before the conversion to make a total
that is a multiple of four.

Here are some examples:

B2X('11000011')

->

'C3'

B2X('10111')

->

'17'

B2X('101')

->

'5'

B2X('1 1111 0000') ->

'1F0'

You can combine B2X with the functions X2D and X2C to convert a binary number into other forms. For
example:

X2D(B2X('10111'))

->

'23'

/* decimal 23 */

CENTER/CENTRE

CENTER(
CENTRE(

string,length

,pad

)

returns a string of length length with string centered in it, with pad characters added as necessary to make
up length. The length must be a positive whole number or zero. The default pad character is blank. If the
string is longer than length, it is truncated at both ends to fit. If an odd number of characters are truncated
or added, the right-hand end loses or gains one more character than the left-hand end.

Here are some examples:

CENTER(abc,7)

->

'

ABC

'

CENTER(abc,8,'-')

->

'--ABC---'

CENTRE('The blue sky',8)

->

'e blue s'

CENTRE('The blue sky',7)

->

'e blue '

Note: To avoid errors because of the difference between British and American spellings, this function can

be called either CENTRE or CENTER.

COMPARE

COMPARE(string1,string2

,pad

)

returns 0 if the strings, string1 and string2, are identical. Otherwise, returns the position of the first
character that does not match. The shorter string is padded on the right with pad if necessary. The default
pad character is a blank.

Here are some examples:

COMPARE('abc','abc')

->

0

COMPARE('abc','ak')

->

2

COMPARE('ab ','ab')

->

0

COMPARE('ab ','ab',' ')

->

0

COMPARE('ab ','ab','x')

->

3

COMPARE('ab-- ','ab','-')

->

5

CONDITION

CONDITION(

option

)

returns the condition information associated with the current trapped condition. (See Chapter 17,
“Conditions and Condition Traps,” on page 225
for a description of condition traps.) You can request the
following pieces of information:
v

The name of the current trapped condition

v

Any descriptive string associated with that condition

Functions

178

CICS TS for VSE/ESA: REXX Guide

Advertising