Академический Документы
Профессиональный Документы
Культура Документы
COBOL-85
For IBM Mainframe
System 390
Jyothi Sridhar Kini
E&R, Infosys
Mail-id: Jyothis@infosys.com
Phone: 52179
BU103 Roopa 19
BU101 Deeptha 20
BU102 Bhavana 18
Index File
REGNO ADDRESS
Index
BU101 00a3c2
BU102 00a3d4
BU103 00b943
10/15/08 18:48 E&R Dept., ITLInfosys 4
Indexed and Relative
Files
SEQUENTIAL
ACCESS MODE IS RANDOM
DYNAMIC
[ RECORD KEY IS UniqueRecKey]
[ ]
ALTERNATE RECORD KEY IS AltKey [ WITH DUPLICATES]
[ FILE STATUS IS FileStatus]
INPUT
OPEN OUTPUT FileName
I-O
Sample Programs
Examples
DATA DIVISION.
10/15/08 18:48 E&R Dept., ITLInfosys
CALL Verb
Is the most important verb that provides structured
programming capabilities in COBOL.
Is equivalent to a function or a sub-routine call in
other computer languages.
Is similar to the COPY verb, in the sense that it
provides code re-usability.
Provides two ways of passing parameters to the
called program
(1) By REFERENCE and (2) By CONTENT.
10/15/08 18:48 E&R Dept., ITLInfosys 25
Syntax of call statement
By REFERENCE
– CALL SUBPGM1 USING WS-NUM1.
BY VALUE
– CALL SUBPGM1 USING
BY CONTENT WS-NUM1
BY REFERENCE WS-NUM2
BY REFERENCE WS-NUM3.
10/15/08 18:48 E&R Dept., ITLInfosys 27
Rules for coding CALLed Programs
DATA DIVISION.
WORKING –STORAGE
The CALLed SECTION.
programs should have a LINKAGE
---- SECTION in the DATA DIVISION.
LINKAGE SECTION.
If the CALLed programs possess WORKING-
STORAGEPIC
01 WS-NUM1 SECTION,
9(3). then the LINKAGE
SECTION must appear after it.
01 WS-NUM2 PIC 9(3).
The PROCEDURE
PROCEDURE DIVISION
DIVISION of the CALLed
USING WS-NUM1,WS-NUM2
program must have a USING clause to identify
the variables passed from the CALLing program.