IBM 1130 User Manual page 621

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

Advertisement

7. In many cases, several values may be com-
bined into one word.
For example, in a payroll file,
you might have four different variables:
IE (Exempt or nonexempt)
1
=
EXEMPT
2
=
NONEXEMPT
MSC (Marital Status Code)
1
=
SINGLE
2
=
MARRIED
MORF(Male OR Female)
1
=
MALE
2
=
FEMALE
NDEP(Number of DEPendents)
o
through 99
One way to compress these four items into a five-
digit word (called KODE) is:
Digit
1
2
3
4
I
5
Exempt
Marital
Male
Number
Description
or
status
or
of
nonexempt
code
female
dependents
Variable
IE
MSC
MORF
NDEP
Name
For example, if KODE
=
22103, this employee is:
Nonexempt (digit 1 is 2)
Married (digit 2 is 2)
Male (digit 3 is 1)
With three dependents (digits 4 and 5 are 03)
Section
Subsections
Page
80
60
I
00
02
To compress these values before writing on the
disk, all you need do is
KODE= (IE*10000)+(MSC*1000)+MORF*100)+NDEP
To decompress the word KODE after reading it
from the disk, you could use a function similar to
the one below, called NDIG
FUNCTION NDIG (N, IT)
DIMENSION IZ (6)
DATA IZ/32767, 10000, 1000, 100, 10, 1/
NDIG
=
IT/IZ(N+1)-IT/IZ(N)*10
RETURN
END
Using this function
IE
=
NDIG (1, KODE)
MSC
=
NDIG (2, KODE)
MORF
=
NDIG (3, KODE)
NDEP
=
NDIG (4, KODE) *10+NDIG(5, KODE)
etc.
In this case, such a packing technique will save
three words on each disk record (by using one word
rather than four).
This mayor may not be worth
the added programming involved, the additional
core storage required for the function, and the
packing/unpacking coding.
Don't forget that KODE is an integer, and its
magnitude is limited to 32767.
To be safe, you
should plan for a limit of 29999 for such compressed
words.

Advertisement

Table of Contents
loading

Table of Contents