Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 3 Tools : PAD

PAD
Returns a string padded to a specified length using a pad character, positioning the string to the left, right or center of the padding. (F)
Invocation
pad_string = PAD(string, length, padcharacter, just)
 
On return, contains the padded string. Its syntax can be UN (Unicode), V (for a string of C or V), or W (double-byte character).
The string to pad. Its syntax can be C (fixed-length character string), UN, V (variable-length character string), or W.
An integer specifying the length, in characters, to which pad_string should be padded. Its syntax is B (binary) with length 2.
The specified length cannot exceed the greater of 4096 or the value of the EXECSTACKSIZE session parameter minus 32768, to a maximum of 32,767.
Its syntax is C or UN. If it’s of syntax C and alphabetic, it is treated as uppercase. If it’s of syntax C and null, and string is of syntax C, V, or W, it is treated as a blank. If string is of syntax UN, a null pad character is not allowed.
Usage Notes
string is not altered.
Example
Rule Using PAD
The following rule pads a string and prints both the original string and the padded string to the message log:

 
PAD_1;
_ LOCAL SOURCE_STRING, PADDED_STRING;
_ ------------------------------------------------------------------------
_ ------------------------------------------------------------+-----------
_ SOURCE_STRING = 'THIS IS THE SOURCE STRING'; | 1
_ PADDED_STRING = PAD(SOURCE_STRING, 40, '*', 'C'); | 2
_ CALL MSGLOG('THE PADDED STRING IS:'); | 3
_ CALL MSGLOG(PADDED_STRING); | 4
_ CALL MSGLOG('THE SOURCE STRING IS STILL:'); | 5
_ CALL MSGLOG(SOURCE_STRING); | 6
_ ------------------------------------------------------------------------

 
Output for the PAD_1 Rule
Pressing PF2 after executing this rule displays the following:

 
----------------------- INFORMATIONAL MESSAGE LOG --------------------
COMMAND ===> SCROLL ===> P
THE PADDED STRING IS:
*******THIS IS THE SOURCE STRING********
THE SOURCE STRING IS STILL:
 THIS IS THE SOURCE STRING

 

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved