IBM 1130 User Manual page 533

Computing system
Hide thumbs Also See for 1130:
Table of Contents

Advertisement

Section
Subsections
Page
70
10
I
30
21
Constants
There are four ways in which you may create con-
stants such as 1968, 40, 6600, etc. To illustrate,
suppose you wish to create the constant 660000 (the
Social Security deduction base, in cents) to be
stored in an array named ISSD, DIME NSIONed as
ISSD (6).
The four options are:
1.
Use FORTRAN equalities.
ISSD (1) = 6
ISSD (2)
=
6
ISSD (3) = 0
ISSD (4) = 0
ISSD (5) = 0
ISSD (6) = 0
2. Use the DATA statement.
DATA ISSD/6, 6, 0,0,0,0/
or
DATA ISSD/2*6, 4*0/
3. Use the TILL subroutine.
CALL FILL (ISSD, 1,2,6)
CALL FILL (ISSD, 3,6,0)
4. Read it from a card, tape, keyboard, or disk.
Option 2 is preferred, since it consumes less core
storage than the other three
meth~ds.
Negative constants are handled in much the same
way. Because of their special representation, how-
ever,
it
would be wise to make the constants pos itive
and change the arithmetic.
For example, rather
than set up -1 and add it to something, it would be
easier to subtract +1.
Testing and Modifying Signs
To facilitate testing and modifying the signs of deci-
mal arithmetic fields, the subroutine NSIGN is
available.
It
has four parameters:
NARR Y The name of the array
NPOS
The position in the array to be tested
NEWS
"New sign", indicating what you want
done to the previous sign:
+ 1
Make it positive
o
Reverse it
-1
Make it negative
NOLDS Leave it alone
NOmS
"Old sign", returned to you, indicating
what the previous sign was:
+ 1
It
was positive
-1
It
was negative
You, the programmer, send the subroutine the
first three parameters; it returns the last.
To
illustrate, suppose you wish to test the sign of the
18th position in the K array:
Case 1:
It
Is Now Positive:
NOLDS is returned as +1
K(18) is made + if you said
CALL NSIGN (K, 18, +1, NOLDS)
K(18) is changed to - if you said
CALL NSIGN (K, 18,0, NOLDS)
K(18) is made - if you said
CALL NSIGN (K, 18, -1, NOLDS)
K(18) remains + if you said
CALL NSIGN((K, 18, NOLDS, NOLDS)
Case 2:
It
Is Now Negative:
NOLDS is returned as -1 and
K(18) is made + if you said
CALL NSIGN (K, 18, +1, NOLDS)
K(18) is changed to + if you said
CALL NSIGN (K, 18,0, NOLDS)
K(18) is made- if you said
CALL NSIGN (K, 18, -1, NOLDS)
K(18) remains - if you said
CALL NSIGN (K, 18, NOLDS, NOLDS)

Advertisement

Table of Contents
loading

Table of Contents