C24 3235 2_Disk_COBOL_Specifications_1964 2 Disk COBOL Specifications 1964

C24-3235-2_Disk_COBOL_Specifications_1964 C24-3235-2_Disk_COBOL_Specifications_1964

User Manual: C24-3235-2_Disk_COBOL_Specifications_1964

Open the PDF directly: View PDF PDF.
Page Count: 47

DownloadC24-3235-2_Disk_COBOL_Specifications_1964 C24-3235-2 Disk COBOL Specifications 1964
Open PDF In BrowserView PDF
File Number GENL-24
Form C24-3235- 2

Systems Reference Library

COBOL (on Disk) Specifications
IBM 1401, 1440,and 1460
This publication is intended for programmers who
have a basic knowledge of COBOL programming. It includes the additional specifications necessary to write
a COBOL program for the IBM 1401, 1440, and 1460 Data
Processing Systems with disk storage.
Specific examples show how many COBOL statements
are coded. A general explanation of these statements
is also given.
A sample problem shows entries for all divisions.

This publication is a major reVlSlon of form C24-3235-1 and
obsoletes it and prior editions. In addition to incorporating information released in Technical Newsletter N24-0293, additional infonnation concerning programming considerations is provided.

Copies of this and other IBM publications can be obtained through IBM Branch Offices.
A form is included at the back of this manual for readers' comments. If this form has
been removed, address comments to: IBM Corporation, Product Publications, Dept. 245,
Rochester, Minn. 55901.

© 1964 by International Business Machines Corporation

Contents

The COBOL Language . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Machine Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
COBOL Language Notation. . . . . . . . . . . . . . . . . . . . . . . . . .

5

IBM 1401, 1440, and 1460 COBOL Programming. .

7

Environment Division. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Configuration Section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Input-Output Section. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

7
7
9

Data Division . .................................. .
Record Formats for Tape Files. . . . . . . . . . . . . . . . . . . . . . ..
Record Formats for Punched-Card Files. . . . . . . . . . . . . . ..
Record Formats for Disk Files. . . . . . . . . . . . . . . . . . . . . . ..
Data Division Language Specifications. . . . . . . . . . . . . . . ..
File Section. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..
The Constant and Working-Storage Sections. . . . . . . . . . ..

12
12
13
13
13
14
21

Procedure Division . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..

21

General Information . ........................... .
Character Sets. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..
Figurative Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..
Word Lists ...................................... "
Class Conditions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..
Continuation of Alpha Literals. . . . . . . . . . . . . . . . . . . . .

29
29
29
29
29

Reference Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..

30

Sample Problem ............................... "

37

Programming Considerations .....................
Aids ............................... '" .. . ... .. . ... .
Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..
Area Allocation in the Data Division. . . . . . . . . . . . . . . . ..
Tables..... .... .. ....... .... ... .. . .... . ... .. .....
Move Verb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..
If Statement. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..
Arithmetic Verbs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..
Perform and Alter Statements . . . . . . . . . . . . . . . . . . . . . . ..
Input/Output Verbs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..
Optional COBOL Words......... ... ........ .. ......
Object Time Subroutines . . . . . . . . . . . . . . . . . . . . . . . . . . ..

40
·1:0
40
40
40
40
41
41
42
42
42
42

Index ... ............... .

46

5

5

30

Acknowledgment
In accordance with the reql:lirements of the official government
manual describing COBOL-1961 extended, the following extract
from that manual is presented for the information and guidance
of the user:
"This publication is based on the COBOL System developed in
1959 by a committee composed of government users and computer manufacturers. The organizations participating in the original development were:
Air Material Command, United States Air Force
Bureau of Standards, United States Department of Commerce
Burroughs Corporation
David Taylor Model Basin, Bureau of Ships, United States
Navy
Electronic Data Processing Division, Minneapolis-Honeywell
Regulator Company
International Business Machines Corporation
Radio Corporation of America
Sylvania Electric Products, Inc.
UNIVAC Division of Sperry Rand Corporation
"In addition to the organizations listed above, the following
other organizations participated in the work of the Maintenance
Group:
Allstate Insurance Company
The Bendix Corporation, Computer Division
Control Data Corporation
E. I. DuPont de Nemours and Company
General Electric Company
General Motors Corporation
Lockheed Aircraft Corporation
The National Cash Register Company
Philco Corporation
Standard Oil Company (New Jersey)
United States Steel Corporation

"This manual is the result of contributions made by all of the
above-mentioned organizations. No warranty, expressed or implied, is made by any contributor or by the committee as to the
accuracy and functioning of the programming system and language. Moreover, no responsibility is assumed by any contributor, or by the committee, in connection therewith.
"It is reasonable to assume that a number of improvements
and additions will be made to COBOL. Every effort will be made
to insure that the improvements and corrections will be made in
an orderly fashion, with due recognition of existing users' investments in programming. However, this protection can be positively assured only by individual implementors.
"Procedures have been established for the maintenance of
COBOL. Inquiries concerning the procedures and the methods
for proposing changes should be directed to the Executive Com,
mittee of the Conference on Data Systems Languages.
"The authors and copyright holders of the copyrighted material used herein: FLOW-MATIC (Trade-mark of Sperry Rand
Corporation), Programming for the UNIV AC® I and II, Data
Automation Systems © 1958, 1959, Sperry Rand Corporation;
IBM Commercial Translator, Form No. F28-8013, copyrighted
1959 by IBM; FACT, DSI 27A5260-2760, copyrighted 1960 by
Minneapolis-H.oneywell, have specifically authorized the use of
this material, in whole or in part, in the COBOL specifications.
Such authorization extends to the reproduction and use of COBOL
specifications in programming manuals or similar publications.
"Any organization interested in reproducing the COBOL report
and initial specifications in whole or in part, using ideas taken
from this report or utilizing this report as the basis for an instruction manual or any other purpose is free to do so. However,
all such organizations are requested to reproduce this section as
part of the introduction to the document. Those using a short
passage, as in a book review, are requested to mention 'COBOL'
in acknowledgment of the source, but need not quote this entire
section."

The COBOL Language

The programmer's responsibility in preparing a COBOL
program is to:
1. Identify the program.
2. Specify the features and devices of the IBM 1401,
1440, or 1460 Data Processing System that will be
used to compile and execute the resultant machinelanguage object program.
3. Describe the data to be processed.
4. State the procedure to process the data.
The programmer uses the characters, words, and expressions that make up the COBOL language. He writes
them according to a standard reference format that is
outlined on the COBOL program sheet (Form X28-1464).
This standard coding sheet is used with all IBM COBOL
systems to record the source program.
The COBOL source-program card deck is punched
from these coding sheets. These cards make up the
COBOL source-program card input to the COBOL processor.

Machine Requirements
To process a COBOL source program, the following minimum machine configurations are specified.
An IBM 1401 system with:
4,000 positions of core storage
Advanced Programming Feature
High-Low-Equal Compare Feature
One IBM 1311 Disk Storage Drive with an IBM 1316
Disk Pack
One IBM 1402 Card Read-Punch
One IBM 1403 Printer.
An IBM 1440 system with:
4,000 positions of core storage
Indexing and Store Address Register Feature
One IBM 1311 Disk Storage Drive with an IBM 1316
Disk Pack
One IBM 1442 Card Reader
One IBM 1443 Printer.
An IBM 1440 system with:
8,000 positions of core storage
Indexing and Store Address Register Feature
One IBM 1301 Disk Storage
One IBM 1442 Card Reader
One IBM 1443 Printer

An IBM 1460 system with:
8,000 positions of core storage
Indexing and Store Address Register Feature
One IBM 1311 Disk Storage Drive with an IBM 1316
Disk Pack, or one IBM 1301 Disk Storage
One IBM 1402 Card Read-Punch
One IBM 1403 Printer.
The system on which the object program is to be
executed must have:
1. A card reader or a disk file to load the object program resulting from the Autocoder assembly.
2. Sufficient core storage to contain the program generated by the COBOL processor. If the object program
requires more than the available core-storage capacity, either the program must be executed in sections (overlays) or the job must be divided into
multiple runs. This requirement is a significant
consideration when planning to implement COBOL
on a system with 4,000 positions of core storage.
3. The input and output devices defined in the FILECONTROL paragraph.
4. Sense switches if they are referred to in the SPECIALNAMES paragraph.
5. The expanded print-edit feature when any of the
following COBOL editing functions are used:
a. High-order CR or minus signs and high-order
DB or plus signs.
b. Floating plus and minus signs, and floating dollar signs.
c. Check protection (asterisk fill ) .
d. Decimal suppression for blank or zero fields.

