FLD - bit string manipulation.

Usage:

ival = fld( i, k, e )

Where:

i
is an integer expression, where 0<i<35.
k
is an integer expression, where 1<k<36.
e
is any integer, real or typeless expression, a Hollerith word, or any function with a typeless result.

Description:

FLD is an intrinsic function that may be used to extract a field of bits from a word or to place some bits into a field of a word.

If it appears on the right hand side of an assignment, FLD extracts a field of "k" bits from the 36 bit word "e", starting with bit "i" (counting from left to right, where the zeroth bit is the leftmost bit of "e"). The resulting field is right-justified, with the leftmost bits set to zero. For example,

i = 64
j = fld(29,1,i)
print, "i = ", i
print, "j = ", j

yields

i = 64
j = 1

When it appears on the left hand side of an assignment, FLD copies the rightmost "k" bits of the result of the expression to the right of the assignment into the variable "a", starting at position "i". When used like this, it must not be the first executable statement of the program or it will be interpreted as an arithmetic statement function.

Here is an example using FLD on the left hand side of an assignment (ASCII characters assumed).

character*4 a,b
a = "abcd"
b = "1234"
fld(9,9,a) = b
print, a
print, b

This would yield

a4cd
1234

Copyright © 1996, Thinkage Ltd.