Marc's Place

DIBIOL/DBL - Assignment Statements


    o  Move data.
    o  Store the results of arithmetic expressions.
    o  Convert and format data.
    o  Clear variables.

             destination = {source{,format}}

    Alpha-to-alpha

Value assignment statements move alpha data.  If the size of the source is greater than
the size of the destination, the data is truncated on the right; otherwise, the data is
left justified and blank filled.

               afield = aexp

    Numeric-to-Numeric

Value assignment statements move numeric data.  If the size of the source is greater
than the size of the destination, data is truncated on the left; otherwise the data is
right justified and zero filled.

Any implied decimal points are aligned. If the number of fractional digits of the source
is greater than that of the destination, digits are truncated from the right; otherwise
the destination is zero filled.

               nfield = nexp

    Alpha-to-Numeric

Value assignment statements convert alpha data to its numeric equivalent.  If the size
of the source is greater than the size of the destination, data is truncated on the
left; otherwise the data is right justified and zero filled.

               nfield = aexp

    Array-information

An asterisk (*) is used to specify each dimension in the passed array. The number of
asterisks must match the number of dimensions in the passed array.

    Numeric-to-Alpha

Value assignment statements convert numeric data to its alpha equivalent.  If the size
of the source is greater than the size of the destination, data is truncated on the
left; otherwise data is right justified and blank filled.  If the source is negative,
the destination field will contain a minus sign preceding the leading digit.

               afield = nexp

    Formatted

Value assignment statements permit numeric data to be converted to its alpha equivalent
and formatted.  If the size of the format string is greater than the size of the
destination, data is truncated on the left; otherwise data is right justified and blank
filled.

               afield = nexp, format_string

      X

Each X represents a digit position. An X causes a digit in the source to be placed in
the corresponding position in the destination.  If there are more Xs than source digits,
a leading zero is inserted for each additional X.

      Z

Each Z represents a digit position.  A Z suppresses a leading zero in this character
position if Z is to the left of the decimal point. When placed to the right of the
decimal point, zeros are suppressed only if all digits are zero.

      Asterisk

Each asterisk (*) represents a digit position.  It replaces a leading zero with an *
symbol in this position.

      Money

Each money sign (for example, $) represents a sign digit position. It replaces leading
zeros beginning at this character position with leading spaces and a single money sign.
Format characters to the left of the money sign are ignored.  Any character can be used
for the money sign by calling the MONEY external subroutine or by setting the
SYS$CURRENCY logical, although it is initially set to $.  Any character with an
established format meaning should not be used, for example, (,),(.),(Z),(X),(-),(*).

      Minus

When used as the first or last character in a format string, the minus sign (-) causes
the sign of the number being formatted to be placed in that position.  If the number is
negative, a minus appears, otherwise a space is inserted.  When used elsewhere in a
format string, this will cause a minus to be placed in that position in the formatted
data.  A minus cannot be used to the left of a money sign format character.

      Point

A decimal point (.) causes a decimal point to be inserted in the corresponding position
in the formatted data and causes zeros to the right of it to become significant.

      Comma

The comma (,) causes a comma to be inserted in the corresponding position in the
formatted data if there are significant digits to the left.

¥ The functions of the decimal point and comma are reversed when international data
  formatting is selected via the FLAGS external subroutine or by setting the
  SYS$RADIX_PT and the SYS$DIGIT_SEP logical.

      Clear

Value assignment statements clear variables.  (Also see the CLEAR statement).

     field =

Subscripting

    a = field(10,11)         copies positions 10 and 11 into a.
    a = field(10:11)         copies 11 positions, startting at 10, into a.
© 1997- Marc Vos (and others)   -   Privacy Statement   -    Contact Me

On this website, Google Analytics is used to track visitor statistics. These are anonymised data about the number of visitors, which pages they visit on this site, from which regions they visit, which web browsers they use, etc.. You will also see non-personalised ads via Google AdSense. Cookies from Paddle or Paypal are placed when you click on a 'Buy now!' or 'Donate!' button, and possible cookies from Disqus when you use that system to comment on one or more blogposts.
Privacy Statement