IBM 1130 User Manual page 548

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

Advertisement

Real to A1 -- PUT
This step is quite commonly required -- if you are
us ing the over lapped
II
0
routines, if you wis h to do
further editing, etc.
It
is accomplished with the
PUT subroutine supplied with CSP.
Suppose you have just computed a gross pay figure,
GROSS, which might have a typical value of 275869. ,
understood to be mills. Again, note that you are
working,in whole numbers, so that no fraction prob-
lems are encountered.
This value is to be rounded
off and the result placed in the first ten postions of
array I}GROS for ,later editing and output. The
statement
CALL PUT (KGROS, 1, 10, GROSS,
§..,~)
will take GRQSS, add 5. to it, truncate the last 1
digit, and place it in A1 format in the KGROS array
as 0000027587, with leading zeros and no decimal
point.
The last two parameters, the adjust factor and the
truncate factor, usually form a logical pair. Obvi-
ously, if you add 5. to half-adjust, you won't want
to print the resulting digit. The table below shows
the common pairs:
5th parameter
(half-adjust factor)
.5
5.
50.
500.
etc.
6th parameter
(how many digits to
truncate from right end)
o
1
2
3
etc.
Half-adjust factors of less than. 5 should not be
used, since this will bring up the problem of inexact
fractions.
If
GR'OSS is negative, an 11-zone punch will be
added to the code for the low-order digit.
For ex-
ample, if GROSS is -275869., the result will be
000002758P, where the character P is equivalent to
a 7,11 punch.
Secti0n
Subsections
Page
70
40
I
10
03
Integer to A1
This requires two steps, since PUT operates on
real numbers, not integers.
If
you have an integer
I, which you want converted to A1 format, you must
first convert it to real format:
x
=
I
or
X
=
FLOAT(I)
then use the PUT subroutine. Or, in one step:
CALL PUT (KGROS, 1, 10, FLOAT (I) ,
5.
,1)
will perform this conversion.

Advertisement

Table of Contents
loading

Table of Contents