IBM 1130 User Manual page 546

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

Advertisement

Code Conversion
As you saw earlier, code conversion is essential to
any program, commercial or technical.
If
you use
standard FORTRAN, you must specify the desired
conversions with the FORMAT statement.
If
you
are using FORTRAN augmented by the Commercial
Subroutines, you can also use the GET, PUT and
EDIT subroutines for special formatting.
If you
are using the overlapped I/o routines, you must
specify all the code convers ions with the Commercial
Subroutines (except Al format), since no FORMAT
statements may be used.
Basically there are five internal codes with which
you might be concerned:
Integer
Real
Alphabetic -- one character per word (AI)
Alphabetic -- two characters per word (A2)
Decimal -- one digit per word
Very few programs can avoid converting from one
code to the other.
Figure 70.23 shows the tools at
your disposal to effect all possible conversions. The
common ones are handled by a single subroutine;
those less often needed require a combination of two
or three subroutines.
The Al code is particularly important since all
the overlapped I/O routines require data in that
format. In addition, GET, PUT, and EDIT work
with data in the Al format.
The A2 code is used primarily when writing
alphabetic data on the disk, since it holds twice as
much data per word as Al format.
Decimal code is encountered only if you are using
the decimal arithmetic, variable length routines of
CSP.
FROM
Integer
Real
Integer
Real
Alphabetic (All
IFIX (GET)
GET
Alphabetic (A2)
UN PAC, then
UN PAC, then
GET, then
GET
IFIX
Variable Length
OECA 1, then
OECA 1, then
Decimal
GET, then
GET
IFIX
Figure 70. 23.
TO
Alpha (A 1)
Alpha (A2)
Decimal
PUT (FLOAT)
FLOAT,then
FLOAT,then
PUT, then
PUT, then
PACK
A1DEC
Section
Subsections
Page
70
40
I
10
01
Integer to Real -- FLOAT
The FLOAT function, a FORTRAN standard, is used
to convert an integer to a real number. A typical
use of this function is
x
=
FLOAT
(K)
which will set the real variable X equal to the value
of
K.
The same conversion can also be accomplished
by coding
X=K
This also uses the FLOAT function, even though it
does not appear.
Real to Integer -- IFIX
The IFIX function, also a FORTRAN standard, is
used to convert a real number to an integer. A
typical use is
K
=
IFIX(X)
which will take the real variable X, convert it to an
integer, and store it as
K.
If
X
is 6.0, then
K
=
6;
if
X
is 87.9, then
K
=
87; and so on.
This can also be accomplished by coding K
=
X;
this too uses the IFIX function.

Advertisement

Table of Contents
loading

Table of Contents