FILL

Fill a variable with a pattern

WSupported on Windows
USupported on Unix
VSupported on OpenVMS
NSupported in Synergy .NET
xcall FILL(pattern, destination)

Arguments

pattern

An expression that contains a value to be loaded into the destination variable. (a)

destination

The variable that will be loaded with the specified pattern. (a)

Discussion

The FILL subroutine fills an alpha variable with the specified pattern.

All character positions of the destination variable are loaded left-justified. If the destination is longer than the pattern, the pattern is repeated until the destination variable is filled. For example, loading a 15-byte variable with the pattern “ABCD” gives the variable the following contents:

ABCDABCDABCDABC

Examples

subroutine sub
record
    dest        ,a10
    pat         ,a16,   "0123456789ABCDEF"
proc
    xcall fill("]", dest)                       ;dest = "]]]]]]]]]]"
    xcall fill(pat, dest)                       ;dest = "0123456789"
    xcall fill(pat(4,6), dest)                  ;dest = "3453453453"
    xcall fill("A.", dest)                      ;dest = "A.A.A.A.A."
    return
endsubroutine