Table Of Contentf ats,
ELECTRONIC COMPUTER PROGRAMMING INSTITUTE,
LB-M Data Processing and
Computer Programming Course
L.B.M, SYSTEM /960 - COBOL
STUDY UNIT COBOL 1
LESSON 1-5
INDEX TO INSTRUCTIONS, 18M SYSTEM 360 lastraction
Foret Lesson
Opeetian Cade a oa:
ca : a ee cones
ae -—
—- Rx wove s
BF oh el ——
ae a Re
ee ES er =
ASSEMBLER ANO MACRO INSTRUCTIONS
IBM. DATA PROCESSING
AND COMPUTER PROGRAMMING
COBOL
IBM SYSTEM 360
LESSON C-1
TABLE GF CONTENTS
CLI Acknowledgement
2.2 Inmeduetion fe COBOL
C13 COBOL forthe 360
ELECTRONIC COMPUTER PROGRAMMING INSTITUTE
1.1 ACKNOWLEDGEMENT
‘The following is an extract from
COBOL-41 EXTENDED, published by.
the conference on Data Systems Lan-
wuages (CODASYL), ane printed by the
U.S, Government Printing Clee:
COBOL System developed in 1959
Dy a comnlttee composed of gov
eament users-and compater man=
ufacturers, The exganizations
participating in the original evel
his publication
opment were
based on the
Air Material Command, United States Air Force
Bureau of Stindarde, Department of Commerce
David Taylor Model Rasia, Bureau of Ships, U.S. Navy
Electronic Data Processing Divisien, MinneapoliasHonaywell
Regulator Company
Burroughs Corpe-ation
Interaational Business Machines Corporation
Radio Corporation of Ameica
Sylvania Electzic Products, Inc.
Uhivac Division of Sporry-Rand Corporation
In Addition to che organizations
Listed above, the following organt-
Lesson €1
zations participated in the work of
the Moiatensnee
‘(llstate Insurance Company
Bendix Corporation, Computer Division
Control Data Corporation
DuPont Company
| General Electric Gompary
General Motore Cozporatinn
Tockhead Alera it Corporation
National Cash Register Company
Philee Corporation
‘This manasl is the reault of cone
tributions made by 211 of the above
mentioned organs!
ranty, oxpress or implied, is made
by any contributes oF by the com~
mittee as to the accuracy and
functioning of the programming
system and language. Moreover, no
Fesponsibility is assumed by ay
contributor, or by the committee,
in connection therewita
No ware
tions
It is reasonable to assume that a
number of improvements ané adeli~
tions will be made to COBOL,
Every effort will be made leineure
‘that the improvements and correc
tions will be made in an orderly
fashion, with cue recogiitior of
eaisting agers’ inveatmenta inpro-
gramming, Howevez, tis pro
tection can be sositively ascuzed
only by inaividual imslementors,
Provedures have heen establighed
for the mainteaance of COBOL,
Inquiries concerning the proced-
ures and methods for proposing
Changes saould be direcied to the
Executive Gommittse of the Con
ference on Data Systems Tan-
guages,
The authors and copyright holders
of the copyrighted matoriel used
bezels: MATIC (Trade-
mark of the Sperzy-Rand Corps
ovation), Programming for the
UNIVAC Tané TT, Data Automation
ems 1968, 1599, Spenry-Rand
Corporation; IBM Commeretal
Traneletor, Form No, F28-8013,
copyrighled i989 by IBM; FACT,
DSO 2745269-27E0, copyrighted
1360 by Minneapolie-Honeywell;
have speciffcally authorized the
ase of this material, in whole or in
part, in the COBOL specifications.
Such authorization extends tn the
reproduction and use of COBOL
specifications ix
manials o= cimilar publications,
Prouramming
Any organization intecusted In re-
Producing the COBOL wepart ard
initial specifieations in
in pert, using ideas taker from thie
Feport or utiizing this xaport ae
the basis for a9 instauetion manual
other pumpose is free to do
so. However, all auch ozgani=
Zallons are vequeated tu reprat
this section a8 part of the intro-
Guetion to the document, ‘Those
using a sor! passage, as ina book
"COBOL" ia acknowledyn,
the source Sut mene not quote thie
cntize section
requested to mention
1.2 INTRODUCTION To Copal
What ie COBOL? COROL{COmmnon
Business Oriented Lazgnaze} repre
sents a joint effort made by the mama
facturers and users of data proces.
sing systems te develop = common
Programming language which, with
Lesson C1
mogifications, could be weed on any
cumpuler regardlaas ofmanufacturer
oF model. Those of you wao are fame
iliac with 5/360 assembly language
know that, ingenaral, aprogrem wr!
ten in this language can be assembled
Pope 2,
and ren oa ary model 36U a6 long as.
tke input/output unite, Zestures, and
arnount of siorage regaired by the
program aze present,
hen
This ix not always the case +
we leave the 5/360, Far exareple, ir
order to -nest taeir reece mary agers
found il necessary to possess several
computers: eithes made by ene mana
faclurc: or diffezent marafasturers,
To
puters, a programmer hue lo be cor
versal with the aesembly Langs
site programe for these come
developed far eack con
tiea, pragzams written for eae som
puter were aot acceptable “2 another,
Vo ve able to run a yrogcam we'tten
fez one computer 02 anotaer,
The pro-
bsing the
aasem ay tanguaye fox that eemputes,
pram aad to be re-we.th
his probleme ariece trom lac tact
that aacembly languages are mee
chine-orieated’ in that tiey met
sellact che ehareetertuties ofthe ape-
cific computer for waiea they were
designed, In other words, when a
programmer writes tae coded in-
steetions te salve a probiem, his
solution will neceaserily be in terms
of tae loaic of the computes to beusee
rathes then human logic
COROT, on the ocher hand, repres
seats an altempt to zoliove the prc~
yrammar of the usceastty oTkuowing,
for example, the requirements of a
move instraction, thereby sowing
him to concenteate on the Logica:
golution of hie problem, Putiasncther
way, COROT ia ©
‘oliem=ortented
is! eesigraed ir tenon oF the solution
of svoblems vataey taan the techaiea!
characteristics 0° a given comzut
COBOL fe relatively machiae-‘ade-
pendent in taut x GUBO_ programmer
can pre
puters “with very “tie addi
geen tor a wide range of com-
How dees COROT. work? COROT. ia
3 language complete with a vocabalary
of noms, verbs ard adjectives, Pro
grams ere written in English and
consist of aentences ard pazoararas,
For example, the COROT. statenenta
required to mavetie contealy of FLDA,
to LDU ane aude the coatente of Fue
fo FLDD, would be ae sollowe
MOVE LDA TO TLDB, ADD FLDG TO FD)
Now, we know thataprogcamweit-
ten ir a1 assembly langcage must
veatuaily he translated ine machine
Targuoge a order for i to be eur,
COBO!. programs aze no exception to
this zele. Zach marnfartnrar of com-
putere azs developec an assembly
Program, known 6 the ‘compiler’,
ich will recognize programe writ
ten in COBOL ané transiate them inty
Lesson €1
machine ‘anguage iazlzuctions a2-
coptablc to che designated compater,
This, in brief, is tae cagic or which
the COBOL system is built: the Las
guage remains the same regardless
of the computer lo be used while the
compiler changes to adjust lo Une
quicements of lne object compater.
The programmer creates a aource
program which will meet GUBQL re-
Poge 3
quirements, If the programwerc tobe
mn on 5/360, are of the 360 COBOL,
flezs would be need to produce
ct program acceptable ta the
360, If the program wore ta be zur on
2 1401, Zor example, then 3 1401
compiler wonld then have ‘a be used,
In musnmery, COROL ie a program-
ming language which enables taegro-
grammer to concentrate on the
solucion of problems, The program is
waitten in English and is ozganived
into centences and pi
implement the GOBUL system, com-
puter menuacturers neve developed
compilers waica w:
programe acceptable to their com
puters, from swwurce programs written
in tac COBOL langage. Advantages
deriving froin tae use of COROL, are
wrapha, To
IL prodace object
the jact thet ‘op! codes are the same
vagardleea of which computer i2 tobe
used urd, that programs wrilten in
COBOT. can he teas and understood
by almost anyone.
1.3 COBOL FOR THE 260
Although a COZOL programmer
aced never imow the ‘op’ codes and
formate of macaine instructions, be
may bo zoquired to snow tae formate
iz which data may be represented ia
fig computer, If aig computer uses
caly one form of data representation,
such 9s BCD, ke aged no: concern
himeelf with this problem,
vver, hiv computer cecuires different
character represeatasion
and arithmetic operations, hemast oe,
avare of Uhis co that kis daa will
be in the covvect format for a given
epezatian,
how-
formate
The 360 i9 @ case ir point, Date
ally in chavactor format.
if numeric data isto be imvelved
yrs, it mut
in any arithmetic esieulst
bo ir the forma: nequized sy the type
of arithmetic Saing nerformed, Le,
Binary, decimal oz Moating-polnt, The
compiler will gonerste the necossary,
instructions in che objec’ program to
conver: the data to the proper formal
but the programme: smust tell the
compiler the original format of the
Bote
1d the format in waich the re~
sull ds te be stored, Ttwoulé be useful,
therefore, if we stop for a moment 19
review the orgeniuation af 360 stor:
and ite deta formats and also to learn
the terms whith are used tu describe
taese formats to tae compl
‘The basic bullding Siock of storage
ie called a ‘ayte’, Zach byte has ite
pwn uddress with uddresses slarting
at zero end contining to the last
instailed byle, Consequently, a byte
ia the smallest addressable wnit of
slorage in the 369, Bytes ere grouped
into Sixed-leng:h fields of 2, 4 02 &
bytes for binary azarations, ard vor-
inble-length Helds for decimal op:
Each byte consists of 9 mugnetic
bite, One bil functions az a parity bit
e remaining 8 bite areusedto
zopreten’ the contonte ef tho byle,
hile
Then data is read it is converted
to the internal cade of che machine
which {4 The Litended Sinazy Goded
stexchange Code (ERCDIC).
Jn this format, the leftmost 4 ite of
the by
Decisal
faxction aa x zona portion and
Pegs 4
the rightmost 4 bite asamumerie por-
tion, In EBCDIC, then, the combination
of the zone and the mumer‘c portions
indicate the ch.
cter atored in the
byte. The zone codes used for alpha-
etic and aumeric characters are
shown below =
Gedo
Gaaracte
118 Letters A= 1
1102 Letlere TR
ig Trettere § — 2
nu Digits 0- 9
‘The coding for letters ofthe alpha~
bet and the digite 0-9 is given below «
enepic | BESDIC
Gade Code Character
qivu opat jw iii colo 8
Tipo onto B iio coll T
Ton 011 ¢ 1110 C100 1
2190 9190 DB | 1110 cioT ¥
aioe qual E 1110 6110 ¥
i100 aly Fr 119 0111 x
400 alll re} 110.190 Y
Lop 1009 # vio uo) A
i100 1087 1
i 114i eoo9 6
} 1101 oaey 5 111i ooul 1
| ar ara x 112 00 2
orem. | ok ants aol) 3
iim cco | 0M nuit goo 4
Tint 0161 N 1111 v10r 5
1ini 9210 ° ql 110 4
1101 old 2 ql our 7
tol 1c00 2 1211 1900 &
111 1eat R Ti 1008 3
200 CT
Pee 5
The programmer describes = field
which Is in EBCDIC sa being in
“DISPLAY’ format. Tae compiler re-
cognizes the COBOL ward ‘DISPLAY’
to mean that the data is coded in
EBCDIC, one character to a byte. In
2 COBOL program much of the data
(eames, addressos, account aumbars,
etc.) will be converted as it is read
te ERCDIC ané its
changed. However, data on which eal-
calations are to be performed maybe
converted to a computational format,
vefore the
format never
calculations are made,
The two types of aritimnetic which
will concera ns in this text are binary
and decimal, Let's take binary arita-
metic first, In FECDIG, the lezimost
4 bite af each byte served to identity
the category of the character, i.e.
alphabetic -- and if ea, which of the
three groupe --
rightmost 4 oils
or numeric, ‘The
Proceeding from
left to right -- have a value of 8. 4,
2 and 1 respectively. Once the eate-
gory hae been idontitied, we add the
place values of those bite whien are
ter represented by the code, For
example, the zone ILI indicstes a
digit. If a byte contained 1111 0021,
we see that the 2 bit and the 1 bit
are on giving ue a value of decimal 3,
Howevor, if a byte contained 1100
0011, the zone would identify it ae
belonging to the group of letters AL,
and the numeric portionwonld identi
it ac the third letter ofthe group -'C",
) to arrive al the charse-
A byte of binary data, on the other
hand, does rot consain u zone portion,
Instead, each bil in the ayta partici-
vates ae a binary value, The place
values assigned ty cach bil -- going
from left to right -- are 128, 64, 32,
16, 8, 4, 2ané | ag illusteated below:
Place Value we 6438,
Bit oo 0
The sum of the place values of
those bits which are on, indicates the
value contained in the byte.In the pre-
cecing example, the value atored in
the byte had a decimal value of 40
(32 +8). The COBOL word ‘COMPU
TTATIONAL is uacd to dasezibe data,
in the binary format, The compiler
underetands that data contained ia ——
or to be stored in -- afield described
as COMPUTATIONAL should be ir the
Lesson C1
binary format, If the data is to be
stored and ie not alzeady in binary
format, tae compile will produce the
necessary inatructions in the object
program to convert the dula prior 0
storing it,
Decimal arithmetic, on che other
hand, ia performed on data whichis in
che “packed” formst, In shiv format,
‘vo digita cecupy each byt except far
Pege 5.