COBOL Language Notation
The entire COBOL language is described in detail in
the SRL publication COBOL General Information
Afanual (F28-8053). COBOL (on Disk) Specifications
for IBM 1401,1440, and 1460 contains additional information that enables the programmer to apply the
COBOL language to the IBM 1401, 1440, and 1460.
Throughout this publication, basic formats are prescribed for the various verbs, clauses, entries, and other
essential elements of the COBOL language. These are
generalized formats intended to guide the programmer
in writing his own statements. These rules of notation
must be followed:
5

1. All words printed entirely in capital letters are
COBOL words. They have preassigned meanings in
the COBOL system. For example: IDENTIFICATION
DIVISION. When the COBOL processor sees these two
words, it notes the beginning of the identification
of the program.
2. All underlined words are required unless the portion of the format containing them is enclosed in
square brackets. Square brackets [ ] indicate an
optional portion of a COBOL format. Underlined
words are key words. If any key word is missing
or misspelled, it is considered an error in the program. For example:
SEEK file-name RECORD

is the COBOL format for the SEEK verb. The programmer may write either of the following entries assuming that PAYROLL is the file-name.
SEEK PAYROLL RECORD
SEEK PAYROLL

is a key word and must be included. However, RECORD is an optional word and may be omitted if the user so chooses.
3. All COBOL words not underlined may be included
or omitted at the option of the programmer. These
words, called optional words, are used only for
the sake of readability. Misspelling constitutes an
error.
4. All lower-case words represent information that
the programmer must supply. The nature of the
information required is indicated. In most instances,
the programmer must provide an appropriate dataname, procedure-name, or literal. For example,
file-description format is
SEEK

FD file-name

The programmer writes
FD ACCOUNTS-RECEIVABLE

has been used as the filename for this file-description entry.

ACCOUNTS-RECEIV ABLE

6

Di.sk COBOL Specs.

5. Material enclosed in square backets can be used
or omitted as required by the program. For example, the format for the PERFORM verb is
PERFORM procedure-name-l [THRU procedure-name-.9J

The programmer can write one of the following
statements:
PERFORM GROSS PAY
PERFOR~I

GROSS PAY THRU NET PAY

The first statement can be used to specify calculation of gross pay. The second can be used to calculate gross pay and then net pay.
6. Braces mean that one and only one of the enclosed
items must be chosen. Other items are to be omitted. For example:
LABEL RECORD[S] ~ ARE
1IS ~

t 1~ OMITTED
STANDARD t
~

The statement
rect.

LABEL RECORDS ARE OMITTED

is cor-

7. Punctuation, where shown, is essential. The programmer can insert other punctuation in accordance with the rules outlined in this publication.
8. Special characters, such as the equal sign, are essential where shown, although they may not be
underlined.
9. In certain cases, a succession of operands or other
elements may be used in the same statement. In
such a case, the possibility is indicated by the use
of three dots following the item affected. The dots
apply to the last complete element preceding them.
Thus, if a group of operands and key words is enclosed within brackets and the closing bracket is
followed by three dots, the entire group (not merely
the last operand) must be repeated if any repetition is required.
10. Restrictions and comments on each basic format
will be found in this publication. The formats
should not be used without reading the accompanying text.

IBM 1401, 1440, and 1460 COBOL Programming

The COBOL source program has four major divisions.
Each division has its own set of statements, which are
written according to the rules established for the COBOL
language, as described in the IBM COBOL General Information ~lanual (F2B-B053). These division-statement sets must be arranged for presentation to the
1401, 1440, and 1460 COBOL processor in this order:
IDENTIFICATION DIVISION.
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
The IDENTIFICATION DIVISION entries are written as
described in the mM COBOL General Information
Manual.

condition-names to standard names for the status of
actual machine switches, and Autocoder-names to
COBOL-names.
Source-Computer Paragraph

Reference Format
SOURCE-COMPUTER.

Obiect-Computer Paragraph

Reference Format

Environment Division

ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER.
OBJECT-COMPUTER.
SPECIAL-NAMES.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
I-O-CONTROL.

Configuration Section
The CONFIGURATION section has three paragraphs. The
SOURCE-COMPUTER paragraph names the system that
will compile the object program from the COBOL source
statements.
The OBJECT-COMPUTER paragraph names and describes the system that will execute the object program.
The SPECIAL-NAMES paragraph equates: mnemonic
names to standard names for actual machine devices,

IBM-l40l}
IBM-1440 .
IBM-1460

This statement is required in all 1401, 1440, and 1460
COBOL source programs.

OBJECT-COMPUTER.

In this part of the COBOL source program, the programmer specifies the physical characteristics of the particular mM 1401, 1440, and/or 1460 system ( s) to be
used to compile and to execute the object program.
The ENVIRONMENT DIVISION has two major sections,
each of which has a fixed section name: CONFIGURATION and INPUT-OUTPUT.
The 1401, 1440, and 1460 COBOL presentation format
for this is:

{

(
)
)
\
MEMORY SIZE

IBM-140l}
{ IBM-1440
IBM-1460
4000)
8000 ~
12000 ( CHARACTERS
16000 )

t

.
jTHROUGH
ADDRESS mteger 1THRU
~

S :g~g}

) 12000
~ 16000

[NO-PRINT-STORAGE]
[NO-MULTIPLY-DIVIDE]
[NO-DIRECT-SEEKJ
[ NO-OVERLAP]
[NO-CONSOLE-PRINTER] .

The OBJECT-COMPUTER paragraph describes the computer that will execute the object program. The
OBJECT-COMPUTER. mM-1401 (or 1440 or 1460) statement
without optional clauses defines an IBM 1401 (or 1440
or 1460) with 16,000 positions of core storage, the processing overlap feature (1401 and 1460 systems only),
the input/output units required for the files defined in
the FILE-CONTROL paragraph, the direct-seek feature,
the multiply/divide feature, and print storage. If the
object machine has fewer than 16,000 positions of core
7

storage, and/or if any of these features are not present
in the object machine, the appropriate clause must be
included in the source program.
, 4000)
) 8000 \.
) 12000 ( CHARACTERS
,16000 )
MEMORY SIZE

jTHROUGH
.
ADDRESS mteger 1!!!illl

ft

f :g:}

) 12000
t 16000

If the system is 1440 or 1460, and if an mM 1447 is
included in the system, the No-CONSOLE-PRINTER option
will cause a SToP-literal statement to display the literal
itseH or its address in the B-address register. If this
clause is omitted, the literal will be displayed on the
console printer.
Special-Names Paragraph

Reference Format
SPECIAL-NAMES.

