S_DETAB

Expand tabs

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
xcall S_DETAB(string, [length][, expand_length])

Arguments

string

The alpha text whose tabs will be expanded. (a)

length

(optional) The length of the string to be expanded. (n)

expand_length

(optional) The variable that will be loaded with the length of the expanded string. (n)

Discussion

The S_DETAB subroutine expands tabs “in place.” Tab stops are set to 8.

If you specify length, the specified number of characters in string will have embedded tabs expanded. If length is not present, or if it has a value of zero, the string to expand is the contents of string with trailing blanks stripped.

If string isn’t long enough to expand all of the tabs, string is not changed. If length and/or expand_length are passed, they are returned with a value of zero on an overflow.

Synergy DBL assumes that no more than 80 tabs will be expanded.

Examples

.define TTCHN           ,1
record
    line                ,a80
    length              ,d2,    15
    explen              ,d2
proc
    open(TTCHN, o, "tt:")
    reads(TTCHN, line)
    xcall s_detab(line, length, explen)
    if (explen) then
      writes(TTCHN, line(1,explen))
    else
      writes(TTCHN, "An overflow has occurred!")
    close TTCHN
    stop
end

If the string input looks like this:

DOE,<tab>JOHN<tab>,27

and the first tab is three characters in length and the second tab is five characters in length, the resulting string is as follows:

DOE, JOHN ,27