T Correlative

Text Extraction. The T correlative extracts a specified number of characters from a string beginning at a specified position.

Format

T [start ,] #chars

Parameter(s)

start

Left-most position of the first character to extract. If start is omitted, 1 is assumed.

#chars

Number of characters to extract.

Description

Using the T Correlative

Suppose Attribute 2 contained a long description of an inventory part. An Attribute Synonym Definition item can be created, named SHORT-DESC, that extracts the first 10 characters from the long description:

   SHORT-DESC

001 S

002 2

003

004

005

006

007

008 T10

009 L

010 10

In the next example, Attribute 3 contains a person’s complete phone number, including a 3-digit extension, stored in the format:

718-538-9000X512

The following Attribute Synonym Definition item could be used to extract just the extension number 512:

   EXTENSION

001 S

002 3

003

004

005

006

007

008 T3

009 R

010 3

Extraction occurs from right to left because no starting position is specified and the justification is R. Similarly, to extract the area code 718, use the same T correlative of T3 and specify left justification in line 9.

Yet another Attribute Synonym Definition item, named MAIN-PHONE, could be used to extract the main number (538-9000) without the area code or extension:

   MAIN-PHONE

001 S

002 2

003

004

005

006

007

008 T5 , 8

009 R

010 8

In this case, the extraction begins at the fifth character and takes the next eight characters, moving left to right. Because the starting position of the extraction is specified, the extraction occurs from left to right, regardless of the justification specified in line 9.

The table below shows more examples of how the T correlative can be used:

Stored Value

Justification

T Correlative

Output

ABCDEF

L

T3

ABC

ABCDEF

R

T3

DEF

HELLO OUT THERE

L

T3,5

LLO O

HELLO OUT THERE

R

T3,5

LLO O

123 SMITH  CR

L

T4,7

SMITH

848JOHNSONDB

L

T4,7

JOHNSON

123SMITH  CR

L

T3

123

848JOHNSONDB

L

T3

848

123SMITH  CR

R

T2

CR

848JOHNSONDB

R

T2

DB

See Also

Correlatives and Conversions Reference