[device-name

This clause tells the processor how many positions
of core storage are available in the object machine and
the starting core-storage address of the object program.
If the programmer wishes the program to start at any
location other than 334, and if a printer is not to be
used as an output device, he can use the ADDRESS integer THRU option and write the numerical address of
this location in the integer portion. This number should
not be less than 334. If a printer is to be used as an output device, the program starts at location 469. If the
programmer wishes the program to start at any location other than 469, and if a printer is to be used as an
output device, the integer portion of the ADDRESS integer THRU option must be greater than 469.
If the MEMORY SIZE statement is omitted from the
COBOL source program, the processor assumes that the
object computer has 16,000 positions and starts the
object program at core-storage location 334.

IS mnemonic-name

[devlce....me

[Switch-name

lg~F f

IS mnernonic-name

J] .

STATUS IS condition-name

[l g~F f

STATUS IS condition-name ]

[

[

swltch-Mme • • • ] ] •

autocoder-name!§
[

cobol-name

autocoder -name .. ]

J.

This paragraph equates: mnemonic names to the
standard names for actual machine devices, conditionnames to the status of actual machine switches, and
Autocoder-names to COBOL-names.

[NO-PRINT-STORAGE]
[NO-MULTIPLY..:DIVIDE ]
[NO-DIRECT-SEEKJ
[ NO-OVERLAP]
[r\O-CONSOLE-PRINTERJ .

These clauses tell the processor that the object machine is not equipped with certain special features.
If either NO-PRINT-STORAGE or NO-DIRECf-SEEK is specified, the IOCS generated instructions will not use those
machine features.
If NO-MULTIPLY-DIVIDE is specified, a subroutine will
be included in and used by the object program whenever COMPUTE is used with *, /, or **, or whenever
MULTIPLY or DIVIDE is used. If the NO-MULTIPLY-DIVIDE
clause is not specified, the multiply/divide special
feature will be used by the object program.
The lXO-OVERLAP option must be included only if the
object computer is an IBM 1401 or IBM 1460 that does
not have the processing overlap feature.
8

Disk COBOL Specs.

Device-Names

The standard device-names for the IBM 1401, 1440, and
1460 systems indicate to the COBOL processor which devices are available in the object computer. They are
written with the mnemonic-name the programmer has
used to refer to them in the PROCEDURE DIVISION. This is
a list of device-names:
Device-Name
1402-R, n
1442-R, n
1402-P, n
1442-P, n
1444-P
1403-P
1443-P
1403-CT,11
1443-CT, n
1447-CP

Actual Device
1402 Card Reader
1442 Card Reader
1402 Card Punch
1442 Card Punch
1444 Card Punch
1403 Printer
1443 Printer
1403 Carriage Tape
1443 Carriage Tape
1447 Console Printer

1401 and 1460 Device-Names. For the 1402-R and
1402-P device-names, n is a digit specifying the stacker
into which a carq is to fall. For the card reader it must
be a 0 (normal read), 1 (read select), or 2 (common).
For the card punch it must be 0 (normal punch), 4

(punch select), or 8 (common). If one of the digits is
not included with a 1402 device-name, the processor
assumes that the stacker desired is 1 for a read operation and 4 for a punch operation. If n is coded, there
mus,t be a space between it and the device-name as in
1402-R,I.
1440 Device-Names. For the 1442-R and 1442-P, n
is the digit (lor 2) that specifies the unit (1442
Unit 1 or 1442 Unit 2) of the card read-punch to
which the device-name is assigned. If n is not specified,
the processor will assume Unit 1. If n is coded, there
must be a space between it and the device-name as in
1442-R, 1. 1444-P refers to the 1444 card punch unit 3.
For all systems, the printer is the assumed standard output unit for use with the DiSPLAY verb. The
card reader is the standard input device for use with
the ACCEPT verb. However, if the IBM 1447 Console
Printer is equated with a special name, that unit may
be specified as an input or output unit (or both) with
the ACCEPT and DISPLAY verbs.
For the carriage tape device-name. n specifies which
channel in the carriage tape terminates a particular
carriage skip. It can be any number from 1 to 12. This
name is used with the ADV ANCIl'I:G option of the WRITE
verb (see Procedure Division). If n is not coded, the
processor assumes that the skip is to channel 1. If n is
coded, there must be a space between it and the
device-name as in 1443-CT, 3 or 1403-CT, 3.
Note: Punched-card input and'outpu.t devices should
not be used with both the DISPLAY and WRITE verbs in
the same program. The same restriction applies to
using these devices with both the ACCEPT and READ
verbs.
[

autocoder-name IS

cobol-name]

General Description: This statement enables the programmer to write Autocoder statements that refer to
COBOL data-names and procedure-names (see ENTER).
If an Autocoder-name is used to refer to an area
that has been defined by a COBOL statement, the
COBOL name must be equated to the Autocodername.
Example: If TOTALS is a COBOL-name used to define
a COBOL area and the symbol TOTLS is used in an
Autocoder statement to refer to the same area, the
statement shown in Figure 1 must appear in the
SPECIAL-NAMES paragraph of the COBOL program.

:8
.
T
!" .. ..
[ ::::~":':: ~ :':~ ~q:~:~ ~ :::":::::::::::::::::::::

I ~IA

u

n

~

M

~

..

q

Figure 1. Equating an Autocoder-Name to a COBOL-Name

A symbol used as an Autocoder-name must meet
these requirements:
1. It must be five characters long.
2. It must begin with an alphabetic character.
3. It cannot contain a special character.
4. A blank cannot appear within the symbol.
The COBOL-name must be a non-qualified procedure-name or data-name. It cannot be a conditionname.
Switch-Names and Conditions

General Description: A switch-name is written followed by the condition-names used to identify ON
STATUS and OFF STATUS.
The standard switch-names are:
5 witcll-Narne Indicates
Printer Carriage Busy
1403-P-CB
Printer Carriage Busy
1443-P-CB
Sense Carriage Tape Channel 9
1403-P-C9
Sense Carriage Tape Channel 9
1443-P-C9
1403-P-CV
Sense Carriage Tape Channel 12 (Overflow)
1443-P-CV
Sense Carriage Tape Channel 12 (Overflow)
1460-SS x
Sense Switch
1401-55 x
Sense Switch
1440-55 x
Sense Switch

The x in the sense switch is the actual letter that
represents a specific 1401, 1440, or 1460 sense switch.
This must be a letter within the range A-G. There
must be at least one space between the switch designation and the letter used for x. For example, 1401SS C.
The status of 1401, 1440, and 1460 switches may be
interrogated by expressions in the PROCEDURE DIVISION that use condition-names.
Examples: Figures 2 and 3 show examples of SPECIALNAMES paragraphs.

Input-Output Section
The INPUT-OUTPUT section has two paragraphs.
The FILE-CONTROL paragraph names each file, identifies its input or output medium, and assigns it to one
or more input/output devices.
File-Control Paragraph

Reference Format
FILE-CONTROL.

SELECT /ile-name-l

ASSIGN TO device-name

[RESERVE

l~of

[SELECT ..... , ....

ALTERNATE AREA[SU'

J.
9

Figure 2. 1401 and 1460 SPECIAL-NAMES Paragraph

Figure 3. 1440 SPECIAL-NAMES Paragraph

This paragraph names each file used in the source
program, identifies its media, and assigns it to an input
or output device. It also permits the programmer of
1401 and 1460 systems to specify an alternate input!
output area for magnetic tape files if the 1401 or 1460
has the processing-overlap feature.
SELECT file-name-l

Each file to be processed by the READ or WRITE verbs
in the PROCEDURE DIVISION must be named in a SELECT
file-name entry. This file-name must be unique within
the source program and must be described by a filedescription entry in the DATA DIVISION of the source
program.

Example: Figure 4 shows a sample
entry.
>'

§A
7 •

:8
II

'

.....

Figure 4.

10

..

24

20
,~

SELECT

Disk COBOL Specs.

II

51

,.

_ ,/oJIAD"AT,_,r.1 .LoII!.

SELECT

file-name

ASSIGN TO device-name-l

This clause is used to assign a file to an input or
output device-name. The device-names that are valid
in the FILE-CONTROL paragraph are:
Device-Name
1402-R, n
1442-R, n
1402-P, n
1442-P, n
1444-P
1403-P
1443-P
1311-D, d
1301-D, d
TAPE(S) U, a

Punched-Card Device-Names

The punched-card devices that are valid in the FILEparagraph are the card reader, the card
punch, and the printer.
For the 1402-R and 1402-P device-names, n is a
digit specifying the stacker into which a card is to fall.
For the card reader it must be a 0 (normal read), 1
(read select), or 2 (common). For the card punch it

CONTROL

40

44

4'

Actual Device
1402 Card Reader
1442 Card Reader
1402 Card Punch
1442 Card Punch
1444 Card Punch
1403 Printer
1443 Printer
1311 Disk Storage Drive
1301 Disk Storage
729 or 7330 or 7335 Magnetic Tape Unit

must be 0 (normal punch), 4 (punch select), or 8 (common). If one of the digits is not included with a 1402
device-name, the processor assumes that the stacker
desired is 1 for a read operation and 4 for a punch
operation. If n is coded, there must be a space between
it and the device-name as in 1402-R, 1.
For the 1442-R and 1442-P device-names, n is a digit
(lor 2) specifying the unit in which a file is to be
placed. If n is not coded, the processor assumes unit 1.
If n is coded, there must be a space between it and the
device-name as in 1442-R, 1.

ned only if the object machine has the processing overlap feature. If this clause is missing from the source
program, the processor reserves no alternate area.
Example: Figure 7 shows a sample RESERVE statement.

Figure 7.

RESERVE

Note. In the SPECIAL-NAMES paragraph and the FILEparagraph, two unit-record files cannot be assigned
to the same device. For example, if the punch is defined in the
SPECIAL-NAMES paragraph, it cannot be defined again in the
SPECIAL-NAMES paragraph, nor can it be defined in the FILECONTROL paragraph.
CONTROL

Disk-Storage Device-Names

For disk files, 1311-D or IS01-D is the device-name.
It indicates that the file is to be assigned to either a 1301

or a 1311. For both the 1301 and 1311, the d specifies
the particular unit and can be any digit from to 4.
There must be a space between the comma and the
digit.
Example: Figure 5 shows an ASSIGN statement for a
1311 disk file.

°

,2

II;

20

24

~.sS,16oA1 ,Tot:),
I

I

Reference Format
I-O-CONTROL.

APPLY

:e
!

I-O-Control Paragraph

,I!

Figure 5.

!

I

,

,

ASSIGN

I

L'

32

28

IJ,I,1 -,D
!

I

!

!

,

!

1

36

40

44

!

,

I

I

I

I

,

,

!

!

I

I

,

!

I

I

I

,

I

,

,

,

!

!

Disk-File

32

36

I!

!

40

I!

I

!

44

I

!

I

I

41

I!

!

I

"

,

Tape-File

[RESERVE

~ ~O ~

!

ON file-name [APPLY ..

J.

48

For magnetic-tape files, TAPE(S) is the device-name.
It indicates that the file is to be assigned to a tape unit.
The u specifies the particular unit to be assigned. It can
be any digit from 1 to 6 with the 1401 or 1460. For the
1440, u can be 1 or 2. The a specifies that an alternate
unit is to be assigned. It can be any digit from 1 to 6
with the 1401 or 1460, but should not be the same digit
that is used for u. For the 1440, a can be 1 or 2, but
should not be the same digit that is used for u. The
same tape unit (or alternate tape unit) should not be
assigned more than once in a COBOL source program.
There must be a space between u and a.
Example: Figure 6 shows an ASSIGN statement for a
tape file.

ASSIGN

I

,0,.

Magnetic-Tape Device-Names

Figure 6.

~ TYPE-A-LABEL
TYPE-B-LABEL
TYPE-C-LABEL

ALTERNATE AREA[S]].

This statement reserves one or no alternate area for
a magnetic-tape file. One alternate area may be speci-

The I-O-CONTROL paragraph is used to specify the
type of the label records for tape files.
Type-A, -B, and -C label records contain 120, 80,
and 84 characters, respectively. The file-name refers to
the file-name assigned to the file in the associated FD
entry.
Example: Figure 8 shows a sample APPLY statement.

Figure 8.

APPLY

Deferred Elements of the Environment Division

Several elements described in the COBOL General Information Manual are not contained in this COBOL processor. These should not be coded in the ENVIRONMENT
DIVISION entries for a 1401, 1440, or 1460 COBOL program. They are stated here for reference.
1, The OPTIONAL option of the FILE-CONTROL paragraph.
2. The MULTIPLE REEL option in the FILE-CONTROL paragraph and all other features that provide for automatic assignments of tape units for a file.
3. The RENAMING option of the FILE-CONTROL paragraph.
11

4. The entire copy option. (The library tape for the
1401 COBOL processor does not presently support
the copy feature.)
4. The RERUN option of the I-O-CONTROL paragraph.
Not Applicable

The

ASSIGN

option of the

OBJECf-COMPUTER

paragraph.

Data Division
Each file, record, and data item is described within
a program by writing data-description entries in the
source program. Every data-name referred to in the
PROCEDURE DIVISION except figurative constants must be
described in the DATA DIVISION. Items and records are
described by record-descriptiO'n entries, and files are
described by file-description entries (MD and FD entries).
Detailed information a bout record formats is presented in the SRL publications Input/Output Control
System (on Disk) for IBM 1401/1460: Specifications
(C24-1489) and Input/Output Control System for IBM
1440: Specifications (C24-3011). General information is
presented in the following sections.

Record formats for Tape files
Form-l Records
Form-l tape records are fixed length, unblocked, with
or without record marks. Fixed-length implies that all
records in the file have the same number of characters.
Unblocked means that one data record is contained in
one tape record. A record mark (+) is a special character written at the end of a data record to indicate
that the preceding character is the last record character. If input records are form-l but are to be written
as output in form-2 or form-4, they should have record
marks. Otherwise the use of record marks is optional.
Tape records are physically separated by a section
of blank tape called an Interrecord Gap (IRG). Figures 9 and 10 show examples of form-l records with
and without record marks.

,

~

I
R
G

Record 1

*'

I
R

Form-2 Records
Form-2 records are fixed length, blocked, with record
marks, and with padding of short-length blocks.
Blocked means that more than one data record is contained in one tape record (two or more data records
occupy the space between two interrecord gaps).
Record marks must be used to separate the data records.
Padding means that nines (9's) are used to fill the
last block for a file if there are not sufficient data
records to fill it. Thus, a fixed-length block will always
contain the same number of characters, but a padded
record ( s) will be substituted if there are not enough
data records to fill the last block.
Figure 11 shows fixed-length, blocked tape records
with record marks and padding. Each block contains
four records.
Form-3 Records
Form-3 records (variable unblocked) are not permitted
with COBOL.
Form-4 Records
Form-4 tape records are variable-length, blocked, with
record marks and a Record Character-Count (RCC)
field in each record, and a Block Character-Count
(BCC) field in each block. Variable length implies that
all the records in a file do not contain the same number of characters.
Block Character-Count Field

A four-character field at the beginning of each block
contains a count of the total number of characters in
the block (including the block character-count field itself). The BCC field has AB zone bits (IBM card code
12-punch) over the units position. This count is used
to check wrong-length record conditions.
Record Character-Count Field

A record character-count field of three characters in
each record contains a count of the number of charac-

Record 2

G

*'

I
R
G

4:

Record 3

G

Figure 9. Fonn-1 Records with Record Marks

Record 1

Figure 10. Fonn-1 Records without Record Marks
12

Disk COBOL Specs.

Record 2

I
R

Record 3

)

~

14------- Block 1--------..

1 4 - - - - - - - Block 2 - - - - - - - . - . 1

Figure 11. Fonn-2 Records with Padding

ters in that record, including the RCC field itself and
the record mark. This field must be in the same relative position in each record (the character size of each
C1 in Figure 12 is the same). Figure 12 shows the record format for a form-4 record.

Note: For form-2 and form-4 records, it is the programmer's responsibility to place all record marks in
the file-description entries, and in the work areas,
where applicable.

Record Formats for Punched-Card Files
Card Read-Punch Records

Records of files assigned to the card reader and the
card punch must be eighty characters long, unblocked,
and mayor may not have record marks in the 80th
character position (card column 80). This is equivalent
to the form-1 record described previously.
Printer Records

Records of files assigned to the printer must also have
form-1 record format. For the printer the fixed record
size must be equal to the number of print positions on
the printer. A maximum of 132 print positions is used
by the COBOL compiler.

Record Formats for Disk Files
can process disk records that are fixed-length
unblocked (form-I), fixed-length blocked (form-2), or
variable-length blocked records (form-4). The maximum size of a record is 999 characters. Figure 22 shows
the record forms permitted for each type of access
mode.
To process blocked records, the COBOL processor requires the following.

COBOL

1. A block may contain a maximum of ten records for
random files, one hundred for sequential files, and
thirty for control-sequential files.

rCl~
, I

1

I

1

R
G

C
C
B

:C
C:
: R :
I

I

rCl~

*

I

I
I

I
I

:
I
I
I
I

2. In blocked files, each record in every block must
contain a record mark as its last character.
3. For variable-length records, a block-length field
must be included in each block, and a record-length
field in each record (see Figure 13).
As the name implies, block length is the total number of characters in the block, including itself and
record marks. The block-length field must always
be recorded in the first four positions of the block.
When output records are created by COBOL, this
count is generated automatically.

Record length .is the total number of characters in
the record, including itself and the record mark. The
record-length field is a three-position field and must be
located in the same three positions within each record
in the file.
Figure 13 shows examples of the various types of
disk records that this COBOL processor can handle.

Data Division Language Specifications
The DATA DIVISION of a COBOL source program is divided into three major sections:
FILE SECfION.
WORKING-STORAGE SECTION.
CONSTANT SECTION.
The FILE SECTION describes the input and output files
with respect to content and organizational format. It
has two major subdivisions: the file-description entry
that specifies the physical characteristics and organization of the input and/or output data and the recorddescription entry that describes the individual items
contained in the file records.
The WORKING-STORAGE SECTION describes the areas of
core storage where intermediate results and other
items are stored temporarily at object-program execution time.
The CONSTANT SECTION describes fixed items of data
which remain unchanged during the running of the

r c 1\2i1
*

T

1

I
I

I

I
I

I

I

I

I

*

I

I
R
G

1III~t------ Record 1- - - -........1•..-.----- Record 2 --------t.~I••-- Record 3 --J~
~~~-------------------------------Block-------------------------------~~
Figure 12. Fonn-4 Records
13

(Fixed-Length)
FILE A. FORM-1 8O-CHARACTER UNBLOCKED RECORDS
mm--------------f0IT8'·El~

80 - Character Record

FILE B, FORM-l

80 - Character Record

(Fixed-Length)
175-CHARACTER UNBLOCKED RECORDS
175 - Character Record

S

(First 100 Characters)

A

175 - Character Record
(First 100 Characters)

(Last 75 Characters)

(Fixed-Length)
FILE C, FORM-2 7O-CHARACTER RECORDS
70 - Character Record

FILE D

S B
A L

TO A BLOCK

70 - Char,
(First 30
Characters) •.

Record
(Last 40
Characters)

Last
10
Char

70 - Character Record
(First 60 Characters)

70 - Character Record

FORM-4 VARIABLE-LENGTH BLOCKED RECORDS (LARGEST BLOCK - 300 CHARACTERS; LARGEST RECORD - 296 CHARACTERS)

< ...

50 - Character
Record

66 - Character

I I

L

Record

I I

L

RL

I I

L RL

RL

40 - Character 40 - Character 91
Record
S B Record
A L
I I
I I

LRL

40 - Character
Record

LRL

SA - Sector Address
G - Gap Between Sectors

-

65 - Character

I I

•.........

~I

Record

45 - Character
Record

3OUrius.,-

87 8A

:e

16

12

20

24

28

32

36

40

44

48

GmCORD CONTAINS [integer-2 TO]
«,«

integer-3

LABEL RECORD[S]

CHARACTER[S~

~ ARE t

1IS

~

[

integer-3 CHARACTER[S] ]

J]

data-name~.

Note: A VALUE clause is required when
are standard.

LABEL REC-

ORDS

FD file-name

The level indicator identifies the beginning of the
file-description entry and precedes the file-name assigned by the programmer. (Example: Figure 14.)

24

Figure 14.

FD

28

32

36

40

44

The RECORD CONTAINS clause may be used to specify
the number of characters in the data records. Because
the record-description entries define the size of each
data record, this clause is never necessary. However,
if the programmer wishes to include it, integer-2 speci~
fies the number of characters in the smallest record in
the file, and integer-3 specifies the number of characters in the largest record.
Fixed-length records must be specified using integer3 only. Variable-length records are specified by using
both integer-2 and integer-3.
Example: The records for a certain file are variable
length. The smallest record size is 75 characters; the
largest is 86 characters (Figure 16). When levels are
defined in the FD, 86 must be defined before 75.

48

File-Name

[RECORDING MODE IS

I

BLOCK CONTAINS

~

[data-name-2 IS ..

1tsRE ! data-name-3

«, ,

[RECORD CONTAINS [integer-2 TO]

~ STANDARD t

I OMITTED

[VALUE OF data-name-l IS literal

DATA RECORD[S]

Figure 15.

, ,

Figure 16.

1]

This clause specifies the mode in which the file is
recorded. A 1 indicates the move mode, even-parity.
RECORDING MODE 1 is the only recording mode implemented by this COBOL processor.
'BLOCK CONTAINS inte er-l ~ RECORD[S]
tl
L-g
I CHARACTER[S] U

This clause must be included if more than one data
record is included in a tape record (other than form-I).
It indicates the size of the block in records or characters. The size may be stated in terms of RECORD(S) for
form-l or form-2 records where integer-l is the number of data records in the block.

RECORD CONTAINS

Note: Both the block count and the record count
must include the record mark ( *) in the count.
LABEL RECORD[S]

~ ARE

1IS

t~ I~ OMITTED
STANDARD t
~

This required clause states whether header and
trailer label records are standard or omitted. This COBOL
processor can handle only standard type-A, type-B,
and type-C tape labels and standard disk labels. For
punched-card files the OMITTED option must be used.
Example: Figure 17 shows a LABEL RECORD entry for
a punched-card input file.
I-'

8A
7 8

:8
12

16

:Io. IS INCR..t::I+S€]) B.v, 1.1. ,U.M-r.I.L II" cQIlA;LS 1.1.16.1.
e.fll.V.T:R.D.IIIoIII.!::tJ-( •.D.T.IIIS.I.O.N..
CON j:'l.(; V R,Il-,I,I 0 N stefION.

5 0 () R.'C E - COM P U 1" £ II.. •
() ((Ie €: - Co flo PUT U~.

.s 0
oS 0

v.l?:ce: - Co,JI1,P U IIE,R..

05J

eCI-,C,OoM,Pu

1"0

I

M-

1r41~,1

I

B~-

1,1,4,', •

•

1 13,t11,- ) 4 {,; •

I.M, -I 4,(1. I

-r,E,f(.

o 8J f'C T,-,C.D.~,P (/ r,f,Il..
013 J t'c J - Cv /If P Il.T.E.!' •

I S.M. - 1.4.4.'.
ISM - J 46",
5.I,t,E. -'

:S

SA

SER'AL

I
I

PR.OUZIlII4 -tt3

6 7 8

]) II 1" A' D I V T j I 0 rJ .

;:2-'1

f I

~$¢

pp

L

114-1
¢S¢

24

20

'6

'2

, I ¢

28

40

SYSTEM

11

woR. K'1 N,q,O,ll,fttq EO S,f
II '5/HMLY-«€COflJ).

44

48

'0 () T PUT -

5,

f? E C 0 fLD

64

60

PrCiUK£;

X ( I:J 2)

X (5') vALUE
lZl.ll.
X ( 0.)
II ALlJ13.

p,).. E: -,~

68

,

72

1 1 1

cr ION.

1'2-

(:.]LJ..ER.

PIC-,URE

J(I~

'¢:z."
'!If/..

WE£~LY-D£iAIL-LIN£

Ple,utZ£
PI e-r Vfl £

¢

56

52

5

OF

7$ItM,

1 1 1

¢H
/ I

,)

'DENT.

L f.
'L II" f.; L I<. £C 0 R..']) 5 4/H Oil1z-r./f.D
'J) A,.4 {UCOi'l.D
IS OU,pvT-R.ecoflD.

V1¢

/ :2.'

ISHEET
I

I·krb

DATE

E' SeC-rION..
's It L II R. Y ~ r: I

11p~

18 'I

36

32

Fo,....,No. X28-1464
Printed in U.S.A.

SHEET

PROGRAMMER

1,11,2,
4

PROGRAM

rILLE-I(
I"1,OrJ-r HL

J3i1

',,2-,

FILLER.

/ 'I-¢:

A,AI,N U A,L,- ]) E, A],L,- J- I '" 13'fHA-DINC,,- R,EtD,R,D.
FIL.J-.E.R
",2,
w.e E I-'

4

SA

'(!

¢,7-,p

¢,5,¢
¢ b,~

¢,9 p 1'1
1,~,P 11
,(,7

j,~,¢

7,1,

/ :?>,~

'1,1,

11 K',~

VALUE

•

s I' fteEs.

\ A-rJlIlcJ A L

I

•

Fo,mNo. X28·1464
l',inted,nU.S.A.

SYSTEM

iSHEET

1<'I-b~

I DATE

'1

'(' D

28

~2

36

40

f- ILL €,~

r ft 8 L E. -

48

I

52

PICTti,R.€. X (s)
I'rCTUflE IH 32..)

15- CD ef(. £ C T

3

'DENT.

OF

:)

7s'ff('1,P L

~- ~

56

60

64

68

vALVF-5

Ref

eOfU'.EC'

-r{tBL£- IS -,NO,-CO 1Z,R.,6cr
"A6L.E VJH-IH,s IHE NO

SEC 110

/

.

VALvE

1.:5

Vfl LUE

15

VALUE

IS

.sPfH',Es:.

IH E.

J

'IJlI,E E J<,L Y -P A Y
#1,0 rJrHL,Y,-P,l},y'
'/trJNvt+L-P,AY

,1\15:, .4,1\,['[;

7,1,
1,1,

44

Prc/llR.f:

)( ( r,.z,)

PICTURE
COf«I';CT'·

A (2.fJ

1/ 11 L UE

IS

q(IoJyq'j

VALUE

'i (. b) 1/99
'i (t,,) I/q,q,

V4LUf

,I S
IS

l£lZo.

VALUE

1.5

~E ((.0.

PICTUf2,£,
f]crVR.Fc
PI C.'IJRE
PreluR.E

SPli-CE5.

zERO.

q,q,qvqq.

PIG'-'U("~.

qqCJqvqq.

PI(~uR.f:

, ,.(,V,N.

ltD vtr.rJC.I rJ&.

,:2, ,t.,I IIf,E,S.

S,/hJ.../'IP..,y - f I,L,E •

,
,

Figure 43. Sample Program

#3

(part 4 of 5 )

IB'4
,

COBOL
PROGRAM

PAGE
3

5li-tvlPLE

fROG t2A-fi/l

'"'
gA

:8

6 7 8

'2

SER,AL

'6

20

24

ISYSTEM
I DATE

*3

28

FOJmNo. X2B-1464
Printed in U.S.A.

PROGRAM SHEET

PROGRAMMER

1¢,¢,5
4

I SYSTEM
I DATE

-Jr3

28

Form No. X28-1464
p,intedinU.S.A.

PROGRAM SHEET

PROGRAMMER

!t,~.4
4

COBOL

32

36

40

44

,SHEET

141,,0

48

52

I 'DENT.
56

60

S-0F

S

7s. nM P L F

64

68

-,~
72

14f,/,¢ 1(,.,1) L,c.:U L II "I 0 rJ S •
'e 0 "I P u 1.& Wef-K.LY-PI}( :: 3
!lt~¢
J"/,O Nr.Jt,L.LY - Poll Y /, , 3.
1¢,,;,{.6
'CO"1P v-rE If rJ tJ V Ij. L - 'p,1i Y =- 12- *' 1''1.0 rJ r.H,t.. Y - {J 1/ V •
:M,D V,e W.E.f.K.LY-Pf!rY TO W.f.E.KL,Y,-[)£-r.If-I L- LI,N,E..
~4-¢

*

'~O,i/,e, lliONlftLy-PfI,Y,

~5p

I¢,b¢
~

:M,o I/.E

/,0

A-A!l\f.ufhL-Ptj-Y
,TtD
',4D.D
,0
,WEE/( L,Y,- P,If,"h
:II DD ,II1,D N"rtL Y - PIf", Y -r.o
'IlD D It iii fIJ V I'1:L - P f+,y,
-r.o
'W,((r I E- O UrPtJT-f(e.CO f<.D

1,rj

~i¢

IfI,'1 I!
/J,;

,
,
,
,

i
;

,II1DIIi~HrL,Y;-,J:\E,TITIL-LIl\f.E.
F!;fIJ N It,L - DE -(lU ,L - L1 rJ, £. •

u

Mit S 1-1-.-1.0 IJt J.- - Co V IJ. r. £,12 - 'll/,E,E,K. LY •
!tA·s J!- - -r.D -r.1t, z..- (! 0 (),N,T.£12 -11.0 Mr;!f.L,~.
II 45 Jh,,/l-,L - C. 0 VII!.I F f2 - J!;IIi,AlV,AL,'

,,0

F.f2 DM

SIf; L fJ I( Y - Ii!

e. c. 0,1(, D •

,

,
,
,
I

,
,
,
,

Figure 43. Sample Program

# 3 (part 5 of 5)

39

Programming Considerations
Aids
Two aids to generating more efficient machine language coding and decreasing compiling time are the
optional WORK4 and WORK5 file assignments [COBOL
(on Disk) Program Specifications and Operating Procedures, IBM 1401,1440, and 1460, C24-3242].
The use of WORK4 intersperses COBOL source statements, by paragraph, with the Autocoder symbolic
statements generated by the COBOL compiler. The programmer can then determine which .autocoder statements were generated for the respective COBOL statements.
The use of WORK5 produces a listing of the Autocoder symbolic statements generated by the COBOL
compiler. It is valuable when warning diagnostics are
generated. Errors can be corrected before the generated autocoder program is assembled, thus saving
the extra assembly time.

Techniques
COBOL provides a convenient metliod of writing business-oriented programs. However, certain techniques
can be used to produce more efficient machine language coding and increased compiling speed.
The following considerations and suggestions are
included to aid the programmer in obtaining a better
COBOL-generated program. An original program (Figure 43) required approximately 3,100 positions of core
storage. By applying a few of the suggestions to the
second program (Figure 44) the core storage requirement is reduced to approximately 2,350 positions of
core storag~, representing a saving of 25 percent.
The changed statements utilize redefinition, equal
decimal alignment, alphabetic compare, and the deletion of a subroutine caused by the statement WRITE
OUTPUT-RECORD FROM SALARY-RECORD (Figure 43, part
5 of 5, line 100). It is recommended that the programmer become familiar with these suggestions and apply
them in the writing of COBOL programs.
Area Allocation in the Data Division

The following rules govern when 1401 COBOL sets
word marks with data areas:
1. Record areas (01 entries) always have a group
mark with a word mark in the following position,
and have a word mark in the high order position.
2. Word marks will be set in the high order positions
at the next level from the 01 entry. This will be
02, or the next lower level if no 02 is present, unless
occurs or redefinition is present.
3. Subfields have word marks set only when their
high order positions coincide with word marks set
as in preceding item 2.
40

Disk COBOL Specs.

4. A word mark is always set in the high order position at the 77 levels, but there is no group mark
with a word mark set.
5. No word marks are set for data fields within a 01
entry which contains a redefines or an occurs, either
at the 01 entry (implicit redefinition is allowable)
or at any sublevel.
If word marks are required but not present, they
will be set continually and cleared for access to the
field; this requires time and core. If word marks are
present, they will be regenerated if removed. For example, if editing into a 02 area, a word mark will be
reset each time.
Tables

:Many programs require tables. Following are several
considerations about table building and searching
with 1401 COBOL.
1. Unless it is certain that a table will never change,
the initial values in the table should not be established with the VALUE clause. A better approach is
to set up a card deck or tape file with one table
entry and a sequence number on each record. Using
the READ verb, build up the table data during program initialization. This approach eliminates the
need for recompilation or object-program patching
in the event that the table changes in value or size.
2. Before using the OCCURS clause and one or more
levels of subscripting, weigh the alternate storage
cost of naming each table entry and writing (for
example):
IF ARG = TAB-1 MOVE ENT-1 TO WORK GO TO FOUND.
IF ARG = TAB-2 MOVE ENT-2 TO WORK GO TO FOUND.
etc.
3. Define long tables as a set of shorter tables. A few
IF statements are enough to isolate the relevant
position, which can then be moved to a work area
where the final pinpointing of the correct entry can
be done.
4. If the work area mentioned in the preceding item
3 is n entries long where n is a power of 2 (such
as 8 or 16), the IF statements which are used can
be written in such a way as to eHect a binary
search. In the case of a 16-entry work area, this
technique can yield an answer after only four IF
statements.
5. Sequential table searches require little prograrp.ming eHort and are efficient if the table can be
arr;mged so that the most active items are at the
beginning of the table.
Move Verb

1. MOVE A TO B, where A and B are equal length
alphanumeric elementary items defined at either
the 01 or 02 levels, gives the best possible coding.

All items with subfields are treated as alphanumeric
by COBOL, even if some or all subfields are defined
as numeric. Only one 7 character instruction is
generated as long as A and B are not redefined or
subscripted.
2. If both A and B are redefined items or items defined
at 03 levels and up, eight additional characters of
instructions are generated (i.e. SET WORD MARK and

2.

CLEAR WORD MARK).

3. Elementary items are treated as above unless they
have an unequal number of decimal places. In that
case, a greater number of instructions is generated.
4. Unequal length elementary alphanumeric items
are moved the same as equal length items when
A is longer than B. However when B is longer, additional instruction characters are generated to
blank the receiving field.
5. MOVE A TO B causes COBOL to include a special subroutine when A and B are of unequal length or one
or both contain subfields. The special subroutine is
used because the MLC and MRCM instructions cannot conveniently handle this complex situation.
Even when A and B are the same length, the subroutine is still used if A is a 01 item and B is a 77
item or vice versa. The subroutine may be avoided
by writing a set of individual MOVES, redefining
both A and B, or by making them the same length.
6. MOVE SPACES TO A and MOVE ZEROS TO A each generate 11 characters of object code unless A is a 01
level item with subfields. In that case, A can be
redefined at an additional cost of eight characters
of object code.
7. When editing is involved in MOVE A TO B, the same
rules about scaling, redefinition, and size apply.
For example, when the A field has fewer decimal
places than the editing PICTURE describing B, many
characters of coding are generated. If the scaling is
identical for A and B, approximately one-third as
many instruction characters are generated, plus the
edit word.
8. Avoid editing functions which cannot be handled
by the edit instruction directly; COBOL zeros, Hoating plus or minus, DB, and single plus. A special
subroutine is called to handle these cases.
9. MOVE ALL requires a special subroutine. Use a literal
or constant of correct length to handle this case.
If Statement

l. When defining fields that are to be compared, consider the following:
a. When at least one of the fields is a 01 item with
subfields, a special subroutine is required. It is
better to process such fields by comparing each
lower-level item individually; or the group item

3.

4.

5.

6.

7.

can be moved to a hold area of equal size (not
containing subfields), and then comparing.
b. When numeric compares must be used because
one or both of' the fields are signed, attempt to
arrange the record format so each item has the
same number of decimal places. The fields do
not have to be the same total length.
In the statement IF A = B, only one of the fields
(A or B) need be defined as alphanumeriC to get
the more efficient alphanumeric compare instructions generated.
IF A NOT GREATER THAN B •.. has the same meaning
as IF A LESS THAN B OR EQUAL TO B . • . and the generated instructions for the first statement require
half the number of core positions.
The statement IF A IS ZERO • . • generates more
efficient coding when A is defined as numeric
rather than alphanumeriC. However, an even
greater improvement can be gained by declaring a
constant of zeros (named C, for example) , and
writing IF A = C ••• which is twice as fast.
Avoid the statements IF A ALPHABETIC and IF A
NUMERIC whenever possible because they require
subroutines in the object program.
Avoid the use of ALL, HIGH-VALUES, LOW-VALUES,
SPACES, and ZEROS in conditional expressions. They
can easily be replaced by named constants.
Subscripted names in an IF statement will cause
the compiler to include appropriate subroutines
which often perform slowly at object time. Frequently it is better to use several IF statements to
perform a table look-up on a short table rather than
use subscripting and the PERFORM verb (or an
equivalent loop).

Arithmetic Verbs

l. Avoid ON SIZE ERROR . . . whenever possible. The
generated coding to perform this test consists of
up to 40 characters.
2. ADD and SUBTRACT statements:
a. The most efficient object coding is obtained for
fields which have equal scaling. When two fields
(A and B) have equal scaling, the statement ADD
A to B generates 7 characters of object code.
b. Redefining, or using 03 levels or greater, will
require 8 additional characters for each field so
defined.
c. Multiple operands are as efficient as the equivalent set of single statements. ADD A, B TO C generates 14 characters (assuming the requirements
of 3a are met).
d. ADD A TO A is an economical way of multiplying
A by two. Other sequen<;es of ADD's and SUBTRACT'S, sometimes with REDEFINE'S to achieve a
41

shift, can be devised to simulate a more complex
multiplication.
3. MULTIPLY and DIVIDE statements:
a. MULTIPLY A BY B GIVING C generates 21 characters
of instructions if A, B, and C have no decimal
places. When A, B, and C have decimals, and
the number of decimals in C is not the sum of
those in A and B, 42 characters of instructions
are generated.
b. In the preceding; example, ROUNDED generates an
additional 7 characters.
c. Less efficient coding is generated for a COMPUTE
statement than for the equivalent set ADD, SUBTRACT, MULTIPLY, and DIVIDE statements. The reason for this is the need to retain up to 18-digit
precision throughout the execution of a COMPUTE
statement. Because the 18 digits can be on either
side of the decimal point, and because one or
two extra digits may be required for rounding,
COBOL allocates 40 digit accumulators for the
storage of temporary results.
Work areas are assigned only once per program. Thus the most complex COMPUTE statement determines the number of 40 character
areas that will be needed for all COMPUTE'S.

Perform and Alter Statements

1. The statement ALTER LABEL TO PROCEED TO NEXTLABEL generates 10 characters of coding.
2. The statement PERFORM CALCULATION generates 18
characters of coding at the point in the program
where the PERFORM occurs. In addition, CALCULATION is augmented by 4 positions for each PERFORM
which references it.
3. CALCULATION should be positioned in the source
program at the point where it will be executed
most frequently simply by falling through from the
preceding paragraph.
4. The option 2 statement, PERFORM CALCULATION 5
TIMES is efficient. Core requirements are about 45
positions at the point in the program where the
PERFORM occurs and 4 positions additional at the
end of CALCULATION. No additional core or time is
required when a data-name instead of a literal is
used to indicate the number of TIMES.
5. Option 4 of the PERFORM verb is handled best if
the VARYING field is defined as alphanumeric and
each of the fields in the expression has the same
length.
Input/Output Verbs

1. The statements READ INTO and WRITE FROM each
cause a move of the entire logical record. In many
42

Disk COBOL Specs.

2.

3.

4.

5.
6.

cases the use of these options is unnecessary because processing can be done either in an input
or an output record area as defined by the DATA
RECORDS ARE clause in the FD'S. When READ INTO or
WRITE FROM must be used, ensure that the implied
data move involves equal length areas.
When using a card reader, READ is faster and generally smaller than ACCEPT. Similarly, WRITE is better than DISPLAY for printing and punching.
It is not possible within COBOL to assign the same
input/output area to two files. Areas in the WORKING-STORAGE SECTION can be ( and should be)
shared, however.
For card and printer files, input/output areas in
addition to 001-080, 101-180, and 201-332 are assigned. This is in anticipation of a possible conflict
with the ACCEPT and DISPLAY verbs, which use those
areas also.
The WRITE verb for a printer FD does not clear the
print area. Use MOVE SPACES to clear this area.
Form 3 (unblocked, variable length) tape records
are not permitted within COBOL. If necessary the
file can be defined as Form 1, and a simple Autocoder sequence can be used to set and clear the
GMWM at the end of the portion of data to be
written. Form 4 usually offers better tape utilization.
A common error in COBOL programming is the
assumption that a different area in WORKING-STORAGE
must be defined for each record type in a given
file. This may be avoided by (1) defining all possible data records directly under the FD with one 01
entry group per record type, or (2) defining the
most common record type under the FD and all the
others in a single area in WORKING-STORAGE which is
redefined once for each record type.

Optional COBOL Words

words, defined as being optional words in this
manual, add nothing to the object program but do require time for the compiler to evaluate. Compiling
time can be decreased by avoiding these optional
COBOL words.
COBOL

Obiect Time Subroutines

There are several COBOL object time subroutines that
may be generated. These routines are described in a
separate bulletin which may be obtained with the program. Normally, the programmer should avoid COBOL
statements which cause these subroutines to be used.
For the most part their inclusion is caused by either
unusual language features or by complex data formats.
Following is a list of these subroutines and the reason

why they are called and/or how they may be avoided.
1. The Examine subroutine is included whenever
the EXAMINE verb is used. It may be avoided as
follows:
a. For short fields, give each position a name by
defining an appropriate number of subfields
and using a set of IF statements.
b. For long fields, define a work area with onecharacter subfields and process portions of the
long field there.
2. Single, double, and triple subscript subroutines
are included whenever a field is singly, doubly,
or three-level subscripted.
3. The Alpha Compare subroutine is included when
a group item with subfields is compared to any
data item. The subroutine may be avoided by
redefining the field which contains subfields.
4. The Figcon Compare subroutine is included
whenever a record with subfields is compared to
a figurative constant (HIGH-VALUE, LOW-VALUE,
QUOTE, and ALL alpha-literal). This subroutine
may be avoided by redefining the field with subfields and using a literal or constant.
5. The If Numeric subroutine is included whenever
an alphanumeric field whose size is greater than 1
is tested for a numeric value.
6. The If Alphabetic subroutine is included whenever an alphanumeric field whose size is greater
than 1 is tested for an alphabetic value.
7. The Accept subroutine is included whenever the
ACCEPT verb is used. To avoid this subroutine,
define a file and use the READ verb.
8. The Display subroutine is included whenever the
DISPLAY verb is used. To avoid this subroutine,
define a file and use the WRITE verb.
9. The Editing subroutine is included when editing
requirements include COBOL zero, floating + and
- sign, single plus, and DB. It produces highly

specialized editing features. If possible, use only
the standard editing features of the 1401, 1440, or
1460.
10. The Expin subroutine is included whenever an
integer exponent is used (COMPUTE A = BOO, 5). It
may be avoided by writing successive MULTIPLY'S.
11. The Go To Depending subroutine is included
whenever GO TO DEPENDING is used. This subroutine may be avoided by a set of IF statements.
12. The Move All subroutine is included when the
ALL option of the MOVE verb is used and a record
with subfields is to be filled. A MOVE statement or
a set of MOVE statements is preferable.

13. The Move Record subroutine is included when
ever a record with subfields is used in a MOVE
statement, except when the other field is a record
(01 level) of equal length. This subroutine may
be avoided by:
a. Using a set of elementary MOVE'S.
b. Redefining both fields to eliminate word
marks.
14. The Expni subroutine is included when raising
an expression by a non-integral exponent (COMPUTE A = B 0, 0, 2.5). It is impossible to perform all
the functions of this subroutine with other COBOL
statements unless the exponent is defined as an
integer. For special purposes an Autocoder subroutine may be a more practical solution.
15. The Multiply subroutine (MULTY) is included
whenever the object computer does not have the
Multiply/Divide feature. The subroutine may be
avoided by substituting a comparable set of ADD
instructions.
16. The Stop-literal subroutine (SPLIT) is included
whenever a STOP literal statement is used. The
size of the subroutine may be reduced by declaring NO-CONSOLE-PRINTER.

43

"'No.~l"

COBOL PROGRAM SHEET
PAG! PROGRAM
I
:s
PROGRAMMER

SAMPLE

ISYSTEI!I

PR06T,A,T,A, ,R,E C.,O,R,D,S, A,Ro Ei H ErA D \ N G -,R.£

~,6,Q)

ID •

1z).7,tJ rb,l
(!j,g,a

'II E,A,D,',N,6 -,RoE,c,ooRoDo.
:tl).f. FI LLE,R.

~q,tll

!m.~ .IME E..K,L,Y,- 1-1 E A DIN G - L I .N.f

l,~

lJ02.

111,0
112.,a

!0,1

l.,3,(t

!0tZ

14,Ql

:0,L

:(l),z.

Ir5,a 14),1

F \ LL,EaR
ANNUAL-HEAVING- LINE

,1,t

F ILL E,It
'S,A,L ,A,R, 'i,- ,R, E,CoO,"'O, •
.F, I L L,E.R
:lA2 ,IME.E.KL'f-DET,AI L-,L I WE

:0,l.
:aI.Z.

U,oJ
1q,a

:lh

2.,~,t.

ZJ.,1ll

:0.2..

.u.. ol

:1'b.2
0.1

FILLER
M,O /II T H L Y - 0 ETA I L -

LIN E

F ILL E,R..
oA,N N U,4 L - DE T A I L - L' N E
FILLER

SAL ~,~'I'.- R E COR 0 ..

PI CTURE
PIC T 1I.R.E

"'(0.
'I. (52) •

Pol C T U.RoE
P \ C T V.ftE
PI CTU,ftE

)t (5,~,),.

PICTURE

,z~~

.P.I C T U.RoE

~:z:z .,~~.

'1.,(

5) •
1·

:~.z..

E -,R,E C O,R.O,
F I,l L E,R.
MESSAGE

Disk COBOL Specs.

# 3 Revised

(Part 2 of 4)

.
.

~,~.

11(.( 5 ) •

PICTURE

Zl~~l_l:1-.

PI C.,T.oRE

~ ( 5,.1,) •

P \ c. T U,RoE
PIC.TU,RtE.

11(

M,E S SA 6
:0,2.

Figure 44. Sample Program

44

,

PIC T IJ,R,E )( (,5,0,),.
Pd C T,U,P.E. A ( 6,) ,Pol C,T,U.RoE. X (,5,) •
P \ C T V,R,E A ( '1,) •
,Pol C.,T,U,RoE- l( ( b) •

:as,2.

16.d.

2..3,ol
:L4.0
2. s,al

I=J,LLE,lL
1/0,0 NT H L,'t',- HE A.Do/,N,6 - L I II E

cP,~D

(5,,) .

X (l.B.).

NlESS.A6E- RE.c.o,R

COBOL PROGRAM SHEET

Figure 44. Sample Program #3 Revised

(Part 3 of 4)

COBOL PROGRAM SHEET

Figure 44. Sample Program

"'Na.~l""

PMtM in U.s.A,.

r:-No.

X21--1464

Prw.d in U.S.A.

# 3 Revised ( Part 4 of 4)
45

Index
ACCEPT....................
. ................ .
Acknowledgment . . . . . . . . . . . . .
. ...... .
ACTUAL KEy.............
. ................... .
Added Elective Elements of the Data Division . . .... .
Added Elective Elements of the Procedure Division .. .
Additional COBOL Words.
Aids, Programming .................................. .
Alter Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ........ .
Arithmetic Verbs. . . . . . . . . . . . . . . . . . . . . . . . . . . . ........ .
ASSIGN ....................... , .

22

If Statement ,. . . . . . . . . . . . . . . . . . . . . . . . . . . ............. .

4
19

Input-Output Section ................ , . . .. .. , ..... .
Input/Output Verbs ................. , .............. .

42

Label Information (Header Label Records).
LABEL RECORD(S). . . . . . . . .. ,.,
LOW-VALUE(S) ............... .

16
15
29

21
26

29
40
42
41
10

Block Character-Count Field
BLOCK CONTAINS ........... .

12
15

Card Read-Punch Records ........................... .
Character Sets . . . . . . . . . . . . . . . . . . . . . . . . . .
Class Conditions. . . . . . . . . .
Clause Descriptions (File Section) .
COBOL Language.
COBOL Language Notation
Conditional Statements ...... .
Configuration Section. . . . . . . . . . . . .
Constant and Working Storage Sections.
Continuation of Alpha Literals. . .. ......... .
CONTROL-SEQUENTIAL Access ..
Creation Date .................................... .

13
29
29

Data Division. . . .
........
..
Data Division Language Specifications
Date Card ......... , .......... .
Declaratives ., . . . . . . . . . . . . . .. ..... .
Deferred Elements of the Data Division ...... . .
Deferred Elements of the Environment Division.
Deferred Elements of the Procedure Division.
Device-Names .........
...
. .. .
Disk-Storage Device-Names ............ .
Disk Trailer Labels ... .
DISPLAY ......... , .. .
Division, Data . . . . . . .
Division, Environment. . .
Division, Identification ....
Division, Procedure . . . . . . . . ..

18

5
5

25
7

21
29
18

16
12
13

16
21
21
11
27
8

11

20
22

12
7
7

21

ENTER ................... .
Environment Division ............... .
Exponents ........... .

22

FD file-name. . . .
. ...... .
Figurative Constants ............ .
File-Control Paragraph . ,
........ , .
File-DeSCription Entries ......... , .......... .
File-Description Entry-Punched-Card Files .. .
File-Description Entry-Tape Files.
. ....... .
File Section. . . . . . . . . . . . .
Form-l Records
Form-2 Records .
Form-3 Records
Form-4 Records .....

15
29

General Information. . .

29

Header Label Identifier.
HIGH VALUE(S) ..

16
29

140111311 COBOL Programming
I-O-Control Paragraph .. , ... , . , . , ..
Identification Division .. , ... , ..

IBM

46

Disk COBOL Specs.

41
9

7

25

9
14

17
15
14

12
12
12
12

7
11

7

Machine Requirements ..
Magnetic-Tape Device-Names .. .
Mass-Storage Files ............. .
MEMORY SIZE (Object Computer).
Move Verb ....................................... ·.. .

5
11

17
8

40

Nested Conditional IF Statements
NO-CONSOLE-PRINTER ....... .
NO-DIRECT-SEEK
. , ..... .
NO-MULTIPLY-DIVIDE ...... .
NO-OVERLAP
. , ... , .... .
NO-PRINT-STORAGE .................... .

26
8

Object-Computer Paragraph ... , ..
OPEN . . . . . . . . . . , ......... .
Optional COBOL Words .............. , .... '....... : .. :

7
23

8

8
8
8

42

Perform Statement " ................................ .
Printer Records ..
Procedure Division. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Programming Considerations .......................... .
Punched-Card Device-Names

42

QUOTE(S) ...... .

29

RANDOM Access ....
READ
Record Character-Count Field
RECORD CONTAINS ..
Record-Description Entries,
Record Formats for Disk Files
Record Formats for Tape Files
Record Fomlats for Punched-Card Files.
RECORDING MODE. .., .....
Reference Formats
... , . , ..
RETENTION CYCLE ... .

17
24
12
15
20

13

21
40
10

.13,19

Sample Problem ......... .
SEEK ........ ,
SELECT, .............. .
SEQUENTIAL Access ....... .
SIZE ... , ..... , ...... .
Source-Computer Paragraph
Special-Names Paragraph
STOP .......... .
Subroutines, Object Time ......................... '. '.. .
Switch-Names and Conditions
SYMBOLIC KEY ... , ..... , ..

12
13

15
29
17
37

24
10
18

20
7
8

24
42
9
19

Tables ............................................ .
Tape Trailer Labels
Technique, Programming ............................ .
THR U Option.
Today's Date ...

40
16

VALUE

21

Word Lists. ,
........... ,
Word Marks ....................................... .
\Vorking Storage Section (Data Division) ..
'WRITE .................. , ... .

29
40
21

40

21
16

25

C24-3235-2

..,

()

t

~I

..,

1rlW~
(!)

International Business Machines Corporation
Data Processing Division
112 East Post Road, White Plains, N.Y. 10BOt



Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.3
Linearized                      : No
XMP Toolkit                     : Adobe XMP Core 4.2.1-c043 52.372728, 2009/01/18-15:56:37
Producer                        : Adobe Acrobat 9.13 Paper Capture Plug-in
Modify Date                     : 2009:09:01 09:26:39-07:00
Create Date                     : 2009:09:01 09:26:39-07:00
Metadata Date                   : 2009:09:01 09:26:39-07:00
Format                          : application/pdf
Document ID                     : uuid:cae78477-6770-4c16-97a2-d520447d9751
Instance ID                     : uuid:a80798a8-9bc0-44ad-b205-2fe5fe779513
Page Layout                     : SinglePage
Page Mode                       : UseOutlines
Page Count                      : 47
EXIF Metadata provided by EXIF.tools

Navigation menu