Mainframes Refresher

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 285

http://www.techinterview.

org/archive/
-------------------------------------------------------------------
CONTENTS
No Particulars Page No
1 TSO Commands 2
2 COBOL Tutorial 9
3 COBOL File status Code 43
4 COBOL Coding Standard 46
5 JCL 49
6 JCL Utilities 73
7 JCL FAQs 83
8 CICS Tutorial 92
9 CICS Abend Codes 116
10 CICS FAQs 121
11 DB2 Tutorial 126
12 DB2 Utilities 144
13 DB2 FAQs 146
14 Change man Tool 154
15 File-Aid Tool 172
16 Endevor Tool 207
17 Domain Banking and Finance 214
18 Domain - Telecom 232
19 PL/I 252
TSO Commands
Panel-id show? = PANELD
Displays the name of the current panel.
Message-id = MSGD
Displays the Message-id of the last message.
Automatic REFLIST can be accessed by
o REFLSTD
o REFLSTL
o REFACTD
o REFACTL
These allow you to pull back datasets without seeing the intermediate lists.
Commands to quickly add names to your personal lists. These are REFOPEND,
REFOPENL, REFADDD, and REFADDL
RETP - View the stack of your typed commands.
RETF - Pull back commands in reverse order.
RETRIEVE - Pop up the most recent typed commands from the stack.
CRETRIEV - Pop up the most recent typed commands from the stack.
ISRDDN - Shows the current data sets allocation for our SPF session.
XMIT
The TSO/E nteractive Data Transmission Facility TRANSMT command allows you to
send data sets or messages to persons on other MVS systems via Network Job Entry or
directly to persons on your own system.
XMIT node.userid DA ('your.pds') OUTDA ('your.ps')
RECEIVE
The TSO/E nteractive Data Transmission Facility RECEVE command allows you to
obtain files transmitted to your userid. The RECEVE command queries the Job Entry
Subsystem
RECEIVE INDS('your xmi.ps')
DSLIST
SAVE VDL
Save the data set list in log data set
!PRINT
Save the Quick Reference document in a PDS or PS
2
TSO PROFILE
The profile command is used either to specify to the system certain user characteristics
which are to be used to control the flow of information to and from the terminal or to list
the user profile. The user profile is retained throughout each terminal session unless the
user wishes to change it by issuing the profile command again and specifying the
appropriate operands.
C"T DISPLA#
This command when given while a member is opened in view/edit mode will show the
Clipboard manager. The Clipboard can then be browsed or deleted.
$E#LIST
Displays the Keylist utility. nvoking $E#LIST OFF can disable it.
$E#S
o f the $E#LIST is ON, it displays the keys of current Keylist.
o f the $E#LIST is OFF, it displays the Primary keys definition.
PFS%O&
Displays the value of all the PFKEYS on the panel.
They can be removed from the panel by invoking PFS%O& OFF
SCRNAME ON
Displays the screen name of the Top Left corner. We can give our own screen name to
any screen by writing "SCRNAME m's()name"
S&AP LIST
Displays the Active SPF logical Sessions.
LAN*"A*E PROCESSIN* COMMANDS
ASM
nvoke assembler prompter and assembler f compiler.
CALC
nvoke itf:pl/1 processor for desk calculator mode.
CO+OL
nvoke cobol prompter and ans cobol compiler.
FORT
3
nvoke fortran prompter and fortran iv g1 compiler.
PRO*RAM CONTROL COMMANDS
CALL
Load and execute the specified load module.
LIN$
nvoke link prompter and linkage editor.
LOAD*O
Load and execute program.
R"N
Compile, load, and execute program.
TEST
Test user program.
TESTA"T%
Test apf authorized programs.
DATA MANA*EMENT COMMANDS
ALLOCATE
ALLOCATE A DATA SET WTH OR WTHOUT AN ATTRBUTE LST OF DCB
PARAMETERS.

ALTLI+
DEFNE OPTONAL, USER-LEVEL OR APPLCATON-LEVEL SETS OF LBRARES
CONTANNG SAA/PL EXECS OR CLSTS. THESE LBRARES ARE SEARCHED
WHEN MPLCTLY NVOKNG AN SAA/PL EXEC OR CLST.

ATTRI+
ALLOW DCB PARAMETERS TO BE DYNAMCALLY NTRODUCED AND NAMED FOR
USE WTH A SUBSEQUENT ALLOCATE COM.
4
CONVERT
SFT TF/PL1 AND FORTRAN SOURCE.
COP#
COPY A DATA SET. (SEE NOTE BELOW.)
DELETE
DELETE A DATA SET.
EDIT
CREATE, EDT, AND/OR EXECUTE A DATA SET.
FORMAT
FORMAT AND PRNT A TEXT DATA SET. (SEE NOTE BELOW.)
FREE
RELEASE A DATA SET AND/OR AN ATTRBUTE LST.
LIST
DSPLAY A DATA SET. (SEE NOTE BELOW.)
LISTALC
DSPLAY ACTVE DATA SETS.
LIST+C
DSPLAY MESSAGES FROM OPERATOR/USER.
LISTCAT
DSPLAY USER CATALOGUED DATA SETS.
LISTDS
DSPLAY DATA SET ATTRBUTES.
MER*E
5
COMBNE DATA SETS. (SEE NOTE BELOW).
PRINTDS
PRNT A DATA SET.
PROTECT
PASSWORD PROTECT DATA SETS.
RENAME
RENAME A DATA SET.
TSOLI+
DEFNE OPTONAL SEARCH LEVEL THAT TSO/E USES WHEN SEARCHNG FOR
COMMANDS AND PROGRAMS.
S#STEM CONTROL COMMANDS
ACCO"NT
MODFY/ADD/DELETE USER ATTRBUTES.
CONSOLE
PLACE TERMNAL N CONSOLE MODE.
OPERATOR
PLACE TERMNAL N OPERATOR MODE.
PARMLI+
LST/UPDATE TSO/E DEFAULTS.
RACONVRT
UADS TO RACF DATA BASE CONVERSON UTLTY.
S#NC
SYNCHRONZE THE BROADCAST DATA SET WTH USER DS FROM THE UADS
AND RACF DATA BASE.
6
SESSION CONTROL
CONSPROF
DEFNE USER CONSOLE CHARACTERSTCS.
EXEC
NVOKE COMMAND PROCEDURE.
EXEC"TIL
ALTER REXX ENVRONMENT.
%ELP
NVOKE HELP PROCESSOR.
LO*OFF
END TERMNAL SESSON.
LO*ON
START TERMNAL SESSON.
PROFILE
DEFNE USER CHARACTERSTCS.
SEND
SEND MESSAGE TO OPERATOR/USER.
TERMINAL
DEFNE TERMNAL CHARACTERSTCS.
TIME
LOG SESSON USAGE TME.
TSOEXEC
7
EXECUTE AN AUTHORZED OR UNAUTHORZED COMMAND FROM WTHN AN
UNAUTHORZED ENVRONMENT.
&%EN
CONDTONALLY EXECUTE NEXT COMMAND.
FORE*RO"ND INITIATED +AC$*RO"ND COMMANDS
CANCEL
CANCEL BACKGROUND JOB.
O"TP"T
DRECT OUTPUT MEDUM FOR BACKGROUND JOB.
STAT"S
LST STATUS OF BACKGROUND JOB.
S"+MIT
SUBMT BACKGROUND JOB.
INTERACTIVE
DATA TRANSMSSON FACLTY.
RECEIVE
RECEVE DATA SENT TO YOU BY A TRANSMT COMMAND.
TRANSMIT
TRANSMT MESSAGES AND/OR DATA SETS VA NODES DEFNED TO JES
8
CO+OL T,-o)ial
Compuer !ro"r#mmin"
A Program is a set of instructions that enables a computer to process data, there are two types of
computer programs which are 1- Operating system programs, which control the overall operation
of the system and 2- Applications programs, it is the actual program tasks required by the users.
The term used to describe all type of programs is called software in general application program
reads input , process it, and produce information or out put the user needs. A set of computerized
business procedures in an application area is called information systems.
App$i%#ion pro"r#m de&e$opmen pro%ess
1. Determine program specifications.
2. Design the program planning tools.
3. Code and enter the program.
4. Compile the program.
5. Test the program.
6. Document the program.
'isory o( CO)O*.
Developed by 1959 by a group called Conference on Data Systems Language (CODASYL). First
COBOL compiler was released by December 1959.
First ANS approved version 1968
Modified ANS approved version 1974 (OS/VS COBOL)
Modified ANS approved version 1985 (VS COBOL 2)
This book is written based on BM COBOL for OS/390 V2R2.
Inrodu%ion o CO)O*
COBOL is a high-level programming language first developed by the CODASYL Committee
(Conference on Data Systems Languages) in 1960. Since then, responsibility for developing new
COBOL standards has been assumed by the American National Standards nstitute (ANS).
The word COBOL is an acronym that stands for Common Business Oriented Language. As the
the expanded acronym indicates, COBOL is designed for developing business, typically file-
9
oriented, applications. t is not designed for writing systems programs. For instance you would not
develop an operating system or a compiler using COBOL
Codin" S+ee.
1-6 Page/line numbers - Optional (automatically assigned by compiler)
7 Continuity (-), Comment (*), Starting a new page (/), Debugging lines (D)
8-11 Column A -Division, Section, Paragraph, 01,77 declarations must begin here.
12-72 Column B -All the other declarations/statements begin here.
73-80 dentification field. t will be ignored by the compiler but visible in the source listing.
*#n"u#"e Sru%ure.
Character Set :-
Digits (0-9), Alphabets (A-Z), Space (b), Special Characters (+ - * / ( ) = $ ; " >
< . ,)
Word :- One or more characters- User defined or Reserved.
Clause :- One or more words. t specifies an attribute for an entry.
Statement :- One or more valid words and clauses.
Sentence :- One or more statements terminated by a period.
Paragraph :- One or more sentences.
Section :- One or more paragraphs.
Division :- One or more sections or paragraphs.
Program :- Made up of four divisions.
Di&isions in CO)O*.
There are four divisions in a COBOL program and Data division is optional.

1. dentification Division.
2. Environment Division.
3. Data Division.
4. Procedure Division.
Ideni(i%#ion Di&ision.
This is the first division and the program is identified here. Paragraph PROGRAM-D followed by
user-defined name is mandatory. All other paragraphs are optional and used for documentation.
The length of user-defined name for BM COBOL is EGHT.

IDENTIFICATION DIVISION.
PROGRAM-D. PROGRAM NAME.
AUTHOR. COMMENT ENTRY.
NSTALLATON. COMMENT ENTRY.
DATE-WRTTEN. COMMENT ENTRY.
DATE-COMPLED. COMMENT ENTRY.
SECURTY. COMMENT ENTRY.
10
Security does not pertain to the operating system security, but the information that is passed to
the user of the program about the security features of the program.
En&ironmen Di&ision.
Only machine dependant division of COBOL program. t supplies information about the hardware
or computer equipment to be used on the program. When your program moves from one
computer to another computer, the only section that may need to be changed is ENVRONMENT
division.
Configuration
Section.
t supplies information concerning the computer on which the program will be
compiled (SOURCE-COMPUTER) and executed (OBJECT-COMPUTER). t
consists of three paragraphs - SOURCE COMPUTER, OBJECT-COMPUTER and
SPECAL-NAMES. This is OPTONAL section from COBOL 85.
SOURCE-
COMPUTER.
BM-4381 (Computer and model # supplied by manufacturer)
WTH DEBUGGNG MODE clause specifies that the debugging
lines in the program (statements coded with 'D' in column 7) are
compiled.
OBJECT-
COMPUTER.
BM-4381 (Usually same as source computer)
SPECAL-
NAMES.
This paragraph is used to relate hardware names to user-
specified mnemonic names.
1. Substitute character for currency sign. (CURRENCY SGN S
litearal-1)
2. Comma can be used as decimal point. (DECMAL-PONT S
COMMA)
3. Default collating sequence can be changed. t will be
explained later
. 4. New class can be defined using CLASS keyword. (CLASS
DGT is "0" thru "9")

nput-Output
Section.
t contains information regarding the files to be used in the program and it consists
of two paragraphs FLE-CONTROL & -O CONTROL.
FLE
CONTROL.
Files used in the program are identified in this paragraph.
-O CONTROL.
t specifies when check points to be taken and storage areas that
are shared by different files.
D## Di&ision.
Data division is used to define the data that need to be accessed by the program. t has three
sections.
FLE SECTON describes the record structure of the files.
WORKNG-STORAGE SECTON is used to for define intermediate variables.
LNKAGE SECTON
is used to access the external data.
Ex: Data passed from other programs or from PARM of JCL.
11
*ier#$s, Cons#ns, Ideni(ier,
1. Literal is a constant and it can be numeric or non-numeric.
2. Numeric literal can hold 18 digits and non-numeric literal can hold 160 characters in it.
(COBOL74 supports 120 characters only)
3. Literal stored in a named memory location is called as variable or identifier.
4. Figurative Constant is a COBOL reserved word representing frequently used constants. They
are ZERO/ZEROS/ZEROES, QUOTE/QUOTES, SPACE/SPACES, ALL, HGH-VALUE/HGH-
VALUES, LOW-VALUE/LOW-VALUES.
Example: 01 WS-VAR1 PC X (04) VALUE 'MUSA'.
'MUSA ' is a non-numeric literal. WS-VAR1 is an identifier or variable.

De%$#r#ion o( &#ri#-$e
Level# $ {Variable/Filler} $ Picture clause $ Value clause $ Usage Clause $ Sync clause.

Le/el0
t specifies the hierarchy of data within a record. t can take a value from the set of integers
between 01-49 or from one of the special level-numbers 66 77 88
01 level :-
Specifies the record itself. t may be either a group item or an Elementary item. t
must begin in Area A.
02-49
levels
:-
Specify group or elementary items within a record. Group level items must not have
picture clause.
66 level :- dentify the items that contain the RENAMES clause.
77 level :- dentify independent data item.
88 level :- Condition names.
Va)ia1le name and !,ali2ie)
Variable name can have 1-30 characters with at least one alphabet in it. Hyphen is the only
allowed special character but it cannot be first or last letter of the name. Name should be unique
within the record. f two variables with same name are there, then use OF qualifier of high level
grouping to refer a variable uniquely.
Ex: MOVE balance OF record-1 TO balance OF record-2.
FILLER
When the program is not intended to use selected fields in a record structure, define them as
FLLER. FLLER items cannot be initialized or used in any operation of the procedure division.

12
PICT"RE Cla,se
Describes the attributes of variable.
Numeric 9 (Digit), V (mplied decimal point), S (Sign)
Numeric
Edited
+ (Plus Sign), - (Minus Sign), CR DB (Credit Debit Sign), '.' (Period), b (Blank),
','(comma), 0 (Zero), / (Slash) BLANK WHEN ZERO (nsert blank when data value is
0), Z (ZERO suppression), * (ASTERSK), $(Currency Sign)
Non
Numeric
A (alphabet), B (Blank insertion Character), X(Alpha numeric), G(DBCS)
Exclusive
sets
1. + - CR DB
2. V '.'
3. $ + - Z * (But $ Can appear as first place and * as floating. $***.**)
DBCS (Double Byte Character Set) is used in the applications that support large character sets.
16 bits are used for one character. Ex: Japanese language applications.

Re(res+in" )#si%s
Nibble :- 4 Bits is one nibble. n packed decimal, each nibble stores one digit.
Byte :- 8 Bits is one byte. By default, every character is stored in one byte.
Half word :- 16 bits or 2 bytes is one half word. (MVS)
Full word :- 32 bits or 4 bytes is one full word. (MVS)
Double word :- 64 bits or 8 bytes is one double word. (MVS)
"sage Cla,se
DSPLAY :- Default. Number of bytes required equals to the size of the data item.
COMP :-
Binary representation of data item.
PC clause can contain S and 9 only.
S9(01) - S9(04) Half word.
S9(05) - S9(09) Full word.
S9(10) - S9(18) Double word.
Most significant bit is ON if the number is negative.
COMP-1 :- Single word floating point item. PC Clause should not be specified.
COMP-2 :- Double word floating-point item. PC Clause should not be specified.
COMP-3 :-
Packed Decimal representation. Two digits are stored in each byte. Last nibble is for
sign. (F for unsigned positive, C for signed positive and D for signed negative)
Formula for Bytes: nteger ((n/2) + 1)) => n is number of 9s.
NDEX :- t is used for preserve the index value of an array. PC Clause should not be specified.
13
VAL"E Cla,se
t is used for initializing data items in the working storage section. Value of item must not exceed
picture size. t cannot be specified for the items whose size is variable.

Syntax:
VALUE S literal.
VALUES ARE literal-1 THRU | THROUGH literal-2
VALUES ARE literal-1, literal-2
Literal can be numeric without quotes OR non-numeric within quotes OR figurative constant.
SI*N Cla,se
Syntax - SGN S (LEADNG) SEPARATE CHARACTER (TRALNG).
t is applicable when the picture string contain 'S'. Default is TRALNG WTH NO SEPARATE
CHARACTER. So 'S' doesn't take any space. t is stored along with last digit.
+1=A, +2=B, +3=C, +4=D, +5=E, +6=F, +7=G, +8=H, +9=, -0=}, -1= J, -2= K, -3=L, -4=M, -5=N,
-6=O, -7=P, -8=Q, -9=R
Number TRALNG SGN (Default) LEADNG SGN LEADNG SEPARATE
-125 12N J25 -125
+125 12E A25 +125
S#NC Cla,se and Sla(3 +'-es
SYNC clause is specified with COMP, COMP-1 and COMP-2 items. These items are expected to
start at half/full/double word boundaries for faster address resolution. SYNC clause does this but
it may introduce slack bytes (unused bytes) before the binary item.
01 WS-TEST.
10 WS-VAR1 PC X(02).
10 WS-VAR2 PC S9(6) COMP SYNC.
Assumes WS-TEST starts at relative location 0 in the memory, WS-VAR1 occupies zero and first
byte. WS-VAR2 is expected to start at second byte. As the comp item in the example needs one
word and it is coded with SYNC clause, it will start only at the next word boundary that is 4th byte.
So this introduces two slack bytes between WS-VAR1 and WS-VAR2.

REDE.INES
The REDEFNES clause allows you to use different data description entries to describe the same
computer storage area. Redefining declaration should immediately follow the redefined item and
14
should be done at the same level. Multiple redefinitions are possible. Size of redefined and
redefining need not be the same.
Example:

01 WS-DATE PC9(06).
01 WS-REDEF-DATE WS-DATE.
05 WS-YEAR PC9(02).
05 WS-MON PC9(02).
05 WS-DAY PC9(02).
RENAMES
t is used for regrouping of elementary data items in a record. t should be declared at 66 level. t
need not immediately follows the data item, which is being renamed. But all RENAMES entries
associated with one logical record must immediately follow that record's last data description
entry. RENAMES cannot be done for a 01, 77, 88 or another 66 entry.

01 WS-REPSONSE.
05 WS-CHAR143 PCX(03).
05 WS-CHAR4 PCX(04).
66 ADD-REPSONSE RENAMES WS-CHAR143.
CONDITION n#me
t is identified with special level '88'. A condition name specifies the value that a field can contain
and used as abbreviation in condition checking.
01 SEX PCX.
88 MALE VALUE '1'
88 FEMALE VALUE '2' '3'.
F SEX=1 can also be coded as F MALE in Procedure division.
'SET FEMALE TO TRUE ' moves value 2 to SEX.
f multiple values are coded on VALUE clause, the first value will be moved when it is set to true.
/USTI.IED RI0'T
This clause can be specified with alphanumeric and alphabetic items for right justification. t
cannot be used with 66 and 88 level items.
15
OCCURS C$#use
OCCURS Clause is used to allocate physically contiguous memory locations to store the table
values and access them with subscript or index. Detail explanation is given in Table Handling
section.
*IN1A0E SECTION
t is used to access the data that are external to the program. JCL can send maximum 100
characters to a program thru PARM. Linkage section MUST be coded with a half word binary
field, prior to actual field. f length field is not coded, the first two bytes of the field coded in the
linkage section will be filled with length and so there are chances of 2 bytes data truncation in the
actual field.
01 LK-DATA.
05 LK-LENGTH PC S9(04) COMP.
05 LK-VARABLE PC X(08).
!ro%edure Di&ision.
This is the last division and business logic is coded here. t has user-defined sections and
paragraphs. Section name should be unique within the program and paragraph name should be
unique within the section.
Procedure division statements are broadly classified into following categories.
Statement Type Meaning
mperative
Direct the program to take a specific action.
Ex: MOVE ADD EXT GO TO
Conditional
Decide the truth or false of relational condition and based on it, execute
different paths
. Ex: F, EVALUATE
Compiler Directive
Directs the compiler to take specific action during compilation.
Ex: COPY SKP EJECT
Explicit Scope
terminator
Terminate the scope of conditional and imperative statements.
Ex: END-ADD END-F END-EVALUATE
mplicit Scope
terminator
The period at the end of any sentence, terminates the scope of all previous
statements not yet terminated.
MOVE S#emen
t is used to transfer data between internal storage areas defined in either file section or working
storage section.
Syn#x2
MOVE identifier1/literal1/figurative-constant TO identifier2 (identifier3)
Multiple move statements can be separated using comma, semicolons, blanks or the keyword
THEN.
16
N,me)i( mo/e ),les4
A numeric or numeric-edited item receives data in such a way that the decimal point is aligned
first and then filling of the receiving field takes place. Unfilled positions are filled with zero. Zero
suppression or insertion of editing symbols takes places according to the rules of editing pictures.
f the receiving field width is smaller than sending field then excess digits, to the left and/or to the
right of the decimal point are truncated.
Al5han,me)i( Mo/e R,les4
Alphabetic, alphanumeric or alphanumeric-edited data field receives the data from left to right.
Any unfilled field of the receiving filed is filled with spaces. When the length of receiving field is
shorter than that of sending field, then receiving field accepts characters from left to right until it is
filled. The unaccomodated characters on the right of the sending field are truncated. When an
alphanumeric field is moved to a numeric or numeric-edited field, the item is moved as if it were in
an unsigned numeric integer mode. CORRESPONDNG can be used to transfer data between
items of the same names belonging to different group-items by specifying the names of group-
items to which they belong.
MOVE CORRESPONDNG group-1 TO group-2
*)o,5 Mo/e ),le
When MOVE statement is used to move information at group level, the movement of data takes
place as if both sending and receiving fields are specified as alphanumeric items. This is
regardless of the description of the elementary items constituting the group item.
Samples for understanding MOVE statement (MOVE A TO B)
Picture of A Value of A Picture of B Value of B after Move
PC 99V99 12.35 PC 999V99 012.35
PC 99V99 12.35 PC 9999V9999 0012.3500
PC99V999 12.345 PC9V99 2.34
PC9(05)V9(03) 54321.543 PC 9(03)V9(03) 321.543
PC9(04)V9(02) 23.24 PCZZZ99.9 23.2
PC99V99 00.34 PC$$$.99 $.34
PCX(04) MUSA XBXBXB M U S
ARIT'METIC VER)S
All the possible arithmetic operations in COBOL using ADD, SUBTRACT, MULTPLY and DVDE
are given below:
Arithmetic Operation A B C D
ADD A TO B A A+B
ADD A B C TO D A B C A+B+C+D
ADD A B C GVNG D A B C A+B+C
17
ADD A TO B C A A+B A+C
SUBTRACT A FROM B A B-A
SUBTRACT A B FROM C A B C-(A+B)
SUBTRACT A B FROM C GVNG D A B C C-(A+B)
MULTPLY A BY B A A*B
MULTPLY A BY B GVNG C A B A*B
DVDE A NTO B A B/A
DVDE A NTO B GVNG C A B B/A
DVDE A BY B GVNG C A B A/B
DVDE A NTO B GVNG C REMANDER D A B nteger (B/A) nteger remainder
GVNG is used in the following cases:
1.To retain the values of operands participating in the operation.
2.The resultant value of operation exceeds any of the operand size.
ROUNDED opion
With ROUNDED option, the computer will always round the result to the PCTURE clause
specification of the receiving field. t is usually coded after the field to be rounded. t is prefixed
with REMANDER keyword ONLY in DVDE operation.
ADD A B GVNG C ROUNDED.
Caution: Don't use for intermediate computation.

ON SI3E ERROR
f A=20 (PC 9(02)) and B=90 (PC 9(02)), ADD A TO B will result 10 in B where the expected
value in B is 110. ON SZE ERROR clause is coded to trap such size errors in arithmetic
operation.
f this is coded with arithmetic statement, any operation that ended with SZE error will not be
carried out but the statement follows ON SZE ERROR will be executed.
ADD A TO B ON SZE ERROR DSPLAY 'ERROR!'.
COM!UTE
Complex arithmetic operations can be carried out using COMPUTE statement. We can use
arithmetic symbols than keywords and so it is simple and easy to code.
+ For ADD, - for SUBTRACT, * for MULTPLY, / for DVDE and ** for exponentiation.
Rule: Left to right -
1.Parentheses
2.Exponentiation
3.Multiplication and Division
4.Addition and Subtraction
Caution: When ROUNDED is coded with COMPUTE, some compiler will do rounding for every
arithmetic operation and so the final result would not be precise. 77 A PC 999 VALUE 10
COMPUTE A ROUNDED = (A+2.95) *10.99
18
Result: (ROUNDED(ROUNDED(12.95) * ROUNDED(10.99)) =120 or ROUNDED(142.3205) =
142 So the result can be 120 or 142.
Be cautious when using ROUNDED keyword with COMPUTE statement.
All arithmetic operators have their own explicit scope terminators. (END-ADD, END-SUBTRACT,
END-MULTPLY, END-DVDE, END-COMPUTE). t is suggested to use them.
CORRESPONDNG is available for ADD and SUBTRACT only.
INITIA*I3E
VALUE clause is used to initialize the data items in the working storage section whereas
NTALZE is used to initialize the data items in the procedure division. NTALZE sets the
alphabetic, alphanumeric and alphanumeric-edited items to SPACES and numeric and numeric-
edited items to ZERO. This can be overridden by REPLACNG option of NTALZE. FLLER,
OCCURS DEPENDNG ON items are not affected.
Syntax:
NTALZE identifier-1 REPLACNG (ALPHABETC/ALPHANUMERC/ALPHA-
NUMERC-EDTED NUMERC/NUMERC-EDTED) DATA BY (identifier-2 /Literal-2)
ACCE!T
ACCEPT can transfer data from input device or system information contain in the reserved data
items like DATE, TME, DAY.
ACCEPT WS-VAR1 (FROM DATE/TME/DAY/OTHER SYSTEM VARS).
f FROM Clause is not coded, then the data is read from terminal. At the time of execution, batch
program will ABEND if there is no in-stream data from JCL and there is no FROM clause in the
ACCEPT clause. DATE option returns six digit current date in YYYYMMDD
DAY returns 5 digit current date in YYDDD
TME returns 8 digit RUN TME in HHMMSSTT
DAY-OF-WEEK returns single digit whose value can be 1-7 (Monday-Sunday respectively)

DIS!*A4
t is used to display data. By default display messages are routed to SYSOUT.
Syntax: DSPLAY identifier1| literal1 (UPON mnemonic name)
STO! RUN, EXIT !RO0RAM 5 0O )AC1
STOP RUN is the last executable statement of the main program. t returns control back to OS.
EXT PROGRAM is the last executable statement of sub-program. t returns control back to main
program.
GOBACK can be coded in main program as well as sub-program as the last statement. t just
gives the control back from where it received the control.
19
Co$$#in" Se6uen%e
There are two famous Collating Sequence available in computers. BM and BM Compatible
machine use EBCDC collating sequence whereas most micro and many mainframe systems use
ASC collating sequence. The result of arithmetic and alphabetic comparison would be same in
both collating sequences whereas the same is not true for alphanumeric comparison
EBCDC (Ascending Order) ASC (Ascending Order)
Special Characters Special Characters
a-z 0-9
A-Z A-Z
0-9 a-z
Default collating sequence can be overridden by an entry in OBJECT-COMPUTER and SPECAL
NAMES paragraphs.
1. Code the PROGRAM COLLATNG SEQUENCE Clause in the Object computer paragraph.
PROGRAM COLLATNG SEQUENCE S alphabet-name
2. Map the alphabet-name in the SPECAL-NAMES paragraph as follows:
ALPHABET alphabet-name is STANDARD-1 | NATVE
NATVE stands for computer's own collating sequence whereas STANDARD-1 stands for ASC
collating sequence.
I.7T'EN7E*SE7END8I.
The most famous decision making statement in all language is 'F'. The syntax of F statement is
given below: F can be coded without any ELSE statement. THEN is a noise word and it is
optional.
f ORs & ANDs are used in the same sentence, ANDs are evaluated first from left to right,
followed by ORs.
This rule can be overridden by using parentheses. The permitted relation conditions are =, <, >,
<=, >=, <>
CONTNUE is no operation statement. The control is just passed to next STATEMENT.
NEXT SENTENCE passes the control to the next SENTENCE.
f you forgot the difference between statement and sentence, refer the first page. t is advised to
use END-F, explicit scope terminator for the F statements than period, implicit scope terminator.
F condition1 AND condition2 THEN
Statement-Block-1
ELSE
F condition3 THEN
CONTNUE
ELSE
F condition4 THEN
Statement-Block-2
ELSE
NEXT SENTENCE
END-F
END-F
END-F
20
Statement-Block-2 will be executed only when condition 1, 2 and 4 are TRUE and condition 3 is
FALSE.
mplied operand: n compound conditions, it is not always necessary to specify both operands for
each condition.
F TOTAL=7 or 8 is acceptable. Here TOTAL=8 is implied operation.
SI*N -es- and CLASS -es-
SGN test is used to check the sign of a data item. t can be done as follows -
F identifier is POSTVE/NEGATVE/ZERO
CLASS test is used to check the content of data item against pre-defined range of values. t can
be done as follows -
F identifier is NUMERC/ALPHABETC/ALPHABETC-HGHER/ALPHABETC-LOWER
You can define your own classes in the special names paragraph. We have defined a class DGT
in our special names paragraph. t can be used in the following way. F identifier is DGT
Ne"#ed %ondiions.
Any simple, relational, class, sign test can be negated using NOT.
But it is not always true that NOT NEGATVE is equal to POSTVE. (Example ZERO)
EVA*UATE
With COBOL85, we use the EVALUATE verb to implement the case structure of other languages.
Multiple F statements can be efficiently and effectively replaced with EVALUATE statement. After
the execution of one of the when clauses, the control is automatically come to the next statement
after the END-EVALUATE. Any complex condition can be given in the WHEN clause. Break
statement is not needed, as it is so in other languages.
General Syntax

EVALUATE subject-1 (ALSO subject2..)
WHEN object-1 (ALSO object2..)
WHEN object-3 (ALSO object4..)
WHEN OTHER imperative statement
END-EVALUATE.
1.Number of Subjects in EVALUATE clause should be equal to number of objects in every WHEN
clause.
2.Subject can be variable, expression or the keyword TRUE/ FLASE and respectively objects can
be values, TRUE/FALSE or any condition.
3.f none of the WHEN condition is satisfied, then WHEN OTHER path will be executed.
Sample
EVALUATE SQLCODE ALSO TRUE
21
WHEN 100 ALSO A=B imperative statement
WHEN -305 ALSO (A/C=4) imperative statement
WHEN OTHER imperative statement
END-EVALUATE.
!ER.ORM STATEMENTS
PERFORM will be useful when you want to execute a set of statements in multiple places of the
program. Write all the statements in one paragraph and invoke it using PERFORM wherever
needed. Once the paragraph is executed, the control comes back to next statement following the
PERFORM.

6.SIMPLE PERFORM.
PERFORM PARA-1.
DSPLAY 'PARA-1 executed'
STOP RUN.
PARA-1.
Statement1.
Statement2.
t executes all the instructions coded in PARA-1 and then transfers the control to the next
instruction in sequence.
7.INLINE PERFORM.
When sets of statements are used only in one place then we can group all of them within
PERFORM END-PERFORM structure. This is called NLNE PERFORM. This is equal to
DO..END structure of other languages.
PERFORM
ADD A TO B
MULTPLE B BY C
DSPLAY 'VALUE OF A+B*C ' C
END-PERFORM
8. PERFORM PARA-6 T%R" PARA-N.
All the paragraphs between PARA-1 and PARA-N are executed once.
9. PERFORM PARA-6 T%R" PARA-N "NTIL (ondi-ion:s;.
The identifiers used in the UNTL condition(s) must be altered within the paragraph(s) being
performed; otherwise the paragraphs will be performed indefinitely. f the condition in the UNTL
clause is met at first time of execution, then named paragraph(s) will not be executed at all.
22
<. PERFORM PARA-6 T%R" PARA-N N TIMES.
N can be literal defined as numeric item in working storage or hard coded constant.
=. PERFORM PARA-6 T%R" PARA-N VAR#IN* iden-i2ie)6
FROM identifier 2 BY identifier3 UNTL condition(s) nitialize identifier1 with identifier2 and test
the condition(s). f the condition is false execute the statements in PARA-1 thru PARA-N and
increment identifier1 BY identifier3 and check the condition(s) again. f the condition is again
false, repeat this process till the condition is satisfied.
>.PERFORM PARA-6 &IT% TEST +EFOREAFTER "NTIL (ondi-ion:s;.
With TEST BEFORE, Condition is checked first and if it found false, then PARA-1 is executed and
this is the default. (Functions like DO- WHLE) With TEST AFTER, PARA-1 is executed once and
then the condition is checked. (Functions like DO-UNTL)
EXIT s#emen.
COBOL reserved word that performs NOTHNG. t is used as a single statement in a paragraph
that indicate the end of paragraph(s) execution. EXT must be the only statement in a paragraph
in COBOL74 whereas it can be used with other statements in COBOL85.
0O TO Us#"e2
n a structured top-down programming GO TO is not preferable. t offers permanent control
transfer to another paragraph and the chances of logic errors is much greater with GO TO than
PERFORM. The readability of the program will also be badly affected.
But still GO TO can be used within the paragraphs being performed. i.e. When using the THRU
option of PERFORM statement, branches or GO TO statements, are permitted as long as they
are within the range of named paragraphs.
PERFORM 100-STEP1 THRU STEP-4
100-STEP-1.
ADD A TO B GVNG C.
F D = ZERO DSPLAY 'MULTPLCATON NOT DONE'
GO TO 300-STEP3
END-F.
200-STEP-2.
MULTPLY C BY D.
300-STEP-3.
DSPLAY 'VALUE OF C:' C.
Here GO TO used within the range of PERFORM. This kind of Controlled GO TO is fine with
structured programming also!
23
TA)*ES
An OCCURS clause is used to indicate the repeated occurrences of items of the same format in a
structure. OCCURS clause is not valid for 01, 77, 88 levels.
t can be defined as elementary or group item. nitialization of large table occurrences with
specific values are usually done using perform loops in procedure division. Simple tables can be
initialized in the following way.
01 WEEK-ARRAY VALUE 'MONTUEWEDTHUFRSATSUN'.
05 WS-WEEK-DAYS OCCURS 7 TMES PC X(03).
Dynamic array is the array whose size is decided during runtime just before the access of first
element of the array.
01 WS-MONTH-DAY-CAL.
05 WS-DAYS OCCURS 31 TMES DEPENDNG ON WS-OCCURENCE.
F MONTH = 'FEB' MOVE '28' to WS-OCCURRENCE.
Array tems can be accessed using NDEX or subscript and the difference between them are
listed in the table. Relative subscripts and relative indexes are supported only in COBOL85.
Literals used in relative subscripting/indexing must be an unsigned integer.
ADD WS-SAL(SUB) WS-SAL(SUB + 1) TO WS-SAL(SUB + 2).

Sl
#
Subscript ndex
1 Working Storage item nternal tem-No need to declare it.
2 t means occurrence t means displacement
3
Occurrence, in turn translated to displacement to
access elements and so slower than NDEX access.
Faster and efficient.
4
t can be used in any arithmetic operations or for
display.
t cannot be used for arithmetic operation
or for display purpose.
5
Subscripts can be modified by any arithmetic
statement.
NDEX can only be modified with SET,
SEARCH and PERFORM statements.
Sometimes, you may face a question like how to randomly access the information in the
sequential file of 50 records that contains all the designation and the respective lower and higher
salary information.
Obviously, OS does not allow you to randomly access the sequence file. You have to do by
yourself and the best way is, load the file into a working storage table in the first section of the
program and then access as you wish.
The table look-up can be done in two ways.
-Sequential search.
-Binary search.

24
Se?,en-ial SEARC%
During SERAL SEARCH, the first entry of the table is searched. f the condition is met, the table
look-up is completed. f the condition is not met, then index or subscript is incremented by one
and the next entry is searched and the process continues until a match is found or the table has
been completely searched.
SET indexname-1 TO 1.
SEARCH identifier-1 AT END display 'match not found:'
WHEN condition-1 imperative statement-1 /NEXT SENTENCE
WHEN condition-2 imperative statement-2 /NEXT SENTENCE
END-SEARCH
dentifier-1 should be OCCURS item and not 01 item.
Condition-1, Condition-2 compares an input field or search argument with a table argument.
Though AT END Clause is optional, it is highly recommended to code that. Because if it is not
coded and element looking for is not found, then the control simply comes to the next statement
after SEARCH where an invalid table item can be referred and that may lead to incorrect results /
abnormal ends.
SET statement Syntax:
SET index-name-1 TO/UP BY/DOWN BY integer-1.
+ina)' SEARC%
When the size of the table is large and it is arranged in some sequence -either ascending or
descending on search field, then BNARY SEARCH would be the efficient method.
SEARCH ALL identifier-1 AT END imperative-statement-1
WHEN dataname-1 = identifier-2/literal-1/arithmetic expression-1
AND dataname-2 = identifier-3/literal-2/arithmetic expression-2
END-SEARCH.
dentifier-2 and identifier-3 are subscripted items and dataname-1 and dataname-2 are working
storage items that are not subscripted.
Compare the item to be searched with the item at the center. f it matches fine, else repeat the
process with the left or right half depending on where the item lies.
Sl
#
Sequential SEARCH Binary SEARCH
1 SEARCH SEARCH ALL
2 Table should have NDEX. Table should have NDEX.
3
Table need not be in
SORTED order.
Table should be in sorted order of the searching argument. There
should be ASCENDNG/DESCENDNG Clause.
4
Multiple WHEN conditions
can be coded.
Only one WHEN condition can be coded.
5
Any logical comparison is
possible.
Only = is possible. Only AND is possible in compound conditions.
6
ndex should be set to 1
before using SEARCH
ndex need not be set to 1 before SEARCH ALL.
7
Prefer when the table size
is small
Prefer when the table size is significantly large.
25
Mu$i Dimension#$ Arr#ys
COBOL74 supports array of maximum of three dimensions whereas COBOL85 supports up to
seven dimensions. The lowest- level OCCURS data-name or an item subordinate to it is used to
access an entry in the array or the table.
f we use SEARCH for accessing multi-dimension table, then NDEXED BY must be used on all
OCCURS levels. Expanded nested perform is available for processing multi level tables. The
syntax of this perform is given below:
PERFORM para-1 thru para-n VARYNG index-1 from 1 BY 1 UNTL index-1 > size- of- outer-
occurs AFTER VARYNG index-2 from 1 by 1 until index-2 > size of inner occurs.
SEARCH example for multi level tables:

01 EMP-TABLE.
05 DEPTNUMBER OCCURS 10 TMES NDEXED BY 1.
10 EMP-DETAL OCCURS 50 TMES NDEXED BY 2.
15 EMP-NUMBER PC9(04).
15 EMP-SALARY PC9(05).
77 EMPNUMBER-N PC 9(04) VALUE '2052'.
PERFORM 100-SEARCH-EMP-SAL VARYNG 1 FROM 1 BY 1
UNTL 1 > 10 OR WS-FOUND
100-SEARCH-EMP-SAL.
SET 2 TO .
SEARCH EMP-DETAL AT END DSPLAY 'NOT FOUND'. == > Lowest Occurs
WHEN EMPNUMBER-N = EMP-NUMBER(1,2).
DSPLAY 'SALARY S:' EMP-SALARY(1,2).
SET WS-FOUND TO TRUE. == > Search ends
END-SEARCH.

NESTED !RO0RAMS, 0*O)A*, EXTERNA*
One program may contain other program(s). The contained program(s) may themselves contain
yet other program(s). All the contained and containing programs should end with END
PROGRAM statement. PGMB is nested a program in the example below:

Example:
DENTFCATON DVSON.
PROGRAM-D. PGMA
.....

DENTFCATON DVSON.
PROGRAM-D. PGMB
.....

END PROGRAM PGMB.
....
END PROGRAM PGMA.
26
f you want access any working storage variable of PGMA in PGMB, then declare them with the
clause 'S GLOBAL' in PGMA. f you want to access any working storage variable of PGMB in
PGMA, declare them with the clause 'S EXTERNAL' in PGMB. Nested Programs are supported
only in COBOL85.
f there is a program PGMC inside PGMB, it cannot be called from PGMA unless it's program id is
qualified with keyword COMMON.
SORT #nd MER0E
The programming SORT is called as internal sort whereas the sort in JCL is called external sort. f
you want to manipulate the data before feeding to sort, prefer internal sort. n all other cases,
external sort is the good choice. nternal sort, in turn invokes the SORT product of your
installation. (DFSORT). n the run JCL, allocate at least three sort work files. (SORT-WKnn => nn
can be 00-99).
FASTSRT compiler option makes the DFSORT to do all file -O operation than your COBOL
program. t would significantly improve the performance. The result of the SORT can be checked
in SORT-RETURN register. f the sort is successful, the value will be 0 else 16.
Syn#x2
SORT SORTFLE ON ASCENDNG /DESCENDNG KEY sd-key-1 sd-key2
USNG file1 file2 / NPUT PROCEDURE S section-1
GVNG file3 / OUTPUT PROCEDURE is section-2
END-SORT
File1, File2 are to-be-sorted input files and File3 is sorted-output file and all of them are defined in
FD.SORTFLE is Disk SORT Work file that is defined at SD. t should not be explicitly opened or
closed.
NPUT PROCEDURE and USNG are mutually exclusive. f USNG is used, then file1 and files
should not be opened or READ explicitly. f NPUT PROCEDURE is used then File1 and file2
need to be OPENed and READ the records one by one until end of the file and pass the required
records to sort-work-file using the command RELEASE.

Syn#x2
RELEASE sort-work-record from input-file-record.
OUTPUT Procedure and GVNG are mutually exclusive. f GVNG is used, then file3 should not
be opened or WRTE explicitly. f OUTPUT procedure is used, then File3 should be OPENed and
the required records from sort work file should be RETURNed to it. Once AT END is reached for
sort-work-file, close the output file.
Syn#x2
RETURN sort-work-file-name AT END imperative statement.

27
INP"T PROCED"RE Vs O"TP"T PROCED"RE
Sometimes it would be more efficient to process data before it is sorted, whereas other times it is
more efficient to process after it is sorted. f we intend to eliminate more records, then it would be
better preprocess them before feeding to SORT. f we want to eliminate all the records having
spaces in the key field then it would be efficient if we eliminate them after sorting. Because the
records with blank key comes first after sorting.
MER0E
t is same as sort. USNG is mandatory. There should be minimum two files in USNG.
MERGE Sort-work-file ON ASCENDNG KEY dataname1 dataname2
USNG file1 file2
GVNG file3 / OUTPUT PROCEDURE is section-1
END-MERGE
!ro"r#m sor re"isers (#nd is e6ui&#$en D.SORT
p#r#meer7me#nin")
SORT-FLE-SZE (FLSZ), SORT-CORE-SZE (RESNV), SORT-MSG(MSGDDN)
SORT-MODE-SZE (SMS=nnnnn)
SORT-RETURN(return-code of sort) and
SORT-CONTROL (Names the file of control card - default is GZSRTCD)
STRIN* MANIP"LATION
A string refers to a sequence of characters. String manipulation operations include finding a
particular character/sub-string in a string, replacing particular character/sub-string in a string,
concatenating strings and segmenting strings. All these functions are handled by three verbs
NSPECT, STRNG and UNSTRNG in COBOL. EXAMNE is the obsolete version of NSPECT
supported in COBOL74.
INSPECT- FOR CO"NTIN*
t is used to tally the occurrence of a single character or groups of characters in a data field.
NSPECT identifier-1 TALLYNG identifier-2 FOR ALL/LEADNG literal-1|identifier-3 [BEFORE|
AFTER NTAL identifier-4|literal-2] - Optional.
NSPECT identifier-1 TALLYNG identifier-2 FOR CHARACTERS [BEFORE|AFTER NTAL
identifier-4|literal-2] - Optional.
Main String is identifier-1 and count is stored in identifier-2. Literal-1 or dentifier-3 is a character
or group-of-characters you are looking in the main-string. NSPECT further qualifies the search
with BEFORE and AFTER of the initial occurrence of identifier-4 or literal-2.
Example:
WS-NAME - 'MUTHU SARAVANA SURYA CHANDRA DEV'
NSPECT WS-NAME TALLYNG WS-COUNT ALL 'S'
BEFORE NTAL 'SARAVANA' AFTER NTAL 'CHANDRA'
END-NSPECT
28
Result:
WS-COUNT contains - 1
INSPECT- FOR REPLACIN*
t is used to replace the occurrence of a single character or groups of characters in a data field.
NSPECT identifier-1 REPLACNG ALL|LEADNG literal-1|identifier-2 BY identifier-3|literal-2
[BEFORE|AFTER NTAL identifier-4|literal-2] - Optional.
NSPECT identifier-1 REPLCNG CHARACTERS BY identifier-2 BEFORE|AFTER NTAL
identifier-3|literal-1
NSPECT-FOR COUNTNG AND REPLACNG t is a combination of the above two methods.
NSPECT identifier-1 TALLYNG (tallying part ) REPLACNG (replacing part)
STRIN0
STRNG command is used to concatenate one or more strings.
Syn#x2
STRNG identifier-1 / literal-1, identifier-2/ literal-2 DELMTED BY (identifier-3/literal-3/SZE)
NTO identifier-4 END-STRNG.
01 VAR1 PC X(10) VALUE 'MUTHU '
01 VAR2 PC X(10) VALUE 'SARA '
01 VAR2 PC X(20).
To get display 'MUTHU,SARA'
STRNG VAR1 DELMTED BY ' ' ',' DELMTED BY SZE VAR2 DELMTED BY ' ' NTO VAR3
END-STRNG.
The receiving field must be an elementary data item with no editing symbols and JUST RGHT
clause.
With STRNG statement, specific characters of a string can be replaced whereas MOVE replaces
the full string.
01 AGE-OUT PC X(12) VALUE '12 YEARS OLD'.
STRNG '18' DELMTED BY SZE NTO AGE-OUT. => 18 YEARS OLD.

Re(eren%e Modi(i%#ion 8 e6ui&#$en o( SU)STR
'Reference modification' is used to retrieve or overwrite a sub-string of a string. ':' is known as
reference modification operator.
Syn#x2
String(Starting-Position:Length)
MOVE '18' TO AGE-OUT(1:2) does the same as what we did with STRNG command.
When it is used in array elements, the syntax is Array-element (occurrence) (Starting-
Position:Length)

29
UNSTRIN0
UNSTRNG command is used to split one string to many strings.
Syn#x2
UNSTRNG identifier-1 [DELMTED BY (ALL/) identifier2/literal1 [,OR (ALL/) (identifier-3/literal-
2),..]] NTO identifier-4 [,DELMTER N identifier-5, COUNT N identifier-6] [,identifier-7
[,DELMTER N identifier-8, COUNT N identifier-9]
01 WS-DATA PC X(12) VALUE '10/200/300/1'.
UNSTRNG WS-DATA DELMTED BY '/'
NTO WS-FLD1 DELMTER N WS-D1 COUNT N WS-C1
WS-FLD2 DELMTER N WS-D2 COUNT N WS-C2
WS-FLD3 DELMTER N WS-D3 COUNT N WS-C3
END-UNSTRNG.

Resu$2
WS-FLD1 = 10 WS-FLD2 =200 WS-FLD3=300 WS-C1 = 2 WS-C2=3 WS-C3=3 WS-D1 = '/' WS-
D2='/' WS-D3 ='/'
ON OVERFLOW can be coded with STRNG and UNSTRNG. f there is STRNG truncation then
the imperative statements followed ON OVERFLOW will be executed.
CO!4 S#emen
A COPY statement is used to bring a series of prewritten COBOL entries that have been stored in
library, into a program.
1.Common routines like error routine, date validation routine are coded in a library and bring into
the program by COPY.
2. Master files are used in multiple programs. Their layout can be placed in one copybook and be
placed wherever the files are used. t promotes program standardization since all the programs
share the same layout and the same data names.
This reduces coding and debugging time. Change in layout needs change in copybook only. t is
enough if we just recompile the program for making the new copy effective.
Syn#x2
COPY copybook-name [(OF/N) library name]
[REPLACNG string-to-be-replaced BY replacing-string]
Copybooks are stored as members in PDS library and during compilation time, they are included
into the program. By default, the copybook library is SYSLB and it can be changed using N or
OF of COPY statement.
Copybooks can be used in the following paragraphs.
SOURCE-COMPUTER, OBJECT-COMPUTER, SPECAL-NAMES, FLE-CONTROL, O-
CONTROL, FD SECTON, PARAGRAPHS N PROCEDURE DVSON.
f the same copybook is used more than once in the program, then there will be "duplicate data
30
declaration" error during compilation, as all the fields are declared twice. n this case, one
copybook can be used with REPLACNG verb to replace high-level qualifier of the all the
variables with another qualifier.
Ex#mp$e2
COPY CUSTOMER REPLACNG 'CUST1-' BY 'CUST2-'.
Delimiter '= =' should be used for replacing pseudo texts. The replacing option does not alter the
prewritten entries in the library; the changes are made to the user's source program only.
CA** s#emen (Su-8!ro"r#ms)
When a specific functionality need to be performed in more than one program, it is best to write
them separately and call them into each program. Sub Programs can be written in any
programming language. They are typically written in a language best suited to the specific task
required and thus provide greater flexibility.
Main P)og)am Changes4
CALL statement is used for executing the sub-program from the main program. A sample of CALL
statement is given below:
CALL 'PGM2' USNG BY REFERENCE WS-VAR1, BY CONTENT WS-VAR2.
PGM2 is called here. WS-VAR1 and WS-VAR2 are working storage items.
WS-VAR1 is passed by reference. WS-VAR2 is passed by Content. BY REFERENCE is default in
COBOL and need not be coded. BY CONTENT LENGTH phrase permits the length of data item
to be passed to a called program.
S,1-P)og)am Changes4
WS-VAR1 and WS-VAR2 are working storage items of main program.
As we have already mentioned, the linkage section is used for accessing external elements. As
these working storage items are owned by main program, to access them in the sub-program, we
need to define them in the linkage section.
LNKAGE SECTON.
01 LNKAGE SECTON.
05 LK-VAR1 PC9(04).
05 LK-VAR2 PC9(04).
n addition to define them in linkage section, the procedure division should be coded with these
data items for address-ability.
PROCEDURE DVSON USNG LK-VAR1,LK-VAR2
There is a one-one correspondence between passed elements and received elements (Call
using, linkage and procedure division using) BY POSTON. This implies that the name of the
identifiers in the called and calling program need not be the same (WS-VAR1 & LK-VAR1) but the
number of elements and picture clause should be same.
31
The last statement of your sub-program should be EXT PROGRAM. This returns the control back
to main program. GOBACK can also be coded instead of EXT PROGRAM but not STOP RUN.
EXT PROGRAM should be the only statement in a paragraph in COBOL74 whereas it can be
coded along with other statements in a paragraph in COBOL85.
PROGRAM-D. S NTAL PROGRAM.
f S NTAL PROGRAM is coded along with program-id of sub program, then the program will be
in initial stage every time it is called (COBOL85 feature). Alternatively CANCEL issued after
CALL, will set the sub-program to initial state.
f the sub program is modified then it needs to be recompiled. The need for main program
recompilation is decided by the compiler option used for the main program. f the DYNAM
compiler is used, then there is no need to recompile the main program. The modified subroutine
will be in effect during the run. NODYNAM is default that expects the main program
recompilation.
Difference between Pass-by-reference and Pass-by-content
Sl
#
Passl By Reference Pass By Content
1
CALL 'sub1' USNG BY REFERENCE
WS-VAR1
CALL 'sub1' USNG BY CONTENT WS-VAR1 (BY
CONTENT keyword is needed)
2
t is default in COBOL. BY REFERENCE
is not needed.
BY CONTENT key word is mandatory to pass an
element by value.
3 Address of WS-VAR1 is passed Value of WS-VAR1 is passed
4
The sub-program modifications on the
passed elements are visible in the main
program.
The sub-program modifications on the passed
elements are local to that sub-program and not
visible in the main program.
Difference between Static Call and Dynamic Call
Sl
#
STATC Call DYNAMC Call
1
dentified by Call literal. Ex: CALL
'PGM1'.
dentified by Call variable and the variable should be
populated at run time. 01 WS-PGM PC X(08). Move
'PGM1' to WS-PGM CALL WS-PGM
2
Default Compiler option is NODYNAM
and so all the literal calls are considered
as static calls.
f you want convert the literal calls into DYNAMC, the
program should be compiled with DYNAM option. By
default, call variables and any un-resolved calls are
considered as dynamic.
3
f the subprogram undergoes change,
sub program and main program need to
be recompiled.
f the subprogram undergoes change, recompilation
of subprogram is enough.
4
Sub modules are link edited with main
module.
Sub modules are picked up during run time from the
load library.
5 Size of load module will be large Size of load module will be less.
6 Fast Slow compared to Static call.
7 Less flexible. More flexible.
8
Sub-program will not be in initial stage
the next time it is called unless you
explicitly use NTAL or you do a
CANCEL after each call.
Program will be in initial state every time it is called.
32
NTRNSC FUNCTONS:
LENGTH :-
Returns the length of the PC clause. Used for finding length of group item that
spanned across multiple levels.
MAX :- Returns the content of the argument that contains the maximum value
MN :- Returns the content of the argument that contains the minimum value
NUMVAL :-
Returns the numeric value represented by an alphanumeric character string
specified in the argument.
NUMVAL-C :-
Same as NUMVAL but currency and decimal points are ignored during
conversion.
CURRENT
DATE
:- Returns 21 Chars alphanumeric value - YYYYMMDDHHMMSSnnnnnn
NTEGER OF
DATE
:- Returns NTEGER equivalent of Gregorian date passed.
NTEGER OF
DAY
:- Returns NTEGER equivalent of Julian date passed.
DATE OF
NTEGER
:- Returns Gregorian date for the integer passed.
DAY OF
NTEGER
:- Returns Julian date for the integer passed.
Note: FUNCTON NTEGER OF DATE (01-01-1601) returns 1.
.I*E 'AND*IN0
A data file is collection of relevant records and a record is collection of relevant fields. The file
handling in COBOL program involves five steps.

S-e5s in 2ile-handing
1.Allocation: The files used in the program should be declared in FLE-CONTROL paragraph of
environment division. The mapping with JCL DDNAME is done here. The file is allocated to your
program by this statement.
2.Definition. The layout of the file and its attributes are defined in the FLE SECTON of DATA
DVSON.
3.Open: Dataset is connected/readied to your program using OPEN statement. The mode of
OPEN decides the operation allowed and the initial pointer in the dataset. For example, EXTEND
mode allows only write access and the pointer is kept on the end of file to append.
4.Process: Process the file as per requirement, using the -O statements provided by COBOL.
(READ, WRTE, REWRTE and DELETE)
5. Close: After the processing, close the file to disconnect it from the program.
Allo(a-ion o2 2ile - SELECT S-a-emen-
(ENVRONMENT-> NPUT-OUTPUT-> FLE-CONTROL)
SELECT [OPTONAL] FLENAME ASSGN to DDNAME :- ALL Files
ORGANZATON S SEQUENTAL/NDEXED/RELATVE :- ALL Files
33
ACCESS S SEQUNETAL/RANDOM/DYNAMC :- ALL Files
RECORD KEY S FLE-KEY1 :- KSDS
RELATVE KEY S WS-RRN :- RRDS
ALTERNARE RECORD KEY S FLE-KEY2 WTH DUPLCATES :- KSDS
ALTERNARE RECORD KEY S FLE-KEY3 WTHOUT DUPLCATES :- AX
FLE STATUS S WS-FLE-STAT1 :- ALL Files
[,WS-FLE-STAT2] :- VSAM Files
SE*ECT S#emen8 O!TIONA* C$#use
This can be coded only for input files. f OPTONAL is not coded, then the input file is expected to
present in JCL. f not, an execution error will occur. f OPTONAL is coded, then if the file is not
mapped in JCL, it is considered as empty file and the first read results end of file. The file can
also be dynamically allocated instead of static allocation in JCL.
SE*ECT S#emen8 ASSI0N TO
FLENAME is the logical name used inside the program and DDNAME is the logical name in the
JCL, mapped with physical dataset. DDNAME can be prefixed with 'S-' to indicate QSAM file, '-
AS' to indicate ESDS file and with no prefix to indicate KSDS/RRDS file.
JCL Step executing the program should have a dataset with DDNAME as label
//DDNAME DD DSN=BPMAN.EMPLOYEE.DATA,DSP=SHR

SE*ECT S#emen8OR0ANI3ATION
t can be SEQUENTAL (PS or VSAM ESDS), NDEXED (VSAM KSDS), RELATVE (VSAM
RRDS). Default is Sequential.
SE*ECT S#emen8ACCESS MODE
SE!"ENTIAL.
t is default access mode and it is used to access the records ONLY in sequential order. To read
100th record, first 99 records need to be read and skipped.
RANDOM.
Records can be randomly accessed in the program using the primary/alternate key of indexed file
organization or relative record number of relative organization.100th record can directly be read
after getting the address of the record from the NDEX part for NDEXED files.100th record can
directly be read for RELATVE files even without any index.
D#NAMIC.
t is mixed access mode where the file can be accessed in random as well as sequential mode in
the program. Example: Reading the details of all the employees between 1000-2000. First
34
randomly access 1000th employee record, then read sequentially till 2000th employee record.
START and READ NEXT commands are used for this purpose in the procedure division.
SE*ECT S#emen8RECORD 1E4 IS
t is primary key of VSAM KSDS file. t should be unique and part of indexed record structure.
SE*ECT S#emen8A*TERNATE RECORD 1E4 IS
This phrase is used for KSDS files defined with AX. Add the clause WTH DUPLCATES if the
AX is defined with duplicates. Referring to VSAM basics, every alternate index record has an
associated PATH and the path should be allocated in the JCL that invokes this program. The
DDNAME of the path should be DDNAME of the base cluster suffixed with 1 for the first alternate
record clause, suffixed with n for nth ALTERNATE RECORD KEY clause in SELECT clause.
SE*ECT S#emen8.I*E STATUS IS 9S8.I*E8STAT:,9S8.I*E8STAT;
WS-FLE-STAT1 should be defined as PC X(02) in working storage section. After every file
operation, the file status should be checked for allowable values. WS-FLE-STAT2 can be coded
for VSAM files to get the VSAM return code (2 bytes), VSAM function-code (1 byte) and VSAM
feedback code (3 bytes). This is a 6- byte field in working storage.
RESERVE C$#use.
RESERVE clause [RESERVE integer AREA ] can be coded in the SELECT statement. The
number of buffers to be allocated for the file is coded here. By default two buffers will be allocated
if the clause is not coded. Since similar option is available in JCL, this is not coded in program.
RESERVE 1 AREA allocates one buffer, for the file in the SELECT statement.
Defining the file in FLE SECTON - FD
FD FLENAME
RECORDNG MODE S V/VB/F/FB
RECORD CONTANS M CHARACTERS (TO N CHARACTERS)
BLOCK CONTANS X CHARACTERS/RECORDS (TO Y CHARACTERS/RECORDS)
LABEL RECORDS ARE OMTTED/STANDARD
DATA RECORD S FLE-RECORD.
01 FLE-RECORD PC X(nnn).
FD-RECORD CONTAINS
t specifies the length of the record in terms of bytes. (t will be RECORD contains m to n
CHARACTERS for variable format files)
35
FD-+LOC$ CONTAINS
t specifies the physical record size. t can be mentioned as number of logical records OR number
of characters, that is multiple of logical record length. t is suggested to code BLOCK CONTANS
0 RECORDS so that system will decide the optimum size for the file based on the device used for
storing the file. BLOCK CONTANS clause is treated as comments for VSAM files.
Ad&#n#"e o( )$o%<in"2
1.-O time is reduced as n numbers of records are read into main memory buffer during an -O.
2.nter record gap is removed and the gap exist only between blocks. So memory wastage due to
RG is avoided.
FD-RECORDIN* MODE IS
t can be F (FXED) V(VARABLE) FB(FXED BLOCK) VB(VARABLE BLOCKED)
V#ri#-$e re%ord (i$e ideni(i%#ion2
f there is no recording mode/record contains clause, it is still possible to identify variable length
records. f there is an OCCURS depending on clause or there are multiple 01 levels and every 01
level is of different size, then the file would be of variable length. Multiple 01 level in File section is
an example for implicit redefinition.
FD-LA+EL RECORDS Cla,se
As a general rule, LABEL RECORDS are STANDARD is coded for Disk and Tape files, LABEL
RECORDS ARE OMTTED is coded for printer files. n COBOL74, this clause is a mandatory
clause whereas COBOL85 made this as optional.
FD-DATA RECORD IS Cla,se
t is used to name the data record(s) of the file. More than one record can be coded here.
OPEN STATEMENT
Syn#x2
OPEN OPENMODE FLENAME
OPENMODE can be NPUT OUTPUT -O EXTEND

NPUT :- File can be used ONLY-FOR-READ purpose.
OUTPUT :- File can be used ONLY-FOR-WRTE purpose.
-O :- File can be used FOR READ, WRTE and REWRTE purpose.
EXTEND :- File can be used FOR appending records using WRTE.
36
C*OSE s#emen.
The used files are closed using CLOSE statement. f you don't close the files, the completion of
the program closes all the files used in the program.
Syn#x2
CLOSE FLENAME
O!EN #nd C*OSE (or TA!E (i$es 8 Ad&#n%ed
f more than one file is stored in a reel of tape, it is called as multi-file volume. When one file is
stored in more than one reel of tape, it is called as multi-volume label. One reel is known as one
volume. When the end of one volume is reached, automatically the next volume opens. So there
is no special control is needed for multi volume files.
OPEN NPUT file-1 [WTH NO REWND | REVERSED]
OPEN OUTPUT file-2 [WTH NO REWND]
CLOSE file-3 [{REEL|UNT} [WTH NO REWND| FOR REMOVAL]
CLOSE file-3 [WTH NO REWND|LOCK]
UNIT #nd REE* #re synonyms.
After opening a TAPE file, the file is positioned at its beginning. When opening the file if the
clause REVERSED is coded, then the file can be read in the REVERESE direction. (Provided
hardware supports this feature)
When you close the file, the tape is normally rewound. The NO REWND clause specifies that the
TAPE should be left in its current position.
CLOSE statement with REEL option closes the current reel alone. So the next READ will get the
first record of next REEL. This will be useful when you want skip all the records in the first reel
after n number of records processing.
Since TAPE is sequential device, if you create multiple files in the same TAPE, then before
opening the second file, first file should be closed. At any point of time, you can have only one file
is active in the program. n addition to this, you have to code MULTPLE FLE clause in the -O
control paragraph of environment division.
MULTPLE FLE TAPE CONTANS OUT-FLE1 POSTON 1
OUT-FLE3 POSTON 3.
The files OUT-FLE1 and OUT-FLE3 used in the program are part of a same TAPE and they exist
in first and third position in the tape. Alternatively, this information can be passed from JCL using
LABEL parameter.
READ s#emen
READ statement is used to read the record from the file.
Syn#x2
READ FLENAME [NTO ws-record] [KEY S FLE-KEY1]
37
[AT END/NVALD KEY imperative statement1]
[NOT AT END/NOT NVALD KEY imperative statement2]
END-READ
f NTO clause is coded, then the file is directly read into working storage section record. t is
preferred as it avoids another move of file-section-record to working-storage-record followed by
simple READ. READ-NTO is not preferred for variable size records where the length of the
record being read is not known.
KEY S clause is used while accessing a record randomly using primary/alternate record key.
AT END and NOT AT END are used during sequential READ of the file.
NVALD KEY and NOT NVALD KEY are used during random read of the file. Before accessing
the file randomly, the key field should have a value before READ.
9RITE S#emen
Write statement is used to write a new record in the file. f the file is opened in EXTEND mode,
the record will be appended. f the file is opened in OUTPUT mode, the record will be added at
the current position.
Syn#x2
WRTE FLE-RECORD [FROM ws-record]
[NVALD KEY imperative statement1]
END-WRTE
FROM clause avoids the explicit move of working storage record to file section record before
WRTE.
RE9RITE S#emen
REWRTE is used to update an already read record. To update a record in a file, the file should
be opened in -O mode.
Syn#x2
REWRTE FLE-RECORD [FROM ws-record]
[NVALD KEY imperative statement1]
END-REWRTE
START S#emen
START is used with dynamic access mode of indexed files. t establishes the current location in
the cluster for READ NEXT statement. START itself does not retrieve any record.
Syn#x2
START FLENAME KEY is EQUAL TO/NOT LESS THAN/GREATER THAN key-name
[NVALD KEY imperative statement1]
38
END-START.
DE*ETE S#emen
DELETE is used to delete the most recently read record in the file. To delete a record, the file
should be opened in -O mode.
Syn#x2
DELETE FLENAME RECORD
[NVALD KEY imperative statement1]
END-DELETE.
.i$e Error 8 '#nd$in"
There are chances for failure of any file -O processing. The failure of an -O operation can be
accepted or cannot be tolerated. The severity of failure has to be defined in the program design
stage.
Let us assume that we don't have any error handling in our program. n this case, for example, if
you don't have a specific record in the file, the random read of that record would immediately
terminate the program with error 'record not found'.
E))o) %andling Cla,ses P)o/ided 1' CO+OL.
The sudden termination can be avoided by handling this error, with NVALD KEY clause of
READ. Based on the importance of the record and business rule, we can continue our program
with next record or terminate the program properly.
AT END is another error handling clause provided by COBOL. But there is no way to handle all
such errors in this way.
Assign 2ile-s-a-,s and -a3e -he )es5onsi1ili-'.
The second method is, assigning file-status to the file in the SELECT clause and checks the file
status after each and every -O and ensures that the value of status code is one of the allowable
values. f it is not an allowable return code, then abnormally end the program with error
statements that would be easier to debug.
But we have to do this checking after each and every -O operation.
This is MOST PREFERRED ERROR HANDLNG METHOD in structured programming.
De(la)a-i/es - "SE s-a-emen-
COBOL provides an option to group all the possible errors of specific operation(s) in a place and
that will be automatically invoked during the respective operation(s) of any file. This avoids
redundant code.
This is done in DECLARATVE section of the procedure division. DECLARATVE should be the
first section in the procedure division if coded.
PROCEDURE DVSON.
DECLARATVES.
39
USE-PROCEDURE SECTON.
USE AFTER EXCEPTON PROCEDURE ON NPUT.
ERROR-PROCEDURE.
Check the file-status code for validity.
END-DECLARATVES.
Whenever there is an error in the processing of ANY FLE opened in NPUT mode, then the
control comes to ERROR-PROCEDURE. The validity of error should be checked in this
paragraph and allow or restrict the process down, based on severity of error code.
Syn#x2
USE AFTER STANDARD ERROR|EXCEPTON PROCEDURE ON NPUT|OUTPUT|-O|
EXTEND| file-1
f NPUT is coded, the following procedure will be executed for every operation involved in any file
that is opened in NPUT mode. OUTPUT, -O and EXTEND have the same meaning but the
mode is different.
f file name (file-1) is coded in the USE statement, then all the input-output operation of that
specific file will be checked.
ERROR and EXCEPTON are synonyms.
The Procedure written in a DECLARATVE section should not refer to any non-declarative
procedure written after the end procedure and vice-versa.
I-O-CONTROL - SAME AREA AND SAME RECORD AREA
RESERVE clause of SELECT statement specifies the number of buffers to be allocated for a file.
SAME AREA allows more than one file to use the same buffer area. This will be very useful when
the program must work with a limited memory space. But the problem is only one file should be
open at a time if SAME AREA is coded.
Syn#x2
SAME AREA FOR file-1 file-2 file-3.
f SAME RECORD AREA is coded, then the buffer is not shared but only the record area is
shared. So more than one file can be in open state. We should be careful while filling in the
record area of the output file. This may destroy the record read most recently.
Syn#x2
SAME RECORD AREA FOR file-1 file-2 file-3.
SAME SORT AREA allows more than one sort/merge work files to use the same area. The sort
work files are automatically allocated when file is opened and de-allocated when file is closed. As
the sort file is automatically opened and closed during a SORT and two sort files cannot be
opened at a time, this clause may not be useful.
Syn#x2
SAME SORT|SORT-MERGE AREA for file-1 file-2. File-1 or file-2 should be a SD file.
40
I8O CONTRO*8 RERUN C$#use
RERUN ON rescue FOR EVERY integer RECORDS on file-1
This will cause checkpoint to be taken for every interger-1 records processing of file-1. f the
program ABENDED before the complete processing of the file-1, then the program will restart
from integer+1ST record instead of first record. The rescue file details should be mentioned
outside the program and it varies from installation to installation.
ENTR4 s#emen
ENTRY statement establishes an alternate ENTRY point in a COBOL called sub-program. When
a CALL statement naming the alternate entry point is executed in a calling program, control is
transferred to the next executable statement following the entry statement. Except when a CALL
statement refers to an entry name, the ENTRY statements are ignored at run-time.
Ma-(hing Logi(
f you have been given two files of similar type, say master and transaction file and you are
requested to update the master file with transaction file information for existing records and
prepare a report of new transactions and deleted transactions, then you should go for what is
called Matching logic. This is also known as co-sequential processing.
Sort both the files on key and compare the keys. f the keys are matching then update the file. f
you find any record that is found in transaction but not in master file, then that is new addition and
the reverse is deletion. f the master key is greater than transaction key, then that corresponds to
the first case and reverse is the second case.
This can be easily done in JCL using CETOOL.

41
42
FILE STAT"S CODES
File
Status
Result Explanation
2
VALD DUPLCATE ALTERNATE
KEY DETECTED.
N/A
5
ATTEMPT TO OPEN A FLE THAT S
NOT AVALABLE.
N/A
7
NCONSSTENCY N STORAGE
DEVCE.
N/A
10 END OF FLE REACHED
A sequential READ statement was attempted and no
next logical record existed in the file because the end
of the file had been reached, or the first READ was
attempted on an optional input file that was not
present.
14
NVALD READ ATTEMPT ON
RELATVE FLE. THE GVEN RRN
NUMBER S LARGER THAN THE
RELATVE KEY.
A sequential READ statement was attempted for a
relative file and the number of significant digits in the
relative record number was larger than the size of the
relative key data item described for the file.
16
A READ WAS ATTEMPTED WHEN
AT THE END CONDTON S TRUE.
N/A
20 NVALD KEY. N/A
21 RECORD OUT OF SEQUENCE
A sequence error exists for a sequentially accessed
indexed file. The prime record key value has been
changed by the program between the successful
execution of a READ statement and the execution of
the next REWRTE statement for that file, or the
ascending requirements for successive record key
values were violated.
22 DUPLCATE KEY
An attempt was made to write a record that would
create a duplicate key in a relative file; or an attempt
was made to write or rewrite a record that would
create a duplicate prime record key or a duplicate
alternate record key without the DUPLCATES
phrase in an indexed file. This key value applies to
an indexed file in which the alternate key has been
declared 'UNQUE'.
23 RECORD NOT FOUND
An attempt was made to randomly access a record
that does not exist in the file, or a START or random
READ statement was attempted on an optional input
file that was not present.
24
NO MORE SPACE ALLOCATED TO
FLE. WRTNG BEYOND THE
ALLOCATON OF THE FLE.
An attempt was made to write beyond the externally
defined boundaries of a relative or indexed file. Or, a
sequential WRTE statement was attempted for a
relative file and the number of significant digits in the
relative record number was larger than the size of the
relative key data item described for the file.
30 UNCORRECTABLE /O ERROR. No further information
34
AN ATTEMPT WAS MADE TO
WRTE BEYOND THE BOUNDARY
OF THE FLE.
A permanent error exists because of a boundary
violation; an attempt was made to write beyond the
externally-defined boundaries of a sequential file.
35
ATEEMPTNG TO OPEN AN EMPTY
FLE N NPUT OR /O MODE. DD
NAME S MSSNG OR WRONGLY
An OPEN statement with the NPUT, -O, or EXTEND
phrase was attempted on a non-optional file that was
43
Advertisement
44
Co1ol Coding
*ood CO+OL Coding 5)a(-i(es 2o) 1e--e) Mod,la)i-' and Pe)2o)man(e.
1. Do not use 66 level. Planning of data definition should make this redundant
2. Do not use 77 level. Collect all these together and group under a 01 level.
3. Use 88 level appropriately. For conditional names.
4.
All level numbers increment by an odd number in order to allow for the insertion of extra levels
during modifications; this reduces the need for wholesale renumbering of the levels with all the
problems that this entails.

5.
PARAGRAPHs or SECTONs should be used; they should not be mixed except when the
PARAGRAPH names are used to subdivide the SECTON. f this is used then only the SECTONs
should be performed.
6.
t corresponds to the sequence/logical position in the structure of the code. This enables the
location to be easily ascertained in a listing and also allows the user to see where the program has
progressed to in the event of any problems.
7.
The SORT and MERGE statements should be avoided if at all possible, it is more efficient to use an
external sort, e.g. SYNCSORT/DFSORT, rather than calling the internal sort which also uses one of
these sorts. This is because with an internal sort, control is passed back to the program after each
record reducing the speed of the sort. t is also easier to debug a COBOL program than it is to
debug the dump from an internal sort abend. f SORT routines are used then the maximum key
length is 4092 bytes with no maximum number of keys. To increase the efficiency of the sort, keep
the key fields at the start of the record and as contiguous as possible.
8.
GOTO should never be used; a structured program should not need to use this command. f
however because of coding or processing constraints, then the only possible use is to transfer
control to the end of the SECTON or PARAGRAPH being processed. t MUST NOT be used in any
other case.
9.
Nested F statements should be avoided and consideration should be given to the use of
EVALUATE as an alternative. The other option is to restructure the logic of the program so that the
if statement is either eliminated or simplified. The WHEN OTHER must always be coded; if this is
not present then if none of the prior conditions are satisfied then the program will fall through with
no processing occurring. The WHEN OTHER statement should always be the last option; if it is not
then all conditions following are irrelevant as they will not be tested.
10.
Care should be taken when using STRNG and UNSTRNG as this may hide data structures. When
using these operations then the ON OVERFLOW clause should always be used; if this is not used
then you are not notified of the incomplete operation and control passes to the next sequential
statement.
11. All structures are terminating with END-XXX.
12. The READ and WRTE PARAGRAPH/SECTONS should be grouped together
For each file there should be a separate READ PARAGRAPH/SECTON with an 'AT END' clause;
45
Advertisement
@CL:@o1 Con-)ol Lang,age;
6. &%AT IS @CL?
6.6 @O+ CONTROL LAN*"A*E consists of control statements that:
46
introduce a computer job to the operating system
request hardware devices
direct the operating system on what is to be done in terms of running applications and
scheduling resources
JCL is not used to write computer programs. nstead it is most concerned with input/output---
telling the operating system everything it needs to know about the input/output requirements. t
provides the means of communicating between an application program and the operating system
and computer hardware.
6.7 IS @CL DIFFIC"LT? ... NOT NECESSARIL#A
The role of JCL sounds complex and it is---JCL can be downright difficult.
JCL can be difficult because of the way it is used. A normal programming language, however
difficult, soon becomes familiar through constant usage. This contrasts with JCL in which
language features are used so infrequently that many never become familiar.
JCL can be difficult because of its design - JCL:
consists of individual parameters, each of which has an effect that may take pages to
describe
has few defaults--must be told exactly what to do
requires specific placement of commas and blanks
is very unforgiving--one error may prevent execution
JCL is not necessarily difficult because most users only use a small set of similar JCL that never
changes from job to job.
6.8 %O& DO #O" SEND INFORMATION TO T%E COMP"TER?
BATCH PROCESSNG VS. NTERACTVE PROCESSNG
In-e)a(-i/e P)o(essing means that you give the computer a command and the computer
responds to your command request. t is more like a conversation.
+a-(h P)o(essing means that you give the computer a whole group of commands, usually in the
form of some sort of program you have written, and have the computer process this group of
commands. t is more like writing a letter.
7. +ASIC S#NTAX OF @CL STATEMENTS
//NAME OPERATON OPERAND,OPERAND,OPERAND COMMENTS
|
name
field
|
operation
field
|
operand field
|
comment
field
47
name field - identifies the statement so that other statements or the system can refer to it. The
name field must begin immediately after the second slash. t can range from 1 to 8 characters in
length, and can contain any alphanumeric (A to Z) or national (@ $ #) characters.
operation field - specifies the type of statement: JOB, EXEC, DD, or an operand command.
operand field - contains parameters separated by commas. Parameters are composites of
prescribed words (keywords) and variables for which information must be substituted.
comments field - optional. Comments can be extended through column 80, and can only be
coded if there is an operand field.
0ener#$ /C* Ru$es2
Must begin with // (except for the /* statement) in columns 1 and 2
s case-sensitive (lower-case is just not permitted)
NAME field is optional
must begin in column 3 if used
must code one or more blanks if omitted
OPERATON field must begin on or before column 16
OPERATON field stands alone
OPERANDS must end before column 72
OPERANDS are separated by commas
All fields, except for the operands, must be separated by one blank.
7.6 CONTIN"ATION OF @CL STATEMENTS
//LABEL OPERATON OPERAND, OPERAND,
// OPERAND,OPERAND,
// OPERAND,
// OPERAND
When the total length of the fields on a control statement exceeds 71 columns, continue the fields
onto one or more following statements.
nterrupt the field after a complete operand (including the comma that follows it) at or
before column 71
Code // in columns 1 and 2 of the following line
Continue the interrupted statement beginning anywhere in columns 4 to 16.
7.7 COMMENTIN* @CL
//* THS S A COMMENT LNE
JCL should be commented as you would any programming language. The comments statement
contains //* in columns 1 to 3, with the remaining columns containing any desired comments.
They can be placed before or after any JCL statements following the JOB statement to help
document the JCL. Comments can also be coded on any JCL statement by leaving a blank field
after the operand field.
48
8. T%REE T#PES OF @CL STATEMENTS
JOB dentifies the beginning of a job
EXEC ndicates what work is to be done
DD Data Definition, i.e., dentifies what resources are needed and where to find them
9. T%E @O+ STATEMENT
The JOB statement informs the operating system of the start of a job, gives the necessary
accounting information, and supplies run parameters. Each job must begin with a single JOB
statement.//jobname JOB USER=userid
jobname - a descriptive name assigned to the job by the user which is the banner on your printout
- any name from 1 to 8 alphanumeric (A-Z,0-9) or national ($,@,#) characters
- first character must be alphabetic or national
JOB - indicates the beginning of a job
Userid - a 1 to 7 character user identification assigned to access the system
9.6 ADDITIONAL OPERANDS OF T%E @O+ STATEMENT
Bo1name @O+ "SERC,se)idD TIMECmD MS*CLASSC(lassD NOTIF#C,se)id
USER=userid dentifies to the system the user executing the job
TME=m Total machine (m)inutes allowed for a job to execute
MSGCLASS=class Output class for the job log
NOTFY=userid User to receive a TSO message upon completion of a job
=.:.: MS0C*ASS
The MSGCLASS parameter allows you to specify the output class to which the operating system
MVS is to write the job log or job entry subsystem (JES) messages. f you do not code the
MSGCLASS parameter, MSGCLASS=J is the default and will be used. MSGCLASS=J indicates
the output will be printed on 8 1/2" by 11" hole paper.
This includes the following:
1. Job Entry Subsystem (JES) Messages
2. Error Messages
3. JCL Statements
4. Dataset Dispositions
5. Accounting information
49
Here is a list of available output classes:
A greenbar paper
5-9 TSO held output
C-Z BM page printer output classes. See chart in section "Sys-out Classes for BM Print"
on page 28.
<. T%E EXEC STATEMENT
Use the EXEC (execute) statement to identify the application program or cataloged or in-stream
procedure that this job is to execute and to tell the system how to process the job.
//stepname EXEC procedure,REGON=####K
or
//stepname EXEC PGM=program,REGON=####K
stepname - an optional 1 to 8 character word used to identify the step
EXEC - indicates that you want to invoke a program or cataloged procedure
procedure - name of the cataloged procedure to be executed
program - name of the program to be executed
REGON=####K - amount of storage to allocate to the job
<.6 PRO*RAMS AND CATALO*ED PROCED"RES
// EXEC PGM=pgmname
A program referred to on the EXEC PGM= statement is a compiled and linked version of a set of
source language statements that are ready to be executed to perform a designed task. t is also
known as an executable load module. t must reside in a partitioned dataset.
// EXEC cataloged-procedure-name
Because the same set of JCL statements are often used repeatedly with little or no change they
can be stored in cataloged procedures. JCL provides programmers with the option of coding
these statements only once, recording and cataloging the statements under an appropriate name
in a procedure library, and then invoking these statements through an EXEC statement. Such a
previously established set of JCL statements is known as a "cataloged procedure." The effect of
using a cataloged procedure is the same as if the JCL statements in the procedure appeared
directly in the input stream in place of the EXEC statement calling the procedure. This saves the
user from writing lengthy error-prone JCL statements. n short, this is JCL that does not have to
be included in batch jobs.
* Note that within cataloged procedures a program will be executed.
>.:.: Modi(yin" C##$o"ed !ro%edures
50
Additional statements may be added to the JCL comprising a cataloged procedure at the time of
invocation. Also, operand values on existing JCL statements may be altered or parameters
defined in the procedure may be substituted at invocation time.
The value in the override statement replaces the value for the same parameter in the cataloged
procedure. Cataloged procedure statements must be overridden in the same order as they
appear in the procedure.
//procstepname.ddname DD parameter=value
You can modify cataloged procedures by:
Overriding parameters in an existing DD statement
Adding DD statements to the procedure. To add new DD statements let them follow any
changed DD cards for that step.
To modify an existing DD statement, only those operands to be changed need be coded on the
modifying DD statement. The remaining operands of the DD statement within the procedure will
be unchanged. f more than one DD statement in a procedure is to be modified, the modifying DD
statements must be placed in the same order as the original DD statements occur in the
procedure.
To add a DD statement to an existing procedure, place the DD statement after the procdure
invocation EXEC statement and any modified DD statements within the job step.
// EXEC SAS
//NEWDD DD DSN=user.file,DSP=SHR
When looking at your output, the following symbols will determine what kind of statement is
indicated when your job runs:
// ndicates JCL statements
XX ndicates cataloged procedure statements
X/ ndicates a modified cataloged procedures statement
=. DATA DEFINITION :DD; STATEMENT
A DD (Data Definition) statement must be included after the EXEC statement for each data set
used in the step. The DD statement gives the data set name, /O unit, perhaps a specific volume
to use, and the data set disposition. The system ensures that requested /O devices can be
allocated to the job before execution is allowed to begin.
The DD statement may also give the system various information about the data set: its
organization, record length, blocking, and so on.
51
//ddname DD operand,operand,etc.
ddname - a 1 to 8 character name given to the DD statement
DD - DD statement identifier
operand - parameters used to define the input or output dataset
The DD Statement
appears after an EXEC statement
gives the system information on many things, including the dataset attributes, the
disposition of the dataset when the job completes, and which input/output device(s) to
use
6.1 DD STATEMENT FOR NSTREAM DATA
nstream data is perhaps the most common form of input. To include data in the input stream,
code:
ddname DD E
.
.
.
E :-o s5e(i2' end o2 da-a;
SYSN is often used as a ddname for instream data. The /* marks the end of the data.

=.7 EXAMPLE PRO*RAMS &IT% INSTREAM DD STATEMENTS
?.;.: .orr#n Ex#mp$e
n this example, the userid UGUSER is executing a Fortran procedure with the Fortran program
inserted after the FORT.SYSN line and the data inserted after the GO.SYSN line.
//FORTRUN JOB USER=UGUSER
// EXEC FORTVCLG,REGON=1500K
//FORT.SYSN DD *
FORTRAN statements
/*
//GO.SYSN DD *
data lines
/*
//
?.;.; SAS Ex#mp$e
52
n this example, the userid UGBM is executing a SAS procedure with the SAS program inserted
after the SYSN line.
//SASRUN JOB USER=UGBM
// EXEC SAS,REGON=1500K
//SYSN DD *
SAS statements
/*
//

=.8 DATA DEFINITION :DD; STATEMENT FOR DIS$ DATASETS
//ddname DD UNT=unittype,
// DSN=userid.name,
// DSP=(beginning,normal-end,abnormal-end),
// SPACE=(TRK,(primary,secondary,directory)),
// RECFM=xx,LRECL=yy,MGMTCLAS=retainx
ddname - data definition name; a 1-8 character word of your choice, must begin with a letter or $,
@, #
DD - DD statement identifier
"NIT C ,ni--'5e - an /O unit is a particular type of /O device: a disk, tape, etc. UNT=SYSDA
refers to the next available disk storage device.
DSNC,se)id.name DSN parameter names the data set. Data sets can be temporary or
nontemporary. A temporary data set is created and deleted within the job, whereas nontemporary
data sets can be retained after the job completes. A data set name can contain up to 44
characters including periods.
Ex. UGBM.DATA
mgm-(las - MGMTCLAS specifies the name of the Management Class which is a set of
specifications for the way the storage occupied by the data set should be treated by SMS.
Generally, this deals with how long you want to keep this data set around. UCNS has set up the
following management classes:

MGMTCLAS Days Retention MGMTCLAS Days Retention
RETAN0 0 (DEFAULT) RETAN8 8
RETAN1 1 RETAN9 9
RETAN2 2 RETAN10 10
RETAN3 3 RETAN14 14
RETAN4 4 RETAN28 28
RETAN5 5 RETAN56 56
53
RETAN6 6 RETAN95 95
RETAN7 7 STANDARD (18 months past last use)
=.9 DATA DEFINITION :DD; STATEMENT FOR TAPE DATASETS
//ddname DD UNT=unittype,VOL=SER=unitname,
// DSN=filename,
// DSP=(beginning,normal-end,abnormal-end),
// DCB=(RECFM=xx,LRECL=yy,BLKSZE=zz,DEN=density),
// LABEL=(file#,labeltype,,mode)
ddname - data definition name; a 1-8 character word of your choice, must begin with a letter or $,
@, #
DD - DD statement identifier
"NITC,ni--'5e - an /O unit is a particular type of /O device: disk, tape, etc.
TAPE16 refers to a 1600 bpi tape drive
TAPE62 refers to a 6250 bpi tape drive
TAPECA refers to a 38K or XF catridge tape drive
VOLCSERC,ni-name - VOL=SER parameter is needed if the data set is to be placed on a
specific tape volume. This refers to the volume serial number on an internal tape label.
DSNC2ilename - DSN parameter names the file on the tape. The filename can be from 1 to 17
characters in length.
Ex. COWDATA
?.=.: Disposiion (DIS!) !#r#meers
The DSP parameter describes the current status of the data set (old, new, or to be modified) and
directs the system on the disposition of the dataset (pass, keep, catalog, uncatalog, or delete)
either at the end of the step or if the step abnormally terminates. DSP is always required unless
the data set is created and deleted in the same step.
DISP C :1eginningD no)mal--e)mina-ion Da1no)mal--e)mina-ion;
_________ _________________ ___________________
| | |
NEW CATLG DELETE
OLD KEEP KEEP
SHR PASS CATLG
MOD DELETE UNCATLG
UNCATLG
?.=.:.: )e"innin" Disposiions
54
This is the status of the data set at the beginning of the step. f the data set is new, the system
creates a data set label; if it is old, the system locates it and reads its label
NE& creates a new data set
OLD designates an existing data set; it can be an input data set or an output data set to rewrite
S%R identical to OLD except that several jobs may read from the data set at the same time.
MOD modifies a sequential data set - positions the pointer at the end of the data set in order to
add new data to the data set.
?.=.:.; Norm#$ Termin#ion #nd A-norm#$ Termin#ion Disposiions
Normal disposition, the second term in the DSP parameter, indicates the disposition of the data
set when the data set is closed or when the job terminates normally. The abnormal dispositions,
effective only if the step abnormally terminates, are the same as normal dispositions except that
PASS is not allowed.
PASS passes the data set on to subsequent job steps, and each step can use the data set once.
$EEP keeps nontemporary data sets.
DELETE deletes data sets.
CATL* catalogs a nontemporary data set. CATLG is similar to KEEP except that the unit and
volume of the data set are recorded in the catalog along with the data set name.
"NCATL* uncatalogs a data set. UNCATLG is the same as KEEP except that the data set name
is removed from the catalog.
?.=.:.@ Ex#mp$es o( DIS! p#r#meers
// DSP=SHR read from
// DSP=OLD write to
// DSP=(NEW,CATLG,DELETE)
create and catalog; delete if
there is a system abend
// DSP=(OLD,PASS)
dataset already exists; pass it
to the next step
// DSP=MOD
write to the bottom of an
existing dataset
?.=.; S!ACE !#r#meer
All new data sets on disk volumes must be allocated space. Storage on disk volumes can be
allocated in units of blocks, cylinders, tracks, kilobytes, and bytes.
55
The space may be requested as a primary and a secondary amount. The primary amount is
allocated when the data set is opened with a disposition of NEW. The secondary amount is
allocated if the primary amount is exceeded.
The primary amount can be conservative, with the secondary amount providing a reserve. The
secondary amount provides for data set growth over time.
SPACEC:TR$D:5)ima)'Dse(onda)'Ddi)e(-o)';;
5)ima)' receive this amount of space initially
se(onda)' receive this amount of space each time more is needed (up to 15 times)
di)e(-o)' reserve this amount of blocks to keep the directory of a partitioned dataset (NOT
USED for a sequential dataset)
1 directory block allows for 5 members in a partitioned dataset
Total Space = (1 * primary) + (15 * secondary)
?.=.;.: !#riioned D##se &s. Se6ueni#$ D##se
Any named collection of data is called a data set. A partitioned dataset consists of multiple files
within one data structure. A sequential dataset consists of one file within a data structure.
Partitioned Dataset
individual members are read/manipulated without disturbing other members
it is advisable to never write directly to a partitioned dataset in your program
on DD statememt: DSN=userid.file(member)
call from editor: file(member)
Sequential Dataset
dataset must be read from top to bottom
on DD statement: DSN=userid.file
call from editor: file
PARTTONED DATASET
DSN='userid.data-set-
name(member)'
SEQUENTAL DATASET
DSN='userid.data-set-name'
______________
| DRECTORY |
|-----------------|
| MEMBER1 |
|-----------------|
| MEMBER2 |
|-----------------|
| ....... |
______________
| |
| |
| |
| DATASET |
| |
| |
| |
56
|-----------------|
| MEMBERn |
|--------------------------|
|_______________|
| |
| |
|_______________|
A partitioned dataset differs from a sequential dataset in that it has a directory of its members.
Whenever you refer to a member of a partitioned dataset, you include the member name in
parentheses.
?.=.;.; D.SMS (Sysem M#n#"ed D##ses)
On the TSO service, data sets are typically created and reside on disk volumes. A volume is a
standard unit of storage. These disk volumes are referred to as DASD, which stands for Direct
Access Storage Device. Each block of data on a DASD volume has a distinct location and a
unique address, making it possible to find any record without extensive searching. One DASD
volume can be used for many different data sets, and space on it can be reallocated and reused.
At the University of Georgia, you are now required to utilize the Data Facilities Storage
Management Subsystem (DFSMS) to establish permanent data sets. The Storage Management
Subsystem (SMS) is an operating environment that automates the management of storage. With
SMS, users can allocate data sets more easily. The data sets allocated through the Storage
Management Subsystem are called system-managed. System-managed means that the system
determines data placement and automatically manages data availability, performance, space,
reclamation, and security. One of the most beneficial goals of System-managed storage is to
relieve users of performance, availability, space, and device management details.
DFSMS stores data in a device-independent format so that it can easily move the data to any of
the following devices:
3490E Magnetic Catridge Tape
DASD for models 3380 and 3390
The migration and movement of data depends on such factors as:
Management Class
Data set Usage
Minimum percent free space on a DASD Volume
Request by storage administrator or user
DFSMS records the location of each dataset it moves in a control data set. The actual migration
is handled by DFHSM (Data Facilities Hierarchical Storage Manager). DFHSM is a DASD
management product tool for managing low-activity and inactive data.
Data sets that have reached the end of their retention period (expired) will be deleted. Data sets
with a management class of STANDARD will be deleted if the data set has not been referenced
for a period of eighteen months. A notification will be sent to the user after a STANDARD data set
57
has not been referenced for six months informing the user of the STANDARD deletion policy. At
this time the data set will be moved to tape.
All data sets that have a management class of RETAN95 or STANDARD will be automatically
backed up by DFHSM. Two copies of each will be kept. The change indicator will trigger the
backup after the first backup is made. A user can use the HBACK command to add non-
STANDARD and non-RETAN95 data sets to this.
?.=.;.@ S!ACE !#r#meer (!#riioned D##se)
SPACEC:TR$D:5)ima)'Dse(onda)'Ddi)e(-o)';;
This SPACE example allows a total of 40 tracks for the dataset with 1 block of space reserved for
the directory.
// SPACE=(TRK,(10,2,1))
Total Space = (1*10) + (15*2) = 10 + 30 = 40 tracks
Directory = (1*5) = 5 members/dataset

This SPACE example allows a total of 100 tracks for the dataset with 8 blocks reserved for the
directory.
// SPACE=(TRK,(25,5,8))
Total Space = (1*25) + (15*5) = 25 + 75 = 100 tracks
Directory = (8*5) = 40 members/dataset
* Note that the track capacity for 3380 is 1 track = 47,476 characters.
?.=.;.= S!ACE !#r#meer (Se6ueni#$ D##se)
SPACEC:TR$D:5)ima)'Dse(onda)';;

This SPACE example allows a total of 53 tracks for the dataset.
// SPACE=(TRK,(8,3))
Total Space = (1*8) + (15*3) = 8 + 43 = 53 tracks
This SPACE example allows a total of 520000 bytes for the dataset.
// SPACE=(80,(5000,100))
58
Total Space = (1*400000) + (15*8000) = 400000 + 120000 = 520000 bytes
* Note that directory blocks are always 0 for sequential datasets; therefore, the directory
parameter is NOT USED for sequential datasets.
?.=.@ D## Se Ari-ues
With SMS, you do not need to use the DCB parameter to specify data set attributes. ALL of the
DCB keyword subparameters (record length, record format, and blocksize) can be specified
without the need to code DCB=.
For example, the following DD statement:
// DCB=(RECFM=FB,LRECL=80,BLKSZE=8000)
can be specified as:
// RECFM=FB,LRECL=80
The blocksize parameter can be omitted because SMS will select the optimum blocksize.
RECFMCFF specifies the record format. The format can be one or more of the following
characters:
F fixed-length records
V variable-length records
U undefined-length records
FB fixed and blocked
FBA fixed, blocked, with ANS carriage control characters
VB variable and blocked
VBA variable, blocked, with ANS carriage control characters
LRECLC'' specifies the length of records
equal to the record length for fixed-length records
equal to the size of the largest record plus the 4 bytes describing the record's
size for variable-length records
omit the LRECL for undefined records
LRECL can range from 1 to 32760 bytes
+L$SIGECHH specifies the blocksize if you wish to block records
must be a multiple of LRECL for fixed-length records
must be equal to or greater than LRECL for variable-length records
must be as large as the longest block for undefined-length records
59
BLKSZE can range from 1 to 32760 bytes
?.=.@.: .ixed )$o%<
// RECFM=FB,LRECL=80,BLKSZE=9040
This dataset will have fixed length records with a length of 80. There will be 113 records of data
per block.
BLKSZE/LRECL = 9040/80 = 113 records of data per block

.=.@.; V#ri#-$e )$o%<
// RECFM=VB,LRECL=255,BLKSZE=3120
This dataset will have variable length records with a maximum of 255 characters. The blocksize
of the dataset will be 3120.

?.=.= DC) #nd *A)E* !#r#meers (or T#pes
RECFMCFF specifies the record format. The format can be one or more of the following
characters:
F fixed-length records
V variable-length records
U undefined-length records
FB fixed and blocked
FBA fixed, blocked, with ANS carriage control characters
VB variable and blocked
VBA variable, blocked, with ANS carriage control characters
LRECLC'' specifies the length of records
equal to the record length for fixed-length records
equal to the size of the largest record plus the 4 bytes describing the record's size for
variable-length records
omit the LRECL for undefined records
LRECL can range from 1 to 32760 bytes
+L$SIGECHH specifies the blocksize if you wish to block records
must be a multiple of LRECL for fixed-length records
must be equal to or greater than LRECL for variable-length records
must be as large as the longest block for undefined-length records
BLKSZE can range from 1 to 32760 bytes
60
DENCdensi-' measures the number of bits that are stored in a unit of measurement on the tape.
This measurement is commonly referred to as BP (bits per inch).
densities are represented in the DEN parameter as follows:
2 800 BP
3 1600 BP
4 6250 BP
* 38K OR XF BP
when adding files to an existing tape all new files will be written at the same density
as the first file no matter if you specify differently.
The LABEL parameter tells the type of label, the relative file number on the tape, and whether the
data set is to be protected for input or output.
LA+ELC:2ile0Dla1el-'5eDDmode;
2ile - the relative file number on the tape (1-4 digits)
-'5e - the type of label on the tape
NL No Label
SL Standard Label
AL American National Standard Label
BLP Bypass Label Processing
mode N/OUT parameter
N protects the file from being opened for output
OUT protects it from being opened for input
// LABEL=(3,SL,,N) File 3 on a SL tape can only be read
// LABEL=(1,NL,,OUT) File 1 on a NL tape is open for output

=.< EXAMPLE PRO*RAMS &IT% DD STATEMENTS
?.>.: .orr#n /o- (or Re#din" (rom Dis< D##se
n this example, the userid UGBM is executing a Fortran procedure with the Fortran program
inserted after the FORT.SYSN line, and the data is being read by UNT 3 from the data set
UGBM.FOOD.
//FORTRUN JOB USER=UGBM
// EXEC FORTVCLG,REGON=2000K
//FORT.SYSN DD *
61
read(3,10) x,y
10 format(1x,f4.1,1x,f4.1)
/*
//GO.FT03F001 DD DSN=UGBM.FOOD,UNT=SYSDA,DSP=SHR
/*
//
=.<.7 SAS @o1 2o) Reading 2)om Dis3 Da-ase-
n this example, the userid UGBM is executing a SAS procedure with the SAS program inserted
after the SYSN line and the data is being read from the data set UGBM.DATA.
//SASRUN JOB USER=UGBM
// EXEC SAS,REGON=2000K
//OLDDATA DD DSN=UGBM.DATA,UNT=SYSDA,DSP=SHR
//SYSN DD *
data one; infile olddata;
input x y z;
/*
//
?.>.@ .orr#n /o- (or 9riin" o Dis< D##se
n this example, the userid UGABC is executing a Fortran procedure with the Fortran program
inserted after the FORT.SYSN line, and the results are written by UNT 8 to the data set
UGABC.NEWFLE. This dataset will only be retained for 7 days. f the user decides to keep the
dataset for a longer period of time, the ALTER command can be issued. For example, ALTER
'UGABC.NEWFLE' MGMTCLAS(RETAN14), will keep the dataset around for another week.
Since the BLKSZE is not specified, SMS will determine the most efficient blocksize.
//FORTRUN JOB USER=UGABC
// EXEC FORTVCG,REGON=2000K
//FORT.SYSN DD *
write(8,10) x,y
10 format(1x,f4.1,1x,f4.1)
/*
//GO.FT08F001 DD DSN=UGABC.NEWFLE,UNT=SYSDA,
// DSP=(NEW,CATLG,DELETE),
// SPACE=(TRK,(40,10),RLSE),
// RECFM=FB,LRECL=80,MGMTCLAS=RETAN7
/*
//
62
?.>.= SAS /o- (or 9riin" o Dis< D##se
n this example, the userid UGXYZ is executing a SAS procedure with the SAS program inserted
after the SYSN line and the results are written to the data set UGXYZ.SAS.DATA. This dataset,
based on the management class of standard, will be retained on the system as long as the user
utilizes it.
//SASRUN JOB USER=UGXYZ
// EXEC SAS,REGON=2000K
//NEWDATA DD UNT=SYSDA,
// DSN=UGXYZ.SAS.DATA,DSP=(NEW,CATLG,DELETE),
// SPACE=(TRK,(40,10),RLSE),
// RECFM=FB,LRECL=80,MGMTCLAS=STANDARD
//SYSN DD *
data example;
input x y z;
cards;
1 2 3
4 5 6
;
data _null_; set example; file newdata;
put x y z;
return;
/*
//
>. DD STATEMENT FOR PRINTED O"TP"T
The SYSOUT parameter provides a convenient means of routing output to printers or other
devices.
ddname DD S#SO"TC(lass
ddname - a 1 to 8 character name given to the DD statement
DD - DD statement identifier
SYSOUT=class - defines this data set as a system output data set, usually called a sysout data
set and assigns this sysout data set to an output class. Here is a list of available output classes:
A greenbar paper
5-9 TSO held output
C-Z BM page printer output classes. See chart in section "Sysout Classes for BM Print"
on page 28.
63
* same class as specified on the MSGCLASS parameter
* Note that if a sysout data set has the same class as the MSGCLASS parameter, the job log
appears on the same output listing as this sysout data set.
>.6 S#SO"T CLASSES FOR I+M PRINT

SYSOUT*
CLASS
PAPER ORENTATON SDES MAGES CHAR/LNE LNES/MAGE
C hole landscape 1 1 132 62
D hole portrait 1 1 80 62
F bond landscape 2 1 132 62
G bond portrait 2 1 80 62
H bond landscape 2 2 90 80
bond portrait 2 1 80 70
J hole landscape 2 1 132 62
K hole portrait 2 1 80 62
Q bond landscape 1 1 132 62
S bond portrait 1 1 80 62
W hole portrait 2 2 132 62
X bond portrait 2 2 132 62
Y bond landscape 2 1 132 62
Z hole landscape 2 1 132 62
Graybar Overlay: The paper used for classes C,F,H,J, and Q is shaded to mimic standard
greenbar paper.
Service Site Page Printers: To route your output to one of the page printers in the Journalism or
Aderhold sites, you must use a SYSOUT class or message class (MSGCLASS) with a paper type
of "hole" (C, D, J, K, W, or Z).
Line Printer SYSOUT Class: To route your output to a line printer, use a SYSOUT class or
message class (MSGCLASS) of A. Your output will be printed on greenbar paper.
Special Hold Classes: To route your output to a hold queue, use a SYSOUT class or message
class (MSGCLASS) of 5, 6, 7, 8, or 9.
------------------------
* SYSOUT class values may be used for message class (MSGCLASS).


I. O"TP"T @CL STATEMENT
64
The OUTPUT statement is used to specify processing options for a system output data set.
These options are used only when the OUTPUT statement is explicitly or implicitly referenced by
a sysout DD statement.
name O"TP"T FORMDEFC2de2DPA*EDEFC5de2DC%ARSC(hDFORMSC2o)mD
COPIESCnDDESTCdes-DDEFA"LTCdd
name - a 1 to 8 character name given to the OUTPUT statement
O"TP"T - OUTPUT statement identifier
FORMDEFC2de2 - specifies whether to use duplex or simplex and overlay
DUP1 duplex, no overlay
DUP2 duplex, grey bar overlay
SMP1 simplex, no overlay
SMP2 simplex, grey bar overlay
PA*EDEFC5de2 - specifies the logical page length and width, fonts, lines within a page, and
multiple logical pages on a physical page
POR1 portrait, 62 lines at 6 lines per inch
POR2 portrait, 70 lines at 6 lines per inch
POR3 portrait, 2 up format, 62 lines per frame
LAN1 landscape, 62 lines at 8 lines per inch
LAN2 landscape, 2 up format, 80 lines per frame
C%ARSC(h - names the character set
GT12 Gothic font at 12 characters per inch
GT13 Gothic font at 13 characters per inch
GT18 Gothic font at 18 characters per inch
FORMSC2o)m - specifies the type of form
BOND plain bond paper
HOLE 3 hole drilled bond paper
COPIESCn - specifies how many copies of the sysout data set are to be printed
DESTCdes- - specifies a printer destination for the sysout data set
LOCAL Boyd Graduate Studies
SSS02 Journalism Building
SSS03 Aderhold Building
NCT19 Brooks Hall
DEFA"LTCdd - specifies that this OUTPUT statement can or cannot be referenced by a sysout
DD statement
YES specifies that this is the default OUTPUT statement for for all print files within a job
NO specifies that this is not the default OUTPUT statement
65
* Note if you are going to HOLD a print dataset with an OUTPUT statement associated with it,
you will have to fully specify all of the parameters on the OUTPUT statement. Contact the UCNS
Helpdesk for more details.

I.6 EXAMPLES OF T%E O"TP"T STATEMENT
To request that the "gray bar" overlay not print on a landscape sysout class for all print files,
code:
//OUT1 OUTPUT FORMDEF=DUP1,DEFAULT=YES

To request simplex (one sided) printing for a duplex sysout class for all print files, code:
//OUT1 OUTPUT FORMDEF=SMP1,DEFAULT=YES

To request multiple copies of a print file, code:
//OUT1 OUTPUT COPES=12
- with -
//ddname DD SYSOUT=F,OUTPUT=*.OUT1



J. @ES8 CONTROL STATEMENTS
J.6 EMAIN STATEMENT
The //*MAN statement is used to define the processor requirements for the current job. t
specifies what time the job will be executed, how many lines in the job, and where the job is to be
printed.
EMAIN CLASSCFDLINESC'DOR*C"*AI+M6.o)g
CLASSCF specifies the job class for this job
B Batch (default) Anytime daily
NTE 6:00 PM until 7:00 AM daily
WEEKEND 6:00 PM Friday until 7:00 AM Monday
Z 1:30 AM until 7:00 AM daily, weekends, holidays
BL 6:00 PM until 7:00 AM daily, more than 8 MEG region
ZL 1:30 AM until 7:00 AM daily, more than 8 MEG region
66
LINES specifies the maximum number of lines of data to be printed from this job in multiples of a
thousand (default = 5000)
OR*C"*AI+M6.o)g specifies a printer destination for the sysout dataset
LOCAL Boyd Graduate Studies
SSS02 Journalism Building
SSS03 Aderhold Building
NCT19 Brooks Hall
J.7 @O+ SC%ED"LIN* SPECIFICATIONS
Since TSO is a time sharing operating system, it allows many people to use the computer at the
same time in such a way that each is unaware that the computer is being used by others. Time
sharing attempts to to maximize an individuals use of the computer, not the efficiency of the
computer itself. n order to do this, job scheduling is used to assign jobs to a certain class in order
to maximize the resources available to each user.
Priority
-------
___________
BATCH | 4
|
| __________ 3
____
NTE | ____ 2
Any job can be scheduled to run at night or on the weekend by coding:
//*MAN CLASS=NTE
or
//*MAN CLASS=WEEKEND
A.;.: T#-$e o( Resour%e *imi#ions (or /o- S%+edu$in"
Priority CPU Time
(seconds)
Region (K) Estimated
Lines
Setups
Required
6 0-30 0-2048 0-5000 0
4 32-120 2049-3072 5001-10000 0
3 121-300 3073-4096 10001-40000 1-3
2 301+ 4097+ 40000+ 4+
67
J.8 EOPERATOR STATEMENT
The //*OPERATOR statement is primarily used to issue a message to the operator requesting
that the tape with the specific VRN, VSN and KEYWORD is to be mounted for the job.
//*OPERATOR VRN=#9999 VSN=U9999 KEY=HELP
VRN will be assigned when the tape is checked in. This identifies the tape in the tape library.
Cartridge Tapes must have #C in the first two column positions on the vrn parameter.
VSN the volume serial number on the the internal label of a standard labeled tape. This must be
the actual internal label. For non-labeled tapes, this can be any arbitrary name. n both cases, the
VSN must match the VOL=SER parameter on the DD card.
KEY is a password that you will assign to the tape for security purposes. The operator will check
the keyword in your JCL against the keyword on the tape before mounting the tape.
The //*Operator statement in the JCL stream is placed after the JOB or //*MAN statement and
before the EXEC statement. Each //*Operator statement should be referenced by a DD statement
to read or write a file to the tape.
The following example illustrates the operator card with the referencing DD statement. Note that
the VSN and the VOL=SER must be the same. n this example, the user is going to read the first
file on a standard labeled (SL) tape with the name COWDATA. The tape is going to be read on a
6250 BP tape drive.
//SEMNAR JOB USER=USERD
//*MAN LNES=20
//*OPERATOR VRN=#1111 VSN=0211ZZ KEY=KFJD
//STEP1 EXEC ...
//NFLE DD UNT=TAPE62,VOL=SER=0211ZZ,
// LABEL=(1,SL,,N),
// DSN=COWDATA,
// DSP=(OLD,PASS)


6K. EXAMPLE FORTRAN AND SAS PRO*RAMS
68
6K.6 EXAMPLE FORTRAN PRO*RAM
n this example, the userid UGA001 is executing a Fortran procedure with the Fortran program
inserted after the FORT.SYSN line and the data inserted after the GO.SYSN line. This job will
not begin executing until after 6:00PM, and the output will be held to the terminal by the
MSGCLASS=6.
//CONVERT JOB USER=UGA001,MSGCLASS=6,NOTFY=UGA001
//*MAN CLASS=NTE,LNES=40,ORG=UGABM1.LOCAL
// EXEC FORTVCLG,REGON=2000K
//FORT.SYSN DD *
read(5,10) cent
10 format(f6.2)
fahr=(cent*9/5)+32
write(6,20) cent,fahr
20 format(f6.2,' cent = ',f6,2,'fahr')
/*
//GO.SYSN DD *
100.00
/*
//
6K.7 EXAMPLE SAS PRO*RAM
n this example, the userid RESRCH is executing a SAS procedure with the SAS program
inserted after the SYSN line and the data is being read from the first file of a standard labeled
cartridge tape with the file name of DATAFL. The output will go directly to the printer with the
sysout class of S.
//ANALYSS JOB USER=RESRCH,NOTFY=RESRCH,TME=3,MSGCLASS=S
//*MAN LNES=10
//*OPERATOR VRN=#C1234 VSN=WGCF KEY=KFJD
// EXEC SAS,REGON=2500K
//SAMPDATA DD UNT=TAPECA,VOL=SER=WGCF,
// LABEL=(1,SL,,N),
// DSN=DATAFL,
// DSP=(OLD,PASS)
//SYSN DD *
data one;
infile sampdata;
input a b c d;
proc print;
69
/*
//
66. SO"RCES OF %ELP
66.6 "CNS %ELPDES$
The UCNS Helpdesk, located in the Computer Services Annex on the corner of East Campus
Road and Cedar Street and on the first floor of the Boyd Graduate Studies Research Center,
function as the initial contact point for all computer related needs associated with the University of
Georgia computer systems. The primary purpose of the Helpdesk is to aid faculty, staff, and
students with the use of our computer systems through general consulting and information
requests. Assistance is provided through telephone contacts, walkins, and electronic mail.
Hours: Monday - Friday, 8:00AM - 5:00PM
Phone: (404) 542-3106
E-mail Address: HELPDESK@UGA
nternet Address: [email protected]
Limited assistance is available at all staffed UCNS Computer Service Sites.

66.7 %ELPF"L IDS DOC"MENTS
Common BM System Error Messages and Abend Codes
The Case of the Sinister Syntax Error
Facility Access and Services Guide
66.8 +ASIC @CL REFERENCES
BM MVS JCL Publication No. GC28-1300 - This manual is the basic reference document
on the syntax and usage of BM JCL. This manual is available for reference at the Client
Services Help Desk.
System/370 Job Control Language by Gary Dear! "ron # $%&s re'eren(e &s a
stan!ar! an! )o)ular te*tboo+ 'or &ntro!u(&ng ,"- JCL to )ersons 'am&l&ar &t%
(om)uters but not ne(essar&ly ,"- 370 systems.
70
JCL Utilities:-
@CL :@o1 Con-)ol Lang,age;
JCL or Job Control Language is used to communicate with the computer's operating system. A
JOB is a unit of work the computer is to perform. A JOB STREAM consists of JCL statements,
programs that are to be executed, and data that are to be processed. The data included in the job
stream are called NPUT STREAM DATA
@CL s-a-emen-s 4-
@O+ s-a-emen- 4- The first statement in a job stream must be a job statement whose function is
to identify the job to the system.
EXEC s-a-emen- 4- The job statement is usually followed by an exec statement. The exec
statement names the program or the procedure that is to be executed.
DD s-a-emen- 4- Following the exec statement are the DD statements (data definition)
statements. The DD statements describe the data used by the program.
The other JCL statements are delimiter, null, comment, proc & pend.
An EXEC statement and its DD statements make up a job step.
A job may consist of 255 job steps.
The job, exec & DD statements have a common format which is :-
name o5e)a-ion o5e)and (ommen-s
Job executes procedures, procedures have various steps to execute various programs, which
use parameters and parameter files.

Naming (on/en-ions 4-
Jobs will be held in datasets with .cntl or .jcl extension
e.g. ORSDEVP.REL#15.JCL
Procedures will be held in datasets with .proclib or .proc extension
e.g. ORSTEST.REL#15.PROCLB
Parameters used will be held in datasets with .parm or .parmlib extensions
e.g ORSLVE.REL#1.PARMS

71
Pa)ame-e)s 4-
The)e a)e -wo 3inds o2 5a)ame-e)s in -he o5e)and 2ield 4- 5osi-ional and 3e'wo)d
parameters. The operating system recognizes positional parameters by their position in the
operand field. Keyword parameters can be coded in any order. Positional parameters must be
coded in a specific order before any keyword parameter.
Conside) -he Bo1 s-a-emen- 4-
Posi-ional 5a)ame-e)s
1. e.g.. accounting information &
programmers name.
2. accounting information must
precede the programmers name.
3. if a positional parameter /sub
parameter is omitted a comma
must be coded in its place.
$e'wo)d 5a)ame-e)s
1. e.g.. class & msglevel.
2. MSGLEVEL=(1,1) indicates print all the input
JCL & the JCL from catalogued procedures &
print all allocation messages.
3. TYPRUN=SCAN causes the job's JCL to be
checked for syntax errors & prevents the job
from executing.
Con-)olling s-e5 eFe(,-ion
The COND parameter.
The COND parameter offers a method of testing the return codes issued by the previous steps to
determine whether a step will be executed. The format of a simplified version of the COND
parameter is COND C:/al,eDo5e)a-o);. Value is a no. between K and 9KJ< and operator could be
g-, ge,e?, ne, l-, le. The COND parameter causes the value entered to be tested against the
return codes from the previous steps, using the operator provided. f the test condition is true,the
step is skipped.f the test condition is false,the step is executed.
S'm1oli( 5a)ame-e)s
Symbolic parameters offer a convenient way of changing a procedure to fit your requirement.
Consider the example procedure-proglod, sysctl, sym,etc. are all symbolic parameters. Symbolic
parameter names may consist of from one to seven alphanumeric or national characters
preceded by an ampersand. The first character however must be alphabetic / national. Exec
statement keyword parameters may not be used as names of symbolic parameters.For e.g.. &
REGON. This restriction does not extend to DD statement keyword parameters.For e.g. &DSN
can be used as symbolic parameter.
Lin3age 5a)ame-e)
Linkage parameters are used in COBOL programs. Linkage parameters are passed on to the
COBOL programs through JCL by coding 'parm=' parameter in the exec statement. Whenever
linkage parameters have to be used, Linkage section has to be coded in the COBOL program
after the data division and the procedure division should specify the use of linkage section.
//DD400S01 EXEC PGM=DD400900,PARM='&PROCTYPE&DBNME&DCTNME'
72
*ene)a-ion Da-a *)o,5s:*D*;
A gene)a-ion da-a g)o,5 is a collection,or group,of cataloged data sets having the same name
and related to one another chronologically. Each of these datasets is called a generation data set
or,simply, a gene)a-ion.
Each generation data set is distinguished by others by the gene)a-ion n,m1e).
The main advantage of using a GDG is that the same JCL can be reused without change.
*ene)a-ion g)o,5 indeF contains information on how many generations are to be retained and
what to do when the index gets full.
De2ining a gene)a-ion g)o,5 indeF ,sing IDCAMS 4-
DCAMS is the name of the access method services utility program that performs functions vital
to the virtual storage access method(VSAM).
DCAMS requires a region of 300K, a SYSPRNT DD statement for messages and a SYSN DD
statement for control statements.
The (ommand format :-DEFINE *D* :PARMS;.
De2ine *D* 5a)ame-e)s
Parameter Abbrv Meaning
NAME GDD name.
LMT LM
The no. Of generations permitted for this gdg
The max is 255.
EMPTY EMP
f empty is specified, all data sets are to beremoved
from the index when the limit is reached.
NOEMPTY NEMP NOEMPTY is the default.
OWNER User identification (optional).
SCRATCH SCR
f Scratch is specified, the dataset is scratched when
the dataset is removed from the index
NOSCRATCH NSCR NOSCRATCH is the default.
TO (date Dataset retention period.
FOR(days) Dataset retention period.
C)ea-ing and a((essing a gene)a-ion
The generation number may be relative or absolute.
f the DS name in the group is
DDSN"S.DEVTDV.DD9=K8K7D
then to access the current generation,
you code DSNCDDSN"S.DEVTDV.DD9=K8K7:K;.
To access the previous generation,
you code DSNC DDSN"S.DEVTDV.DD9=K8K7:-6;
the generation before would be
DSNC DDSN"S.DEVTDV.DD9=K8K7:-7;.
f you want to create a new generation,
you code DSNC DDSN"S.DEVTDV.DD9=K8K7:L6;.
The absolute no. used by the system is in the form *XXXXV##,where FFFF is a gene)a-ion no.
from KKKK -o JJJJ and '' is a /e)sion no. from KK -o JJ.
73
Thus the generation specified as DSNC DDSN"S.DEVTDV.DD9=K8K7:K; might appear to the
system, for e.g.. ,as
DDSN"S.DEVTDV.DD9=K8K7.*KKK=VKK.
Then the data set with a relative no. of :-6; would be DDSN"S.DEVTDV.DD9=K8K7.*KKK<VKK,
:L6; would be DSN"S.DEVTDV.DD9=K8K7.*KKK>VKK.

Li1)a)ies
Another name for a library is a partitioned data set(PDS).
Libraries can be created,accessed & modified using utility programs like IEF+R69, IE+*ENER,
IE+PTPC%, IE+"PDTE, IE+COP#, etc.
EFBR14, EBGENER & EBCOPY are the most frequently used utilities on any project.

IE.)R:=
Strictly speaking it is not a utility program because it does nothing. t clears register 15 and
BR(branch) 14.
t is used to create or delete a library based on the DD statement parameters.

IE)0ENER
IE+*ENER uses four data sets described by SYSPRNT, SYSN, SYSUT1 & SYSUT2.
S#SPRINT is the DDNAME of the data set that EBGENER uses to write messages.
S#SIN is the DDNAME of the data set that contains the control statements to tell EBGENER
how the input data set should be modified while it is being copied.
S#S"T6 is the DDNAME of the input data set that EBGENER is to copy.
S#S"T7 is the DDNAME of the output data set that is to be created.

IE)CO!4
IE+COP# is a utility program that may be used to copy one or more members from an existing
PDS to a new or existing PDS, to make a backup copy of a PDS, and to reorganize a PDS in
order to reclaim the unused space.
D.SORT
So)-ing means putting records in a data set into a specified order.
Me)ging is closely related to sorting;it means combining records from two or more sorted
datasets into one data set that is in the same order.
The sort program requires three pieces of information:where to find the input data,which fields in
the records to do the sorting on, and where to put the sorted output data set.
74
So)- (on-)ol s-a-emen-s
The most commonly used sort control statements are SORT and MER*E.
A typical control statement would look like : SORT FIELDSC:6D6KDC%DA;.
The s'n-aF for the fields parameter is FIELDSC:5osi-ionDleng-hD2o)ma-Dse?,en(e...; or
FIELDSC:5osi-ionDleng-hDse?,en(e...;, FORMATC2o)ma-.
Posi-ion is the starting byte of the control field in the record.
Leng-h is the length in bytes of the control field.
Fo)ma- is the format of the data in the control field.
Commonly used values for format are ZD for zoned decimal, PD for packed decimal, B for
binary, AC for ASC character, CH for EBCDC character, AQ for EBCDC character using
alternative collating sequence.
Se?,en(e is either A for ascending or D for descending.
The in(l,de M omi- s-a-emen-s The include & omit statements are used to select the records to
be included in the sort. By selecting records for the sort, you can decrease the amount of time the
sort requires.
Only one include or omit statement is permitted in a sort. The syntax is in(l,de (ondC:-es-; &
omi- (ondC:-es-;
The only difference between include & omit is in the result. f test coded with include is true for a
particular record,that record is included in the sort;whereas if test coded with omit is true,that
record is omitted from the sort.
n either case test is coded as follows -es-C:5osi-ionDleng-hD2o)ma-Do5e)a-o)D/al,e; The
position,length & format sub parameters specify a field in the record,just as in sort fields
parameter.
The operator sub parameter may be *T, *E, E!, NE, LT & LE.
The last sub parameter, value, may be either a field in the record-specified by its own position,
length & format, or a constant.
Numeric constants are coded as simple values, such as 15 or -20. Character constants are
enclosed in apostrophes and preceded by a c,as in c'dec'. Hexadecimal constants are enclosed
in apostrophes and preceded by an x,as in x'f1f2c3'.
f more than one test is coded, the tests are joined by the boolean operator AND or OR..
A -'5i(al in(l,de s-a-emen- wo,ld loo3 li3e : INCL"DE CONDC:7JD6DC%DE!DCNLN;
The INREC M O"TREC s-a-emen-s : These statements are used to reformat the records.
The INREC statement is used before sort to shorten the records by eliminating unwanted fields.
This results in faster sorting.
The O"TREC statement is used after the sort to improve readability.
INREC M O"TREC ha/e iden-i(al 2o)ma-s: INREC FIELDSC:nXD5osi-ionDleng-hDalignD...;
O"TREC FIELDSC:nXD5osi-ionDleng-hDalignD...;
The first sub parameter,nX,is optional; it specifies the no. of spaces to be inserted in the
reformatted record.
The next two parameters, 5osi-ion & leng-h, specify the field in the input record.
The third sub parameter, align, is optional; the possible values being H, F, and D specify
alignment on a half-word, full-word, and double-word boundary respectively.

75
Me)ging
When you merge, you start with two or more sorted data sets and create a new data set that is in
the same sorted order.
While merging you must specify more than one input data set. These data sets have the DD
names SORTINnn, where nn may range from 01 to 16.
S$IPREC & E!"ALS / NOE!"ALS options are not used on the merge statement.
The sort control statements are normally coded in a parameter file.

VSAM D## ses
There are three types of VSAM data sets : key sequence data sets,entry sequence data sets, and
relative record data sets. For VSAM data sets, unlike non-vsam data sets, a utility program,
DCAMS is used to perform functions like :
1. Allocating space on DASD
2. Supply description of the data set
3. Set the data set's disposition
4. Load the data set
5. Print the data set
DEFINE CL"STER
is the command using which all the descriptive information about the VSAM data set is supplied.
REPRO
command may be used to load data into a VSAM data set.
PRINT
command is used to obtain a listing of a VSAM data set.
FILE-AID
utility from SPF primary menu(v.1) can be used to allocate / manage VSAM data sets.
76
@CL E))o) Codes
S001
An /O error ocurred. Check reason code for exact cause. Examples are
trying to read beyond End of File, trying to write to an input file or a file
length error.
S002
nvalid /O record, eg attempting to write a record that is longer than the
maximum record length.
S004 Error occured during OPEN. Eg nvalid DCB.
S013
Error OPENing a dataset, eg PDS member does not exist, record length
in program doesn't match dataset's record length.
S0C1
Operation Exception. Check for subscript errors, missing DD card, file
not opened.
S0C4
Protection Exception/Storage Violation. Trying to access storage not
available to the program. Can be caused by a subscripting error or
reading/writing a file that isn't open.
S0C7
Program Check Exception - Data. Check for spaces in a packed decimal
or numeric field. Check to see if record layouts or file layouts have been
changed.
Sx22
Job has been cancelled. The value of x will vary depending on the way
the job was cancelled. S222 means job was cancelled by a user or
operator without a dump. f a TSO session times out you will probably
get an S522 abend code.
S806
Unable Link or Load. The job was unable to find the specified load
module. Check that the job is looking at the correct Load Libraries,
specify a STEPLB if required.
S80A Not enough Virtual Sorage to satisfy a GETMAN or FREEMAN request.
S822
Unable to obtain to obtain enough space to satisfy a REGON= request
May need to change REGON statement in the JCL..
S878
Not enough storage available to satisfy a GETMAN or FREEMAN
request.. Job was anable to allocate an area of memory of the correct
size. Try Specifying or amending the 'REGON=' JCL statement.
S913 You are trying to access a dataset which you are not authorized to use.
Sx37
Unable to allocate enough storage for a dataset. You might need to
increase the amount of primary and secondary space to be allocated for
a dataset in the 'SPACE=' parameter, or you may have to move the
dataset to a different DASD devive which has enought space to store the
dataset. 'x' will vary, likely Abends are SB37, SD37 or SE37.
U1020
/O Logic error. Typical reasons are; trying to write to a file opened as
input; Rewrite without a previous read. See the message GZ020 for
details of the exact reason.
U1035
navlid OPEN/CLOSE. Check there is a DD statement for the file. See
the message GZ035 for more detailed information.
001 /O ERROR
002 /O NVALD RECORD
77
004 OPEN ERROR
008 /O SYNAD ERROR
013 OPEN ERROR
028 PAGNG /O ERROR
0CX
PROGRAM CHECK EXCEPTONS:
0C1 OPERATON
0C4 PROTECTON / ADDRESSNG
0C5 ADDRESSNG
706 NON-EXECUTABLE PROGRAM
804 NSUFFCENT VRTUAL STORAGE
806 UNABLE TO LOAD (LNK ETC) PROGRAM
80A NSUFFCENT VRTUAL STORAGE
878 NSUFFCENT VRTUAL STORAGE
737 /O ERROR
A14 /O ERROR
B37 NSUFFCENT DASD SPACE
D37 NSUFFCENT DASD SPACE
E37 NSUFFCENT DASD SPACE
VSAM *o"i%#$ error %odes
These codes indicate VSAM errors. They appear on the JOB log.
004(04) Read past end of file
008(08)
You attempted to store a record with a Duplicate Key, or there is a
duplicate record for an alternate index with the unique key option.
012(0C)
You attempted to store a record out of Ascending Key Sequence in
Skip-Sequential Mode; record had a Duplicate Key; for Skip-
Sequential processing your GET, PUT, and PONT Requests are not
referencing records in Ascending Sequence; or, for Skip-Sequential
Retrieval, the key requested is lower than the previous key requested.
For Shared Resources, buffer pool is full.
016(10) Record not found.
020(14) Record already held in exclusive control by another requester.
024(18) Record resides on a volume that cannot be mounted.
028(1C)
Data set cannot be extended because VSAM can't allocate additional
Direct-Access Storage Space. Either there is not enough space left to
make the secondary allocation or you attempted to increase the size
of a data set while processing SHROPT=4 and DSP=SHR.
036(24)
Key Ranges were specified for the data set when it was defined but
no range was specified that includes the record to be inserted.
040(28)
nsufficient Virtual Storage to complete the request. 044(2A) Work
area too small. 064(40) All available strings are in use.
068(44)
You attempted to use a type of processing (Output or Control-nterval
Processing) that was not specified when the data set was opened.
074(4A) Trying to use keys on ESDS or RRDS.
076(4C)
You issued an Addressed or Control-nterval PUT to add to a Key-
Sequenced data set, or issued a Control-nterval put to a Relative
Record data set.
78
080(50) Trying to delete from ESDS.
084(54) Using OPTCODE=LOC for a PUT.
088(58)
You issued a Sequential GET request without having caused VSAM
to be positioned for it, or you changed from Addressed Access to
Keyed Access without causing VSAM to be positioned for Keyed-
Sequential Retrieval; there was no Sequential PUT insert for a
Relative Record data set, or you attempted an illegal switch between
forward and backward processing.
92(5C)
A PUT for update or an ERASE was issued without a previous GET
for update, or a PUTX was issued without a previous GETX.
96(60)
Changing the Prime Key or Key of Reference when making an
update. 100(64 Trying to change record length.
104(68)
he RPL options are either invalid or conflicting. 108(6C) RECLEN
specified was larger than the maximum allowed, equal to 0, or smaller
than the sum of the length and the displacement of the key field;
RECLEN was not equal to record (SLOT) size specified for a Relative
Record data set.
112(70) nvalid key length.
116(74) Trying to update an empty dataset.
120(78)
Request was submitted by the wrong task. 132(84) An attempt was
made in Locate Mode to retrieve a Spanned Record.
136(88)
You attempted an Addressed GET of a Spanned record in a Key-
Sequenced data set.
140(8C) nconsistent Spanned record.
144(90) nvalid pointer (no associated base record) in an Alternate ndex.
148(94) Maximum number of Alternate ndex pointers exceeded.
152(98) Not enough buffers available.
156(9C) nvalid control interval.
192(C0) nvalid Relative Record number in a RRDS dataset.
196(C4)
Addressed access to a Relative Record (RRDS) dataset is not
allowed.
200(C8)
Addressed Access or Generic Backward processing by Key thru a
path is not allowed.
204(CC) Attempting a PUT in backward mode.
252(FC) Record mode processing is not allowed for a Linear data set.
VSAM O5en e))o) (odes
136(88)
Not enough Virtual-Storage Space is available for Work Areas,
Control Blocks, or Buffers.
144(90)
An uncorrectable /O error occurred while VSAM was Reading or
Writing a catalog record.
148(94) No record for the data set to be opened was found in the available
catalog(s) or an unidentified error occurred while VSAM was
79
searching the catalog.
152(98)
Security Verification failed; the password specified in the Access-
Method Control Block for a specified level of access does not match
the password in the catalog for that level of access.
164(A4)
An uncorrectable /O error occurred while VSAM was Reading the
Volume Label.
168(A8)
The data set is not available for the type of processing you specify,
or an attempt was made to open a Reusable data set with the Reset
option while another user had the data set.
176(B0)
An error occurred while VSAM was attempting to fix a page of Virtual
storage in Real storage.
180(B4)
A VSAM catalog specified in JCL either does not exist or is not open,
and no record for the data set to be opened was found in any other
catalog.
184(B8)
An uncorrectable /O error occurred while VSAM was completing an
/O request.
188(BC)
The data set indicated by the Access-Method Control Block is not of
the type that may be specified by an Access-Method Control Block.
192(C0) An unusable data set was opened for output.
232(E8)
Reset was specified for a nonreusable data set and the data set is
not empty.
236(EC) A permanent Staging error occurred in MSS (Acquire).
244(F4)
The Volume containing the Catalog Recovery area was not mounted
and verified for output processing.
JCL FAQ's :-
Question: What is the parameter to be passed in the job card for the unlimited time, irrespective
of the job class?
Answer: TME=1440
80
Question: How do you submit JCL via a Cobol program?
Answer: Use a file //dd1 DD sysout=(*,intrdr)write your JCL to this file.
Question: Definition of COND p-r in JCL and a correction to a previously posted question
Answer: COND is a condition parameter, consists of 2 subparameters,
1st - return code from the previous step,
2nd - condition. f COND is true, the step on which COND is coded will be BYPASSED.
Question: Q) WHAT S MEANT BY S0C7 AND S0C30 SYSTEM ABEND CODES.
Answer: A) S0C7 - Data exception error - you will get it whenever you are trying to move the low
values or spaces into the numeric field, or compare the numeric fields with low values, or try to do
some arithmetic operations on the low values. To avoid this you have to always initialize the
numeric fields otherwise they will contain the low values.
B)S0C 30 - have never heard of it, let you know if come accross it.
Question: How to pass the temp dataset form one JOB step to another?
Answer: By specifying the DSP as PASS for the temp dataset
Question: What is a COND parameter in JCL?
Answer: COND means condition parameter. t is compared with system return code of previous
step. //step1 exec pgm=abcd//step2 exec pgm=xyz, cond=(4,lt) step2 will be executed when
system return code of step1 is less than 4.
Question: WRTE A JCL TO EXECUTE A JOB BY 7 A.M ON JAN 20,1986?
Answer: THE code S: //*MAN DEADLNE=(0700,B, 012086)
Question: HOW MANY TYPES OF LBRARES ARE THERE N JCL?
Answer: LBRARES ARE OF THREE TYPES.
1.SYTEM LBRARES: SUCH AS SYS1.LNKLB
2.PRVATE LBRARES: SPECFED N A JOBLB OR STEPLB DD STATEMENTS.
81
3.TEMPORARY LBRARES: CREATED N A PREVOUS STEP OF THE JOB.
Question: WHAT U MEANS BY NCLUDE STATEMENT N JCL?
Answer: AN NCLUDE STATEMENT DENTFES A MEMBER PF A PDS OR PDSE THAT
CONTANS.THS SET OF JCL STATEMENTS S CALLED AN NCLUDE GROUP.THE SYSTEM
REPLACES THE NCLUDE STATEMENT WTH THE STATEMENTS N THE NCLUDE GROUP.
Question: THE MAXMUM NUMBER OF N-STREAM PROCEDURE YOU CAN CODE N ANY
JCL S?
Answer: 15.
Question: What you mean by skeleton Jell?
Answer: Jell which changes during run time i.e. the values for the jell such as pigmy name ,did
name will change .i.e. same jell can be used for various job, equivalent to dynamic sql...
Question: How do you submit a JCL under CCS environment?
Answer: Edit the JCL in Extra partition TDQ and submit the same using some system command
(not sure) under CCS subsystem. This is what i think, please clarify....
Question: what is JCL
Answer: t is interface between operating system (mvs) & application program. when 2 related
programs are combined together on control statements is called job control language
Question: What is the max blocksize for a Tape file?
Answer: t is 32,760.Based on that we can calculate efficient number of Records in a Block
Question: What are the basic JCL Statements for a Job?
Answer: 1.JOB : dentifies a job and supplies accounting info.
2.EXEC: dentifies a job step by indicating the name of the program to be executed.
3.DD: dentifies a data set to be allocated for the job step.
4.Delimiter (/*): Marks the end of an in-stream dataset.
82
5.Null (//):Marks the end of a job.
6.Comments (//*): Provides Comments.
7.PROC : Marks the beginning of a procedure.
8.PEND : Marks the end of a procedure.
9.OUTPUT: Supplies options for SYSOUT processing.
Question: What does the statements: type run=scan and type run=hold doing a JCL statement
Answer: Typrun=scan checks the JCL for errors,
Typrun=hold holds the job until further notice.
Question: Which of the following is online transaction? CCS, DB2 and JCl
Answer: CCS
Question: How many PERFORM's are there in COBOL-?
Answer: 5
Question: which is the most widely used batch performance monitor for DB2?
Answer: DB2PM
Question: What is QSAM error usually when it is occurs?
Answer: Usually it is occurs at the time of job submission.
Question: what is the purpose of include statement in a jcl?
Answer: t is used as an alternative for steplib.When we specify the dataset name in include, it will
search in all the datasets specified in the include dataset.
Question: S T POSSBLE TO KNOW THE REMANNG FREE SPACE N AN CONTROL
NTERVAL/CONTROL AREA ONCE AN NSERTON HAS BEEN MADE.
Answer: NOT POSSBLE
Question: what does soc04 error mean?
83
Answer: This error is faced when we execute the cobol program.the main reason for this error is
that a variable is defined with less characters and we are trying to move data which is larger than
the actual storage space.
Question: What is JCL
Answer: JCL is Job Control Language and is used for Batch processing. The startup procedures
of OS and standard products like CCS etc are written in JCL.
Question: n which table PLAN is registered in?
Answer: RCT
Question: GDG?
Answer: GDG - group of dataset that are logically or chronologically related, referred by name
and a relative generation number - an integer which identifies the generation of a dataset and is
coded in parentheses after dataset name. Absolute GDG name - GxxxxVyy, where xxxx-absolute
gen.number, yy-version number. Can be sequential, direct, partitioned. (VSAM - no). Must always
be cataloged. Advantage - all datasets have the same name and system keeps track of adding
new and retaining previous generations and deleting oldest successive generation. To create a
GDG we create a GDG index in the system catalog with DCAMS utility and then a model
(prototype, DSCB) on the same volume to supply DCB information. Empty - when limit is reached
all members are removed from the index, otherwise-only oldest. Scratch-removed members are
uncataloged & deleted, otherwise - removed & uncataloged, but remain in the system (not
members of GDG any more). GDG number is updated at the end of the job. f number is not
specified all generations will be processed from the beginning.
Question: what is jcl
Answer: t is used to communicate between the terminals.
Question: what do you mean By spooling? Expand SPOOL?
Answer: This is managed by JES.This is used for Queuing the Outputs that are intended for
Printing and are first stored in SPOOLDASD. This can be managed Using
Question: How many nstream-Procedures(procs) can be Coded in a single Job?
Answer: The Answer is: 15
84
Question: FOR HOW LONG A JOB CAN BE EXECUTED CONTNUEOUSLY N A MANFRAME
Answer: 248 DAYS
Question: How may divisions are there in JCL-COBOL?
Answer: SX
Question: MAX. NO OF DD STATEMENTS N A JOB
Answer: 3273
Question: HOW MUCH SPACE OS ALLOCATES WHEN YOU CREATE A PS OR PDS?
Answer: 56 KB
Question: MN NO OF DATASET NAMES(PDS) N ONE DRECTORY BLOCK?
Answer: SX
Question: THE MAXMUM NUMBER OF STEPS N A JOB?
Answer: 255
Question: How much is memory space involved, when we code BLOCKSZE, TRK & CYL
Answer: One block constitutes 32KB of formatted memory/ 42KB of Unformatted memory,6
blocks makes one Track & 15 Tracks makes one cylinder.
Question: What is DSNDB06?
Answer: This is the Place where DB2 Catalog resides.
Question: What is the use of DSNDB07 ?
Answer: This is the area where sorting takes place in DB2.
Question: What is the purpose of dentification Division?
Answer: Documentation.
Question: WHAT S DATACOM DB?
85
Answer: T S A DATABASE USED WTH VSE.
Question: What is a Dummy Utility and what it does ?
Answer: EFBR14 is a Dummy utility and it is used for the sake of EXEC PGM= .... Statement in
JCL[when used it wouldn't perform any task]. e.g. While Allocating a dataset you don't have to run
any utility [this could be done by giving disp=new inDD statement]. But for a PGM name must be
given in EXEC statement, it is used.
Question: What 3 guidelines do we have to follow when concatenating DD statements?
Answer: 1. Datasets must be of the same type (disk or tape)
2. All datasets must have the same logical record length
3. The dataset with the largest block size must be listed first.
Question: On the DD statement, what is the main difference between creating a new sequential
flat file and a partitioned dataset?
Answer: SPACE=(n,m) for a sequential file, SPACE=(n,m,p) for a PDS where n, m, and p are
numbers. The p designates how many directory blocks to allocate.
Question: What is the difference between EBGENER, EBCOPY and REPRO in DCAMS utility?
Answer: EBGENER -- This is a dataset utility for copying sequential datasets which produces a
PDS or a member from a sequential dataset.
EBCOPY -- This is a dataset utility for copying one PDS to another or to merge PDSs.REPRO --
This is for copying sequential datasets.
Question: How do you submit JCL via a Cobol program?
Answer: Use a file //dd1 DD sysout=(*,intrdr)write your JCL to this file. Pl some on try this out.
Question: How to execute a set of JCL statements from a COBOL program
Answer: Using EXEC CCS SPOOL WRTE(var-name) END-EXEC command.var-name is a
COBOL host structure containing JCL statements.
Question: What is the difference between static call & Dynamic call
86
Answer: n the case of Static call, the called program is a stand along program, it is an executable
program . During run time we can call it in our called program. As about Dynamic call , the called
program is not an executable program it can executed thru the called program
Question: What is the difference between catalouge procedure and n-Stream procedure?
Answer: n Stream procedures are set of JCL statements written between JOB and EXEC
statements, start with PROC and end with PEND statement.Mainly used to test catalog
procedures. Cataloged procedure is cataloged on the procedure library and is called by
specifying the procedure name on the EXEC statement.
Question: What do you feel makes a good program?
Answer: A program that follows a top down approach. t is also one that other programmers or
users can follow logically and is easy to read and understand.
Question: Can we browse or edit the GDG dataset if it is a tape entry?
Answer: No
Question: What are the maximum and minimum sizes of any CONTROL AREA (VSAM
datasets) ?
Answer: Minimum Size : 1 track Maximum size : 1 cylinder
Question: HOW TO GET CURSOR POSTON FROM SYSTEM N CCS ENVRONMENT ?
Answer: GET T FROM EBCURPOS !
Question: How many parameters are there to a DSP statement and what are their uses.
Answer: There are three(3) parameters.
Parameter 1: current data set disposition(new, shr, old, mod)
Parameter 2: normal close action for data set (catlg, keep, delete)
Parameter 3:abend action for data set (catlg, keep, delete).
Question: What is the error code SOC01 indicate ?
Answer: Operation exception error For eg a dataset open error
87
Question: WHAT S COMM?
Answer: COMM - HALF WORD BNARY
Question: What is a procedure?
Answer: A set of precoded JCL that can be modified through the use of parameters or override
cards. Note: Procedures can be catalogued or instream.
Question: What is the difference between specifying DSP=OLD and DSP=SHR for a dataset?
Answer: OLD specifies exclusive use of a dataset, SHR allows multiple jobs to concurrently
access the dataset Note: When updating a dataset, you would normally use OLD.
Question: What are the three basic types of statements in a job stream?
Answer: JOB(one per job stream)EXEC(one or more per job)DD(one or more per jobstep)
Question: What does SYSN * indicate?
Answer: nstream data follows this card and is terminated when followed by a card containing // or
/* in columns 1 and 2.
Question: What are three major types of JCL statements? What are their functions?
Answer: JOB, EXEC, DD. JOB - indicates start of jobstream to the operating system and through
parms coded on it, certain details about the job (time, region, message level, job accounting
data). EXEC - indicates the start of execution of a particular job step, be that step a program or a
proc.DD - is a data definition, which is used to describe the attributes of a data set (name, unit,
type, space, disposition).
Question: What happens if the Time specified is exceeded ?
Answer: The job ends with the ABEND code S322.
Question: Abbreviation of ST.
Answer: ST stands for STATUS.
Question: What is STEPLB, JOBLB? What is it used for? What is order of searching of the
libraries in a JCL?
88
Answer: Specifies that the private library (or libraries) specified should be searched before the
default system libraries in order to locate a program to be executed.
STEPLB applies only to the particular step, JOBLB to all steps in the job.First any private
libraries as specified in the STEPLB or JOBLB, then the system libraries such as
SYS1.LNKLB. The system libraries are specified in the linklist.
Question: What is primary allocation for a data set?
Answer:The space allocated when the data set is first created.
Question: What is the difference between primary and secondary allocations for a data set?
Answer:Secondary allocation is done when more space is required than what has already been
allocated.
Question: How many extents are possible for a sequential file ? For a VSAM file ?
Answer:16 extents on a volume for a sequential file and 123 for a VSAM file.
Question: What does a disposition of (NEW,CATLG,DELETE) mean?
Answer:That this is a new dataset and needs to be allocated, to CATLG the Data set if the step is
successful and to delete the data set if the step abends
CICS Tutorial :-
CICS
89
INTRODUCTION
+ATC% M ONLINE S#STEM
ON*INE S4STEM
DEFINITION 4 ONLNE processing allows a user to interact with a computer and access its
resources via a terminal.
EFam5le 4 Railway Reservation system.
+ATC% M ONLINE S#STEM
BATCH ONLNE
nput
Data from card tape, disk Batched,
sequential, scheduled
Data from terminal random,
concurrent
Start of A job
Operator (or operating system) initiates the
job. Other jobs in the same region must
wait.
Once CCS is initialized, entering
transaction id triggers the transaction
to start.
Processing
Mode
Single task single thread. Priority in job
scheduling
Multi task multi thread. Priority
processing.
End of job Each job
Each transaction. Once CCS is
terminated, no transactions can be
entered.
Output
printed reports, output files. User must wait
for batch jobs to produce reports (day,
week, month)
Message terminals updated files,
system nstant feed back
Resource
Usage
Less More
Example of
application
Monthly sales report Airline reservation system
&%AT IS CICS?
Customer nformation Control System (CCS) was developed in 1960 by BM
ONLNE CONTROL SYSTEM
General purpose data communication control system
Provides services to handle all the special requirements for online processing
No-e 4 Role of CCS is to interface between application programs and the DB/DC control system.
CICS SERVICES 5 T'E O!ERATIN0 S4STEM
Requests for file /P, O/P
Requests for database /P, O/P
Requests for terminal /P, O/P
90
CICS CONTRO* !RO0RAM AND TA)*ES
CICS CONTROL PRO*RAM
CCS CONTROL PROGRAM (BM SUPPLED)
FCP (FLE CONTROL PROGRAM)
JCP (JOURNAL CONTROL PROGRAM)
KCP (TASK CONTROL PROGRAM)
PCP (PROGRAM CONTROL PROGRAM)
SCP (STORAGE CONTROL PROGRAM)
TCP (TERMNAL CONTROL PROGRAM)
TDP (TRANSENT DATA PROGRAM)
TSP (TEMPORARY STORAGE PROGRAM)
OTHERS
CICS CONTROL TA+LES
CCS CONTROL TABLES (USER SPECFED)
FCT (FLE CONTROL TABLE)
JCT (JOURNAL CONTROL TABLE)
PCT (PROGRAM CONTROL TABLE)
PPT (PROCESSNG PROGRAM TABLE)
TCT (TERMNAL CONTROL TABLE)
DCT (DESTNATON CONTROL TABLE)
TST (TEMPORARY STORAGE TABLE)
CICS START "P
CCS is submitted as a batch job.
CCS System nitialization program (SP) is the main job step
SP loads System nitialization Table (ST)
SP further loads all control programs and tables
- Perform initial housekeeping tasks
CICS S%"TDO&N
Master terminal transaction is entered with shutdown option
CCS job produces various logs, statistics, dumps and other reports and ends
No transaction can be executed after that
ROLE OF CICS
MULT TASKNG
o More than one task can be executed concurrently.
MULT THREADNG
o Tasks share the same program under the multi tasking environment.
RE-ENTRANT PROGRAM
91
o Program when does not modify itself in any way during execution.
QUAS RE-ENTRANT
o s a reentrant program under the CCS environment.
MA!S AND DIS!*A4S
INTROD"CTION TO +MS
To make the application program device independent and format independent CCS
provides Basic Mapping Support (BMS)
BMS is a standard facility, to deal with the formatted screen operations
Screen defined through BMS is called a "MAP"
P%#SICAL AND S#M+OLIC MAP
Ph'si(al Ma5
Primarily used by CCS
Ensures device independence in the application program
For input operations, it defines the maximal data length and starting position of each field
to be read and allows BMS to interpret an input data stream
For output operations it defines starting position, length, field characteristics
(Attribute Bytes) and default data for each field, and allows BMS to construct an output
data stream.
Physical map is a program in the form of Load module
Physical map is coded using BMS macros
BMS macros are assembled separately and link edited into the CCS load library
S#M+OLIC MAP
1. Ensures the device and format independence to the application programs
2. A layout change in the formatted screen can be done independent of the application
program coding as long as field name and length remain the same
3. Symbolic map is included in the program by issuing a COBOL COPY statement
USIN0 MA!S IN A !RO0RAM
S#M+OLIC MAP *ENERATION
Symbolic map is a copy library member
ncluded in application program for defining the screen fields.
BMS Macros are coded, assembled and catalogued into a COPY library
92
SYMBOLC MAP S"FFIXES

L
Halfward binary
Contain the length of data entered by the terminal operator
F One byte flag field
Contains the data entered by the operator
A One byte field that contains Attribute byte
O Contains data to be sent to terminal
SYMBOLC MAP FORMAT
A 12 byte TOA prefix is automatically provided.
When performing input functions fields suffixed with "L, "F, and " are meaningful.
When performing OUTPUT functions, the fields suffixed with "A and "O are
meaningful.Contains the data to be sent to the terminal.
O"TP"T MAPPIN*
OMAP ONL#P
EXEC CCS SEND
MAP ("mapname1')
MAPSET ('mapset1')
MAPONLY
END-EXEC

ODATA ONL#P
EXEC CCS SEND
MAP ('mapname1')
MAPSET ('mapset1')
DATA ONLY.
END-EXEC.

1. MAP ONLY option.
o Use the physical map only.
o Field headings, attribute bytes, and the location of where all information is to be
placed is sent.
2. DATA ONLY
o Use the symbolic map only
o only the data in the symbolic map is sent to the screen.
3. Neither " MAPONLY NOR DATAONLY"
EXEC CCS SEND
MAP ('map-name1')
MAPSET ('mapset1')
END-EXEC

o The physical map and the data from symbolic map is sent to the terminal.
93
Other options of SEND command.

ERASE: Current screen is erased before the map specified appears on the screen
ERASEAUP: erase all the unprotected fields.
FREEKB: to free the keyboard
ALARM: to make an alarms sound.
FRSET: to reset MDT to zero
CURSOR: to place the cursor in a specified field
C"RSOR POSITIONIN*
Static positioning
o f C option is specified in the ATTRB field of DFHMDF macro the cursor will be
placed at this field.
Dynamic / symbolic positioning.
o Place (-1) into the field length field ("L suffix). Cursor will be placed in the field.
Dynamic / Relative positioning.
o Cursor (data-value) option is used.
o Data-Value will have the value at which the cursor has to be positioned.
o E.g.. EXEC CCS SEND
MAP (...)
MAPSET (...)
CURSOR (100)
ERASE
END-EXEC.
MAPFAL condition will caused in RECEVE MAP command.
o f the data to be mapped has a length of zero.
o f the operator presses any key (clear, PA, PF, ENTER, Keys) without entering
any data.
ACCESSIN* AND DISPLA#IN* MAP FIELDS
MAP STORA*E AREAS
Placing maps in the Program
o Any of the three plans for redefinition of maps may be used with either of the 2
alternatives for placing maps in your program.
WORKNG - STORAGE SECTON
o Copying a symbolic description map structure here makes the area automatically
available whenever the program is invoked.

LNKAGE SECTON
94
o Copying a symbolic description map structure here does NOT mean the storage
will be available. Some methods for providing storage are passing a
COMMAREA, acquiring temporary storage with the SET option, or using a GET
MAN command.
SEND RECEIVE
Sending 2)om -he S'm1oli( des()i5-ion ma5

SEND MAP (`MAP1')
MAPSET(`SET1')
MOVE `MAP1' TO MAPVAR
MOVE `SET1' TO SETVAR
SEND MAP (MAPVAR)
MAPSET(SETVAR)
FROM (MAP1O)
o SEND MAP Coding Al-e)na-i/es You can code the SEND MAP command to
locate the symbolic description map in several ways:
Using constants in the name field for MAP and MAPSET(FROM is not
required)
Using variables in the name field for MAP and MAPSET (This makes
FROM a required parameter)
Using only the MAP parameter. n this case the name in the MAP option
must be the MAPSET name.
RECEIVIN* in-o -he s'm1oli( des()i5-ion ma5

RECEVE MAP(`MAP1')
MAPSET(`SET1') ... MAP1
Move `MAP1' to MAPVAR
Move `SET1' to SETVAR ..... MAP1
RECEVE MAP (MAPVAR)
MAPSET(SETVAR)
NTO (MAP1 )
Receive MAP (`SET1') ... SET1
o RECEIVE MAP (oding al-e)na-i/es You can code the RECEVE MAP command
to locate the symbolic description map in several ways:
Using constants in the name field for map and mapset (NTO/SET is not
required) This is the most commonly used format.
Using variables in the name field for MAP and MAPSET. This makes
NTO (database) or SET a required parameter.
Using only the MAP parameter. n this case the name in the MAP option
must be the MAPSET name.
Linkage Section.
01 DFHCOMMAREA
01 LST
02 PTR-2-LST PC S 9(8) COMP.
02 PTR-2-BMS PC S 9(8) COMP.
RECEVE MAP (`MAP1') MAPSET (`SET1')
SET (PTR-2-BMS) ..... MAP1
95
Using the SET option requests CCS to get the storage and return a
pointer to it. The symbolic description map must be in the LNKAGE
SECTON.
O"T+O"ND F"NCTIONS
SEND MAP (`MAPA') MAPSET (`SETA')

[ERASE/ ERASEAUP]
[FREEKB]
[ALARM]
[FRSET]
[PRNT]
ERASE Erase Buffer, place cursor in upper left corner then write
ERASEAUP Erase all the unprotected fields before the Write
FREEKB Unlock Keyboard after the write
ALARM Active alarm with the write
FRSET Set all MDT currently on to off
PRNT Start the 3270 print operation.
Con-)ol F,n(-ions4
Typically the first type of command in the program is a SEND MAP. Certain control
functions may be included in that command.
ERASEAUP will clear out each field whose attribute is unprotected. t will NOT alter any
attribute settings.
f you do not free the keyboard using FREEKB, the operator will have to press the
RESET key before entering data.
f you code FRSET, all attribute bytes currently having Modified Data Tags (MDT) set on
will be set off. Selective resetting of the MDT's must be done another way.
When sending data to a 3270 screen the actual printing from the buffer will occur when
the PRNT function is requested.
A--)i1,-es 4
The `A' suffixed field is an attribute field which controls the following:
PROTECTED/UNPROTECTED
ASKP
NUM
MDT
Non Display (dark)DSPLAY (normal/bright)
f the color or highlighting of a field has to be changed, additional symbolic fields are
needed which are called the EXTENDED ATTRBUTES.
EXTENDED ATTRI+"TES
DSATTS (for symbolic map) and MAPATTS (for physical map) support the extended
attribute characteristics
The MAPATTS allows you to set up the physical map with any of the characteristic(s)
coded.
96
The DSATTS will create appropriate suffixed labels for the attribute characteristic(s)
coded.
IN+O"ND F"NCTIONS - AIDC"RSOR CONTROL
Attention dentifier (D) and Cursor:
o On a RECEVE, CCS updates the EB with the following information:
The screen cursor position relative to zero is placed is EBCPOSN.
The name of the input key the terminal operator pressed is placed in the
field EBAD.
EI+AIDC"RSOR
WORKNG-STORAGE SECTON.
COPY DFHAD.
......
PROCEDURE DVSON.
F EBAD = DFHPF12 THEN
......
F EBAD = DFHENTER THEN
......
F EBCPOSN LESS THAN 80 THEN
......

When you first enter your program as a result of a transaction id, you can test EBAD
and/or EBCPOSN. This may be done prior to issuing a RECEVE command, if so
chosen.
AIDC"RSOR - SAMPLE CODIN* :CONTROL;
f the operator uses any PA key or presses the CLEAR key, no data is transmitted
EBAD is useful when function keys are defined for the user.
for eg. PF12 may be the exit function
PF3 may be an update function etc.
Thus testing for the type of AD will alter the logic flow.
EBCPOSN can be used to determine where the cursor was positioned on the screen.
This information is especially useful with screens containing an action bar.
C"RSLOC
Sam5le Ma5
MAPSETA DFHMSD TYPE=&SYSPARM, MODE= NOUT,
TERM=ALL, LANG=COBOL, TOAPFX=YES,
STORAGE=AUTO
MAP1 DFHMD SZE=(24,80), LNE=1, COLUMN=1,
CURSLOC=YES
97
DFHMDF POS(2,1), LENGTH=4, NTAL=`NAME',
ATTRB=ASKP
NAME DFHMDF POS(2,6),LENGTH=20,
ATTRB=(UNPROT, C)
DFHMDF POS(2,27), LENGTH=1,
ATTRB=PROT

CURSLOC= YES allows you to determine after a RECEVE MAP command, which map
field had the cursor in it.
CURSLOC=NO is the default.
CURSLOC=(NO/YES) may be coded on the DFHMSD or the DFHMD macro. f coded
on the DFHMSD macro, it will provide a default for all the maps in that mapset.
When CURSLOC=YES, BMS will set the `F' suffix field to X'02' indicating that field
contained the cursor. f the cursor is in a field for which there is no symbolic label i.e. a
DFHMDF with no label the program will not be notified.
Note : The `F' suffix field continues.
To be used to indicate the operator pressed the erase to end of fixed (EOF) key by being
set to X'80'.
Therefore, if CURSLOC=YES it is possible to have both these conditions occur for the
same field, in which case the `F' suffix field will contain a X'82'.
EDITIN*
Map field Definition PCN/PCOUT
Built in function De-edit command.
When data is sent out via the `O' suffix fields or received into the `' suffix fields you may
want a definition other than PC x. PCN AND PCOUT allows the user to use other
COBOL PCS such as $,Z etc.
f the date contains special characters, you may want to remove them using the BF
DEEDT command.
PIC INPIC O"T
f PCN/PCOUT is not coded in the macro, the pic generated is always PC X (length of
field)
By using PCN/PCOUT BMS can be forced to generate the appropriate PC.
PCN tells BMS how to move data into the `' suffix field.
PCOUT tells COBOL how to edit your data move to the `O' suffix field.
FIELD EDIT +"ILT-IN F"NCTION
Amount BF Amount
$5431.80 EDT 00543180
EXEC CCS
BF DEEDT
FELD (amount)
LENGTH (8)
98
END-EXEC.
BF DEEDT is used to remove the special characters from the input field.
The Amount field displayed has a dollar sign and a decimal point
By using BF DEEDT dollar sign and decimal point is removed. Thus the number can be
used for arithmetic operations.
COBOL compiler requires LENGTH specification:
VS COBOL- uses the implied length of the data-area used in the field parameter.
CICS !RO0RAM COM!ONENTS
O+@ECTIVES
Structure of CCS Application Program
CCS Management Functions
Starting a Task
Conversational& Pseudoconversational transactions
CCS Program preparation
CCS Program testing & Debugging
CCS commands
Passing Data across tasks
STR"CT"RE OF CICS APPLICATION PRO*RAM
Iden-i2i(a-ion Di/ision
P)og)am - ID )e?,i)ed
Other comments as below, are optional but recommended.
o Author
o Date-Written
o Date-compiled
o Remarks
En/i)onmen- Di/ision
Only header is required
Other requirements:
COBOL statements and CCS commands should be coded
The following COBOL statements are prohibited.
ACCEPT, CURRENT-DATE, DATE, DAY, DSPLAY, EXHBT, STOP RUN, TRACE
Any /O Statements(OPEN, CLOSE, READ, WRTE, REWRTE, DELETE, START)
REPORT WRTER feature
SORT feature
CALL statement is allowed if the called program does not issue any CCS commands or
inhibited COBOL statements mentioned above.
99
TERMINATION STATEMENTS
No-es 4This is not the way to terminate a CCS program. CCS has a command for that purpose.
Nevertheless, COBOL and VS COBOL have three statements to conclude programs.
Control must not be allowed to pass beyond the last statement of a CCS Program.
STOP RUN in COBOL uses operating system facilities, and therefore, is discouraged.
EXT program is ignored if the program has not been called.
CCS RETURN COMMAND and/or GOBACK statement is recommended.
CICS MANA*EMENT F"NCTIONS
Transactions
Task
Program
T)ansa(-ions
An exchange between a terminal and a data base representing an application process. For
example, an inquiry or a deposit and balance update
Tas3
A specific instance of a transaction i.e. a unique unit of work.
P)og)am
Prepared statements compiled or assembled into an executable module of machine instructions.
CONVERSATIONAL TRANSACTION
Program uses a pair of SEND and RECEVE commands.
Program waits until the user responds.
Resources are held until the user responds.
Very inefficient way of conversing with the user.
PSE"DO CONVERSATIONAL TRANSACTION
The task is terminated after a message is sent with a linkage for the next task. CCS
provides a facility (COMMAREA) to made it easier to accomplish this.
When the user completes response (by pressing enter) reset task is automatically
initiated by CCS.
The task receives the message from the terminal & processes it.
This is a multitask operation from system's point of view.
100
PRO*RAM PREPARATION
Running the DB2 precompiler first is the preferred method. DB2 precompiler precedes
another process, binding, not mentioned here.
Output of the DB2 precompiler can serve as input to the translator.
Output of the translator will be input to the compiler.
Messages or warnings are provided on all the listings.
TRANSLATOR recognizes EXEC CCS and EXEC DL statements. They are commented
out and replaced with statements in the appropriate language. Here, COBOL MOVE
instructions and a CALL are inserted and passed on to the COBOL compiler.
DB2 Precompiler is supplied by the relational data base managers, DB2 and SQL/DS. t
recognizes EXEC SQL statements which it will comment out and replace with in our case.
COBOL PERFORM and CALL statements.
Output of the transaction is i/p to the compiler
The o/p of the linkage editor is executable. The load module is placed in the CCS online
program library.
Messages or warnings are provided on all the listings. The compiler listing is or limited
use if the translator listing would not process all commands.
TESTIN*
CEMT set program (prg1) New comp
Or
CEMT S PR (prg1) N
After making changes to a program the new version replaces old version, but CCS which
is currently executing has no way of knowing this automatically. The CCS processing
program table PPT still points to the old-version.
To avoid testing with the old version, you must use the CCS-provided CEMT transaction
to update the pointer to the program.
COMMON FORMAT
A CCS command consists of a keyword phrase, delimiter, function, options and their
argument values.
Be careful about periods. Avoid them after END-EXEC. Where you don't really want
them.
For eg. within an I2 .... -hen ... else s-a-emen-
The translator will place a period into the generated code if a period follows end-exec.
AR*"MENT VAL"ES
data - value
PC S9(4) comp Halfword binary
PC S9(8) comp Fullword binary
PC X(15) character string constants permitted
data - area COBOL data name
(Not a constant)
eg :-
101
01 Record-area.
05 Fld 1
05 Fld 2
name COBOL data name Character string
label Paragraph name
hhmmss
PC S9(7) comp 3
Packed decimal
pointer-ref
BLL cell
Usage pointer
RECEIVE COMMAND
EXEC CCS RECEVE
NTO (data area)
LENGTH(ml)
END-EXEC
RECEVE command is used to receive incoming data from the terminal to which this
CCS transaction is associated.
A receiving area must be defined in working storage section and has to be specified in
the NTO parameter.
Length field must be defined in working storage section as a S9(4) comp. t has to be
specified in length option.
SEND COMMAND
EXEC CCS SEND
FROM (data area)
LENGTH(ln)
END-EXEC
The data to be sent must be stored in working storage section, and this field name has to
be specified in the FROM parameter.
Length must be specified the same as that of the Receive command.

EXCEPTIONAL CONDITIONS
RESP option
o Define a full word binary field S9(8) comp in the working storage section as the
response field.
o Place RESP option with the response field in any CCS command.
102
o After command execution, check the response code in the response field with
DFHRESP (xxxx)where xxxx is
NORMAL for normal completion or Any exceptional condition

%ANDLE CONDITION
Handle condition command is used to transfer control to the procedure label specified if
the exceptional condition, specified occurs.
Remains active until the end of program or another handle condition request overrides it.
I*NORE CONDITION
gnore condition command causes no action to be taken if the condition specified occurs
in the programs.
Request by the GNORE CONDTON command is valid until the subsequent HANDLE
CONDTON command for the same condition.
NO %ANDLE OPTION
f NOHANDLE option is specified in any CCS command, no action will be taken for any
exceptional condition occurring during execution of this command.
o Eg : EXEC CCS SEND
From (...)
Length (...)
NOHANDLE
END-EXEC

FORMATTIN* TIME AND DATE
ASKTME Command
o used to request the current date and time
o EBDATE and EBTME fields have the values at the task initiation time.
FORMAT EXEC CICS AS1TIME END8EXEC
FORMAT TIME COMMAND
Used to receive the information of data and time in various formats.
o Format
[YYDDD (data - area)]
[YYMMDD (data - area)]
[YYDDMM (data - area)]
[MMDDYY (data - area)]
[DDMMYY (data - area)]
[DATESEP(data - value)]
[DAY OF WEEK (data - area)]
103
[DAY OF MONTH (data - area)]
[MONTH OF YEAR (data - area)]
[YEAR (data - area)]
[TME (data - area)]
[TMESEP (data - value)]
DATESEP represents data separator (default is "/").
TMESEP represents time separator (default is ":").
The data area for the ABSTME option of ASKTME and FORMATTME commands must
be a 15-digit packed decimal data type.
DELA# COMMAND
used to delay the processing of a task for the specified time interval or until the specified
time.
FORMAT
EXEC CCS DELAY
NTERVAL (002000)
TME (152000)
End - EXEC

Task will be suspended for 20 minutes if NTERVAL is specified or until 15:20:00 if TME
is specified.
COMMAREA
Passing data via the COMMAREA
pseudo conversational task to task
Linking program to program
PSE"DO CONVERSATIONAL
Pseudo conversational technique is uses the multiple transaction identifiers(pct entries) and
multiple program (pct entries). t performsthe terminal conversation in the following way:
A conversational program is logically and physically divided into separte programs after sending a
message and before receving the message. For each separate program, a unique cics trasction
identifier is assigned. before terminating the program, each program issues the RETURN
command with the next transaction identifier which is associated with the next program, unless it
is the least return to CCS itself. in this way, a series of terminal conversations can be carried out
continuously.
PASSIN* DATA TO NEXT TAS$

No-es 4
104
o The first time commarea is passed, it must begin as an area of storage in the
working storage section of the program passing it.
o A commarea parameter in the RETURN will pass the area to the program
associated with the subsequent transaction. n this case, itself.
o The subsequent program (in this case the same program) must define access to
all the commarea that was passed to it.
PAYROLL as both the sender and the receiver of the COMMAREA needs the working
storage definition to send and the linkage section DFHCOMMAREA to receive.
PAYROLL must therefore be able to distinguish between FRST TME into the program.
When there is no COMMAREA and subsequent times in. Where one exists in the Linkage
section. The EB field, EBCALEN indicates the length of the commarea.
EI+CALEN
First time into the program no commarea exists, therefore EBCALEN = 0
While returning the control to CCS the working storage is loaded and this is sent via the
commarea parameter in the RETURN Transid.
On subsequent entry, commarea exists and is automatically made addressable by CCS
in the linkage section of DFHCOMMAREA
PASSIN* DATA "SIN* LIN$
To pass control from one program to another and then return to the original like executing
a subroutine.
The link command passes control to another program defined in CCS PPT expecting
that the program will return to the linking program instruction following the LNK
command. This happens when the linked program issues a RETURN command.
Data may be passed using the commarea.
The commarea is shared between the two program regains control may changes made to
the commarea by the linked program are accessible.
The two programs executive under the same task.
The working storage section for the linking program is retained. Working storage for the
linked program is automatically released after its RETURN command is executed.
To pass control from one program to another and then return to the original like executing
a subroutine.
The link command passes control to another program defined in CCS PPT expecting
that the program will return to the linking program instruction following the LNK
command. This happens when the linked program issues a RETURN command.
Re#din" Exern#$ D##
F,n(-ional o/e)/iew
DRECT RETREVAL
o VSAM DATA STRUCTURES
DRECT RETREVAL
105
o RELATONAL TABLE ROW
BROWSE
o VSAM DATA STRUCTURE
BROWSE
o RELATONAL TABLE ROWS
Entry for VSAM file has to be there in FCT (File Control Table)
Each entry contains all descriptive information for the file it represents. So, programmer
need not define the physical organization and other attributes of the files.
o The File parameter coded in the program must be the same as the file name in
the FCT.
o nterface between CCS and Relational Database is called CCS attachment
Facility. Statement are coded in SQL language in the application program to
Communicate data requests to the database.
TOPICS
DRECT RETREVAL
o VSAM FLE RECORD
o RELATONAL TABLE ROW
BROWSE
o VSAM FLE RECORDS
o SET OF RELATONAL TABLE WORKS
VSAM DATA STR"CT"RES
CCS uses the following VSAM structures
o Key sequenced data set (KSDS)
o Entry sequenced dataset (ESDS)
o Relative record dataset (RRDS)
PRO*RAM OR*ANIGATION
File attributes are defined in the FCT for each file
Files are opened by CCS
o mmediately after system initialization if specified in the FCT.
o n response to a file access request from an application if the file is closed
o n response to a master terminal CEMT request from an operation.
Application program is not responsible for open / close of files
RECORD IDENTIFICATION
RECORD KEY
RELATVE BYTE ADDRESS
RELATVE RECORD NUMBER
PARTAL KEY
o key of the record to be read is specified in the RDFLD. for KSDS
106
o Key specified can be a full key or partial key
o f partial key, key length has to be provided
o RBA (Relative Byte Address)
o Can also be used instead of actual key value
For ESDS
o RDFLD contain a 4 byte RBA
For RRDS
o RDFLD contains 4 Byte binary relative record number.
RECORD $E# DEFINITION EXAMPLE
WORKNG - STORAGE SECTON.
05 RECKEY PC X(6).
PROCEDURE DVSON.
MOVE VALUE TO RECKEY.
RDFLD must be set to the value of the key of the record to be retrieved.
RDFLD must be large enough to hold a full record key even when a partial key is used.
READ COMMAND
READ command with NTO Option. (FULL KEY)
o Reads the record specified by the full key.
o The data content of the record is moved into the specified data-area defined in
the working storage section.
o FORMAT
EXEC CCS READ
DATASET (name) | FLE (name)
NTO (data-area) |SET(ptr-ref)
RDFLD (data-area)
[ LENGTH (data-values) ]
END - EXEC.
DATASET / FLE names the file.
t must be defined in FCT.
NTO names the field in the working storage section where the data has to be placed.
RDFLD is the key field.
LENGTH is half word binary.
t indicates maximum length of the record to be read. t is optional.
EXCE!TIONA* CONDITIONS
DUPKEY : f duplicate record is found for the specified key.
NOTFND : f the record is not found for the key specified.
LENGER R LENGERR : The specified length (in LENGTH OPTON) is shorter than the
actual record length.
NOTOPEN : When file specified is not open.
107
The exceptional condition can be trapped using RESP option in the READ command.

ADDRESSA)I*IT4 TEC'NIBUES
EXEC CCS XCTL
PROGRAM (PROGRAM NAME)
RESP (EXCEPTON)
END-EXEC.
F EXCEPTON = DFHRESP (PGMDERR)
a module given control through the use of a CCS XCTL command will not return to the
program that issued the XCTL.
The required. program name is character string constant (max 8 characters)
The PGMDERR exception condition occurs when the name is not in the PPT.
*O0ICA* *EVE*S
The linked to program runs at a new logical level and returns to a logical level back to the
linking program.
The linking program and its storage area remain available.
No-es 4
To quit the repeated execution simply RETURN without the TRANSD option.
Any linked program could use the same COMMAREA of the parameters so indicated.
The transid & commarea option easy enough to use to make this method practical.
PRO*RAMS TO PRO*RAM TRANSITION
CCS LNK
CCS XCTL
COBOL CALL
Alternative to XCTL or LNK ? COBOL CALL
COBOL CALL passes control to other programs.
PASSIN* DATA "SIN* INP"T MS*
NPUT MSG & NPUT LEN PARAMETERS USED WTH XCTL OR LNK.
Receiver uses EXEC CCS RECEVE command
PASSIN* DATA "SIN* LIN$
AREA1 PC x (200) (prog1)
do--ed
Linkage Section (prog2)
01 DFHCOMMAREA
05 AREA2 PC X(200)
108
1ST Program - COMMAREA - Length 100
Data violation as 2nd Program (receives) tries to move 200 char
PASSIN* A COMMAREA &IT% XCTL
f data is to be passed to the XCTLed program, a COMMAREA can be used.
Data area is to be located in the Linkage Section of the receiving program.
COMMAREA used with RETURN, LNK & XCTL
ADDRESSA+ILIT#
DFHCOMMAREA & DFHEBLK : Addressable automatically by CCS
Dynamically acquired storage : Addressable by program
Not necessary to always do a EXEC CCS GETMAN explicitly
CICS BUEUEIN0 .ACI*ITIES
Two facilities to store data that are temporary in nature.
This data is created or collected by one or more online transaction to be used later by the
same transaction or by a different transaction or even later passed to a batch program.
They are
o Transient data Queue (TDQ)
o Temporary storage Queue (TSQ).
TRANSIENT DATA BUEUE
They are identified by a 4 character D called destination D
Destination D and other characteristics of TDQ are defined in the destination control
table (DCT) by the system programmer.
2 types of TDQ's
o ntra Partition TDQ
o Extra Partition TDQ
ntra Partition TDQ - Processed only within the same CCS region
Extra Partition TDQ - ndividual Sequential Files processed between the transaction of
the CCS region and the system outside of the cics region.
INTRA !ARTITION TDB
All ntra partition TDQ are stored in only 1 physical file (VSAM)
Record from the queue can be returned sequentially.
Record can be written sequentially.
Records can be of variable length format
Several tasks can write to the same TDQ but only one task can read from TDQ.
ntra Partition TDQ is used in application such as
109
nterface among CCS transaction. Applicati on program 1 TDQ Appl . Pgm 2 report
Automatic task nitiation (AT)
Message routing
Message Broad cast.
EXTRA !ARTITION TDB
Extra partition TDQ is a separate physical file & may be a disk, tape or reporter.
DCT determines the initial open / close status of a file while the file can be opened or
closed through the master terminal transaction during CCS session.
TDQ can be defined as an nput or output but not both.
Records are fixed, variable, blocked or unblocked.
TRANSIENT DATA OUT!UT
Appears only for ntra-partition TDQ.
Deletes all records associated with the named destination.
All associated storage is released.
EXCEPTIONAL CONDITIONS
1. Special handling required
LENGERR - length specified is greater than the maximum record length specified in DCT
2. Qzero - Destination empties or end of TDQ error
Qlderr - The dest ld specified cannot be found in DCT.
TEM!ORAR4 STORA0E
TSQ is a queue of stored records.
Created & deleted dynamically by application program.
Used as a scratch pad
Queue D is of length 1-8 bytes
TSQ is of variable length
Records can be stored in main or auxiliary storage
The records once written remains accessible until the
entire TSQ is deleted
Records can be read sequentially or directly
Records can be re-read & updated.
&RITE! TS
To write or re-write a record in TSQ
EXEC CCS WRTEQ TS
QUEUE (NAME)
LENGTH (DATA-VALUE)
[TEM (DATA-AREA)
110
[REWRTE]
[MAN | AUXLARY]
END-EXEC.
TEM - f this option is coded CCS write return the item number assigned to the record
just written.
REWRTE - is used to rewrite the record identified by TEM.
Main / Auxiliary - To specify the storage medium. Will be stored in main if auxiliary
storage not supported.
READ! TS
Can be used to read records either sequentially or directly.Syntax
EXEC CCS READQ TS
QUEUE (NAME)
NTO (DATA - AREA)
LENGTH (DATA-VALUE)
[TEM (DATA-VALUE) | NEXT]
[NUMREC (DATA-AREA)]
END-EXEC.
NEXT - to retrieve the next - logical record in the TSQ. mutually exclusive to the item
option
NUMREC - the data area is defined as PC 9(4) comp. to find the Total no. of records in
the TSQ.
tem - for direct access specify the item no of the record.
DE*ETEB TS o( TSB
EXEC CCS
DELETEQ TS
QUEUE (NAME)
END-EXEC.
All records is TSQ are deleted.
All associated storage is released.
EXCEPTIONAL CONDITIONS
Special handling required
o temerr - tem number specified is not in the range of entry number assigned for
the Queue.
o Lengerr - Length specified is greater than the maximum record length.
error
Q iderr - specified is Queue id not found.
111
TESTIN0 5 'AND*IN0 EXCE!TIONS
COMMANDS FOR TESTIN* APPLICATION PRO*RAMS
CEC (Command Level nterpreter) is a CCS - supplied transaction which performs
syntax checking of a CCS command. f the syntax is satisfied, it will execute the
command.
CEBR (Temporary Storage Browse) is a CCS - supplied transaction which browses
Temporary Storage Queue (TSQ).
CEDF is a CCS - supplied transaction which monitors the execution of an application
program as an interactive debugging aid.
APPLICATION PRO*RAM S"PPORT
RESP and NOHANDLE
GNORE CONDTON
HANDLE CONDTON
HANDLE AD
HANDLE ABEND
COMMAND LEVEL INTERPRETER
For invoking CEC, type CEC with the CCS command to be interpreted.
The first screen lists all the possible CCS commands.
Giving question mark (?) before the command requests a syntax check only. No
execution.
Ex. CEC SEND MAP (`SPOOMPO')
MAPSET (`SPOOMSO')
ERASE
+RO&SIN* CICS !"E"ES
CEBR can be invoked while you are already in the CEDF mode.
Press the PF5 key to display the working storage section.
Then, press PF12 key to invoke CEBR.
CEBR allows to browse information in Temporary Storage (TS) queues.
Help (PF1) give you a list of CEBR commands on the screen.
TS queues are retained until purged.
EXCEPTION %ANDLIN*
CCS to respond to exceptional conditions in one of three ways:
RESP option: - The RESP option can be specified in any CCS command. ts function is
similar to the return code in the batch program.
o Define a fullword binary field (S9(8)COMP) in the working storage section as a
response field.
112
Place the RESP option with the response filed in a command.
After command execution, check the response code in the response field
with DFHRESP (xxxx), where xxxx is the - NORMAL
- Any exceptional condition
HANDLE CONDTON This command is used to transfer control to the procedure label
specified if the exceptional condition specified occurs.
GNORE CONDTON This command causes no action to be taken if the condition
specified occurs in the program.
EXEC CCS HANDLE CONDTON
Condition (Label)
[Condition (Label)]
[Error (Label)]
END-EXEC.
o)
EXEC CCS GNORE CONDTON
Condition
[Condition]
END-EXEC.
ABEND CODE
f an exceptional condition occurs during execution of a CCS application program and if
the program does not check the exceptional condition, CCS may continue executing the
program or terminate abnormally the execution of the program, depending on the
exceptional condition and the command involved.
O!TION .OR EXCE!TION 'AND*IN0
CODE RESP keyword in commands: CHECK USER-SUPPLED FELD N WORKNG -
STORAGE.
CODE NOHANDLE KEYWORD N COMMANDS.
HANDLE CONDTON
COMMANDS
GNORE CONDTON
SYSTEM DEFAULT -- ABEND
CICS Adend Codes :-
EFe(,-e In-e)2a(e +lo(3 and (i(s a1end (odes
Some of the more (ommon CICS a1ends are briefly described below. These are only brief
descriptions and do not cover all possible reasons.
ASRA
113
This is the most common abend in CCS. t indicates a Program Check Exception, roughly
equivalent to having an S0C7 in a batch program. Check for spaces in a packed decimal
numeric field and changes to the file and record layouts.
AEIx #nd AE4x
There are numerous abends that start with AE or AEY. They indicate that an exception has
occured, and RESP (or NOHANDLE) is not is use. The last character indicates the exact error
AEIC
indicates a PGMDERR.
AEIA
is a MAPFAL condition,
AEIO
indicates a duplicate key (DUPKEY) condition.
AEIN
indicates a duplicatebrecord (DUPREC) condition.
AEID
indicates an End of file condition.
AEIS
indicates that a file is not open (NOTOPEN)
AEI!
indicates an invalid request condition (NVREQ)
AE4D
indicates that you are not authorised to use a resource (NOTAUTH)
AICA
114
This abend usually occurs if your program is looping. There are CCS parameters that
determine how long a task can run without giving up control. The CVR parameter in the CCS
ST table can be used to specify a value for all tasks running in CCS, or you can specify a
RUNAWAY value when you define a transaction . f a program is looping then you may not get
an ACA abend, because the timer can be reset when certain events occur, eg some EXEC
CCS commands may reset the timer to zero.
ATC' #nd ATCI
These abends indicates that the task was purged. The task may have been purged by someone
issuing a CEMT command to purge the task, or by CCS because the Deadlock timeout limit
has been exceeded or because there was not enough virtual storage available to run all the
tasks in CCS (Short on Storage)
A!CT
A program was not found or was disabled. Check the transaction definition to see if the program
name was misspelled. Check that the program is enabled. Check that the program is in an
appropriate Load Library (ie one defined to the current CCS system).
A1C! #nd A1CT
These abends indicate that a timeout of the task occurred. This may be due to a deadlock.
A.CA
A dataset could not be accessed because it was disabled.
A)MC
The specified map was not found in the specified mapset. Check that you have not misspelled
the map name.
The Execute nterface Block (EBLK) contains a variable called EBFN.This contains a value
that tells you what CCS command was last executed. This value can be displayed as part of an
error message, to aid in the debugging of your code or when an exception condition occurs
The values for EBFN are show below.
Code Command
0202 ADDRESS
0204 HANDLE CONDTON
0206 HANDLE AD
0208 ASSGN
020A GNORE CONDTON
115
020C PUSH
020E POP
0210 ADDRESS SET
0402 RECEVE
0404 SEND
0406 CONVERSE
0408 SSUE EODS
040A SSUE COPY
040C WAT TERMNAL
040E SSUE LOAD
0410 WAT SGNAL
0412 SSUE RESET
0414 SSUE DSCONNECT
0416 SSUE ENDOUTPUT
0418 SSUE ERASEAUP
041A SSUE ENDFLE
041C SSUE PRNT
041E SSUE SGNAL
0420 ALLOCATE
0422 FREE
0424 PONT
0426 BULD ATTACH
0428 EXTRACT ATTACH
042A EXTRACT TCT
042C WAT CONVD
042E EXTRACT PROCESS
0430 SSUE ABEND
0432 CONNECT PROCESS
0434 SSUE CONFRMATON
0436 SSUE ERROR
0438 SSUE PREPARE
043A SSUE PASS
043C EXTRACT LOGONMSG
043E EXTRACT ATTRBUTES
0602 READ
0604 WRTE
0606 REWRTE
0608 DELETE
060A UNLOCK
060C STARTBR
060E READNEXT
0610 READPREV
0612 ENDBR
0614 RESETBR
0802 WRTEQ TD
0804 READQ TD
116
0806 DELETEQ TD
0A02 WRTEQ TS
0A04 READQ TS
0A06 DELETEQ TS
0C02 GETMAN
0C04 FREEMAN
0E02 LNK
0E04 XCTL
0E06 LOAD
0E08 RETURN
0E0A RELEASE
0E0C ABEND
0E0E HANDLE ABEND
1002 ASKTME
1004 DELAY
1006 POST
1008 START
100A RETREVE
100C CANCEL
1202 WAT EVENT
1204 ENQ
1206 DEQ
1208 SUSPEND
1402 WRTE JOURNALNUM
1404 WAT JOURNALNUM
1602 SYNCPONT
1802 RECEVE MAP
1804 SEND MAP
1806 SEND TEXT
1808 SEND PAGE
180A PURGE MESSAGE
180C ROUTE
180E RECEVE PARTN
1810 SEND PARTNSET
1812 SEND CONTROL
1C02 DUMP
1E02 SSUE ADD
1E04 SSUE ERASE
1E06 SSUE REPLACE
1E08 SSUE ABORT
1E0A SSUE QUERY
1E0C SSUE END
1E0E SSUE RECEVE
1E10 SSUE NOTE
1E12 SSUE WAT
1E14 SSUE SEND
117
2002 BF DEEDT
4802 ENTER TRACENUM
4804 MONTOR
4A02 ASKTME ABSTME
4A04 FORMATTME
5602 SPOOLOPEN
5604 SPOOLREAD
5606 SPOOLWRTE
5610 SPOOLCLOSE
5E06 CHANGE TASK
5E22 WAT EXTERNAL
5E32 WATCCS
6A02 QUERY SECURTY
6C02 WRTE OPERATOR
6C12 SSUE DFHWTO
7402 SGNON
7404 SGNOFF
7406 VERFY PASSWORD
7408 CHANGE PASSWORD
7E02 DUMP TRANSACTON
CICS FAQs:-
CICS .ABS
Question: what is difference between call and link ?
Answer: n case of call , whenever you do changes to the called program you need to compile the
calling program also. n case of link , it is not needed .
118
Question: what are the differences between dfhcommarea and tsq ?
Answer: both are used to save data among tasks. but 1. commarea is private to that transaction
only . like every transaction has its own commarea created by cics as soon as the transaction is
initiated . however tsq , if qid is known can be accessed by other transactions also 2. commarea
length is s9(4) comp ie 65k . but tsq can have any length.3. commarea is available only during the
transaction is running. tsq if created with auxiliary option resides in aux memory and available
even if main memory crashes.4.normally commarea is used to tranfer data from one task to
another while tsq is used widely within the task as a scratch pad.
Question: What is Communication Area?
Answer: Communication Area is used to pass data between the programmer between the task.
Question: Which of the following statements correctly describe the syntax of CCS command
language?
Answer:
1. f an EXEC CCS command must be continued onto a second line a hyphen (-) must be
coded in column 7 of the continued line.
2. f an EXEC CCS command must be continued onto a second line an 'X' must be coded
in column 72 of each line to be continued.
3. An EXEC CCS command CANNOT be coded within a COBOL F statement,between the
F command and the period (.) ending it.
4. The END-EXEC delimiter is optional and never needs to be placed at the end of a CCS
command.
5. The options specified within an EXEC CCS command can be in any order. For example
'EXEC CCS SEND FROM(MSG1) LENGTH(30) END-EXEC' can also be coded
'EXEC CCS SEND LENGTH(30) FROM(MSG1) END-EXEC'
Question: .A CCS program ABENDS with an ASRA ABEND code. What is its meaning?
Answer:
1. A link was issued to a program whose name does not exist in the PPT (Program
Processing Table).
2. A program attempted to use a map that is not defined in the PCT (Program Control
Table).
3. A security violation has occurred. The operator is not defined with the proper authority in
the SNT (Sign-on Table) to use a particular file.
4. A program interrupt (0C0 or 0C1 or 0C2 or ...) has occurred in a CCS program.
5. An /O error has occurred when attempting to use a VSAM file from a CCS program
Question: Which of the following commands, when issued by 2 different programs running at the
same time, will prevent simultaneous use of resource 'SNGLE'?
Answer:
1. EXEC CCS PROTECT RESOURCE('SNGLE') LENGTH(6) END-EXEC.
2. EXEC CCS HOLD RESOURCE('SNGLE') LENGTH(6) END-EXEC.
3. EXEC CCS TASK SNGLE('SNGLE') LENGTH(6) END-EXEC.
119
4. EXEC CCS EXCLUSVE RESOURCE('SNGLE') LENGTH(6) END-EXEC.
Question: How can you accomplish braykpoint in intertest?
Answer: U-for uncondishional braykpoint, C-for condishional braykpoint,and A-for automatic
braykpoint
Question: how many ways are there for initiating a transaction?what are they?
Answer: There are six ways in initiating a transaction.they are as follows.
1. embedding four character transid on the top left most corner of the screen.
2. making use of EXEC CCS START TRANSD ( )
3. making use of EXEC CCS RETURN TRANSD ( )
4. By defining the transid in DCT ( destination control table) to enable AT (AUTOMATC
TASK NTATON)
5. Making use of PLT ( program list table)
6. By associating four character transid in PCT (program control table)
Question: which type of TDQ is read destructive?
Answer: intrapartition tdq is read destructive. extrapartition tdq is not read destrctive.
Question: The error code aeiv?
Answer: this is the error code for length,if length of the source data is more than the receiving
field,this error will occur.this is the correct answer,previously i mentioned it as program id
error.sorry for the wrong information.
Question: WHAT U MEAN BY AEV ?
Answer: THS S THE ERROR CODE GVEN BY THE SYSTEM ,T MEANS PROGRAM D
ERROR.
Question: WHAT S THE SZE OF COMMAREA
Answer: THE DEFAULT COMMAREA SZE S 65K.
Question: What is ASRAABEND in CCS?
Answer: t occurs when program interuption takes place.e.g.: when alphanumeric string moved to
numeric data itemOR when arithmetic calculations performed on nonnumeric data itemOR when
an attempt made to read an occurance of a table beyond the defind occurances.
Question:What is a two Phase commit in CCS?
Answer: This occurs when a programmer ssues a Exec CCS Syncpoint command. this is called
two phase because CCS will first commit changes to the resources under its control like VSAM
files. and the DB2 changes are committed. Usually CCS signals Db2 to complete the next phase
and release all the locks.
Question: Answer to ANON's question, diference between TSQ & TDQ
Answer: TDQ is read destructive, TSQ is not. TSQ can be created dynamically, TDQ cannot be
created dynamically. TSQ is temporary in nature (i:e it will be deleted when the program finishes
execution, unless it is made permanent by making a entry in the Temporary Storage Table), TDQ
120
is not. Hope this will suffice
Question: What is ENQ in CCS?
Answer: f any one want to restrict Trans-d to single user, enter trans-id with ENQ. t won't allow
any one else to use the same trans-id.
Question: n SYMBOLC Cursor Positioning after moving -1 to the length field also the cursor is
not positioned in that particular field.Give reasons?
Answer: You have to explicitly specify the word CURSOR between your EXEC CCS and END-
EXEC in the program.
Question: What does EB mean?
Answer: The EB is the EXECUTVE NTERFACE BLOCK. t is not the EXECUTE NTERFACE
BLOCK. All TP monitors or transaction processors are know as EXECUTVEs as they carry out
process on behalf of a program module. CCS and DB2 are excutives.
Question: How many exceptional condition can be given in a HANDLE CONDTON?
Answer: Max. of 12 exceptional conditions can be given in a single HANDLE CONDTON.
Question: What command do you issue to delete a record in a transient data queue ?
Answer: READQ TD, the read is destructive. Yes it is correct but there is a restriction.U can
deletethe records sequentially.. For example if one want to delete 10 th record directly it is not
possible with this..
Question: How do you access the records randomly in TSQ ?
Answer: By specifying the TEM option
Question: What command do you issue to delete a record in a transient data queue ?
Answer: READQ TD, the read is destructive.
Question: WHAT ARE DFFERENT WAYS OF NTATNG TRANSACTON N CCS
Answer: WE CAN NTATE CCS TRANSACTON
1. BY GVNG TRANSACTON D
2. BY GVNG CCS START COMMAND
3. AUTOMATC TASK NTATON.
Question: What is the difference between LNK and XCTL ?
Answer: The XCTL command passes control to another program, but the resources requested by
the first program may still be allocated. A task does not end until a RETURN statement is
executed. While in LNK command, program control resumes its instruction following the LNK
parameter. The disadvantage of LNK is that it requires that both the calling program and the
called program remain in main memory even though both are no longer needed.
Question: What is the difference between CCS Program Control Table (PCT) and CCS
Processing Program Table (PPT) ?
Answer: PCT contains a list of valid transaction D. Each transaction D is paired with the name of
121
the program ,CCS will load and execute when the transaction is invoked. On the other hand,
PPT indicates each program's location which pertains to a storage address if the program has
already been loaded or a disk location if the program hasn't been loaded. PPT will also be used to
determine whether it will load a new copy of the program when the transaction is invoked.
Question: What are the 3 common ways to create maps?
Answer: The first way is to code a physical map and then code a matching symbolic map in your
COBOL program. The second way to create a physical map along with a matching symbolic map
is to code only the physical map using the &SYSPARM option, CCS will automatically create a
member in a COPY library. And the third way is to use a map generator such as SDF (Screen
Definition Facility)
Question: What is Quasi-reentrancy?
Answer: There are times when many users are concurrently using the same program, this is what
we call MultiThreading. For example, 50 users are using program A, CCS will provide 50
Working storage for that program but one Procedure Division. And this technique is known as
quasi-reentrancy
Question: What is the difference between a physical BMS mapset and a logical BMS mapset?
Answer: The physical mapset is a load module used to map the data to the screen at execution
time. The symbolic map is the actual copybook member used in the program to reference the
input and output fields on the screen.
Question: How To Set MDT(Modified Data Tag) Thru Application Program?(Dynamically).
Answer: You have to move the following macro DFHBMFSE to the Attribute field of that particular
Variable.
Question: What CCS facilities can you use to save data between the transactions?
Answer: COMMONAREA, TSQ & TDQ.
Question: How would you release control of the record in a READ for UPDATE?
Answer: By issuing a REWRTE,DELETE, or UNLOCK command or by ending the task.
Question: How would you release control of the record in a READ for UPDATE?
Answer: By issuing a REWRTE,DELETE, or UNLOCK command or by ending the task.
Question: What is the difference between a RETURN with TRANSD and XCTL ?For example
prog. A is issuing REUTRN with TRANSD to prog B. Prog A. is issuing XCTL to prog B.
Answer: n RETURN with TRANSD the control goes to the CCS region and the user have to
transfer the control to prog. B by pressing any of the AD KEYS.n XCTL the control is directly
transfer to prog. B.
Question: What is the maximum number of exceptions that can be specified with a single
HANDLE CONDTON command in CCS ?
Answer: SXTEEN (16)
Question: WHAT WLL BE THE LENGTH OF THE EBCALEN ,F THE TRANSACTON S USED
TO CCS FRST TME?
122
Answer: THE LENGTH WLL BE 0(ZERO)
.
Question: WHAT S DFHEBLK?
Answer: DFHEBLK is Execute nterface Block. t is placed in the linkage section automatically by
CCS translator program. t must be the first entry in linkage section. CCS places values prior to
giving control to the program and we can find almost any information about our transaction.
Question: What is the difference between the XCTL and LNK commands?
Answer: The LNK command anticipates return of control to the calling program, theXCTL
command does not. Return to the calling program will be the result of the CCS RETURN
command, specifying TRANSD(name of the calling program).
Question: What CCS command would you use to read a VSAM KSDS sequentially in ascending
order?
Answer: First issue a STARTBR(start browse), which will position the browse at the desired
record. Retrieve records by using subsequent READNEXT commands. ndicate the end of
sequential processing with the ENDBR command. f the generic key is specified in the STARTBR
command positioning in the file will be before the first record satisfying the generic key.For
reading in descending order use the READPREV instead ofREADNEXT.
Question: What is the difference between pseudo-conversational and conversational?
Answer: Pseudo-conversational will start a new task for each input. By coding a CCS RETURN
command specifying TRANSD(itself). Conversational will have an active task during the duration
of the data entry.
Question: What is the COMMAREA(communications area)?
Answer: An area used to transfer data between diffrent programs or between subsequent
executions of the same program. Needs to be defined in the Linkage Section.

DB2 Tutorial :-
Inrodu%ion o D##-#ses
&ha- is da-a?

123
A representation of facts or instruction in a form suitable for communication.
&ha- is a da-a1ase?
t is a repository for stored data.
&ha- is a da-a1ase S's-em?
An integrated and shared repository for stored data or collection of stored operational
data used by application systems of some particular enterprise.
Nothing more than a computer-based record keeping system
Ad/an-ages o2 D+MS o/e) File Managemen- S's-ems
Data redundancy
Multiple Views
Shared data
Data independence (logical/Physical)
Data dictionary
Search versatility
Cost effective
Security and Control
Recovery ,restart & Backup
Concurrency
T'5es o2 Da-a1ases : o) Models;
Hierarchical Model
Network Model
Relational Model
Object-Oriented Model
%IERARC%ICAL MODEL
Top down structure resembling an upside-down tree.
Parent child relationship
First logical database Model
Available on most of the Mainframe computers
Examples: MS
NET&OR$ MODEL
Does not distinguish between parent and child.Any record type can be associated with
any number of arbitrary record types
Enhanced to overcome limitations of other models but in reality there is minimal
difference due to frequent enhancement
Example: DMS
124
RELATIONAL MODEL
Data stored in the form of table consists of multiple rows and columns.
Examples: DB2,ORACLE,SYBASE
O+@ECT-ORIENTED MODEL
Data attributes and methods that operate on those attributes are encapsulated
instructions called objects.
Types o( Ine"riy
Entity ntegrity
Referential ntegrity
Domain ntegrity
En-i-' In-eg)i-'
s a state where no column that is part of a primary key can have a null values.
Re2e)en-ial In-eg)i-'
s a state where every foreign key in the first table must either match a primary key value
in the second table or must be wholly null.
Domain In-eg)i-'
ntegrating of information allowed in column.
Eniy Re$#ions+ip Mode$
E-R model is a logical representation of data for a business area.
Represented as entities relationship between entities and attributes of both relationships
and entities.
E-R models are outputs of analysis phase.
Example of relational Structure
CUSTOMER places ORDERS
ORDER has PRODUCTS
Each order relates to only one customer (one-to-one)
Many orders can contain many products (many-to-many)
A customer can place any number of orders ( one-to-many)
n last example customer,order & product are called entities
An entities may transform into tables.
The unique identity for information stored in an entity is called a primary key
Attributes which define the characteristics of the table.
125
D);
O+@ECTS
Stogroup(Storage group)
Database
Table Space
Table
View
ndex
S-og)o,5 : S-o)age *)o,5;
t is a collection of direct access volume, all of the same device type
The option is defined as a part of table space definitions
When a given space needs to be extended, storage is acquired from the appropriate
stogroup.
Da-a1ase
A collection of logically related objects like table spaces, index spaces,tables etc.
Not a physical kind of object, may occupy more than one disk space.
A STOGROUP & BUFFER POOL must be defined for each database.
n a given database, all the spaces need not have the same STOGROUP.
TA+LE SPACES
Logical address space on secondary storage to hold one or more tables.
t is the storage unit for recovery and reorganizing purpose
Three types of table spaces are :
o Simple
o Partitioned
o Segmented
Sim5le Ta1le S5a(es
Can contain more than one stored tables
Depending on application, storing more than one tables might enable faster retrieval for
joins using these tables.
Usually only one table is preferred. This is because a single page can contain rows from
all tables defined in the database.
Segmen-ed -a1le s5a(es
Can contain more than one stored tables , but in a segmented space.
A 'segment' consists of a logically contiguous set of 'n' pages.
No segment is allowed to contain records for more than one table.
126
Sequential access to a particular table is more efficient.
Lock Table on table locks only the table, not the entire table space.
f a table is dropped ,the space for that table can be reclaimed within minimum
reorganization.
Pa)-i-ioned Ta1le S5a(e
Primarily used for very large tables
Only one table in a partitioned table space
ndividual partitions can be independently recovered and reorganized.
Different partitions can be stored on different storage groups for efficient access.
TA+LES
A table is a collection of rows and columns.
The data is stored on magnetic disks in a series of TABLES.
Each COLUMN contains some specific information about suppliers and each ROW
contains all the information about a particular supplier.
For example SUPPLER table looks like :
S# SNAME STATUS CTY
001 PRASAD 20 CHENNA
002 VASU 30 DELH
003 SVA 10 BOMBAY
VIE&S
Views can be very practical ways of simplifying queries by reducing the number of
different tables.
Views can also hide sensitive data from users who don't need access to it.
CREATE VEW EMP_VEW
AS
SELECT EMPNO,NAME,DEPT,JOB FROM EMP
S#NON#MS
Synonym is like a nick name to a table name and when no longer needed it can be
dropped. Synonym access is specific to the user who has created it.
127
STRUCTURED BUER4 *AN0UA0E(SB*)
A powerful database management language that performs the function of data
manipulation, data definition and data control.
A non-procedural language.
The capability to act on a set of data and the lack of need to know how to retrieve it.
t allows to specify WHAT the result should be, NOT HOW the result obtained.
S!L T#PES:+ased on 2,n(-ionali-';
DDL - CREATE,ALTER and DROP
DML - SELECT,NSERT,UPDATE & DELETE
DCL - GRANT and REVOKE
S!L T#PES:O-he)s;
Static or Dynamic SQL
Embedded or Stand-alone SQL
%O& DO #O" "TILIGE S!L?
t is usually accessed on-line.
t can be used interactively, such as SPUF,QMF or it can be embedded in
COBOL,PL/,ASSEMBLER or FORTRAN program.
&%AT MI*%T #O" DO &IT% S!L?
As an end-user you will be using SQL on-line to access data and produce formatted
reports.
As an application programmer, you will use SQL to extract data from one or more tables
and pass these data to another program for additional processing.
SQL task is center about four basic functions & these functions correspond to the four
basic SQL command (SELECT, UPDATE, NSERT, DELETE)
%O& TO CREATE A SIMPLE S!L !"ER#?
Search the table of your choice
Select specific columns to be displayed from a table
Select specific rows to be displayed from a table
Specify the order in which to display data
%ow do 'o, s5e(i2' whi(h -a1les 'o, wan- -o sele(- 2)om?
Which tables contain data?
Which columns to display from the table?
128
Which rows to display?
n which order to display the columns and/or rows.
Any SELECT statement must specify a table
f the table belongs to another user, you may have to prefix the table name with the other
user's D.
%ow do 'o, s5e(i2' whi(h COL"MNS 'o, wan- -o dis5la'?
Listing the name of the columns on a SELECT statement, separated by commas.
SELECT SNAME, STATUS
FROM SUPPLERS
&h' no- ,se -he QEN in all 'o,) ?,e)ies ?
Using the '*' to indicate all columns should be displayed is inefficient if you don't need to
see all the columns.
You can put the columns in the order you want them.
t is better to specify just those column you want.
%ow do 'o, s5e(i2' whi(h )ows 'o, wan- -o dis5la'?
Using WHERE keyword .
The format is WHERE followed by a condition or list of conditions.
SELECT SNAME
FROM SUPPLER
WHERE STATUS=30
Can 'o, 5,- -he da-a in O)de)?
Using ORDER BY keyword to your query
SQL automatically orders data in ascending order if you have any ORDER BY statement
in your query.
f you want your data in descending order, use the DESC keyword.
SE*ECT STATUS .ROM SUPPLIERS ORDER )4 STATUS DESC
Can 'o, o)de) 1' mo)e -han one (ol,mn?
You can order by as many columns as you want.
Simple add the columns you want to sort to the ORDER BY clause, separated by comma.
Example:
SE*ECT SNAME ,STATUS, CITY .ROM SUPPLIERS ORDER )4 STATUS,SNAME
"se o2 QANDN and QORN -o ma3e a ?,e)' mo)e s5e(i2i(.
129
Sometimes a single search condition is not precise enough to select only the rows you
need.So you need to use the logical operator AND and OR.
You can link as many search expression as you want using AND and OR.
Using both operator together , searched expression linked by AND are paired up
first.Parentheses can be used to force expression to be paired together.
%ow do 'o, a/oid d,5li(a-e da-a in 'o,) o,-5,-?
By adding the keyword DSTNCT immediately following SELECT , you suppress any
duplicates. SE*ECT DISTINCT STATUS .ROM SUPPLIERS
&ha- a)e -he )ela-ional o5e)a-o)s?
Here is the full list of operators:
SYMBOL CONDTON
= equal to
> greater than
< less than
>= greater than or equal to
<= lesser than or equal to
<> less than or greater than
LKE containing certain characters
BETWEEN within a range of values
N one of a set of values
Each condition also has a negative version.
IN
Lets you retrieve data from each row whose columns has a value equal to one of the
several listed values.
Example: &%ERE STATUS IN (20,10,30)
Any row with STATUS column value of 20,10, 30 is selected.
Each character value must be in quotes.
Values are separated by comma & values list is enclosed in parenthesis.
)ET9EEN
Lets you retrieve data from each row whose columns has a value with two limits.
Example: &%ERE STATUS +ET&EEN 10 AND 30
Any row with STATUS column value of 10 thru 30 is selected.
t can be used for both numeric and character values.
The two values must be separated by AND, the lower value must be the first value.
*I1E
Lets you retrieve data from each row whose columns has a value similar to the value
specified in the WHERE CLAUSE.
130
Example: &%ERE SNAME LI$E 'B%C'
Any row with name column beginning with 'B' followed by ANY VALUE of ANY LENGTH,
and ending with 'C' is selected.
A '%' represents any value of any length,where as an underscore '_' represents any
single character LKE can't use for any numeric column.
9+# is NU**E
A NULL is a column value that does not exists.
t is not a blank, not is it zero it is a 'non-value'.
The columns must predefined to the DBMS as a column that may contain NULL values.
%O& DOES S!L TREAT N"LL VAL"ES?
Generally, NULL values are ignored.
f you perform a calculation using a column with NULL values , those rows containing
NULL's are ignored and a dash will output as the result.
NULL means "VALUE UNKNOWN, so it cannot meet any of the standard search
conditions.
EFam5le o2 N"LL /al,es
To select all rows with a NULL value in the COMM column, you must use WHERE COMM
S NULL as your search condition
To select all rows that do NOT have a NULL value, you must use WHERE COMM S NOT
NULL as your search condition
Note:
WHERE COMM = 0 . Who has earned no commission?
WHERE COMM S NULL Who is ineligible for commission?
ARIT'METRIC EX!RESSIONS
An arithmetic expression is a calculation using numeric values and one or more of the
arithmetic operators :addition (+), subtraction (-), multiplication (*), and division (/).
Example: SE*ECT SALARY + COMM,NAME,DEPT
Arithmetic expressions can also be used in a WHERE clause: 9'ERE SALARY +
COMM >5000.00
R"LES FOR CODIN* ARIT%METIC EXPRESSIONS
Spaces on either side of the arithmetic symbols are optional.
SALARY/12 OR SALARY / 12
You can combine column names and constants in arithmetic expressions.
1998 - JOIN_YR, 1.0*SALARY
%O& DOES S!L EVAL"ATE ARIT%METIC EXPRESSIONS?
131
SQL works from left to right, evaluating multiplication and division before addition and
subtraction (*, / , +, -).
However any expressions in parentheses are evaluated first.
+"ILT IN F"NCTION
SUM
MAX
MN
AVG
COUNT(*)
COUNT(DSTNCT col name)
S"M
Calculate the total value for a given column or arithmetic expression
SE*ECT SUMSALARY! .ROM EMP
MAX and MIN
Display either the highest or lowest value found in the rows selected by the query.
SE*ECT MAXSALARY!,MINSALARY! .ROM EMP
AV*
Display the average of all non-NULL columns
SE*ECT AV0SALARY! .ROM EMP
AVG disregards any rows with NULLs in any column involved in the averaging expression
nteger columns are not rounded, so result may be inaccurate.
To convert an integer column to a decimal column multiply by 1.0 as part of the AVG
expression.
AV01.0 * STATUS!
CO"NT:E;
t counts all the rows selected by a query
SE*ECT COUNT(F) .ROM SUPPLIERS
CO"NT:DISTINCT (ol name;
t counts only those rows that have a unique value in the specified column
SE*ECT COUNT(DISTINCT STATUS) .ROM SUPPLIERS
COUNT (*) counts all the rows selected
COUNT(DSTNCT col name) does not count rows with a duplicate value in the specified
column.
COUNT(DSTNCT col_name) does not count rows that have NULLS in the specified
column.
132
%O& DOES S!L CREATES S"MMAR# DATA
When you request a built-in summary functions, SQL goes through several steps to reach
a result.
First, all the rows and columns are selected. This intermediate result is kept in a
temporary table.
Next, the system process your GROUP BY request, creating a temporary table for each
GROUP and putting the appropriate rows in each table.
Then the built-in functions are calculated.
f, for example you requested an AVG, then the average for each temporary sub group is
calculated.
*RO"P +#
GROUP BY outputs a summary table one line for each group.
GROUP BY can only be used in conjunction with built-in functions.
GROUP BY follows FROM and WHERE and precedes ORDER BY
Example: SE*ECT DEPT, MAXSALARY! .ROM EMP 0OU! )4 DEPT
t will produce a table listing the maximum salary value for each department.
%AVIN*
t is similar in function to the WHERE clause
ts purpose is to further define a 'group' specified in the GROUP BY statement SE*ECT
DEPT, AV0SALARY! .ROM EMP 0ROU! )4 DEPT 'AVIN0 COUNT*!>"
HAVNG can only be used in conjunction with GROUP BY
HAVNG must immediately follow the GROUP BY clause
HAVNG can only compare built-in functions not individual columns
/OININ0
Joining tables involves matching the rows of one table with related rows of another table
to produce a table consisting of rows with columns from both the original tables.
+ASIC PRINCIPLES OF @OININ* TA+LES
t will combine related information from two tables into a single row.
f a value appears once in the "joining column of one table, but several times in the other,
the higher number of occurrences will appear in the output table.
f a value exists in the "joining column of one table, but not in the other, no row appears
in the output table with that value.
/OININ0 CO*UMN
t is a column that is common to all the tables being joined and contains the row values
that tie one table to next.
133
%O& DO #O" ACT"ALL# TIE T%E TA+LES TO*ET%ER?
With a special type of WHERE clause called the joining condition
&%ERE EMP.DEPTNO = DEPT.DEPTNO
Example: SE*ECT ITEM,PRICE,COLOR .ROM T#$%&1,T#$%&2 9'ERE T#$%&1.ITEM '
T#$%&2.ITEM
MER0IN0
Merging tables also involves combining data from two tables, but the rows are not joined
together.
Example:SE*ECT *.ROM EMP UNION SE*ECT * .ROM SUPPLIER
MER*IN* !"ER# CODIN*
Select data from one table
Specify UNON or UNON ALL to indicate MERGE
Select data from second table
Example: SE*ECT * .ROM T#$%&_1 UNION SE*ECT * .ROM T#$%&_2
The UNON or UNON ALL keyword must be entered after the first SELECT statement
"NION /s. "NION ALL
UNON sorts the result tables, UNON ALL does not. n other words, UNON mixes rows
together in the output. UNON ALL outputs all the rows from the first table that meet the
search condition. UNON removes duplicate rows, UNON ALL does not.
&%EN TO MER*E T&O TA+LES
Each column selected from first table must be compatible with the corresponding
columns from the second table.
A numeric column are compatible with numeric column, a character column to a
character column, and so on.
Numeric data types need not be the same column length You must select the same
number of columns from each tables.
CREATIN* AND "PDATIN* TA+LES
To create a new table you must use the SQL statement CREATE TABLE. You must
specify the table name and the names and attributes of each column.
RU*ES .OR TA)*E NAME
Maximum 18 characters
Permissible characters
o letters of the alphabet
o @, #, and $
134
o numbers
o underscore (_)
The first character must be alphabetic or @,#, or $
DATA T4!ES
Data type depends on the nature of the data itself and will always be one of two types
NUMERC or CHARACTER
o Types of CHARACTER column
CHAR Allows any values to be entered in the column. All entries are
the same length
VARCHAR Allows any values to be entered in the column. All entries
are the varying length
o Types of NUMERC columns
NTEGER - For very large integers up to 2,147,483,647
SMALLNT - For small integer up to 99999 Table Space
DECMAL - For numbers with a fixed number of decimal places after the decimal point.
The number can have a total of 15 digits
FLOAT -For very large numbers with an undetermined number of decimal places after the
decimal point
Types of DATE/TME columns
o DATE - Dates are stored in YYYYMMDD format
o TME - Times are stored on a 24-hour clock in HHMMSS format
TMESTAMP TMESTAMP columns contain both date and time information, with the
time value accurate to the millisecond.
0RANT 5 REVO1E
Privileges in DB2 to control accessing data
To grant access to a table or view you must run a query that specifies three things in the
following order
o The privileges you are granting (SELECT,NSERT,DELETE,UPDATE or ALL)
o The name of the table or view
o The user or users to whom you are granting access STOGROUP(Storage group)
To grant everything, use GRANT ALL
To grant a privilege to EVERYBODY , you grant TO PUBLC
PRIVILE*ES
(RANT ALL ON TA)LE EMP TO PU)LIC
RE*O+E ALL ON EMP TO PU)LIC
CAN #O" C%AN*E A TA+LE OR VIE& AFTER #O" CREATE IT?
The only change you can make to a table or view after it has been created is to add an
additional column.
This is done with the SQL command ALTER
135
o ALTER TA)LE EMP ADD COMM DECIMAL , ,2!
DROP
When you no longer need a TABLE, VEW, or SYNONYM you can DROP them.
o DROP TABLE SUPPLER
o DROP VEW EMP_VEW
o DROP SYNONYM S
INSERTIN* A TA+LE
There must be one value for each column
Separate values with commas
Put character values in single quotes
Numeric values do not require quotes
f you want enter the values in a different order, there is an alternative way of inserting a
row, by listing the columns along with their assigned values
o INSERT INTO SUPPLIER S-,STATUS,SNAME! VA*UES.S1/,"0,/*AST/!
"PDATE
SQL provides two commands for updating row values UPDATE and SET.
UPDATE tells SQL which table you want to update and SET provides the name of the
column to update and the new value for the column.
You tell SQL which row to update with a WHERE clause can be very specific, so that a
single row gets changed, or it can be very general, so that many rows get updated.
o <)>UPDATE SUPPLIER SET STATUS ' 00 9'ERE S- ' .S1/
o U!DATE EMP SET SALARY ' SALARY + SALARY *.01
DELETE
Using the DELETE command you can delete rows and using WHERE clause you can
specify which rows you want to delete.
o DE*ETE .ROM SUPPLIER 9'ERE S- ' .S1/
Com5leF S!LNs
One terms a SQL to be complex when data that is to be retrieved comes from more than
one table.
SQL provides two ways of coding a complex SQL
o Subqueries and Join
S"+ !"ERIES
Nested select statements.
Specified using the N or NOT N predicate, equality or non-equality predicate and
comparative operator.
136
When using the equality, non-equality or comparative operators the inner query should
return only a single value.
Nested loop statements gives the user flexibility for querying multiple tables.
A specialized form is a correlated sub query. t works on top-bottom-top fashion.
Non correlated sub query works in bottom to top fashion.
@OINS
OUTER JON
NNER JON
O"TER @OIN
For one or more tables being joined both matching and the non-matching rows are
returned.
Duplicate columns may be eliminated.
Non-matching columns will have nulls.
INNER @OIN
Here there is a possibility one or more of the rows from either or both tables being joined
will not be included in the table that results from the join operation
BM.8 Buery M#n#"emen .#%i$iy
t is an MVS and VM-based query tools
Allows end users to enter SQL queries to produce a verity of reports and graphs as a
result of this query.
QMF queries can be formulated in several ways: by direct SQL statements, by means of
relational prompted query interface
SP"FI :S!L P)o(essing "sing File In5,-;
Supports the on-line execution of SQL statements from a TSO terminal.
Used for developers to check SQL statements or view table details.
SPUF menu contains the input file in which the SQL statements are coded , option for
default settings and editing and output file.
!ro"r#m !rep#r#ion
Precompile
Compile & Link
Bind
o Package
o Plan
137
P)e(om5ile
Searches all the SQL statements and DB2 related NCLUDE members and comments
out every SQL statement in the program.
The SQL statements are replaced by a CALL to the DB2 runtime interface module along
with parameter.
All SQL statements are extracted and put in a DBRM.
Places a time stamp in the modified source and the DBRM so that these are tied.
All DB2 related NCLUDE statements must be placed between EXEC SQL & END-EXEC
key words for the precompiler to recognize them.
Com5ile M Lin3
Modified precompiler COBOL output is complied.
Complied source is link edited to an executable load module.
+ind
A type of compiler for SQL statement.
t reads the SQL statements from the DBRM and produces a mechanism to access data
as directed by the SQL statements being bound.
Checks syntax, check for correctness of table & column definitions against the catalog
information & performs authorization validation.
Pa(3age
t is a single bound DBRM with optimized access paths.
t also contains a location identifier a collection identifier and a package identifier.
A package can have multiple versions , each with it's own version identifier.
Ad/an-ages o2 Pa(3age
Reduced bind time.
Versioning.
Provides remote data access.
Can specify bind options at the programmer level.
Plan
An application plan contains one or both of the following elements
o A list of package names.
o The bound form of SQL statements taken from one or more DBRM.
Every DB2 application requires an application plan.
Plans are created using the DB2 sub commands BND PLAN.
138
D); OpimiGer
Analyzes the SQL statements and determines the most efficient way to access data,
gives physical data independence.
t evaluates the following factors: CPU cost, /O cost, DB2 catalogue statistics & the SQL
statements
t estimate CPU time , cost involved in applying predicates traversing pages & sorting.
t estimates the cost of physically retrieving and writing data.
S-e5s in/ol/ed in ()ea-ing a D+7 A55li(a-ion
Using Embedded SQL
Using Host Variables(DCLGEN)
Using SQLCA
Precompile
Compile & Linkedit the program
Bind
Em1edding S!L S-a-emen-s
t is like the file /O
Normally the embedded SQL statements contain the host variables coded with the NTO
clause of the SELECT statement.
They are delimited with EXEC SB* 1 END8EXEC
Example: EXEC SQL
SELECT eno,ename NTO :h-eno,:h-ename
FROM employee WHERE eno=1001
END-EXEC.
%os- Va)ia1les
These are variables defined in the host language to use the predicates of a DB2 table.
These are referenced in the SQL statement.
A means of moving data from and to DB2 tables.
DCLGEN produces host variables the same as the columns of the tables.
DCL*EN
ssued for a single table.
Prepares the structures of the table in a COBOL copy book.
The copy book contains a SQL DECLARE TABLE statement along with a working storage
host variable definition for the table.
S!LCA
An SQLCA is a structure or collection of variables that is updated after each SQL
statement executes.
139
An application program that contains executable SQL statements must provide exactly
one SQLCA.
C"RSOR
Used when more than one row are to be selected.
Can be used for modifying data using 'FOR "PDATE OF' clause.
T+e .our Cursor %onro$ S#emens
DECLARE : name assigned for a particular SQL statement.
OPEN: Builds the result table .
FETCH : Returns data from the results table one row at a time and assign the value to
the specified host variables.
CLOSE: Releases all resources used by the cursor.
DECLARE4
EXEC SQL
DECLARE empcur CURSOR FOR
SELECT empno, ename, dept, job
FROM emp WHERE dept='D11'
FOR UPDATE OF job
END-EXEC.
OPEN4 for the OPEN statement
EXEC SQL
OPEN empcur
END-EXEC.
FETC%4 for the FETCH statement
EXEC SQL
FETCH empcur
NTO :empno, :ename, :dept, :job END-EXEC.
&%ENEVER4 for the WHENEVER clause
EXEC SQL
WHENEVER NOT FOUND
GO TO close-empcur
END-EXEC.
"PDATE4 for the update statement using cursors
EXEC SQL
UPDATE emp
SET job=:new-job
WHERE CURRENT OF empcur
END-EXEC.
140
DELETE4 for the delete statement using cursor.
EXEC SQL
DELETE FROM EMP
WHERE CURRENT OF empcur
END-EXEC.

D); *OC1IN0
Locking is used to provide multiple user access to the same system.
DB2 uses locking services provided by an MVS subsystem called MS Resource Locking
Manager(RLM).
EF5li(i- Lo(3ing Fa(ili-ies
The SQL statement LOCK TABLE
The SOLATON parameter on the BND PACKAGE command the two possible values
are RR(Repeatable Read) & CS (Cursor Stability).
CS is the value specified if the application program is used in an on-line environment.
The LOCKSZE parameter physically DB2 locks data in terms of pages or tables or
table spaces. This parameter is specified in CREATE or ALTER table space option
'LOCKSZE'. The options are Tablespace, Table, Page or Any.
The ACQURE / RELEASE parameters on the BND PLAN command specifies when
table locks to be acquired and release.
o ACQURE USE / ALLOCATE
o RELESE COMMT / DEALLOCATE
C##$o"ue T#-$es
Repository for all DB2 objects contains 43 tables
Each table maintains data about an aspects of the DB2 environment
The data refers to information about table space, tables, indexes etc.
SYSBM.SYSTABLES, SYSBM.SYSNDEXS, SYSBM.SYSCOLUMNS etc.

DB2 Utilities:-
UTI*ITIES
CHECK
COPY
MERGECOPY
141
RECOVER
LOAD
REORG
RUNSTATS
EXPLAN
C%EC$
Checks the integrity of DB2 data structures
Checks the referential integrity between two tables and also checks DB2 indexes for
consistency.
Can delete invalid rows and copies them to a exception table.
COP#
Used to create an image copy for the complete table space or a portion of the table
space- full image copy or incremental image copy.
Every successful exception of COPY utility places in the table, SYSBM.SYSCOPY, at
least one row that indicates the status of the image copy.
MER*ECOP#
The MERGECOPY utility combines multiple incremented image copy data sets into a
new full or incremental image copy dataset.
RECOVER
Restore Db2 table spaces and indexes to a specific instance.
Data can be recovered for a single page, pages that contain /O errors, a single partition
or an entire tablespace.
Standard unit of recovery is table space.
LOAD
To accomplish bulk inserts into DB2 table
Can replace the current data append to it
f a job terminates in any phase of LOAD REPLACE, the utility has to be terminated and
rerun
REOR*
To reorganize DB2 tables and indexes and there by improving their efficiency of access
re-clusters data, resets free space to the amount specified in the 'create DDL' ,statement
and deletes and redefines underlying VSAM datasets for stogroup defined objects.
142
EXPLAIN
Explain can be used to obtain the details about the access paths chosen by the DB2
optimizer for SQL statements.
Used specifically for performance monitoring.
When EXPLAN is requested the access paths that the DB2 chooses are put in coded
format into the table PLAN_TABLE, which is created in the default database by the user.
The other method is specifying EXPLAN YES with BND command
The PLAN_TABLE is to be queried to get the required information
Since the EXPLAN results are dependent on the DB2 catalogue, it is better to run
RUNSTAT before running EXPLAN.

Db2 FAQ's frae:-
D+7 FA!S
1. How would you find out the total number of rows in a table?
143
o Use SELECT COUNT(*) ...
2. How do you eliminate duplicate values in SELECT?
o Use SELECT DSTNCT ...
3. How do you select a row using indexes?
o Specify the indexed columns in the WHERE clause.
4. What are aggregate functions?
o Built-in mathematical functions for use in SELECT clause.
5. How do you find the maximum value in a column?
o Use SELECT MAX(...)
6. Can you use MAX on a CHAR column?
o Yes.
7. My SQL statement SELECT AVG(SALARY) FROM EMP yields inaccurate results. Why?
o Because SALARY is not declared to have NULLs and the employees for whom
the salary is not known are also counted.
8. How do you retrieve the first 5 characters of FRSTNAME column of EMP table?
o SELECT SUBSTR(FRSTNAME,1,5) FROM EMP;
9. How do you concatenate the FRSTNAME and LASTNAME from EMP table to give a
complete name?
o SELECT FRSTNAME ' ' LASTNAME FROM EMP;
10. What is the use of VALUE function?
o Avoid -ve SQLCODEs by handling nulls and zeroes in computations
o Substitute a numeric value for any nulls used in computation
11. What is UNON,UNON ALL?
o UNON : eliminates duplicates
UNON ALL: retains duplicates
Both these are used to combine the results of different SELECT statements.
12. Suppose have five SQL SELECT statements connected by UNON/UNON ALL, how
many times should specify UNON to eliminate the duplicate rows?
o Once.
13. What is the restriction on using UNON in embedded SQL?
o t has to be in a CURSOR.
14. n the WHERE clause what is BETWEEN and N?
o BETWEEN supplies a range of values while N supplies a list of values.
15. s BETWEEN inclusive of the range values specified?
o Yes.
16. What is 'LKE' used for in WHERE clause? What are the wildcard characters?
o LKE is used for partial string matches. '%' ( for a string of any character ) and '_'
(for any single character ) are the two wild card characters.
17. When do you use a LKE statement?
o To do partial search e.g. to search employee by name, you need not specify the
complete name; using LKE, you can search for partial string matches.
18. What is the meaning of underscore ( '_' ) in the LKE statement?
o Match for any single character.
19. What do you accomplish by GROUP BY ... HAVNG clause?
o GROUP BY partitions the selected rows on the distinct values of the column on
which you group by.
o HAVNG selects GROUPs which match the criteria specified
144
20. Consider the employee table with column PROJECT nullable. How can you get a list of
employees who are not assigned to any project?
o SELECT EMPNO
FROM EMP
WHERE PROJECT S NULL;
21. What is the result of this query if no rows are selected:
o SELECT SUM(SALARY)
FROM EMP
WHERE QUAL='MSC';
NULL
22. Why SELECT * is not preferred in embedded SQL programs?
o For three reasons:
1. f the table structure is changed ( a field is added ), the program will have
to be modified.
2. Program might retrieve the columns which it might not use, leading on
/O over head.
3. The chance of an index only scan is lost.
23. What are correlated sub queries?
o A sub query in which the inner ( nested ) query refers back to the table in the
outer query. Correlated sub queries must be evaluated for each qualified row of
the outer query that is referred to.
24. What is a cursor? why should it be used?
o Cursor is a programming device that allows the SELECT to find a set of rows but
return them one at a time.
o Cursor should be used because the host language can deal with only one row at
a time.
25. How would you retrieve rows from a DB2 table in embedded SQL?
o Either by using the single row SELECT statements, or by using the CURSOR.
26. Apart from cursor, what other ways are available to you to retrieve a row from a table in
embedded SQL?
o Single row SELECTs.
27. How do you specify and use a cursor in a COBOL program?
o Use DECLARE CURSOR statement either in working storage or in procedure
division (before open cursor), to specify the SELECT statement. Then use
OPEN, FETCH rows in a loop and finally CLOSE.
28. What happens when you say OPEN CURSOR?
o f there is an ORDER BY clause, rows are fetched, sorted and made available for
the FETCH statement. Other wise simply the cursor is placed on the first row.
29. s DECLARE CURSOR executable?
o No.
30. Can you have more than one cursor open at any one time in a program?
o Yes.
31. When you COMMT, is the cursor closed?
o Yes.
145
32. How do you leave the cursor open after issuing a COMMT? (for DB2 2.3 or above only )
o Use WTH HOLD option in DECLARE CURSOR statement. But, it has not effect
in psuedo-conversational CCS programs.
33. Give the COBOL definition of a VARCHAR field.
o A VARCHAR column REMARKS would be defined as follows:
10 REMARKS.
49 REMARKS-LEN PC S9(4) USAGE COMP.
49 REMARKS-TEXT PC X(1920).

34. What is the physical storage length of each of the following DB2 data types: DATE, TME,
TMESTAMP?
DATE: 4bytes
TME: 3bytes
TMESTAMP: 10bytes
35. What is the COBOL picture clause of the following DB2 data types: DATE, TME,
TMESTAMP?
DATE: PC X(10)
TME : PC X(08)
TMESTAMP: PC X(26)
36. What is the COBOL picture clause for a DB2 column defined as DECMAL(11,2)?
o PC S9(9)V99 COMP-3.
Note: n DECMAL(11,2), 11 indicates the size of the data type and 2 indicates
the precision.
37. What is DCLGEN?
o DeCLarations GENerator: used to create the host language copybooks for the
table definitions. Also creates the DECLARE table.
38. What is JON and different types of JON.
o The ability to join rows and combine data from two or more tables is one of the
most powerful features of relational system. Three types of joins:
1. Equi-join
2. Non-equijoin
3. self-join
39. Can alter a table (e.g. adding a column) when other user is selecting some Columns or
updating some columns from the same table?
o yes possible. until the updation or selection is committed db2 table will not be
restructured. new column definition will be there but it will not be included until all
the tasks on the table are committed.
40. What are the different methods of accessing db2 from tso?
o There are three ways in establishing tso/db2 connection
1. SPUF
2. QMF
3. CATALOG VSBLTY
41. How is the connection established between TSO & DB2?
146
o A thread between TSO & DB2 is established while attempting to make
Connection between tso & db2.
42. What is sqlcode -922?
o Authorization failure
43. How do you do the EXPLAN of a dynamic SQL statement?
o Use SPUF or QMF to EXPLAN the dynamic SQL statement
o nclude EXPLAN command in the embedded dynamic SQL statements
44. How is a typical DB2 batch pgm executed?
o Use DSN utility to run a DB2 batch program from native TSO. An example is
shown:

DSN SYSTEM(DSP3)
RUN PROGRAM(EDD470BD) PLAN(EDD470BD)
LB ('EDGS01T.OBJ.LOADLB')
END
o Use KJEFT01 utility program to run the above DSN command in a JCL.
45. s it mandatory to use DCLGEN? f not, why would you use it at all?
o t is not mandatory to use DCLGEN.
Using DCLGEN, helps detect wrongly spelt column names etc. during the
pre-compile stage itself (because of the DECLARE TABLE ).
DCLGEN being a tool, would generate accurate host variable definitions for the
table reducing chances of error.
46. Name some fields from SQLCA.
o SQLCODE, SQLERRM, SQLERRD
47. How does DB2 determine what lock-size to use?
o Based on the lock-size given while creating the table space
o Programmer can direct the DB2 what lock-size to use
o f lock-size ANY is specified, DB2 usually choses a lock-size of PAGE
48. What is the difference between CS and RR isolation levels?
o CS: Releases the lock on a page after use
o RR: Retains all locks acquired till end of transaction
49. Where do you specify them?
o SOLATON LEVEL is a parameter for the bind process.
50. How do you simulate the EXPLAN of an embedded SQL statement in SPUF/QMF? Give
an example with a host variable in WHERE clause.
o Use question mark in place of a host variable (or an unknown value). e.g.

SELECT EMP_NAME
FROM EMP
WHERE EMP_SALARY > ?
51. What is ACQURE/RELEASE in BND?
o Determine the point at which DB2 acquires or releases locks against table and
Table spaces, including intent locks.
52. n SPUF suppose you want to select max. of 1000 rows, but the select returns only 200
rows. What are the 2 sqlcodes that are returned?
o 100 (for successful completion of the query), 0 (for successful COMMT if
AUTOCOMMT is set to Yes).
53. How would you print the output of an SQL statement from SPUF?
147
o Print the output data set.
54. What does it mean if the null indicator has -1, 0, -2?
o -1 : the field is null
o 0 : the field is not null
o -2 : the field value is truncated
55. How do you retrieve the data from a nullable column?
o Use null indicators. Syntax ... NTO :HOSTVAR:NULLND
56. What else is there in the PLAN apart from the access path?
o PLAN has the executable code for the SQL statements in the host program
57. What is lock escalation?
o Promoting a PAGE lock-size to table or table space lock-size when a transaction
has aquired more locks than specified in NUMLKTS. Locks should be taken on
objects in single table space for escalation to occur.
58. When is the access path determined for dynamic SQL?
o At run time, when the PREPARE statement is issued.
59. What are the various locks available?
o SHARE, EXCLUSVE, UPDATE
60. What is sqlcode -811?
o SELECT statement has resulted in retrieval of more than one row.
61. What are the advantages of using a PACKAGE?
o Avoid having to bind a large number of DBRM members into a plan
o Avoid cost of a large bind
o Avoid the entire transaction being unavailable during bind and automatic rebind
of a plan
o Minmize fallback complexities if changes result in an error.
62. What is REORG? When is it used?
o REORG reorganizes data on physical storage to re-cluster rows, positioning
oveflowed rows in their proper sequence, to reclaim space, to restore free space.
t is used after huge updates, inserts and delete activity and after segments of a
segmented table space have become fragmented.
63. How does DB2 store NULL physically?
o as an extra-byte prefix to the column value. physically, the nul prefix is Hex '00' if
the value is present and Hex 'FF' if it is not
64. What is CHECK PENDNG?
o When a table is LOADed with ENFORCE NO option, then the table is left in
CHECKPENDNG status. t means that the LOAD utility did not perform
constraint checking.
65. When do you specify the isolation level? How?
o During the BND process. SOLATON (CS/RR)...
66. What is a DBRM, PLAN?
o DBRM: DataBase Request Module, has the SQL statements extracted from the
host language program by the pre-compiler.
o PLAN: A result of the BND process. t has the executable code for the SQL
statements in the DBRM.
67. s DECLARE TABLE in DCLGEN necessary? Why it used?
o t not necessary to have DECLARE TABLE statement in DCLGEN. This is used
by the pre-compiler to validate the table-name, view-name, column name etc.,
during pre-compile.
148
68. What do you need to do before you do EXPLAN?
o Make sure that the PLAN_TABLE is created under the AUTHD.
69. What is a collection?
o a user defined name that is the anchor for packages. t has not physical
existence. Main usage is to group packages.
70. How can you quickly find out the # of rows updated after an update statement?
o Check the value stored in SQLERRD(3).
71. What is EXPLAN?
o EXPLAN is used to display the access path as determined by the optimizer for a
SQL statement. t can be used in SPUF (for single SQL statement ) or in BND
step (for embedded SQL ).
72. Where is the output of EXPLAN stored?
o n userid.PLAN_TABLE
73. Suppose have a program which uses a dynamic SQL and it has been performing well till
now. Off late, find that the performance has deteriorated. What happened?
o Probably RUN STATS is not done and the program is using a wrong index due to
incorrect stats. Probably RUNSTATS is done and optimizer has chosen a wrong
access path based on the latest statistics.
74. What are the contents of a DCLGEN? - GS
o EXEC SQL DECLARE TABLE statement which gives the layout of the table/view
in terms of DB2 data types.
o A host language copy book that gives the host variable definitions for the column
names.
75. Will pre-compile of an DB2-COBOL program bomb, if DB2 is down?
o No. Because the pre-compiler does not refer to the DB2 catalogue tables.
76. What are the isolation (also called isolation parameters) levels possible?
o CS: Cursor Stability
o RR: Repeatable Read
77. What is the picture clause of the null indicator variable?
o S9(4) COMP.
78. EXPLAN has output with MATCHCOLS = 0. What does it mean?
o A non-matching index scan if ACCESSTYPE = .
79. use CS and update a page. Will the lock be released after 've done with that page?
o No.
80. What are the various locking levels available?
o PAGE, TABLE, TABLESPACE
81. What is ALTER?
o SQL command used to change the definition of DB2 objects.
82. Can use LOCK TABLE on a view?
o No. To lock a view, take lock on the underlying tables.
83. What are the disadvantages of PAGE level lock?
o High resource utilization if large updates are to be done
84. What are PACKAGES ?
o They contain executable code for SQL statements for one DBRM.
85. Lot of updates have been done on a table due to which indexes have gone haywire.
What do you do?
o Looks like index page split has occured. DO a REORG of the indexes.
86. What is dynamic SQL?
149
o Dynamic SQL is a SQL statement created at program execution time.
87. What is MAGECOPY ?
o t is full backup of a DB2 table which can be used in recovery.
88. What is QUESCE?
o A QUESCE flushes all DB2 buffers on to the disk. This gives a correct snapshot
of the database and should be used before and after any MAGECOPY to
maintain consistency.
89. What does the sqlcode of -818 pertain to? - GS
o This is generated when the consistency tokens in the DBRM and the load
module are different.
90. What happens to the PLAN if index used by it is dropped?
o Plan is marked as invalid. The next time the plan is accessed, it is rebound.
91.
o
92. What is FREEPAGE and PCTFREE in TABLESPACE creation?
o PCTFREE: percentage of each page to be left free
o FREEPAGE: Number of pages to be loaded with data between each free page
93. Are views updatable?
o Not all of them. Some views are updatable e.g. single table view with all the fields
or mandatory fields. Examples of non-updatable views are views which are joins,
views that contain aggregate functions (such as MN), and views that have
GROUP BY clause.
94. What is COPY PENDNG status?
o A state in which, an image copy on a table needs to be taken, in this state, the
table is available only for queries. You cannot update this table. To remove the
COPY PENDNG status, you take an image copy or use REPAR utility.
95. What is an inner join, and an outer join?
o nner Join: combine information from two or more tables by comparing all values
that meet the search criteria in the designated column or columns of one table
with all the values in corresponding columns of the other table or tables. This kind
of join which involve a match in both columns are called inner joins.
o Outer join is one in which you want both matching and non matching rows to be
returned. DB2 has no specific operator for outer joins, it can be simulated by
combining a join and a correlated sub query with a UNON.
96.
o
97. What is the difference between primary key & unique index?
o Primary: a relational database constraint. Primary key consists of one or more
columns that uniquely identify a row in the table. For a normalized relation, there
is one designated primary key.
o Unique index: a physical object that stores only unique values. There can be one
or more unique indexes on a table.
98. When do you use the MAGECOPY?
o To take routine backup of tables.
o After a LOAD with LOG NO. After REORG with LOG ON.
99. What is RUNSTATS?
150
o A DB2 utility used to collect statistics about the data values in tables which can
be used by the optimizer to decide the access path. t also collects statistics used
for space management. These statistics are stored in DB2 catalog tables.
100. How do you insert a record with a nullable column?
o To insert a NULL, move -1 to the null indicator
o To insert a valid value, move 0 to the null indicator
C!an"an frae:-
C%AN*EMAN
Change Man is a system that manages and automates the process of migrating
software, or applications, from a development environment to a production environment. Change
Man can manage the installation of a variety of components, such as:
JCL, PROC's, AND UTLTY CONTROL CARDS
Copy code used to compile the programs
151
Batch programs written in Assembler, COBOL, COBOL , or PL/
CCS programs written in Assembler, COBOL, COBOL , or PL/
Programs written in Easytrieve, etc.,
9+# is # C+#n"e !#%<#"eE
A Change Man Change Package is the means by which a new application or change to an
existing application is described, scheduled, prepared, and implemented into production. t may
consist of one or more library components. Each package is identified by a unique Change
Package D consisting of the Application Mnemonic and a sequential number (e.g. HFC002939).
All changes are referenced in the Package Master, which is Change Man's control file. t is a
VSAM file that holds all significant data about current and previous Change Packages.
C+#n"e M#n *i-r#ry En&ironmen
Change Man manages the transition from development to production libraries by using staging
libraries, which are specific to each Change Package. Existing production components are copied
into the development environment where they can be modified and tested. The Change Man
staging libraries can be used for both editing and testing. f private libraries are used during
editing, components will be copied into the staging libraries prior to testing.
NOTE: The baseline libraries contain a current production version (baseline 0) and up to 999
(max.) previous versions of the production component (baseline -1, -2, etc.). When a new
production component is installed, the baseline libraries are rippled. This means that the new
version becomes the current version, what was the current version becomes the 1 version, and
so on.
)rie( O&er&ieH o( C+#n"e M#n *i(e Cy%$e
An overview of the Change Man life cycle is given below. t is a step-by-step description of the
actions necessary to migrate a change from development to production within Change Man.
The first step is to Create a Change Package. A Change Package contains all of the
elements to be edited and installed into production, and is identified by a unique package D
automatically generated by Change Man. When a Change Package is created, the
information that Change Man needs in order to track and control the package is entered. This
includes the implementation instructions, whether it is a temporary or permanent change, the
installation date and time, etc.
The typical next step is to Checkout components from baseline. With checkout,
components from your baseline libraries are copied to either a Change Man staging library or
to a personal development library where changes can be made.
Changes may now be Edited in either the Change Man staging or in the development
libraries.
152
Once editing is completed, the components are ready to Staged. We use the STAGE
function within Change Man to edit a component, compile and link edit a program.
Components such as copy members are simply copied into the staging libraries, if they aren't
there already. The Change Package is now ready for Testing.
The audit process ensures that no unexpected problems will occur. For example, if a
component in the production library has been changed since it was checked out, Change
Man alerts you to the problem by creating an out-of-sync condition for the package.
After successfully passing the audit, the next step is to Freeze the Change Package. This
locks the package(prohibiting further changes), and makes the package available for the
promotion and approval processes. Promotion allows a Change Package to be moved
through various levels of testing (e.g. promote from system testing to acceptance testing).
Once all of the necessary Approvals have been done, the package is ready to be installed.
The installation process depends upon the option used for installation, while creating
package.
Once the package has been installed, Change Man will perform the Baseline Ripple.
Baseline Ripple is the process that Change Man executes to version all package
components, i.e.: 0 becomes 1, -1 becomes 3, etc. and the new baseline 0 version is
installed.

T+e C+#n"e M#n !rim#ry Opion Menu2
This panel is the full Change Man Primary Option Menu:
---------------- CHANGE MAN 4.1.0P PRMARY OPTON MEN NOTFCATON UPDATED
OPTON ===>

1 Build - Create, update and review package data
2 Freeze - Freeze or unfreeze a package
153
3 Promote - Promote or demote a package
4 Approve - Approve or reject a package
5 List - Display (to process) package list
C CDF - Concurrent Development Facility
D Delete - Delete or undelete a package
L Log - Browse the activity log
N Notify - Browse the Global Notification File
O OFMlist - Online Forms package list
Q Query - Query packages, components and relationships
R Revert - Revert a package to DEV status
T Tutorial - Display information about Change Man
X Exit - Exit Change Man

Press ENTER to process; enter END command to exit.

T+e C+#n"e M#n )ui$d C+#n"e !#%<#"e Menu2
This panel is displayed when option 1 is selected from the change man primary option menu.
-------------------------------- BULD OPTONS --------------------------------
OPTON ===>

0 Dates - Display the installation calendar
1 Create - Create a new package
154
2 Update - Update package information
3 Custom - Create, update, approve or review custom forms
4 Utility - Rename and Scratch information
5 Checkout - Check out components from baseline or promotion
6 Stage - Stage, edit, browse and delete components
7 Audit - Audit a package
8 Recompile - Recompile source code from baseline or promotion
9 Relink - Relink or delete load modules
B Browse - Browse\print\copy baseline or promotion
C Compare - Compare staging to baseline or promotion
L Listing - Browse compressed listings
S Scan - Scan baseline for character strings
Z Compress - Compress change package Staging Libraries

Press ENTER to process; Enter END command to exit.

When you create the Change Package, you are defining the outer structure of the change
Package. You specify the date and time for installations, whether the package is temporary or
permanent, the installation site, and implementation instructions, etc. Once you have completed
the following four panels, the package is automatically assigned a unique Change Package D.
Cre#e # NeH !#%<#"e2
This panel is to allow you to define package control information. This panel is displayed when
option 1 is selected form the previous menu (Build Change Package)
Panel 1 of 4.
------------------------- CREATE: CREATE A NEW PACKAGE ------------------------
OPTON ===>
155
L Long method - Prompt for package description and special instructions
PACKAGE TTLE ===>
APPLCATON ===> (Blank or pattern for list)
REQUESTER'S NAME ===>
REQUESTER'S PHONE ===>
WORK REQUEST D ===>
DEPARTMENT ===>
PACKAGE LEVEL ===> (1-Simple, 2-Complex,
3-Super, 4-Participating)
PACKAGE TYPE ===> (Planned or Unplanned,
Unplanned is for Emergency Loads )
PACKAGE TME SPAN ===> (Permanent)
PACKAGE TO COPY FORWARD ===> (Optional package name)
UNPLANNED REASON CODE ===> (* for list)
TEMPORARY CHANGE DURATON ===> (n days)

Press ENTER to process; Enter END command to exit.

All the fields are required for the first time you create a Change Package. SO Enter the Relevant
data and press Enter.
0ener#$ In(orm#ion2
This panel allows you to enter a description of the Change Package. t should be as complete
and descriptive as possible.

Panel 2 of 4
156
------------------------- CREATE: PACKAGE DESCRPTON ------ Row 1 to 12 of 12
COMMAND ===> SCROLL ===> CSR

Press ENTER or END to continue or type CANCEL to exit.

(minimum one line, maximum 46 lines)
'''' ________________________________________________________________________
'''' ________________________________________________________________________
'''' ________________________________________________________________________
'''' ________________________________________________________________________
'''' ________________________________________________________________________
'''' ________________________________________________________________________
'''' ________________________________________________________________________
'''' ________________________________________________________________________
'''' ________________________________________________________________________
'''' ________________________________________________________________________
'''' ________________________________________________________________________
'''' ________________________________________________________________________
******************************* Bottom of data ********************************

Imp$emen#ion Insru%ions2
Use this panel to specify how the package is to be installed. This include the installation
method,and specific implementation instructions to be used by in the individual overseeing the
installation
Panel 3 of 4
157
---------------------- CREATE: NSTALLATON NSTRUCTONS --- Row 1 to 12 of 12
COMMAND ===> SCROLL ===> CSR

Press ENTER or END to continue or type CANCEL to exit.

CONTNGENCY ===> 1 1-Hold production and contact analyst



SCHEDULER ===> CMN (CMN)

(minimum one line, maximum 46 lines)
'''' ________________________________________________________________________
'''' ________________________________________________________________________
'''' ________________________________________________________________________
'''' ________________________________________________________________________
'''' ________________________________________________________________________
'''' ________________________________________________________________________
'''' ________________________________________________________________________
'''' ________________________________________________________________________
'''' ________________________________________________________________________
'''' ________________________________________________________________________
'''' ________________________________________________________________________
'''' ________________________________________________________________________
158
Cre#e onsie in(orm#ion2
Use this panel to select the install date and time. Ensure that these fields are correct, and modify
them or the contacts fields as necessary.
Panel 4 of 4
------------------------- CREATE: ON STE NFORMATON -------------------------
COMMAND ===>

Press ENTER to create the package or type CANCEL to exit.

NSTALL DATE/TME
YYMMDD FROM TO PRMARY/BACKUP CONTACTS PHONE NUMBERS
990316 0400 0415 aftab ullah______________ 630-616-3022___
sabbi vamsidar___________ 630-350-9483___




WARNNG: "From nstall" time of 0200 will automatically set the
"To nstall" time to 0230 . This is to enforce the 0200
load time for online modules.

After the information in the above panel is filled, press ENTER Change man will then
automatically create your change package, return you to the first CREATE panel, and display the
change package number in the upper right hand corner of the panel.
159
T+e C+e%<ou !ro%ess2
Once the package is created next process s checkout. select option 1.5 from primary option
menu. Use this panel to select the list of components to be viewed. Select from components in
the baseline libraries, or components already defined to the Change Package from a previously
coped package.
------------------------------- CHECKOUT OPTONS ------------------------------
OPTON ===>

PACKAGE D ===> HFCG003413

1 Base/Prom - Checkout from baseline or promotion libraries
2 Package - Checkout package components

Press ENTER to process; Enter END command to exit.

C+e%<ou2
Use this panel to enter the checkout information, such as the package to which the component is
to be checked out, the type of component, how the component is to be checked out(foreground of
batch), and the name of the component that is to be checked out, etc.,
----------------------------------- CHECKOUT ----------------------------------
OPTON ===>

L - List libraries where component is located

PACKAGE D ===> HFCG003413 (Package or Application name)

160
COMPONENT NAME ===> (Name or Pattern for list; "ABCDEF" OR "ABC*")
Pattern of only "*" Checks Out all Components
related to Library Type.
LBRARY TYPE ===> CP1 (Blank for list)
LANGUAGE ===> (Applies to source code; * for list)
SOURCE LBRARY ===> 0 (Baseline 0 to -n; Promotion +1 to +n)

CHECK OUT TO ===> S (S-Staging library, P-Personal library)
PERSONAL LBRARY ===>
LBRARY DSORG ===> PDS (Personal library: PDS, SEQ, PAN, LB)

CONFRM REQUEST ===> YES (Y/N)
CHECKOUT MODE ===> 1 (1-Online, 2-Batch)

Press ENTER to process; Enter END command to exit.

S#"e2
Once the components have been check out, they must be STAGED. you will use the STAGE
function within Change Man to edit a component, compile and link edit a program, or to submit
another transformation type of process like a JCL scan etc.
Use the panels on the following page to complete the staging process for your Change Package
components. Once these panels are completed, the component list will be displayed. From it you
may browse ,edit,delete,recompile,display the source/load relationship, or stage a component for
a list of valid selection codes.
T+e S#"in" !ro%ess2
S2#3& O4256789
161
Use this panel to tell Change Man where to get the components that are to be staged. Choose
from a personal library or from existing components within the Change Package option is 1.6
Panel 1 of 1
-------------------------------- STAGE OPTONS --------------------------------
OPTON ===>

PACKAGE D ===> HFCG003413

1 Dev - Stage components from development libraries
2 Package - Process package components
3 Parms - Specify component list selection criteria

Press ENTER to process; Enter END command to exit.

S#"e !#%<#"e Componens2
This panel is used to select the components in your change package that you want to edit,
compile, delete, display history etc. OPTON 2 from previous screen
------------------------- STAGE: HFCG003411 COMPONENTS ----- Row 1 to 12 of 12
COMMAND ===> SCROLL ===> CSR
NAME TYPE STATUS CHANGED LANGUAGE PROCNAME D REQUEST
__ ETRTDATA CP1 ACTVE 990403 045047 VEN214
__ LCC261 H3 NCOMP 990405 062822 COBOL370 COBOL370 VEN080
__ LSADL05 H3 ACTVE 990403 042020 COBOL370 COBOL370 VEN214
__ LSAETAD H3 ACTVE 990403 042045 COBOL370 COBOL370 VEN214
__ LSAL05P H3 ACTVE 990403 045624 COBOL370 COBOL370 VEN214
162
__ LSAL05PC CP1 ACTVE 990403 045220 VEN214
__ LSAL051 H3 ACTVE 990403 042233 COBOL370 COBOL370 VEN214
__ LSAUL05 H3 ACTVE 990403 042342 COBOL370 COBOL370 VEN214
__ LSEL05M H3 ACTVE 990403 042422 COBOL370 COBOL370 VEN214
__ LSPL05 H3 ACTVE 990403 042546 COBOL370 COBOL370 VEN214
__ LSPL05G CP1 ACTVE 990403 045057 VEN214
__ LSRL05M H3 ACTVE 990403 042653 COBOL370 COBOL370 VEN214
******************************* Bottom of data ********************************
Compi$e #nd $in< Edi2
This panel is used to compile and optionally link a source component.
Panel 2 of 3.option is S on the previous menu CMD option.
------------------- STAGE: COMPLE AND LNK EDT / JCL CHECK ------------------
COMMAND ===>

PACKAGE D: HFCG003411 STATUS: DEV NSTALL DATE: 990420

STAGED NAME: LCC261
LBRARY TYPE: H3 - MS Online COBOL LE/370 load to LM
LANGUAGE: COBOL370
DATASET NAME: D131.CP000000.CMN.HFCG.#003411.H3

COMPLE PROCEDURE ===> COBOL370 (Blank for list; ? for designated procedure)
COMPLE PARMS OR JOB NAME ===>
(Enter JOB Name for PROCs requiring associated JOB for JCLCHECK)
163
LNK EDT PARMS ===>
DB2 PRE-COMPLE ===> NO (Y/N)
OTHER OPTONS ===> YES (Y to display other options)

JOB STATEMENT NFORMATON:
===> //VEN080U JOB (050D,WD1A),'CHNGMAN
COMPARE',CLASS=W,____________________
===> //
MSGCLASS=T,NOTFY=VEN080___________________________________________
===> //*_____________________________________________________________________
===> /*ROUTE PRNT
PUNE______________________________________________________
Press ENTER to process; Enter END command to exit.
S#"e User Opions2
This panel is an optional panel that is customized for each customer site.Enter a 'Y' for the
options that you wish to select. Press Enter on the preious menu.
----------------------------- STAGE: USER OPTONS -----------------------------
COMMAND ===>

NAME: LCC261 TYPE: H3 LANGUAGE: COBOL370

COMPLE ONLY ===> ??? ENTRY TO DLTCBL ===> Y
CCS PRE-COMPLE ===> DROP NCLUDE STMTS ===>
EASYTREVE NO NAME ===> XPEDTER COMPLE ===>
FORMAT TO MSTEST ===> NCLUDE MQSERES ===>
(TEST MFS S DEFAULT)
164

JCK FULL LSTNG ===> USER OPTON 10 ===>
USER OPTON 11 ===> USER OPTON 12 ===>
USER OPTON 13 ===> USER OPTON 14 ===>
USER OPTON 15 ===> USER OPTON 16 ===>
USER OPTON 17 ===> USER OPTON 18 ===>
USER OPTON 19 ===> USER OPTON 20 ===>

Use Y or N to select or deselect additional processing options;
Press ENTER to continue; Enter END command to exit.
!#%<#"e *is2
Use the Package List panels as an alternative way to perform a variety of Change Man functions.
Use this panel to select the Change Packages to be listed. f the Package Name field is left blank,
you can select the application for which you would like to see a package list. Option is 5 from
Primary change man screen
--------------------------- PACKAGE LST PARAMETERS ---------------------------
COMMAND ===>

SPECFY SELECTON CRTERA:
PACKAGE D ===> HFCG (Full name or pattern; blank for list)
PACKAGE STATUS ===> (DEV, FRZ, APR, REJ, DS, NS,
BAS, BAK, OPN, CLO, TCC or DEL)
CREATOR'S TSO-D ===>
WORK REQUEST D ===>
DEPARTMENT ===>
165
PACKAGE LEVEL ===> (1-Simple, 2-Complex,
3-Super, 4-Participating)
PACKAGE TYPE ===> (Planned or Unplanned)
PACKAGE TME SPAN ===> (Permanent or Temporary)
FROM NSTALL DATE ===> (YYMMDD)
TO NSTALL DATE ===> (YYMMDD)
FROM CREATON DATE ===> (YYMMDD)
TO CREATON DATE ===> (YYMMDD)
OTHER PARAMETERS ===> (Y/N)

Press ENTER to process; Enter END command to exit.

T+e C+#n"e !#%<#"e *is2
This panel displays the Change Packages selected from the previous panel . There are 36
different line commands available for this panel, which can be placed on CMD filed.
----------------------------- CHANGE PACKAGE LST ------------ Row 1 to 2 of 2
COMMAND ===> SCROLL ===> CSR
PACKAGE D STA NSTALL LVL TYPE WORK REQUEST DEPT PROMOTON AUD
CREATOR
__ HFCG003193 DEV 990320 SMPL PLN/PRM VEN214 VEN214
__ HFCG003411 DEV 990420 SMPL PLN/PRM VEN214 VEN214
******************************* Bottom of data ********************************
166
Ui$iies2
R&:6;45%&9
The Recompile function can be used to resolve some of the out-of-sync conditions that can occur
from the Audit process. The recompile is done from baseline or promotion, directly into staging
libraries.
------------------------------- RECOMPLE SOURCE ------------------------------
OPTON ===>

R - Recompile one component
L - List libraries where component is found
blank - Display member selection list

PACKAGE D ===> HFCG003411
COMPONENT NAME ===> (Blank or pattern for list)
SOURCE LBRARY TYPE ===> (Blank for list)
LANGUAGE ===> (Blank for list)
LBRARY LEVEL ===> (Baseline 0, Promotion 1 to n)

Press ENTER to process; Enter END command to exit.
After Entering the required data press Enter. You would get the Recompile job information screen
where the data has to be entered and press ENTER. Your job is submitted.
R&%57<9
Any time a statically linked subroutine has been modified, relinking is required. Use think function
to delete a relinked or recompiled load module from your Change Package.
-------------------------- RELNK/DELETE LOAD MODULES -------------------------
OPTON ===>
167
R - Relink single load module
D - Delete relinked/recompiled module
blank - Display LCT member selection list for multiple member processing

PACKAGE D ===> HFCG003411
RELNK FROM ===> S (S-Staging or B-Baseline)
LCT MEMBER LST ===> (Y - Yes or N - No; member list will be created with input
library type)
NPUT LBRARY TYPE ===> BLM (Blank for list)
TARGET LBRARY TYPE ===> BLM (Blank for list)
MEMBER NAME ===> (Blank for list; required for options R/D)
COMPLE PROCEDURE ===> (Blank for list)
LNK EDT PARMS ===>
DB2 PRE-COMPLE ===> (Y/N)
OTHER OPTONS ===> YES (Y/N for additional user options)
JOB STATEMENT NFORMATON:
===> //VEN080V JOB (050D,WD1A),'CHNGMAN
COMPARE',CLASS=W,____________________
===> //
MSGCLASS=T,NOTFY=VEN080___________________________________________
===> //*_____________________________________________________________________
===> /*ROUTE PRNT
PUNE______________________________________________________

Press ENTER to process; Enter END command to exit.
168
Fileaid :-
FILE AID
GENERAL NFORMATON
Designed for applications and systems programmers, File-AD is an interactive, full-screen
system for editing, browsing, defining, copying, reformatting, comparing, and printing VSAM, AM,
SAM, PDS, BDAM, and sequential files under TSO/SPF.
KEY FEATURES
File-AD's functions enable you to significantly reduce the time required to perform day-to-day
data file manipulation tasks such as creating and modifying test data, resolving production data
problems, and performing ad-hoc file conversions and comparisons.

KEY FEATURES:
o Eliminates SPF editing restrictions
169
- provides on-line editing of sequential, BDAM, PDS, SAM, AM, and VSAM files using
formatted, full-screen displays
- eliminates record length restriction
eliminates file size restriction by using selection criteria to limit the number of records to
be edited
- supports files in compressed/encrypted format (with /O exits)
- provides optional audit trail of all records updated, inserted, and deleted while editing a
data file
o Uses existing COBOL or PL/ record layouts directly
- the record layout is the sole definition of files thus eliminating the need to redefine the
file/data in another language
- superimposing the record layout over raw data brings meaning to that
data
- files may be printed in a formatted manner using the record layout

o Has powerful, easy to use, copying and reformatting capabilities
- these capabilities exist in both batch and on-line modes
- no language to learn and no programming required
- records may be selected for copying using selection criteria based on record counts and/or
specific values in individual fields .
- selection criteria can be used in the Browse, Edit, Copy, Print, or Compare functions .
o Runs as a single dialog under SPF
- uses menu-driven, full-screen, interactive SPF-like displays
- has user defined PF (program function) key support
- can operate "split-screen" with SPF/PDF
- easy to learn and use
- a fully interactive product with batch capabilities
170
- executes in storage available above the 16 megabyte line on systems running MVS/XA or
MVS/ESA
GENERAL NFORMATON NVOKNG File-AD
File-AD executes as a dialog under BM's SPF dialog manager facility. You can invoke it by
selecting the File-AD option from a customized version of the SPF primary option menu, or from
a sub-menu panel your installation has set up.
f the File-AD execution CLSTS have been installed, you may invoke File-AD from any SPF
screen. For example, the command TSO FASTART suspends your current screen and displays
the File-AD primary option menu. Upon exit from File-AD your suspended screen is restored.
The following will be presented only if selected by number:
1 - File-AD execution CLSTS
GENERAL NFORMATON SUMMARY OF OPTONS 0-C
The File-AD primary options are:
OPTON 0 - SPECFY SPF AND File-AD PARAMETERS
This option consists of the SPF-provided parameter option screens and several screens to
specify File-AD default parameters.
OPTON 1 - BROWSE FLE
This option is used to display but not change the contents of files using any of three display
modes - formatted, vertical, and character.
OPTON 2 - EDT FLE
This option is used to create, display and change the contents of files using the formatted,
vertical, and character display modes.
OPTON 3 - UTLTES/E
This option accesses a menu of dataset management utilities. ncluded are:
3.1 Library (PDS directory management and CSECT info),
3.2 Dataset (Non-VSAM dataset allocation, information),
3.3 Copy (Selective record copying for all file types including PDS members),
3.4 Catalog (search catalog using pattern characters)
171
3.5 VSAM (Define VSAM clusters, indexes, and paths online or in batch),
3.6 Search/Update (Scan or perform global changes for any dataset),
3.7 VTOC (Search volumes for datasets using pattern characters, analyze space),
3.8 nteractive (run File-AD/Batch online),
3.9 Submit (create batch JCL).
OPTON 5 - PRNT FLE
This option is used to print data file contents, the selection criteria and rcd/layout XREFs
created in options 6 and 7 of File-AD, formatted record layouts, and audit trail datasets created
while editing a data file in option 2 (Edit) or 3.6 (Update) of File-AD.
OPTON 6 - EDT SELECTON CRTERA
This option is used to create and maintain selection criteria for use in the Browse, Edit, Copy,
Print, and Compare functions.
OPTON 7 - EDT RCD/LAYOUT XREF
This option is used to create and maintain rcd/layout XREFs for use in other File-AD
functions.
OPTON 8 - VEW RECORD LAYOUT
This option is used to display the contents of COBOL or PL/ layouts as interpreted by File-AD.
OPTON 9 - REFORMAT FLE
This option allows the records of an input file to be reformatted and written to an output file
based on record layouts defining the input and output files.
OPTON 10 - COMPARE
This option is used to compare two files and report the differences between
them.
OPTON C - File-AD CHANGES
This option documents changes made in the various releases of File-AD.
GENERAL NFORMATON SCREEN FORMATS
File-AD uses the full screen for display and entry of data.
172
The first three lines of each display, called the heading lines, have a common format for all File-
AD displays. The remainder of the screen may contain a list of options, input fields and prompts,
or scrollable data.
The first three lines of each display are formatted as follows:
|----------------------------------------|------------------------ --|
line 1: | TTLE | SHORT MESSAGE |
|--------------------------------------- |------|---------- ---|
line 2: | COMMAND/OPTON | SCROLL |
|---------------------------------------------- --|---------------- ---|
line 3: | LONG MESSAGE |
|-----------------------------------------------------------------------|
The TTLE area (line 1) identifies the function being performed and, where appropriate, library or
dataset information.
The SHORT MESSAGE area (line 1) is used to indicate:
- Current line or column positions
- Successful completion of a processing function
- Error conditions (accompanied by audible alarm)
The COMMAND/OPTON area (line 2) is used to enter a command. On an option selection
menu, it may be used to enter either a command or an option.
The SCROLL area (line 2) contains the current scroll amount whenever scrolling is applicable.
You may change it by overtyping.
The LONG MESSAGE area (line 3) is used to display an explanation of error conditions upon
request (see HELP command). This line will normally be blank or will contain heading (non data
entry) information. Dataset specification screens allow you to enter information such as dataset
names, member names, and other parameters. The fields in which you may enter information
are labeled and preceded with an arrow. f you fail to enter a required value or if you enter
inconsistent values, you are prompted with a message.

|************************************************
173
The example at the right | File-AD ------------- Edit - Dataset Specifi
shows the edit dataset | COMMAND ===>
specification screen. |
| Edit Mode ===> C (F=Format
|
| Specify Edit nformation:
| Edit Dataset name ===> FASAMP.*
| Member name ===> (Blank or
| Volume serial ===> (f datas
| Disposition ===> OLD (SHR or O
| Create audit trail ===> N (Y = Yes;
Several fields on dataset specification screens are pre-entered with values that you entered the
last time on that screen or on a similar screen. f the values are correct, simply press ENTER. f
the values are not correct, overtype the fields that need to be changed before pressing
ENTER.
The pre-entered information comes from your user profile, which File-AD automatically builds
and maintains across sessions. nformation that is maintained in your user profile
includes:

- Dataset names and member names
- Job statement information
- SYSOUT class for printed output
- Parameters entered via Option 0 (Parameters)
- PF-Key defaults

GENERAL NFORMATON MEMBER SELECTON SCREENS
174
A member selection screen is an alphabetic list of the members of a partitioned dataset. t is
displayed when requested from any of the File-AD functions 1-10.
n most functions it is possible to obtain multiple member lists prior to entering the function.

|************************************************
The example at the right | File-AD ---- EDT - PROJECT.TEST.DATA --------
shows the selection of | COMMAND ===>
member TESTFL3 from the | NAME VER.MOD CREATED LAST M
partitioned dataset | TEST1 01.04 08/17/93 09/23/
PROJECT.TEST.DATA | TEST2 01.02 06/12/93 09/13/
| S TESTFL3 01.13 07/29/93 09/20/
| TESTFL4 01.07 08/01/93 08/29/
| TESTFL5 01.11 07/01/93 09/01/
Scrollable data display screens show file contents or record layouts and allow up/down
scrolling, and in some cases left/right scrolling. On many scrollable data display screens, you can
also update file contents by typing over fields on the screen.
The example below shows the edit formatted screen. You can scroll using the UP and DOWN
commands, and can update file contents by typing over the FELD VALUE column.
File-AD ---- EDT - PROJECT.TEST.DATA(TESTFL3) -------------------- LNE 00001
COMMAND ===> SCROLL ===> PAGE
RCD SEQ NO 1
--------LEVEL NUMBER/DATA-NAME--------- -OFFSET- ---------FELD VALUE----------
01 ORDER-LNE
05 TEM-NO 1 PS/2 MOD50
05 QTY-ORDERED 11 100
05 LST-PRCE 14 2400.00
175
GENERAL NFORMATON UNSCROLLABLE DATA DSPLAY SCREENS
Unscrollable data display screens show "nonrepeating" information which fits on a single
screen. The Selection Criteria Options screen shown below is an example of this type of
screen.
********************************************************************************
File-AD ---- Selection Criteria - Options ------------------------------------
COMMAND ===>

Selection criteria options
First, start at the following record KEY
Starting record key ===>
- OR - OR at the following RBA
Starting RBA ===> (both blank for start of file

nitial records to skip ===> 0 then skip this many records

GENERAL NFORMATON COMMAND ENTRY
File-AD provides commands for commonly used functions. You may enter commands in one of
two ways:
1) By typing the command in the command/option field (line 2 of the screen) and then pressing
the ENTER key, or
2) By pressing a program function (PF) key to which you have assigned the desired command.
You can assign commands to PF keys using option 0.0.3 or the KEYS command. When you
press the PF key, the processing is the same as if you typed the command in the command field
and pressed ENTER.
Before you press a PF key, you can enter information in the command field. The PF key definition
is concatenated ahead of the contents of the command field. For example, suppose you assign
176
the DOWN command to the PF8 key. f you type "6" in the command field and press PF8, the
results are the same as if you had typed "DOWN 6" in the command field and pressed ENTER.
You can stack multiple commands for execution in one interaction by entering a special delimiter
between the commands. The default delimiter is a semicolon (;). You can change the delimiter
using option 0.0.1. For example:
COMMAND ===> DOWN 10;LEFT
n this example the DOWN and LEFT commands have been stacked.
GENERAL NFORMATON COMMAND SUMMARY
File-AD primary commands are divided into four categories listed below. Commands designated
with an asterisk (*) have the same syntax and function as in SPF.
n many File-AD functions, the information to be displayed exceeds the screen size. Scroll
commands allow you to move the screen "window" in as many as three dimensions across the
information: up/down, left/right, and forward/back. For a more detailed description of scrolling,
see the SCROLLNG section within GENERAL NFORMATON.
The scroll commands are:
UP * Causes scrolling toward the top of a record, file, record layout, or member list.
DOWN * Causes scrolling toward the end of a record, file, record layout, or member list.
LEFT * Causes scrolling toward the left margin of the data or causes backward scrolling
towards the beginning of a file.
RGHT * Causes scrolling toward the right margin of the data or causes forward scrolling
towards the end of a file.
FORWARD Causes record scrolling toward the bottom of the file.
BACK Causes scrolling toward the top of the file.
LOCATE Causes up or down scrolling to the specified line number, label, or member
name.
LOCATE Causes up or down scrolling to the record with a label (dataname) or exclude
classification. Also causes scrolling to a data-name that contains, in part or full, the data
name(occ) string.
LR Causes forward or backward scrolling to a specified record number, label, or any record
with a label classification.
177
RECORD MANPULATON COMMANDS
Record manipulation commands allow you to update file contents and to find and change
occurrences of a string in a file.
The record manipulation commands are:
NSERT Causes "n" records to be inserted after the current record (not supported for BDAM
files)
DELETE Causes "n" records to be deleted beginning with current record (not supported for
BDAM files)
REPEAT Causes a record to be repeated "n" times (not supported for BDAM
files)
FND Causes one or all occurrences of a string to be found
RFND * n Edit or Browse, causes the previous FND command to be repeated
CHANGE Causes one or all occurrences of a string to be changed
RCHANGE * n Edit, causes the previous CHANGE command to be repeated
SAVE * Causes the data to be stored back into the edit dataset
UNDO Causes the last applied change to data to be reversed
When using an XREF to work with "segmented" records the following are valid:
ADD nsert a segment at a point in the record.
NEXT Display NEXT segment of record using correct layout
REMOVE Remove a segment at a point in the record.
TOP Return to start of record and display base
USE Display layouts and allow manual selection and relocation
SESSON CONTROL COMMANDS
Session control commands have to do with terminating the current function or switching from one
function to another.
The session control commands are:
178
CANCEL * Causes editing to be terminated without saving the data
END * Terminates the current operation and returns to the next higher level screen (also
used to indicate end of table input)
RETURN * Causes an immediate return to the primary option menu or to a specified
option
Recursive commands: File-AD has special commands like F1 (Browse), F2 (Edit), F33 (Copy)
that let you suspend your current display and start another function. Upon end from the new
function, the suspended display is resumed.
The following will be presented only if selected by number:
1 - Recursive Commands

MSCELLANEOUS COMMANDS
Miscellaneous commands cover a variety of functions. They are listed and briefly described
below.
KEY Causes a specified key to be retrieved or the key specification screen to be displayed
(applies to BDAM, SAM, VSAM-KSDS, VSAM-RRDS, and AM files only)
HEX * Causes data to be displayed in either hexadecimal or character format
CAPS * Causes alphabetic data entered from the terminal to be either translated to upper case
or left as-is
RESET * Causes a general resetting of intensified messages and incomplete line commands
CHAR Causes a switch from Formatted or Vertical editing modes to Character editing
mode
FORMAT Causes a switch from Vertical or Character editing modes to Formatted editing mode
(Aliases: FMT, MAP)
VFMT Causes a switch from Formatted or Character editing modes to Vertical editing
mode
SPLT * Causes split screen mode to be entered or changes the location of the split
line
SWAP * Moves the cursor to wherever it was previously positioned on the other logical screen
of a split screen pair
179
TSO * Allows a TSO command or CLST to be entered from any screen
KEYS * Causes an immediate display of a screen on which current PF key definitions are
displayed and modifiable
PANELD * Causes all subsequent screens to be displayed/not displayed with the panel identifier
shown in the upper left corner of the screen
HELP * Displays additional information about an error or switches to the on-line
tutorial
CURSOR * Moves the cursor to the first input field on line 2
PRNT * Causes a snapshot of the current screen to be recorded in the SPF list file for
subsequent printing
PRNT-H* Same as PRNT except that high-intensity characters on the screen are printed with
overstrikes to simulate the high-intensity display
JCL Causes the generated JCL to be displayed

GENERAL NFORMATON PA KEYS
The two program access (PA) keys have special meaning in SPF and File-AD. They are not
equated to SPF or File-AD commands, and they may not be reassigned.
Normally, you should not use PA1 while operating in File-AD full screen mode. However, there
are two exceptions.
f you press PA1 after the keyboard has been unlocked by File-AD, it is treated like PA2
(RESHOW). t does not cause exit from File-AD. However, if you press PA1 a second time
without any intervening interaction, it causes the current processing to be terminated and the
SPF PRMARY OPTON MENU is redisplayed.
f you press PA1 after the keyboard has been manually unlocked (by pressing the RESET key), it
usually causes the current processing to be terminated. The SPF PRMARY OPTON MENU is
redisplayed.
You can use PA2 to reshow the last full screen image displayed by File-
AD.
You may need to reshow the screen if you accidentally press the ERASE NPUT or CLEAR key,
or if you have typed data on the screen that you want ignored and have not yet pressed ENTER
or a PF key.
180
DEFAULT ASSGNMENT

PROGRAM FUNCTON KEYS
When you begin using File-AD, |-------------|---- --------|------------
-----|
commonly used commands are assigned | PF1/13 | PF2/14 | PF3/15 |
to the PF keys as shown on the right. | HELP | SPLT |
END |
| |
| |
You can change these default assignments
|--------------|-------------|-----------------|
in option 0.0.3 or via the KEYS command. | PF4/16 | PF5/17 | PF6/18 |
| RETURN | RFND |
RCHANGE |
| | |
|

|---------------|------------|------------------|
| PF7/19 | PF8/20 |
PF9/21 |
| UP | DOWN |
SWAP |
| |
| |

|---------------|-------------|-----------------|
| PF10/22 | PF11/23 |
PF12/24 |
181
| LEFT | RGHT |
RETREVE |
| |
| |

|----------------|------------|-----------------|
GENERAL NFORMATON SCROLLNG
n many File-AD functions, the information to be displayed exceeds the screen size. Scrolling
allows you to move the screen "window" in as many as three dimensions across the information:
up/down, left/right, and forward/back.
You accomplish this using two basic types of scrolling:
PAGE SCROLLNG
The page scrolling commands and default PF key assignments are:
UP (PF7/19) - to scroll toward the top of the data
DOWN (PF8/20) - to scroll toward the bottom of the data
LEFT (PF10/22) - to scroll toward the first column of the data
RGHT (PF11/23) - to scroll toward the last column of the data
These commands function exactly as they do in SPF/PDF. On all screens involving scrolling, a
scroll amount is displayed on line 2 of the screen. This value indicates the number of lines or
columns to scroll when you enter one of the four page scrolling commands. You can change the
scroll amount by simply typing over the scroll amount field.
Valid scroll amounts are:
- a number from 1 to 9999 - specifies the number of lines/columns to scroll
- PAGE - specifies scrolling by one logical page
- DATA - specifies scrolling by one logical page less one line
- HALF - specifies scrolling by one-half logical page
- MAX - specifies scrolling to the top, bottom, left margin, or right margin, depending on which
scrolling command is used.
182
- CSR - specifies scrolling based on the current position of the cursor. The line or column where
the cursor is positioned is moved to the top, bottom, left, or right of the screen depending on
which scrolling command is used. f the cursor is not in the body of the data, or if it is already
positioned at the top, bottom, left, or right, a full page scroll occurs.
For scrolling purposes a "page" is defined as the amount of information currently visible on the
logical screen. n split screen mode, for example, the edit character display might have 12 lines
by 80 columns of scrollable data. n this case, a scroll amount of HALF would move the window
up or down by 6 lines, or right or left by 40 columns.
The current scroll amount is saved in the user profile. When you type over the scroll amount, the
new value remains in effect until you change it again.
You can override the current scroll amount on a given interaction by entering a scroll amount in
the command field and using a scroll command or PF key.
For example, you can enter:
COMMAND ===> DOWN 5 and press ENTER or

COMMAND ===> 5 and press the DOWN PF key
Either form results in a temporary, one-time override of the scroll amount.
To reduce keystrokes, you can change the scroll amount field by typing over the first character(s)
only:
- To change the scroll amount to PAGE, DATA, HALF, MAX, or CSR, type over the first character
with P, D, H, M, or C respectively.
- To change the scroll amount to a number of lines or columns, type over the first character(s)
with the desired number.
RECORD SCROLLNG
The record scrolling commands are not directly assigned to a PF key:
FORWARD (or FWD ) - to scroll toward the end of the file
BACK - to scroll toward the beginning of the file
The LEFT (PF10/PF22) and RGHT (PF11/PF23) commands can be used in place of BACK and
FORWARD, respectively.
183
These commands apply to the screens where one "record" per screen is displayed formatted with
a record layout (edit/browse Formatted, edit formatted field selection criteria, define formatted
XREF) and are used to move forward or backward "n" records (or criteria sets) in a file.
You enter the scroll amount for record scrolling in the COMMAND input area (unless you have
assigned both the command and the scroll amount to a PF key). Valid scroll amounts
are:
- a number from 1 to 2,147,483,647 - specifies the number of records to scroll FORWARD or
BACK
- MAX or M - specifies scrolling to the last record (FORWARD) or the first record (BACK) in the
file
GENERAL NFORMATON SPLT SCREEN
There may be times when you want to perform another File-AD function or SPF/PDF function
without ending the current function. File-AD provides the ability to 'split' the physical screen
image into two logical screens that operate independently of one another, as though you had two
terminals.
n split screen mode, only one of the logical screens is considered active at a time. Any
interactions, such as pressing ENTER or a PF key, are interpreted as having meaning for the
active screen. The current location of the cursor identifies which of the two screens is active. To
switch from one screen to the other, simply move the cursor to the desired screen or enter the
SWAP command.
GENERAL NFORMATON TERMNATNG File-AD
You can terminate File-AD in any of three ways:
1) by entering the END command on the primary option menu
2) by entering option X on the primary option menu
3) by entering the =X jump command from any screen
When you invoke File-AD from the SPF primary option menu, eventually terminate SPF/PDF
using the END command, and used either the log or list files, a termination screen is displayed.
GENERAL NFORMATON File-AD DATASETS
General information about the use of datasets by File-AD follows. Each topic is presented in
sequence, or may be selected by number:
1 - Conventions for Specifying Datasets
184
2 - Data File Dataset
3 - Record Layout Dataset and source language support
4 - Layout XREF Dataset
5 - Selection Criteria Dataset
6 - Reformat Definition Dataset
7 - Member List Processing

All datasets processed on-line must reside on a direct access storage device or on a mass
storage device. Uncataloged disk data file datasets are allowed in all functions and can be
accessed by specifying a VOLSER.
Temporary data files and tape datasets are allowed as input to independent File-AD/Batch jobs
for which you develop the JCL. File-AD/Batch JCL can be optionally generated with Copy (3.3),
Search/Update (3.6), Print (5.x), Reformat (9), and Compare (10)
CONVENTONS FOR SPECFYNG DATASETS
When a Dataset Name is required in File-AD, you may enter a fully qualified (quoted), unqualified
(no quotes, userid prefix implied), or pattern (catalog search request).
File-AD saves the name of the most recently referenced dataset of each type (Data file, Record
Layout, XREF, Selection Criteria) in your session profile and redisplays these names on all
appropriate screens.
FULLY QUALFED NAMES
You may enter any fully qualified data set name by enclosing the name in apostrophes (').
Trailing quotes are never required.
Example: Dataset name ===> 'SYS1.MACLB'
UNQUALFED NAMES

185
f you omit the apostrophe(s), your TSO prefix is left-appended to the entered data set name
(unless the TSO profile option "NOPREFX" has been specified).
f you specify a default VSAM NTERMEDATE NAME with the 0.1 System Parameters function,
and/or your installation uses the optional File-AD VSAM high level index, and no dataset can
be
Found with the combination of "TSO-PREFX.DATASET", a new "VSAM prefix" is constructed as
follows:
VSAM high level index.VSAM NTERMEDATE NAME.
The constructed "VSAM prefix" is then left-appended to the entered dataset name (VSAM
prefix.dataset) and the catalog is again searched for the dataset. f allocating a VSAM cluster,
with the 3.5 VSAM utility, the VSAM prefix is always constructed when an unqualified name is
specified.
UNCATALOGED DATASETS
f the dataset is not cataloged, you must specify a Volume serial number.
USNG PATTERN CHARACTERS - CATALOG SEARCH
You can use pattern characters in the dataset field to dynamically invoke File-AD's catalog
search (3.4) to look for matching dataset names. Valid pattern characters are: ? and % (single
character) * (multiple characters in one node), + (0 or more nodes). Pattern characters are used
to represent any or all characters which are not part of the high-level node of a dataset name.
The high-level node must be fully specified. Following are some examples of using the
asterisk (*) to retrieve a list of datasets:
COMPARE DATASET ===> FLE.*
or
COMPARE DATASET ===> 'userid.FLE.*'
or
COMPARE DATASET ===> FLE.ABC*
USNG PATTERN CHARACTERS - CATALOG SEARCH (cont.)
After specifying the pattern, press ENTER. The File-AD 3.4 Catalog Utility is invoked, and a
list of datasets corresponding to the pattern that you specified is displayed. Type S in the
COMMAND column to the left of the name of the dataset you want to select and press ENTER.
186
The selected dataset will be used and will replace the pattern you specified on the panel for the
function you are performing.
f you are not licensed for File-AD/SPF, you will receive an error if you use a pattern
character in the dataset field.
For further information on pattern characters, explore the tutorial for the 3.4 Catalog utility or
see the File-AD Online Reference Manual, CATALOG UTLTY.
PDS DATASET(MEMBER)
A member name enclosed in parentheses may follow the data set name (within the apostrophes,
if they are present) for partitioned data sets. For selection purposes, specifying a member name
for a partitioned dataset will cause the member to be processed as a sequential dataset.
n most instances a Member Name prompt is provided under the Dataset Name prompt. f a
member name is specified in parentheses along with the dataset name, the member information
is considered as if it had been entered in the Member Name field.
PDS MEMBER NAME MASKS
When referencing a PDS dataset, you may specify a Member Name of blank, or use a pattern to
generate a list of members for selection.
PDS MEMBER NAME MASKS (cont.)
You can use a question mark (?) or percent (%) to represent a single character of the member
name or an asterisk (*) to represent multiple
characters in a member name. However, you must enter at least the first character of the
member name before you can use the asterisk. (Exception: in 3.3 Copy or 3.6 Search Update, a
member name of asterisk (*) means to process all members and to bypass all PDS
Processing Options screens and member lists.)
Using blank or a member name pattern will either cause a File-AD member list to be displayed or
a PDS Processing Option screen to appear to provide additional member selection options.
Once a list of members is presented, you can select a member from this list by using the S line
command.
You can also enter the full member name, in parentheses, on the same line as the dataset name.
f you do so, you can ignore the Member Name field.
GENERATON DATASETS
Generation data sets may be referenced by using a signed or
187
unsigned number enclosed in parens.
Example: ===> 'GDS.TEST(0)'
This example references the most recently allocated data set in
the generation data group. Minus numbers reference previously
allocated data sets and positive numbers reference unallocated
data sets of the group.

CATALOG DATASET
On some panels a catalog dataset name may be entered. n this case whether the catalog
dataset name is enclosed in quotes or not, the name is always considered to be a fully qualified
name and no prefix is appended to it.
Catalog dataset name ===> 'CATALOG.DATASET'
Catalog dataset name ===> CATALOG.DATASET
n the above example, both entries are correct and treated equally.
DATA FLE DATASET
The data file dataset contains the data to be browsed, edited, reformatted from/into, copied
from/into, searched, updated, printed or compared. t can also be a dataset you are defining or
managing with the extended utilities.
File-AD supports user written /O exit programs for data file datasets. /O exits can handle
compression/decompression, encryption/decryption, or can perform all physical /O to your data
file. See the File-AD nstallation Guide for details and samples.
The next two tutorial pages display tables showing the combinations of dataset organizations and
record formats allowed for data files. For sequential (PS), partitioned (PO), BDAM (DA), and
SAM (S) files, the LRECL and BLKSZE can range from 1 to 32,760 for each RECFM. For
VSAM files, the LRECL can range from 1 to 32,767.
The table below shows the combinations of dataset organizations and record formats allowed for
data files.
RECFM
DSORG F FB V VB U SPANNED
PS X X X X X X
188
(Sequential)
PO
(Partitioned)
X X X X X X
S (ndexed
Sequential)
X X X X n/a n/a
DA (BDAM) X X
The table below shows the combinations of dataset organizations and record formats allowed for
VSAM data files.
RECFM
DSORG F FB V VB U SPANNED
AM (VSAM-
KSDS,ESDS)
n/a n/a X n/a n/a X
AM (VSAM-
RRDS)
X n/a n/a n/a n/a n/a
AM (AM) X n/a X n/a n/a X
AM (VSAM-
LDS)
(allocate, delete, info only)
1) VSAM-KSDS and ESDS files are treated as variable length files. Also, the concept of
blocking, as applied to PS, PO, and S files, does not apply to VSAM.
2) File-AD does not support SAM files with OPTCD=L in the DCB information when the key
starts in the first position (RKP=0 for fixed length files, RKP=4 for variable length files)
3) File-AD does not support fixed length unblocked SAM files with a relative key position of 0
(RKP=0), or variable length unblocked SAM files with a relative key position of 4
(RKP=4).
4) File-AD supports reading a VSAM-KSDS in an alternate key sequence via a VSAM PATH. A
PATH name may be specified for the input data file name in the browse, edit, copy, print, and
compare options.
5) File-AD treats RECFM=FB BDAM files as RECFM=F (i.e., records are not de-blocked.)
Keyed BDAM files are processed by File-AD as if the key were concatenated in front of
each data block.
6) AM files exist as fixed or variable length files. Due to a constraint in the information available
to File-AD from the AM access method, all files are currently handled as variable length files. f
the length is changed on an AM file which is truly fixed, File-AD will display an error message.
AM files are processed as VSAM-KSDS files in all functions.
OS PASSWORD PROTECTED FLES
File-AD allows you to access data file datasets with OS password protection. Any dataset may
be protected to permit read-only or read/write access. More than one password may be assigned
189
to the same dataset. A dataset that is read/write protected, for example, might allow several
authorized users to read it, but only one user to write.
f you attempt to access a dataset protected by an OS password, File-AD will present the OS-
Password-Protected screen containing a field where you can specify a dataset password as
follows:
Dataset password ===>
A nondisplay input field is used so that the password does not appear on the screen while you
are typing it.
Note that the File-AD 3.5 VSAM utility supports specification and modification of passwords for
VSAM clusters.
RECORD LAYOUT DATASET
This dataset contains the record layouts which are used in many File-AD functions. The record
layout dataset can be one of four types:
TYPE DSORG RECFM LRECL
Partitioned Dataset PO F, FB, V, VB 80
PANVALET file * * *
LBRARAN file * * *
Standard sequential
dataset
PS F, FB, V, VB 80
Must conform to the requirements for a valid CA-PANVALET/LBRARAN file. CA-PANVALET
and CA-LBRARAN are products of Computer Associates nternational, nc.
A record layout may be a separate COPYLB member or may be hard-coded within the source
statements of a program. f the layout is in a program or if a COPYLB member contains multiple
record layouts, you can isolate the specific layout, or portion of a layout, that File-AD should use
by specifying a starting data-name.
f you do not specify a starting data-name, File-AD uses every layout found in the program, or
COPYLB member, to format the data, treating the second through last layouts as additional
layouts that may be manually selected and overlaid at any offset via the USE command.
Note: File-AD Release 6 "MAP" libraries containing compiled record layouts are acceptable as a
record layout library.
LANGUAGE SUPPORT
File-AD supports source record layouts coded in COBOL or PL/.
190
Layouts may be used when browsing, editing, printing, reformatting and comparing data
files.
Layouts can also be used to define selection criteria and to specify tests for multiple record type
layout usage.
File-AD automatically recognizes the source language whenever a layout is referenced.
File-AD supports Format 1 of the COBOL data definition statement and ignores Formats 2 and
3. When a 66 or 88 level item is encountered File-AD skips to the end of the sentence and
performs no syntax checking.
FORMAT 1 FORMAT 2

level number data-name 66 data-name-1 RENAMES clause.

REDEFNES clause
BLANK WHEN ZERO
JUSTFED clause FORMAT 3
OCCURS clause
PCTURE clause 88 condition-name VALUE clause.
SGN clause
SYNCHRONZED clause
USAGE clause
VALUE clause.
The following rules apply to Format 1:
1) The first data description entry in the COBOL layout need not have level number 01.
2) f multiple data description entries have level number 01, the second through "n" 01 level
entries are treated as though they redefine the first 01 level entry. Each 01 level entry need not
be successively longer than the previous 01 level entry.
3) The clauses may be written in any order.
191
4) The PCTURE clause must be specified for every elementary item with the exception of
NDEX, COMP-1, and COMP-2 data items.
5) Each data description entry must be terminated by a period.
6) Semicolons or commas may be used as separators between clauses.
7) The EJECT, SKP1, SKP2, and SKP3 reserved words may be imbedded between data
definition statements within a COBOL layout. File-AD skips over these words.
8) File-AD also skips over the TTLE statement, which is valid in VS COBOL .
9) Sort file description entry statements (SD) and file description entry statements (FD) may be
imbedded within the COBOL layout. File-AD skips these statements and performs no syntax
checking.
10) File-AD also skips debugging lines ("D" in column 7) and sentences which do not begin with
a valid level number.
11) File-AD ignores the REDEFNES clause if it is on the first data description entry in the
COBOL layout.
The level number and data-name are required in the COBOL data description entry. The format
is:
Level number data-name
The level number may be any number from 1 through 49. You may not use level number 77.
Data-names must be 30 characters or less but are not otherwise validated. For example, you are
not restricted to using characters A through Z, 0 through 9, and hyphen to form data-names, and
you need not make data-names unique. The keyword FLLER is treated the same as other data-
names.
The format of the REDEFNES clause is:
level number data-name-1 REDEFNES data-name-2
The level numbers of data-name-1 and data-name-2 must be identical and can be any level
number from 1 to 49. Between the data descriptions of data-name-2 and data-name-1, there may
be no entries having numerically lower level numbers than the level number of data-name-2 and
data-name-1.
The data description entry for data-name-2 may not contain an OCCURS clause. However, data-
name-2 may be subordinate to an item containing an OCCURS clause with or without the
DEPENDNG ON option. tems subordinate to data-name-2 may contain an OCCURS clause
without the DEPENDNG ON option.
192
Data-name-1 and any items subordinate to data-name-1 may contain an OCCURS clause with or
without the DEPENDNG ON option. f data-name-1 contains an OCCURS clause, its length is
computed to be the length of one occurrence multiplied by the number of occurrences.
The size of the redefining area must be less than or equal to the size of the redefined area.
Multiple redefinitions of the same redefined area may reference the data-name of the redefined
area or the data-name of any of the preceding redefining areas.
REDEFNES clauses may also be specified for items subordinate to items containing
REDEFNES clauses.
File-AD ignores the REDEFNES clause if it is on the first data description entry in the COBOL
layout.
The format of the BLANK WHEN ZERO clause is:
BLANK (WHEN) ZERO
The word "WHEN" is optional. This clause is checked for valid syntax but it does not affect
processing in any way.
The format of the JUSTFED clause is:
JUSTFED (RGHT)
JUST
The JUSTFED clause is used to override normal positioning of data within a receiving
alphanumeric data item. This clause affects processing in the reformatting function (option 9)
only.
Normally data is left justified in the receiving field and either truncation or blank padding occurs
on the right. When the JUSTFED clause is specified, data is right justified in the receiving field
and either truncation or blank padding occurs on the left.
The OCCURS clause has two basic formats:
FORMAT 6
OCCURS integer-2 TMES (DEPENDNG ON data-name-1)
(ASCENDNG KEY S data-name-2 (data-name-3)...)...
DESCENDNG
(NDEXED BY index-name-1 (index-name-2)...)
193
FORMAT 7
OCCURS integer-1 TO integer-2 TMES (DEPENDNG ON data-name-1)
(ASCENDNG KEY S data-name-2 (data-name-3)...)...
DESCENDNG
(NDEXED BY index-name-1 (index-name-2)...)
The words "TMES", "KEY S", and "BY" are optional in both formats.
n FORMAT 1, integer-2 represents the exact number of occurrences if the DEPENDNG ON
option is not present, or the maximum number of occurrences if the DEPENDNG ON option is
present. nteger-2 must be greater than 0 and less than 32,768.
n FORMAT 2, integer-1 represents the minimum number of occurrences and integer-2
represents the maximum number of occurrences. nteger-1 must be greater than or equal to 0,
and integer-2 must be greater than integer-1 and less than 32,768.
Three nested levels of OCCURS clauses are allowed. The OCCURS clause may not be
specified on 01 level items.
The ASCENDNG KEY, DESCENDNG KEY, and NDEXED BY options are checked for valid
syntax, but do not affect processing in any way.
Data-name-1, the object of the DEPENDNG ON option:
- must be defined as an integer
- must not contain or be subordinate to an OCCURS clause
There can be multiple OCCURS DEPENDNG ON clauses per COBOL layout.
The format of the PCTURE clause is:
PCTURE (S) character-string
PC
File-AD interprets all options of the PCTURE clause. The alphabetic, alphanumeric,
alphanumeric edited, and numeric edited categories of data are all treated as alphanumeric data
(i.e. treated as if the character string contained all X's). Picture characters
A X B 0 Z , . * - CR DB $ E
194
are all treated as the picture character X (XX for CR and DB). For alphanumeric edited and
numeric edited data items, File-AD does not validate the character string according to the
"precedence of symbols" as COBOL does.
External floating point items are fully syntax checked and treated as picture X items. Also, the
scaling position character, P, is supported
The format of the SGN clause is:
SGN (S) LEADNG (SEPARATE CHARACTER)
TRALNG
The word "CHARACTER" is optional in the SEPARATE option. File-AD treats the SGN clause
exactly as COBOL treats it.
The format of the SYNCHRONZED clause is:
SYNCHRONZED (LEFT)
SYNC (RGHT)
The SYNCHRONZED clause may be specified at the 01 or elementary item level. When
specified at the 01 level, every elementary item within the 01 level is synchronized.
File-AD treats all other aspects of the SYNCHRONZED clause exactly as COBOL treats them,
including computation of slack bytes for groups, defined with the OCCURS clause, containing
synchronized items.
The format of the USAGE clause is:
DSPLAY
DSPLAY-1
COMPUTATONAL
COMP
COMPUTATONAL-1
USAGE (S) COMP-1
COMPUTATONAL-2
COMP-2
195
COMPUTATONAL-3
COMP-3
COMPUTATONAL-4
COMP-4
NDEX
PONTER (VS COBOL only)
PACKED-DECMAL (VS COBOL only)
BNARY (VS COBOL only)
The USAGE clause can be specified at any level of data description. However, if the USAGE
clause is written at a group level, it applies to each elementary item in the group. The usage of
an elementary item may not contradict the usage of a group to which an elementary item belongs.
f the USAGE clause is not specified for an elementary item, or for any group to which the item
belongs, usage DSPLAY is assumed.
COMPUTATONAL-4 and COMP-4 items are treated as COMPUTATONAL items.
The format of the VALUE clause is:
VALUE (S) literal
The VALUE clause is checked for valid syntax but does not affect processing in any way.
COBOL LAYOUT ERRORS
When File-AD encounters an error during its on-line processing of a COBOL layout, an error
messages is written to your SPF log file. These messages contain an image of the last line File-
AD read from the COBOL layout, plus the internal layout representation File-AD built before
the error occurred. By using these messages in conjunction with the error message File-AD
displays at your terminal, you will be able to resolve most COBOL layout errors.
LAYOUT MEMBER SELECTON
Whenever you leave the layout member name blank or use a pattern, File-AD presents a
member list. A partitioned processing options (PPO) screen usually appears first to let you filter
the member list to improve performance. A pattern consisting only of an asterisk (*) tells File-AD
to list all members and to bypass the PPO screen.
196
NOTE: Using a single asterisk (*) pattern to list all members of a large layout library (such as a
Panvalet or Librarian library) may be time consuming.
Member list presentation occurs automatically in the XREF function when you use line
commands, or enter a pattern in the member name field (with or without using the S or SU line
command).
SOURCE STATEMENT SELECTON
SOURCE OPTONS
When File-AD cannot compile your record layout with the default source options, the Source
Statement Selection panel is displayed. This panel contains a Source Statement selection area
and a compiler option section. Record layout extraction can be done by "Character string" or
"Statement number".
Character string selection is Please enter the beginning and term
performed by entering the full or Source statement line numbers or bl
partial dataname of the first group
item wanted. The ending string is Record layout selection by Character St
only needed for PL/ or when a Beginning string ===>
partial group is wanted. Ending string ===>
Selection by number is performed by Record layout selection by Source State
entering the beginning and ending Beginning number ===>
statement numbers. The numbers can Ending number ===>
be standard (cols 73-80), relative, Number type ===>
or COBOL (cols 1-6). Relative is
The Source Options panel is also used to enter compiler options. The compiler options are
Language, Starting level number, Literal delineator (COBOL only) and Use 48 character set (PL/
only).
Language is specified by entering Compiler options:
COBOL or PL/ in the language field. Language ===> COBOL
Starting level number indicates the Starting level numb ===> 01
level number to be used to indicate Literal delineator ===> QUOTE
the start of a new copybook to be compiled. Use 48 character set ===> YES
Literal delineator indicates to the -------------------------------------------------
COBOL compiler that either the quote (") or the apostrophe (') is the character used to delineate
literals.
-Use 48 character set indicates to the PL/ compiler that the source is written in the 48-character
set.
197
f File-AD cannot determine the language, or if compilation fails, it will display this panel to allow
you to change source or compile options.
XREF DATASET
This dataset contains XREF members created using option 7 of
File-AD. XREF members contain information relating record data to a
record layout. The XREF dataset must have the following attributes:
TYPE DSORG RECFM LRECL
Partitioned Dataset PO VB 300
LAYOUT XREF DATASET
You create XREF members to communicate information about the record layout dataset to File-
AD in the following situations:
1) the data file you want to work with contains records with differing formats, requiring different
record layouts to define the various formats
2) the record layout that defines the data file is hard-coded in a program
3) the record layout that defines the data file is stored in a COPYLB member that contains
multiple record layouts
4) each record in the data file requires two or more record layouts, presented in sequence, to
define it
For the first situation, the XREF contains two pieces of information:
1) the name or the length and starting position of the field(s) within each data record that File-
AD should use to identify the data record's type (referred to as the "record type field(s)")
2) a list of all the possible record type values and the corresponding layout library member
which defines the data records with those values
For the second and third situations, the XREF contains the data-name that starts the data
structure you want (referred to as the "starting data-name"). File-AD reads the layout from the
source library member (containing either multiple layouts or a program) starting with the data-
name you specify. File-AD stops reading when it finds a new data structure (equal or lower level
number) or when the end of the record layout, library member, or program is reached.
For the fourth situation, the XREF contains the names of the layout library members for each
segment of a data record. t also contains the rules for identifying each segment of the record
198
by locating the "segment type field" and field values to use for selecting a segment layout (via
NEXT command of Formatted Browse/Edit).
n any of the File-AD primary options which use layouts to define the data, the record layout
dataset and XREF dataset information are specified as shown in the example below.
Specify Record layout and XREF nformation:
Record layout usage ===> X (S = Single; X = XREF; N = None)
Record layout dataset ===> 'PROD.COPYLB'
Member name ===> (Blank or pattern for member list)
XREF dataset name ===> FASAMP.XREF
Member name ===> ORDRFLE (Blank or pattern for member list)
RECORD LAYOUT USAGE indicates whether you will use a single record layout (usage "S"), a
layout XREF (usage "X"), or no source layouts (usage "N") to define the file.
The table below shows the valid dataset and member entries for the record layout and layout
XREF datasets, for each layout usage.
LAYOUT RECORD LAYOUT XREF
USAGE DATASET DATASET
S
sequential file, or member of
partitioned/PAN/LB file
ignored
X
sequential file, or
partitioned/PAN/LB file;
(required) member must be
blank
member of partitioned file
N ignored ignored
SELECTON CRTERA DATASET
This dataset contains existing "selection criteria information" created using option 6 of File-AD.
You can use saved selection criteria in the browse, edit, copy, search/update, print, and compare
functions.
The selection criteria dataset must have the following attributes:
TYPE DSORG RECFM LRECL
Partitioned Dataset PO V, VB 300
REFORMAT DEFNTON DATASET
This dataset contains saved Reformat Definitions created using option 9 of File-AD. You can use
a saved Reformat Definition online or in batch (REFORMAT function).
The Reformat Definition dataset must have the following attributes:
199
TYPE DSORG RECFM LRECL
Partitioned Dataset PO V, VB 1570
MEMBER LST PROCESSNG
When partitioned datasets are specified on the dataset specification screens, you may display a
member list by:
- Leaving the member name field blank
File-AD displays a list of the members in the partitioned dataset
- Entering a pattern as the member name
A pattern is a partial member name containing one or more of the single character "wild cards" *
(asterisk) ? (question) or % (pct). f any pattern character is present, the name becomes a
mask
matching any member name starting with the pattern entered (as if the pattern contained all "wild
cards" at the end). Therefore, one trailing pattern character is used only if it is the only
"wild card" in the mask, otherwise it is assumed. (Ex. PR?G is the same as PR?G???? and PR?
G*. However PRO and PRO* are different because PRO is a member name not a pattern like
PRO* is.)
For example, the patterns: ?RO*, ?RO, P*, PR?G%, P?O?G, PROGRAM* all match and produce
the following list:
PROGRAM1
PROGRAM2
PROGRAM3
Use the S (Select) line command to select the member you want. You may also scroll through the
member list using the UP and DOWN commands. n addition, you can enter a LOCATE primary
command and scroll directly to (or near) a specified member name.
MULTPLE PDS DATASET MEMBER LST CONVENTONS:
On certain dataset specification screens, you can specify multiple partitioned datasets.
Therefore, it is possible for you to receive multiple member list screens (one for each partitioned
dataset specified without a member or with a pattern) before proceeding to the next screen in the
function. The member lists are displayed in the sequence that the datasets appear on the
dataset specification screen.
PDS PROCESSNG OPTONS FOR PROCESSNG PARTTONED DATASETS:
200
f the main dataset in Browse (1), Edit (2), Copy (3.3), Search/Update (3.6), and Print data (5.1),
is a PDS and an explicit member is not specified, File-AD provides a PDS Processing Options
(PPO) screen. The PPO screen lets you specify additional member qualification filters such as:
member name range, last modified userid range, create date range, and modified date range.
f you wish to bypass the PPO screen and process all members, use a member name of * on the
main entry screen (Ex. Edit DSN=MY.PDS(*) ).
Note that when multiple PDSs are specified on the entry screen the list of members matching
your PPO options may not appear until AFTER all other PDS member lists have been presented
and a member selected.
ABNORMAL TERMNATON
File-AD can abnormally terminate in one of two situations:
1) when File-AD detects an unrecoverable error
2) when File-AD itself terminates abnormally
n both situations, File-AD intercepts the abend and displays an error screen. n the first case, a
message is displayed describing the unrecoverable error encountered. n the second case, the
system and user abend codes are displayed.
The first keyboard interaction on the error display screen causes the SPF abnormal termination
screen to be displayed.
File-AD attempts to close all open files prior to returning control to SPF.
DATASET SECURTY
File-AD is completely compatible with any data security software your installation may have (Ex.
RACF, CA-ACF2/TOP Secret, etc). File-AD processing does not circumvent your security
software in any way.
File-AD provides your installation with the capability of creating its own security exit routine that
File-AD will call during its processing. This enables your installation to limit access to certain
datasets. Following are some examples of the optional security exit routine uses:
- To allow only authorized users to browse and/or edit selected data files
f you require information on your installation's security exit routine, contact the person
responsible for File-AD at your installation.
n addition to the security exit, an audit exit is provided that can be customized for various uses
including:
201

- To force the creation of an audit trail when option 2 of File-AD is used to edit selected data
files, and/or to force the printing of an audit trail report upon completion of the data file updates
- To log all or selected dataset updates to the SMF log.
AUDT TRAL FEATURE
When you use option 2 of File-AD to edit a data file, you may specify that File-AD capture all of
your update activity in an audit trail dataset. Every insert, repeat, delete, copy, typeover, and
CHANGE command you perform causes a before and/or after image of the record(s) affected to
be written to the audit trail dataset. When you complete your edit session, a screen is displayed
giving you the option to print, delete, or keep the audit trail. f you specify that the audit trail be
printed, a batch job is submitted which produces a formatted audit trail report.
File-AD also provides your installation with the ability to force the creation of an audit trail during
any user's edit session through an audit exit routine. This is especially useful, for example, if your
installation wants to ensure that an audit trail is created whenever File-AD is used to edit certain
sensitive data files. When the edit session is complete, the audit exit routine can also be used to
force the automatic submittal of a batch job to produce the audit trail report, thereby ensuring
that a record of the edit session is printed.
n addition to the audit trail facility, File-AD provides the option to log all dataset updates to the
system SMF datasets.
f you require information on how your installation may be using any of these audit trail facilities,
contact the person responsible for File-AD at your installation.
COMPRESSON/ENCRYPTON EXT
File-AD provides your installation with the capability of creating its own compression/encryption
exit routine that will act as an interface between File-AD and any compression/encryption
software you may have (e.g., SHRNK or DATA PACKER). This allows you to work with data files
that are stored on disk or tape in a compressed or encrypted format in all File-AD options. File-
AD invokes the compression/encryption exit for data files only, not for record layout datasets,
record/layout cross references, or selection criteria.
f you require information on your installation's compression/ encryption exit, contact the person
responsible for File-AD at your installation.
DOUBLE-BYTE CHARACTER SUPPORT
File-AD will automatically detect and present DBCS data characters if your terminal type is set to
3277KN or 3278KN from option 0.0.1 of File-AD, or option 0.1 of SPF (SPF terminal
characteristics).
202
There are two ways File-AD presents data.
The two ways are presented in sequence, or may be selected by number:
1 - Formatted data presentation (Formatted and Vertical modes)
2 - Full-screen data presentation (Character mode)
File-AD assumes that all character fields contain a mixture of EBCDC data and Double-Byte
Character Set (DBCS) data. The DBCS characters are enclosed with shift-out (X'0E') and shift-in
(X'0F') characters.
For PC G(nn) fields in COBOL or GRAPHC(nn) fields in PL/ File-AD assumes that the field
contains only Double-Byte Character Set (DBCS) data. DBCS data does not include shift-out
(X'0E') and shift-in (X'0F') characters and should be an even number of bytes in length.
Note: X'0E' and X'0F' are for BM sites. Other platforms such as FSP and Hitachi may use other
representations for shift-in and shift-out.
FULL-SCREEN DATA PRESENTATON
When data is presented without COBOL or PL/ record layouts (three-line hexadecimal or
character format), each character line displayed is considered a character field.
File-AD assumes that all character fields contain a mixture of EBCDC data and Double-Byte
Character Set (DBCS) data. The DBCS characters are enclosed with shift-out (X'0E') and shift-
in (X'0F') characters.
Use caution when entering DBCS characters to ensure that the shift-out and shift-in characters
are accounted for and will not overlay other data values unexpectectly.
The command HEX ON is useful to view the location of the shift bytes.
Double-byte character support
File-AD will automatically detect and present DBCS data characters if your terminal type is set to
3277KN or 3278KN from option 0.0.1 of File-AD, or option 0.1 of SPF (SPF terminal
characteristics).
There are two ways File-AD presents data.
The two ways are presented in sequence, or may be selected by number:
1 - Formatted data presentation (Formatted and Vertical modes)
2 - Full-screen data presentation (Character mode)
203
FORMATTED DATA PRESENTATON
File-AD assumes that all character fields contain a mixture of EBCDC data and Double-Byte
Character Set (DBCS) data. The DBCS characters are enclosed with shift-out (X'0E') and shift-in
(X'0F') characters.
For PC G(nn) fields in COBOL or GRAPHC(nn) fields in PL/ File-AD assumes that the field
contains only Double-Byte Character Set (DBCS) data. DBCS data does not include shift-out
(X'0E') and shift-in (X'0F') characters and should be an even number of bytes in length.
Note: X'0E' and X'0F' are for BM sites. Other platforms such as FSP and Hitachi may use other
representations for shift-in and shift-out.
FULL-SCREEN DATA PRESENTATON
When data is presented without COBOL or PL/ record layouts (three-line hexadecimal or
character format), each character line displayed is considered a character field.
File-AD assumes that all character fields contain a mixture of EBCDC data and Double-Byte
Character Set (DBCS) data. The DBCS characters are enclosed with shift-out (X'0E') and shift-in
(X'0F') characters. Use caution when entering DBCS characters to ensure that the shift-out and
shift-in characters are accounted for and will not overlay other data values unexpectectly.
The command HEX ON is useful to view the location of the shift bytes
#nde$or:-
ENDEVOR SOFT&ARE
,se Ende/o) 2o)
So,)(e (on-)ol
To ensure that we always work with the latest version of the source
Ende/o) Sea)(h
To search for a string in a large list of sources
SCL gene)a-ion
This is required at the time of migration
Ende/o) en/i)onmen-s
FX Alternate/Fix environment
TEST Test environment
204
RELEASE - Release environment
DEMOTEST - Demo test environment
DEMOPROD - Demo production envmt.
Ende/o) O5-ions
0 DEFAULTS
1 DSPLAY
2 FOREGROUND
3 BATCH
4 PACKAGE
5 BATCH PACKAGE
U USER MENU
T TUTORAL
C CHANGES
X EXT
Sour%e %onro$ in Ende&or
A so,)(e ma' )eside in an' o2 -hese s-ages4
Environment FX, System EAS0, FXTEST
FXSHP
Environment TEST, System EAS0, ACCEPTANCE
NTEGRATON
Environment RELEASE, System EAS, SHP
PRODUCTON
Disp$#y Opions in Ende&or
The 'Display element list' screen can be accessed in all three environments of Endevor. n
RELEASE, it can be accessed by entering option 1 ;1 (i.e, display; element)
Options B (browse), C (change), H (history), M (master) and S (summary) can be used to get
information on an element.
Option 'B' will give a source listing of the element as it currently exists in the region specified
Option 'C'
can be used to get details of changes made to the current source with respect to the previous
version
Option 'H'
Can be used to get details of all changes ever made to the source. For each line of the source
code, the appropriate version number is indicated at the extreme left
Option 'M'
Can be used to get information about the current status of the source (i.e. whether it has been
retrieved, if so, by whom and on what CCD etc.)
*e--ing S,mma)' In2o)ma-ion
This will give a list of all versions of sources that have existed in endevor to date.
1. Enter the 'Display element list' screen (= en ; e ; 3 ; 1; 1)
2.Enter the element name and type, with environment as RELEASE and stage as
205
/01D2C$,13.
3. Type in option 'S' - summary. Press enter
any version may be selected from this list giving the options B, C or H

Dis5la' o5-ions wi-h QS,mma)'N
Option 'B' can be used to browse the selected version of the source
Option 'C'
can be used to get details of changes made to the current (selected) version with respect to the
previous version
Option 'H'
can be used to get details of all changes ever made up to the selected version. For each line of
the source code, the version number is indicated at the extreme left
C,))en- So,)(e In2o)ma-ion
Enter the 'Display element list' screen (= en ; e ; 2 ; 1; 1)
Enter the element details, with environment as TEST and stage as ntegration (this is the lowest
level in endevor)
Set 'Build Using Map' option to 'Y'. Press enter
This will give a listing of the sources (,))en-l' existing in endevour (e.g versions of the same
source may be existing in ntegration, Ship and Production).
Re-)ie/al
1. For purposes of modification, we will normally retrieve elements from Production.
2. Elements must always be retrieved without a signout.
Ende&or Rerie&#$ S%reen
OPTION CCCR R
ELEMENT DISPLA# OPTIONS4
1lan3 - Elemen- lis- S - S,mma)' + - +)owse % - %is-o)'
R - Re-)ie/e elemen- M - Mas-e) C - Changes

FROM ENDEVOR4 ACTION OPTIONS4
ENVIRONMENT CCCR RELEASE CCID CCCR
S#STEM CCCR EAS EXPAND INCL"DES CCCR N :#N;
S"+S#STEM CCCR EAS SI*NO"T ELEMENT CCCR N :#N;
ELEMENT CCCR IOINTE*6 OVERRIDE SI*NO"T CCCR N :#N;
T#PE CCCR CO+OL REPLACE MEM+ER CCCR N :#N;
STA*E CCCR P S - S%IP P - PROD
COMMENT CCCR

TO ISPF LI+RAR#4 LIST OPTIONS4
PRO@ECT CCCR EASV66 DISPLA# LIST CCCR # :#N;
206
LI+RAR# CCCR !FIX &%ERE CCID E! CCCR
T#PE CCCR CO+OL &%ERE PROC *RP E! CCCR
MEM+ER CCCR +"ILD "SIN* MAP CCCR N :#N;
FIRST FO"ND CCCR # :#N;
TO OT%ER PARTITIONED OR SE!"ENTIAL DATA SET4
DATA SET NAME CCCR
Ende&or Se#r%+
"sing Ende/o) Sea)(h
The search option can be used to search a large list of sources for the occurence of a given
string. Follow the steps as given below:
1. Select the desired endevor environment (Usually RELEASE).
2. Select the BATCH option.
3. Select the 'BULD SCL' option giving a temporary member name.
4. Select option 11 (To list elements).
5. Enter the the partial names of the of the elements you wish to scan, and the
corresponding type.
6. Press enter- SCL will be generated; then press F3
7. Again press F3 to return to the Batch Options Menu
8. Enter option 3 to Submit the SCL
9. Scan the held output under DDNAME C1MSG1
10. Search for the return code of '0000'. Any element which has '0000' against it has the
string you are looking for.
(e.g. O* & COBOL);
Set Display List to 'N';
Select Option 'L';
Type in the string to be searched for.
+a-(h O5-ions men,
OPTION CCCR 6

6 +"ILD SCL - +,ild 1a-(h SCL a(-ions
7 EDIT - Edi- )e?,es- da-a se-
8 S"+MIT - S,1mi- Bo1 2o) 1a-(h 5)o(essing
9 VALIDATE - Che(3 )e?,es- da-a se- 2o) s'n-aF e))o)s
< +"ILD @CL - En-e) addi-ional @CL -o 1e in(l,ded wi-h -he Bo1

RE!"EST DATA SET4
PRO@ECT CCCR A*P77=J APPEND CCCR N :#N;
*RO"P CCCR SO"RCES INCL"DE @CL CCCR N :#N;
T#PE CCCR CO+OL
MEM+ER CCCR SEARC%

207
OT%ER PARTITIONED OR SE!"ENTIAL DATA SET4
DSNAME CCCR

@O+ STATEMENT INFORMATION4
CCCR
CCCR
CCCR
CCCR
Lis- Elemen- A(-ion
OPTION CCCR L
ELEMENT DISPLA# OPTIONS4
1lan3 - Elemen- lis- S - S,mma)' + - +)owse % - %is-o)'
L - LIST elemen- a(-ion M - Mas-e) C - Changes

FROM ENDEVOR4 LIST OPTIONS4
ENVIRONMENT CCCR RELEASE DISPLA# LIST CCCR N :#N;
S#STEM CCCR EAS &%ERE CCID E! CCCR
S"+S#STEM CCCR EAS &%ERE PROC *RP E! CCCR
ELEMENT CCCR IOE +"ILD "SIN* MAP CCCR N :#N;
T#PE CCCR CO+OL
STA*E CCCR P S - S%IP P - PROD

TEXT STRIN*4
CCCR SCONSOLLTS
SCAN COL"MNS4
START CCCR END CCCR
S%O& TEXT CCCR # :#N;

ACTION TO +E *ENERATED &%EN LIST IS CREATED CCCR
&RITE LIST TO O"TP"T DATA SET CCCR N :#N;
&%ERE COMPONENT E! CCCR
SC* 0ener#ion
SCLs are generally used to migrate sources from the Development region to TEST. The steps
involved in the preparation of an SCL are listed as the following
%ow -o gene)a-e an SCL
1. Select option 2, i.e., 'TEST'.
2. Select option 3, i.e., 'BATCH'.
3. To build an SCL for the first time, enter options as given below and press ENTER.
whenever you want to build a fresh SCL, set the append option to 'N'. f you want to
append elements to an existing SCL, then set this option to 'Y.
208
4. On pressing ENTER on the previous screen, the SCL GENERATON screen is brought
up. Enter option '2' (ADD/UPDATE) regardless of whether you are creating a new SCL or
updating an existing one.
5. n the 'Add/Update Elements' screen, type in the fields as shown in the next slide.
Pressing the enter key now will add a member to the SCL
6. Add the remaining members by repeating step 5. Make sure that the member name, type
and processor group are correctly entered.
7. Press PF03 to save the SCL. nform the on-site team giving them the name of the SCL
that has been built [eg. 'EASV11.QFX.SCL(SCLTEST)'].
SCL Submission will be done on-site.

+a-(h O5-ions men,
OPTION CCCR 6

6 +"ILD SCL - +,ild 1a-(h SCL a(-ions
7 EDIT - Edi- )e?,es- da-a se-
8 S"+MIT - S,1mi- Bo1 2o) 1a-(h 5)o(essing
9 VALIDATE - Che(3 )e?,es- da-a se- 2o) s'n-aF e))o)s
< +"ILD @CL - En-e) addi-ional @CL -o 1e in(l,ded wi-h -he Bo1

RE!"EST DATA SET4
PRO@ECT CCCR A*P8JK APPEND CCCR N :#N;
*RO"P CCCR !FIX INCL"DE @CL CCCR N :#N;
T#PE CCCR SCL
MEM+ER CCCR SCLTEST

OT%ER PARTITIONED OR SE!"ENTIAL DATA SET4
DSNAME CCCR

@O+ STATEMENT INFORMATION4
CCCR
CCCR
CCCR
CCCR
Add"5da-e Elemen-s
OPTION CCCR A

1lan3 - Mem1e) lis- A - Add an elemen- " - "5da-e an elemen-

TO ENDEVOR4 ACTION OPTIONS4
ENVIRONMENT CCCR TEST CCID CCCR EAS#7$""9
S#STEM CCCR EASK *ENERATE ELEMENT CCCR # :#N;
S"+S#STEM CCCR EAS DELETE INP"T SO"RCE CCCR N :#N;
209
ELEMENT CCCR DC6KK< NE& VERSION CCCR
T#PE CCCR CO+OL OVERRIDE SI*NO"T CCCR # :#N;
STA*E4 I PROCESSOR *RO"P CCCR CIINCL
"PDATE IF PRESENT CCCR N :#N;
COMMENT CCCR

FROM ISPF LI+RAR#4 LIST OPTIONS4
PRO@ECT CCCR EASV66 DISPLA# LIST CCCR # :#N;
LI+RAR# CCCR LR66
T#PE CCCR CO+OL
MEM+ER CCCR DC6KK< T%R" MEM+ER CCCR

FROM OT%ER PARTITIONED OR SE!"ENTIAL DATA SET4
DATA SET NAME CCCR
Add7Upd#e e$emens
1. Use option 'A' when you are adding new elements to the SCL. The same option will hold
even when we are appending members to an existing SCL.
2. Ensure that the member names match in the 'TO' and 'FROM' libraries. This is very
important !
3. The Processor group field will depend on the type of program. This field is mandatory
when new sources are being added to the system. Use the following key:
So)(e T'5e P)o(esso) *)o,5
Batch COBOL Program CNBL
CCS COBOL Program CNCL
Copy Book CPYNNN
Control card SRCNNS
Bind card BNDSUBX
Batch to Module (TDM) CTBL
CCS to Module (TDM) CTCL
Batch to Module (without TDM) CDBL
CCS to Module (without TDM) CDCL
NOTES
After building the SCL, it is advisable to manually browse it. For this, use the EDT option shown
in the first screen.
Check for :
1. Mismatched member name
2. Repeated entries for same element
3. Wrong Processor group
210
+an3ing and Finan(e Te)ms
Asse M#n#"emen
Asset management is the service of making investment decisions for investors according to
predefined guidelines and objectives. nvestment management, portfolio management, fund
management, and money management are synonymous terms.
Asse- Allo(a-ion
The practice of deciding how investments are divided among asset categories.
Cash E?,i/alen-s
nvestments that are fixed income securities with relatively short maturities (for example, less
than one year). Examples of this are a money market fund and a treasury bill.
Co,n-e)5a)-' Ris3
The risk that the other entity in a financial agreement will be unable to fulfill the obligations of that
transaction.
211
C,s-odian
Bank of other financial institution that keeps custody of stock certificates and other assets of a
mutual fund, individual, or corporate client.
De2ined +ene2i- Plan
A type of employee benefit program where the benefit is defined normally in terms of a promised
monthly retirement income. An individual investment account for each participant is not
maintained. The plan is normally funded through contributions made by the employer. Defined
Contribution Plan A type of employee benefit program where the contribution is defined and an
individual investment account is maintained for each participant reflecting accumulated
contributions and earnings. Contributions can come from the employer, the employee or both.
There is no promise regarding the level of retirement income.
E?,i-'
A type of security representing ownership possessed by shareholders in a corporation. An equity
investment differs from a debt investment in that the issuer makes no promise to pay the investor
current income or any guaranteed amount at a future date. Additionally, although they are
owners, shareholders do not usually participate actively in the management of the corporation,
other than to elect directors, select auditors, and to vote on matters that may be required by law.
FiFed In(ome
A type of security that pays a fixed rate of return. Examples of this include government, corporate,
or municipal bonds, which pay a fixed rate of interest until the bonds matures, or preferred stocks,
which pay a fixed dividend.
In/es-men- T),s-s
A type of investment company that pools money from it shareholders. nvestment trust is also
known as a closed-end investment company, meaning only a fixed number of outstanding shares
is offered
M,-,al F,nd
A type of investment company that pools money from its shareholders. A mutual fund is also
known as an open-end investment company, meaning that there is a continuous offering of new
shares and redemption of outstanding shares
Val,e Chain
A value chain breaks down an industry to its value activities to understand the behavior of costs,
and the existing and potential sources of differentiation. t is used to compare and contrast
competitors in an industry.
212
Commer%i#$ )#n<in"
The commercial bank meets the financing and cash management needs of business customers.
Customers range from small businesses to multi-national corporations in industries such as
manufacturing, wholesaling, retailing, service or agricultural entities. The commercial bank
provides credit and non-credit products and services to customers.
A((o,n-s Re(ei/a1le Finan(ingColle(-ion
The process of obtaining funds for cash needs by selling or borrowing against accounts
receivable. Cash Management Services Non-credit products and services that help meet
business customers' information, transaction, and investment needs. Cash management services
are also called non-credit or treasury management services, and help businesses optimize their
use of cash through quicker collection and slower disbursement of business funds.
Cash Managemen- Se)/i(es
Non-credit products and services that help meet business customers' information, transaction,
and investment needs. Cash management services are also called non-credit or treasury
management services, and help businesses optimize their use of cash through quicker collection
and slower disbursement of business funds.
Commi-men- Fees
Fees paid by a customer in return for the bank's legal commitment to lend funds that have not yet
been borrowed by the customer. The customer pays a fee to ensure that additional funds will be
available to them if needed.
C)edi- S(o)ing
A standardized credit rating system, which analyzes applicant criteria such as income, personal
characteristics and other outstanding debt. The system produces a credit score intended to be
indicative of a borrower's ability to repay a loan.
Lease
A contract granting the use of real estate, equipment, or other assets over a fixed period of time in
exchange for payment. The borrower pays for the privilege of using the asset, and the ownership
of the asset is usually transferred to the borrower at lease end.
Le--e) o2 C)edi-
A bank guarantee of payment for a buyer or seller of goods. Payment for goods is guaranteed
and will be made when the terms of a contract have been met. Payment is also guaranteed if the
applicant for the letter of credit fails to uphold the terms of the contract.
213
Loan S'ndi(a-ion Fees
Fees paid by a customer to a group of banks (called a syndicate) that acts jointly to loan money
to the customer. A syndicate may result from a loan amount that is too large or too risky for one
bank to make by itself.
Ma)gin
The amount of funds that must be deposited when purchasing securities. Also, the equity in an
investor's account.
Ma-(hed F,nding
A process of matching maturing liabilities (customer deposits) with maturing assets (loans or
investments) to manage the costs associated with fluctuating interest rates. As an example, a
bank would try to fund a 3-year loan with a 3-year deposit to lock in the interest rate it will earn for
the three-year period.
Rela-ionshi5 Manage)
Relationship managers typically serve as the primary contact between the bank and customers.
Relationship managers may also coordinate services from other areas of the bank for cross-
selling opportunities.
Re/ol/ing Line o2 C)edi-
Money available to a customer to meet the on going needs of a business. A line of credit is similar
to the concept of a credit card. Money is borrowed and repaid frequently. The bank's commitment
is usually short term (less than one year), but it may be renewed yearly.
Se(,)i-iHa-ion
The process of aggregating debt instruments, such as loans, in a group and issuing stocks or
bonds backed by the group.
S5)ead
ncome earned after interest expense. A bank earns interest income on its loans (for example, 9%
lending rate) and incurs interest expense on the funds used to make loans (for example, 3% paid
to depositors). The difference between the two rates is the bank's spread (9% - 3% = 6% spread).
Te)m Loan
A loan that is made to finance an asset over a period of time. The bank's commitment is usually
long term (greater than 1 year) and is usually a secured loan.
214
Consumer *endin" Ser&i%es
Consumer lending services provides loan and credit services to retail customers. The goal of
lending is to target customers who are able to repay the bank and to eliminate risky customers.
The bank generates revenue from the interest on the loan.
AdB,s-a1le-Ra-e Mo)-gage
A property loan that is subject to periodic rate adjustments. The exact method, frequency, and
basis for the rate change are based on the investment it is tied to, which is usually a widely
published market/base rate of interest or index.
A,-ho)iHa-ion
Process that ensures that the credit card and cardholder are valid and have enough credit to pay
for the item. An authorization occurs electronically at the point of sale, taking only seconds to
complete.
+ad De1-
Open account balance or loan receivable that is proven uncollectable and written off.
Cha)ge Ca)d
A short-term funding mechanism. Charges must be paid in full at the end of the monthly cycle. An
example is a corporate charge card.
Colla-e)al
An asset pledged to a lender until a loan is repaid. f the borrower fails to make payments as
required, the lender has the legal right to seize the collateral and sell it to pay off the loan.
C)edi- S(o)ing
A standardized credit rating system, which analyzes applicant criteria such as income, personal
characteristics and other outstanding debt. The system produces a credit score intended to be
indicative of a borrower's ability to repay a loan.
FiFed-Ra-e Mo)-gage
A property loan in which the payback rate does not vary with market conditions; it is constant over
the life of the loan.
215
%ome E?,i-' Loan
A loan, which is secured by an independent appraisal of the property value of the customer's
home. Essentially, the customer is borrowing against the equity value of their home that is not
mortgaged.
Ins-allmen- Loan
A consumer loan that has a predetermined loan maturity date (the date the loan is to be paid in
full) and repayment schedule.
Loan--o-De5osi- Ra-io
Percentage representing a bank's total amount of outstanding loans to the amount of deposits.
O/e)d)a2- C)edi-
A line of credit attached to a checking account. When a customer withdrawals more money than
in his account, the extra amount is covered by the overdraft credit. The customer pays interest on
the overdraft amount.
Re/ol/ing C)edi-
Loan amount requiring monthly payments of less than the full amount due, with the balance
carried forward subject to additional interest.
)r#n%+7ATM
For some banks, branches are the primary distribution channel for selling products and services.
Although differences exist among banks and across regions, most branches offer a range of
products and services, including deposit accounts, transactional services, lending services,
investment services, and insurance.
Commission
Fee paid to sales personnel for executing a trade based on the number of shares traded or the
dollar amount of the trade.
Com5ensa-ing +alan(e
Minimum balance required by a bank on certain deposit accounts. Banks require customers to
keep these balances as a stable source of funds for the bank, and impose financial penalties if
the account goes below the minimum requirement.
216
Com5,-e) Swi-(h
ATM back-end equipment that allows network banks to share customer account information.
These switches allow customers to use any participating ATM, and allow the network banks to
verify funds for non-customers.
De5osi- A((o,n-s
These accounts allow customers to deposit funds that the bank must repay the customer at some
future date.
Two major types:
1. Funds committed to the bank for a specified period of time. n return, the bank offers a
higher interest rate relative to other types of deposits. A certificate of deposit is one
common form.
2. Funds committed to the bank, which the customer has the option to withdraw at any time.
A savings account is the most common form.
Ins,)an(e
Most countries have an independent insurance industry. n many countries, however, the
insurance and banking industries are merging, resulting in the selling of insurance products in
banks. Some of these products include life insurance, property insurance, and casualty
insurance.
In/es-men- Se)/i(es
Banks offer services to help customers invest their excess funds. Some of these services include
brokerage services, mutual funds, annuities, personal trust, and asset management.
Lending Se)/i(es
Banks provide funds to customer while charging customers interest for the use of those funds.
Some examples include mortgages, home equity loans, overdrafts, and credit cards.
P)emi,m
Fee paid to a bank or insurance provider for insurance coverage.
T)ansa(-ion Se)/i(es
These accounts allow customers to deposit funds with the intention of making non-cash
payments in the near future, usually with instruments such as a check or debit card.
Two major types:
1. Funds may be withdrawn on demand without advance notice. A checking account is the
most common form.
217
2. Some accounts may carry a market interest rate and allow the depositor limited check-
writing privileges. A money market deposit account is one common form.
T)ans2e) P)i(ing
The internal charge to a business unit for goods or services provided by another business unit. An
example of transfer pricing would be the deposits line of business charging a lending division for
using customer deposits as the source for loans.
E$e%roni% )#n<in"
Electronic banking is one type of distribution channel used to deliver products and services to
customers. t brings the bank to the customer-a strategy for penetrating different customer
segments, encouraging customer loyalty, and reducing costs. Within electronic banking, several
different types of delivery mechanisms exist, such as VRU, digital TV, mobile phone, kiosk, PC,
and the nternet.
Digi-al TV :DTV;
To leverage the technology of interactive TV, some banks use the platform of the digital TV
operators, including satellite and cable, to offer home banking services. DTV combines video,
images, sound and textual information. The navigation requires the use of only five keys on the
standard pay-TV remote control. Customers can browse through account information directly on
the TV and perform transactions, such as transfers, blank check orders, or financial product
subscriptions.
Ele(-)oni( +ill P)esen-men- and Pa'men-
EBPP provides customers or businesses with the ability to make "electronic" payments to any
vendor or any person at any time. nstead of receiving a paper bill monthly, customers receive an
electronic version of the bill. Customers can review bills and pay them online electronically,
eliminating the hassle of check writing and the possibility of lost payments or late charges.
Finan(ial Ins-i-,-ions
Financial nstitutions include banks, insurance companies and brokerage houses.
In-e)ne- +an3ing
nternet banking offers the ability for customers to conduct basic bank transactions (for instance,
balance transfers and account inquiries) through direct dial-up connections to the bank. Unlike
PC banking where access is limited to a PC equipped with the bank's software, nternet banking
allows customer access to information and services from any location with an nternet connection.
The goal for a bank's Web site is to provide many, if not all, of the services offered at a branch-
transactions, account information, advice, administration, and even cross-selling. The interactive
218
nature of the Web not only allows banks to enhance these core services, but also enables banks
to communicate more effectively and strengthen customer relationships.
$ios3
The kiosk multimedia application is based on a virtual branch metaphor. Existing or potential
customers can "enter" the branch by touching the doors on the kiosk's touch screen. nside the
virtual bank branch the customer can obtain information and go through the sales process of
products. The customer will be guided by a virtual host and sales personnel through integrated
video sales person and promotion video clips. The application offers a full range of retail banking
products and services. n cases where real signature is required by law, the customer can print
out the application for signature and submission.
Mo1ile Phone
Banking using the mobile phone is similar to using a touch-tone phone. Customers can access
basic transactions such as check balances, loan rates, checks paid, deposit rates, and credit card
payments. Many providers also offer nternet banking over nternet enabled mobile phones.
O)igina-ion
Origination refers to the customer acquisition process.
PC +an3ing
Customers can access accounts by installing the bank's application on the PC. This allows
customers to access account information, pay bills, transfer funds, or to purchase investments
while online. Some major providers of personal management (PFM) software are partnering with
banks to offer additional services. This software may offer additional features such as creating
account registers and checkbooks, balancing accounts, setting up loan amortization schedules,
creating budgets, tracking investment performance, and estimating taxes.
PDA
Banking using a wireless PDA (personal digital assistant) offers all the capabilities of banking on
the nternet (e.g., check balancing, transferring balances, paying bills, etc.), but has a scaled
down user interface. t is very similar to doing nternet banking over a mobile phone.
Voi(e Res5onse "ni- :VR";
An automated system accessed by telephone for providing basic customer service information,
such as account balances or transaction history. Call centers provide VRU's as a way to reduce
cost, since nearly 80% of customer inquiries can be handled through a VRU, and do not require
the more costly CSR interaction.
219
&hi-e La1el Sol,-ions
A white label solution is a solution provided by a bank that can be branded and used by the end
customer like Accenture. Accenture employees could use the 'Accenture Bank', even though all of
the processing takes place at large bank, the web interface to the banking functions would be
branded as Accenture.
C#$$ Cener
Call centers are lower cost delivery channels than branches to maintain high quality customer
service. Call centers allow other delivery channels, such as branches, to focus on marketing and
selling instead of service. Major functions supported by the call center include credit card services
(such as transaction and balance inquiries), retail and commercial account information (such as
transfers or payments), basic customer service (such as change of address) and website support.
In1o,nd
Telephone calls made from either a customer or an employee to the call center.
O,-1o,nd
Telephone calls made from the call center to a customer or potential customer.
Voi(e Res5onse "ni- :VR";
An automated system accessed by telephone for providing basic customer service information,
such as account balances or transaction history. Call centers provide Vero's as a way to reduce
cost, since nearly 80% of customer inquiries can be handled through a VRU, and do not require
the more costly CSR interaction.
Disri-uion C+#nne$s
Banks use a variety of channels to manage products and services. Banks must define policies for
new and existing channels, determine the distribution strategies, support each channel's
operations, and manage the branch network across regions.
While the branch is the most visible distribution channel, alternative channels, such as nternet
banking and ATM's have grown substantially in the past decade. New channels have emerged
due to increasing customer sophistication in technology and product knowledge, competition for
new customers, the need to lower operating costs, to increase time in the branch for commercial
activities and evolving technology.
220
M,l-i-Channel S-)a-eg'
Retail banks use a multi-channel approach to serve a wide range of customers. Channels include
electronic banking, branch, ATM and call centers. This diversification increases bank revenues
while lowering bank costs.
Sr#e"y 5 M#r<ein"
The purpose of strategy is to define the bank's sales objectives and target markets, and to
determine product needs and enhancements. Marketing implements promotional strategies that
support these initiatives and builds brand identity for the bank.
P)i/a-e La1eling
A bank's purchase of a product from a third party for use and sale under the banks own name.
Other banks can purchase the same product and private label it for their own uses. Although
private labeling reduces product development costs, banks usually choose to develop products
internally, rather than through private labeling, since new products often differentiate banks from
their competition.
P)od,(- +,ndling
Bundling offers a complementary group of products or services to a customer. Products and
services may be bundled as a way to increase sales of a particular product (such as, bundling a
poorly selling savings account with a popular checking account), or to target specific market
segments (such as a group of products targeted at young professionals).
Ris< M#n#"emen
Risk management is the framework and related infrastructure by which banks plan for, acquire,
and monitor risk to achieve superior performance. Risk management integrates human
resources, technology, capital, and target marketing to balance risk against reward. Categories of
risk include economic, credit, liquidity, and operational risk.
Asse--Lia1ili-' Managemen-
Matching the maturity of deposits with the length of loan commitments to avoid adverse affects
from changes in interest rates.
+,siness Ris3
Banks analyze a business customer's ability to repay a loan. Loan review and approval by more
than one individual helps offset business risks.
221
C)edi- Ris3
The uncertainty of realizing the return of principle and the expected reward from a customer or
portfolio of customers.
C)edi- Ris3
The uncertainty of realizing the return of principle and the expected reward from a customer or
portfolio of customers.
E(onomi( :Ma)3e-; Ris3
Uncertainty associated with currency, local, regional, global, business and political conditions.
Examples include exposure or concentrations by industry, loan structure, product, interest rate, or
sovereignty.
Indi/id,al Ris3
Banks have replaced the manual review process for individual and small business loans with new
analytical tools. Credit scoring and behavioral modeling are used to standardize the evaluation of
loan applications and to project future risks.
Ind,s-)' Ris3
Loans are classified by industry, and limits are established on loan amounts outstanding by
industry to offset industry risks.
Li?,idi-' Ris3
The ability to convert assets into cash or cash equivalents without experiencing significant loss.
Loan Loss Anal'sis
Analysis of non-performing and problem loans, including probability of default, loss rates by risk
rating, recovery rates, and time from origination of the loan to non-performing status.
Non-5e)2o)ming Loans
Loans for which customers are not making scheduled payments. Commercial loans that are 90
days past due and consumer loans that are 180 days past due are usually classified as non-
performing.
O5e)a-ional Ris3
Risk of loss associated with the failure to execute transactions due to:
1. nadequate controls
222
2. Operating errors
3. naccurate information
4. neffective management
5. Natural disaster
6. Fraud
7. Regulatory issues
8. Legal considerations
Ris3-adB,s-ed Re-,)n on Ca5i-al :RAROC;
A technique for risk analysis that requires a higher net return for a riskier project than for a less
risky project. The risk adjustment is performed by reducing the risky return rather than adjusting
the charge for capital.
Ris3 A55e-i-e
ndustry term used to describe the general level of risk acceptable to a bank. A "small risk
appetite" would mean that a bank would have little interest in a risky transaction.
Ris3 Ra-ing
A rating system based on a scale of loan performance and loss experience. Limits are
established for each rating level for individual, business, industry and country risks. Stress Testing
and "What f" Scenarios Simulation of the impacts of trends and events (such as, interest rate
changes, regulatory changes, economic growth, currency fluctuations) on a loan portfolio.
.in#n%e #nd Corpor#e !$#nnin"
Finance and Corporate Planning provides external customers with financial and credit quality
information. External customers include regulators, shareholders, and market analysts who
monitor financial performance and stability. Finance and Corporate Planning also provides
internal customers with financial management reporting. nternal customers include the CEO, the
Board of Directors, and line of business leads.
A(-i/i-'-1ased Cos-ing
A method of determining the total cost of providing a service to customers. These costs are
aligned to associated revenues by product, customer, and channel. Finance and corporate
planning uses activity-based costing information to help determine product prices and set interest
rates on savings products.
Ca5i-al Ade?,a('
A measure of an institution's capital (equity) in relation to its asset base. A higher capital
adequacy means a stronger ability to absorb losses. A bank's capital usually ranges from 2-12%
and varies based on factors, such as size and regulatory requirements.
223
C)edi- !,ali-'
A measure of the quality of an individual loan or a loan portfolio. Good credit quality means that
the customer continues to make full loan payments on time and is not at risk for defaulting on the
loan.
E22i(ien(' Ra-io
A measure of how well a bank is managing its non-interest expenses. The lower the efficiency
ratio, the better the bank is performing. This ratio is measured by dividing non-interest expense
by the sum of the net interest income and the non-interest income. For banks, typical efficiency
ratios are .55 or lower.
Ea)nings Pe) Sha)e :EPS;
Earnings per share are defined as net income divided by the total number of outstanding shares
of common stock. This ratio measures the net income earned for each share of stock
outstanding.
Ne- In-e)es- In(ome
Net income earned from the bank's lending activities, such as commercial loans, credit cards,
mortgages, etc. Two-thirds of a bank's total income is usually derived from net interest income.
Non-in-e)es- In(ome
ncome earned from non-lending services offered by the bank. Some examples include service
fees and stock exchange commissions. Non-interest income is usually one-third of a bank's total
income.
Re-,)n on Asse-s :ROA;
Return on Assets is defined as net income divided by total assets. This ratio identifies how well
assets are working to produce income. Banks try to average a minimum ROA of at least 1%.
Re-,)n on E?,i-' :ROE;
Return on Equity is defined as net income divided by total equity. This ratio identifies how well a
company's equity is working to produce income. Banks try to average a minimum ROE of at least
15%.
)#n<in" Ser&i%es
The goal of banking services is to provide quality customer service, and efficient and accurate
processing of information and materials.
224
A(?,i)ing +an3
The financial institution where the check is deposited into the payee's account.
Che(3 T),n(a-ion
Process in which the information on a check is converted into electronic images. Checking
account customers receive images of checks they have written, rather than the physical check.
File Folde) Imaging
Process in which documents are converted into images. The images are stored in electronic file
folders, and are used the same way paper documents are used.
Iss,ing +an3
The financial institution that issues the payor's check.
Magne-i( In3 Cha)a(-e) Re(ogni-ion :MICR; En(oding
Magnetic nk Character Recognition Encoding allows high-speed, check-sorting machines to read
and sort checks. Data is encoded onto the checks in this process.
O22-line P)o(essing
ATM or debit card reader does not have a direct link to the customer's account file. nstead, the
purchase information is captured for later processing, and does not immediately post to the
account. Few off-line systems are used today.
Online P)o(essing
ATM card or debit card readers are linked directly to the customer's files, which contain their
individual account information. At the point of sale, these transactions link directly to the bank to
determine whether the customer has funds to cover the purchase or a cash advance.
Poin- o2 Sale :POS;
Retail payment system that substitutes an electronic transfer of funds for cash, checks, or drafts
in the purchase of retail goods and services.
So(ie-' 2o) &o)ldwide In-e)1an3 Finan(ial Comm,ni(a-ion :S.&.I.F.T.;
A predominant European payment processing system, which provides the link between, the
issuing bank and the acquiring bank on an international level. The standardization of the Euro
may change the payment processes between participating countries.
225
Sm#r C#rds
Credit cards with microcomputer chips. Smart cards are a recent trend that will have a substantial
impact on future banking. These cards offer a secure, personalized connection to nternet
shopping and banking and are being considered for multiple purposes across different industries.
!ri&#e )#n<in"
The traditional private banks target high net worth (HNW) individuals and provide customized,
personal services for these clients. Although the minimum requirement varies among banks, they
typically define this specific customer segment as individuals with assets under management of
USD one million or more. Products offered include credit and deposit products, investment
products, estate and financial planning services, and trust products.
Ad/iso)' Managemen-
Accounts that require clients' authorization before executing investment decisions.
Dis()e-iona)' Managemen-
Accounts that give the relationship manager full authority to make investment decisions.
F,ll'-De5enden- In/es-men- S-'le
Clients who are unable to manage their own investment decisions, for different reasons, rely on
professionals who know them well and are willing to pay for the convenience of doing so.
%igh Ne- &o)-h Clien-s :%N&;
ndividual clients whose total assets under management are USD one million or more. Offshore
Private Banking Private banks that focus on wealth held abroad by residents globally; these
traditionally have been focused on avoiding taxes or foreign exchange restrictions.
Onsho)e P)i/a-e +an3ing
Private banks that focus on services for individuals banking in their own country.
O5inion-See3e)s In/es-men- S-'le
Clients who are able to manage their own money but like to receive advice at times. Although
they are fairly price-conscious, they will pay extra for the things that they value. Opinion seekers
may shop around multiple providers for the best information.
Sel2-Di)e(-ed In/es-men- S-'le
Clients who consider themselves financially savvy, who are price-conscious and who do much of
their own investment decision-making and money management.
226
)#n< !er(orm#n%e
Bank performance is important to internal and external stakeholders. A bank's performance is
often compared to other banks of similar size and product offerings.
Ann,al Re/en,e *)ow-h
The increase in revenues from one year to the next, calculated by subtracting the previous year's
revenues from the current year's revenues, and dividing by the previous year's revenues. Banks
target revenue growth of 5-10% per year.
Asse- and Lia1ili-' Managemen-
A technique necessary to counter fluctuations in interest rates and exchange rates. The bank's
Risk Management group typically has responsibility for asset and liability management. Financial
instruments such as options and swaps, which allow banks to limit the adverse affects of rate
movements, are used to manage interest rate risk. Matching foreign currency loans with deposits
in the same currency when appropriate is one way to manage exchange rate risk.
E22i(ien(' Ra-io
A measure of how well a bank is managing its non-interest expenses. The lower the efficiency
ratio, the better the bank is performing. This ratio is measured by dividing non-interest expense
by the sum of the net interest income and the non-interest income. For banks, typical efficiency
ratios are 55% or lower.
Fa(-o)ing
A type of financial service whereby a company sells its accounts receivable to a financial
institution. The financial institution collects the debt or payments for the receivables, and assumes
the risk that the receivable may not be repaid.
*)oss Domes-i( P)od,(- :*DP;
A measure in the change of market value of all goods services and structures produced in the
economy. This quarterly statistic shows the actual pace at which the economy is growing or
shrinking. Personal consumption expenditures typically account for roughly 68% of the GDP.
nvestment, government spending and net exports account for the rest.
In2la-ion
The rate at which the general level of prices for goods and services is rising.
In-e)es- In(ome
Net income earned from the bank's lending activities, such as commercial loans, credit cards,
mortgages, etc. Two-thirds of a bank's total income is usually derived from net interest income.
227
Non-in-e)es- In(ome
ncome earned from non-lending services offered by the bank. Some examples include service
fees and stock exchange commissions. Non-interest income is usually one-third of a bank's total
income.
P)o/ision
Amount charged against the profit and loss statement (income statement) to reserve against loan
losses or losses/charges. Bank management will make a "provision" for losses when they believe
they will be unable to collect the loan amounts due from customers. When the loan is "officially"
not repaid, the loan amount is "written off". f the original provision was insufficient to cover the
loss, an additional charge against income will be taken. f the original provision was greater than
the write-off, the bank will either credit income or apply the provision against another loan.
Re-,)n on E?,i-' :ROE;
Return on Equity is defined as net income divided by total equity. This ratio identifies how well a
company's equity is working to produce income. Banks try to average a minimum ROE of at least
15%.
"nem5lo'men- )a-e
Percentage of a country's workforce actively looking for work, but unable to find jobs. This metric
is one of the most closely watched government rates, because it has long been thought to often
give the clearest indication of the economy's direction. A rising unemployment rate is seen as a
sign of a weakening economy, which may call for an ease of government monetary policy. A drop
in the employment rate, on the other hand, shows that the economy is growing, which may spark
fears of high inflation, in which the government may increase interest rates. While this has proven
true quite often over the years, this theory did not hold true in the 1990's when the economy grew
rapidly, yet both the unemployment rate and inflation remained below 6% for many years. Thus,
rapid growth and the low unemployment rate did not spark fears of high inflation and increases in
interest rates during much of the 1990's.
&eigh-ed Ris3 Asse-s
To calculate the level of regulatory capital required, a bank's loans are first converted into
weighted risk assets (WRA's). Amounts by loan category (such as mortgages, credit card loans,
or loans to other banks) are multiplied by a weighting percentage that reflects the different levels
of risk for each lending type. As an example, credit card lending is assigned a weighting of 100%,
while loans to other banks are weighted at 20%, to reflect the higher risk of credit card lending
relative to lending to a bank. The bank must retain a certain percentage of its capital based on the
weighted amounts outstanding.
228
&)i-e-o22
Charging an asset amount, such as uncollected debt, to expense or loss. Bank management will
make a "provision" for losses when they believe they will be unable to collect the loan amounts
due from customers. When the loan is "officially" not repaid, the loan amount is it "written off". f
the original provision was insufficient to cover the loss, an additional charge against income will
be taken. f the original provision was greater than the write-off, the bank will either credit income
or apply the provision against another loan
TELECOMM"NICATION
Telecommunication refers to long distance communication. The Greek word "tele" means "far off".
At present, such communication is carried out with the aid of electronic equipment such as the
radio, telegraph, telephone, and television. However, in earlier times, smoke signals, drums, light
beacons, and various forms of semaphores were used for the same purpose. The information
transmitted can be in the form of voice, symbols, pictures, data, or a combination of these. The
physical equipment for a telecommunications system includes a transmitter; one or more
receivers; and a channel or means of communication such as air, wire, cable, communications
satellite, or some combination of these.
Componens in # e$ep+oni% %on&ers#ion
The telephone is one of the most amazing devices ever created. f you want to talk to someone,
all that you have to do is pick up the phone and dial a few digits. You are instantly connected to
the person with whom you would like to talk, and you can have a two-way conversation. The
telephone network extends worldwide, so you can reach almost anyone on our planet.
The actual process of making a call involves several functions that are activated with the help of
hardware and software components in the telecom network. The network comprises of telephone
sets, transmission media such as cables, and switching systems.
Ma3ing a (all
The telephone cannot by itself set up a call between two subscribers. Most of the functions occur
in cooperation with the telephone switching equipment (exchange).
When an individual lifts the cradle, a signal is sent to the exchange indicating that the user wants
to make a call. This signal is known as the hook off signal. The signaling process between the
exchange and the telephone set commences in this manner. The exchange checks for certain
parameters to authenticate the subscriber, and sends the dial tone to the user's telephone.
229
When the user dials a number, the exchange gets the destination address of the called
subscriber. The numbering system within the exchange routes the call to the called subscriber.
The exchange then determines the status, whether available or busy, of the called subscriber.
Based on the status, the exchange sends either a ring back tone or a busy tone to the calling
subscriber and the ring tone to the called subscriber. f the calling subscriber is available, a voice
path is created and the two parties can now communicate with each
An#$o" #nd Di"i#$ Si"n#$s
Speech signals may be transmitted through the medium either as analog or digital signals.
An analog signal is a continuously varying smooth electromagnetic wave that can be propagated
over a variety of media, including multi-wire cables, coaxial cables, and fiber optic cables. When a
person speaks into the transmitter on a telephone, voice signals made up of sound energy are
converted into electrical energy for transmission along a transmission medium. The conversion
from voice to analog signal is accomplished inside your telephone.
Digital signal A digital signal is a sequence of discrete voltage pulses that are transmitted over a
wire medium. The state of the digital signal is characterized by abrupt changes. For digital
signaling, voice or data is converted to a stream of binary information (0s and 1s) for
transmission. nstead of the voice signal being processed as an analog signal, it is converted into
a digital signal and handled with digital circuits throughout the transmission process. When it
arrives at the exchange that serves the called telephone, it is converted back to analog to
reproduce the original voice transmission.
Inrodu%ion 8 SHi%+in" Sysems
t is practically impossible to connect all telephones to each other using cables. This led to the
introduction of switching systems, commonly known as exchanges.
With the introduction of switching systems, the subscribers are not directly connected to each
other. nstead, all subscribers are connected to some switching system. Therefore, only one link
is established between the subscriber and the switching system. When a subscriber wants to call
another subscriber, a connection is established between the two at the exchange. This helps in
administration, maintenance, and overall control of the telecommunication network.
Types o( sHi%+in" sysems
The initial switching systems were manual. Many operators were involved with switching calls
manually between various subscribers. As the number of subscribers increased, the need for
automatic exchanges was felt. With the advent of computers, the exchanges were made
completely digital.
T'5es o2 swi-(hing s's-ems
Manual
Automatic
230
o Electromechanical
o Electronic (Stored Program Control)
M#nu#$ SHi%+in" Sysem
The manual exchange allowed the caller to alert the exchange operator, and the operator to alert
the call recipient. The operators, on receipt of this request from the caller, connected the caller's
line to another line, and noted the call duration for billing purposes.
When a caller lifted the receiver, an electrical signal was transmitted down the line, causing a
small metal shutter on the operator's board to drop down. A quick scan of the board showed the
operator the lines that needed attention. A magneto bell, devised by Bell's assistant, Thomas
Watson, was used to alert the person being called. To connect two lines, the manual exchange
had a series of horizontal and vertical metal bars. Each line was connected to one horizontal bar
and one vertical bar. At every cross point, each bar had a hole. To connect line 3 to line 14, the
operator would push a metal peg into the hole where bar 3 crossed bar 14. That allowed the
current to flow between the two lines and the conversation could begin.
Disad/an-ages o2 -he man,al eF(hange
The manual exchange was unable to handle the increasing number of calls as
subscribers grew in number.
The manual exchange was unable to provide privacy as far as the subscriber was
concerned.
t was costly to handle long distance calls manually. Hence, further inventions resulted in
the automatic exchange.
Auom#i% Ex%+#n"es
Due to the disadvantages of manual exchanges, automatic exchanges were invented. Automatic
exchanges can be classified as Electromechanical and Electronic.
The electromechanical exchanges transmitted sound in the form of analog signals. Further, the
electromechanical switching systems can be classified into
Strowger (Step-by-step) exchange
Crossbar exchange
E$e%roni% Ex%+#n"es
The crossbar systems were found to be slow in call processing. t was realized that components
of switching systems could be replaced by a single digital computer. n electronic switching
systems, a computer performs the control functions. Hence, these systems are called Stored
Program Control (SPC) Systems.
Stored Program Control Stored-program control is a broad term designating switches where
common control is carried out to a greater extent or entirely by computer hardware. Control
231
functions can be carried out entirely by a central computer, or partially or fully by distributed
processing.
The)e a)e 2o,) 1asi( 2,n(-ional elemen-s in -he SPC swi-(hing s's-em.
Swi-(hing ma-)iF4 The switching matrix is an abstraction of a switch. The function of a
switch is to connect the calling and the called party. The method of connection differs
based on the topology used. The infrastructure required for the connection is called the
switching matrix.
Call s-o)e4 This is a temporary storage of incoming call information ready for use on
command from the central processor. The call store is also referred to as 'scratch pad'
memory. t also contains data on the availability and status of lines, trunks, service
circuits, and internal switch circuit conditions.
P)og)am s-o)e4 The Program store contains the software needed for the operation of the
switching system.
Cen-)al 5)o(esso)4 The Central processor is the nerve center of the switch. t controls
the operation of various entities such as the dial tone detector, the ring generator, and the
switching matrix.
Di"i#$ Te%+no$o"y
The idea of digital technology is to convert analog signals to digital 1's and 0's. Sound is a set of
analog events, which can be represented in a curve. A continuous analog wave can be converted
to an equivalent digital mode. This process of modulation is called Pulse Code Modulation (PCM).
The PCM Process is illustrated in the figure below.

A single conversation does not utilize bandwidth to the maximum extent. To utilize the bandwidth
to the full extent, you can combine many such conversations to transmit through a same line by
the process of Multiplexing.
The conversion of an analog voice signal for digital transmission involves three steps.
Sam5ling4 Sampling is the process of taking readings (or 'samples') on the speech
curve. t is important to establish a set of discrete times at which the input waveform is
sampled. The Nyquist Criterion (Nyquist theorem) specifies how frequently readings need
to be taken. Thus, a suitable sampling frequency is determined. The result is a Pulse
Amplitude Modulated (PAM) signal, where each pulse corresponds directly to the
amplitude on the speech curve.
!,an-iHa-ion4 Quantization assigns a binary value to each voltage sample. A PAM
waveform could have an infinite number of distinct voltage values between the maximum
and minimum values of the voltages. To assign a different binary sequence to each
voltage value, a code of infinite length would be required. To avoid this, we go in for
quantization. The number of bits used for transmission depends upon the number of
quantum values. For example, eight bits are sufficient to form a unique code for each
232
quantum value when the number of quantum values is 256 (2^8 = 256). Of these, the first
bit is used to denote the polarity of the sampled signal. The equipment needs only to
differentiate between these digits, which are sent in the form of pulses.
During quantization, the Quantizer
o Limits the input signal amplitude between upper and lower voltage values - the
dynamic input range of the ADC.
o Sets a given number of discrete values between the maximum and minimum
voltage limits.
o Compares each sample with a set of quantum values in turn and assigns it to the
one it approximates.
Thus by definition, all samples in an interval between two quantum levels are deemed to
have the same value.
The output of the ADC is in serial digital format, which is a unipolar Binary sequence of
0's and 1's. This sequence cannot be directly fed to any media such as PCM, Optical
Fiber Cables (OFC), or Microwave (MW). Therefore it is given to the Line Coder, which
encodes it in one of the following formats: AM, HDB3, CM, RZ, or NRZ.

Coding: PCM is not specially designed to digitize speech waveforms. Speech waveforms
have a lot of redundancy that can be used to design coding schemes. Speech signals
typically have non-uniform amplitude distributions, sample-to-sample correlation,
periodicity or cycle-to-cycle correlation, and speech pauses or inactivity factors. PCM
outputs very high bit rates, which consume a lot of bandwidth. To overcome this problem,
new voice coders such as ADPCM and LPC were developed. They give much lower bit
rates and are therefore bandwidth efficient.
Di"i#$ SHi%+in" Sysems
n digital switching systems, the operation is automatic and information transfer is digital. Digital
switching systems can provide a better quality of service, as the time needed to connect
subscribers is reduced. t can also be used for large exchanges. Here, the computer carries out
the control functions of a telephone exchange. A set of instructions is stored within the computer's
memory and these are executed automatically by the processor.
Digital Switching is the process of interconnecting time slots between many links. This enables
digital routes at 2 Mbit/s or 1.5 Mbit/s, from other exchanges or digital PABXs, to be directly
terminated on the digital switch. Digital switching involves the transfer of the PCM signal relating
to the channel in a time slot on an inlet bus to a time slot on an outlet bus.
Digital switching system includes two types of switching systems.
Digital Space switching
Digital Time switching
233
Inrodu%ion 8 C#$$ !ro%ess
You have learned that a telephone conversation involves many functions other than picking up
the receiver and dialing the number of the subscriber.
The calling party's touch-tone telephone sends digits as tones instead of pulses through the
subscriber line to the called party's telephone. The incoming call information is stored in the call
store. The central control uses the program store to route the call to the destination. f the called
party answers, the connection is established, and the connection terminates when one of the
parties goes on-hook.
N,m1e)ing Plan
With the increase in number of subscribers, it became necessary to identify each subscriber to
set up the call faster. The numbering plan provides every subscriber and every service including
call forwarding, call waiting and call queuing, in the telephone network with a unique and simple
code, which allows automatic call set up in the network.

t is necessary that each subscriber be able to call any other subscriber. This requires each
subscriber to have a unique code. Also, for the convenience of the subscriber and the telephone
exchange, a simple code is needed.
The need 2o) a well-s-),(-,)ed n,m1e)ing 5lan is ne(essa)' -o4
dentify the calling subscriber in order to charge the call
Guarantee expansion in line with the increase in the number of subscribers without
sweeping changes in the numbering
Create a long term numbering system for subscribers and services
Create subscriber numbering series with as few digits as possible
Create a uniform and simple method of dialing numbers for the whole country
Create simple number codes for specific services, which are the same throughout the
country Simplify coordination with other numbering plans
In-e)na-ional N,m1e)ing Plan
The objective of a international numbering plan is to uniquely identify each subscriber connected
to the telecommunication network. An international numbering plan or world numbering plan has
been defined by CCTT. For numbering purposes, the world is divided into zones. Each zone is
given a single digit code. The European zone has been assigned two codes as a large number of
countries fall within this zone.
E/e)' in-e)na-ional -ele5hone n,m1e) (onsis-s o2 -wo 5a)-s4
Co,n-)' (ode4 The Country code is the combination of one, two, or three digits
characterizing the called country. The first digit in the country code is the zone code of the
234
zone in which the country lies. For example, in zone 9, ndia has the country code '91'
and Maldives '960'. The zone code 9 is the first digit in the country codes of both ndia
and the Maldives.
Na-ional N,m1e)4 The number of digits in an international subscriber number is limited
to a maximum of 12. However, in practice, world numbers are limited to 11 digits.
Therefore, the number of digits in the National Number is limited to 11 - n where n is the
number of digits in the Country Code. Therefore, the national number can contain 9-11
digits.
The Na-ional N,m1e) (onsis-s o2 8 5a)-s4
A)eaT),n3 (ode4 The Area or Trunk code is the digit or combination of digits that
identifies a particular numbering area of the called subscriber in a country. This code
determines the routing for a trunk call and the charge for it. <LTLIREF(hange Code4
The eF(hange (ode iden-i2ies a 5a)-i(,la) eF(hange wi-hin a n,m1e)ing a)ea.
S,1s()i1e) Line N,m1e)4 The s,1s()i1e) line n,m1e) is ,sed -o sele(- -he (alled
s,1s()i1e) line a- -he -e)mina-ing eF(hange. In CCITT -e)minolog'D -he (om1ina-ion
o2 -he eF(hange (ode and -he s,1s()i1e) line n,m1e) is 3nown as -he s,1s()i1e)
n,m1e). This is -he n,m1e) lis-ed in -he -ele5hone di)e(-o)'.
PA+X :P)i/a-e A,-oma-i( +)an(h EF(hange;
PA+X is a de/i(e ins-alled on -he (,s-ome)Ss 5)emisesD -ha- ena1les swi-(hing o2 m,l-i5le
in(oming and o,-going lines 1e-ween m,l-i5le in-e)nal 5hones.
+,siness s,1s()i1e)s o2-en ha/e s5e(i2i( )e?,i)emen-s 2o) -hei) -ele5hone n,m1e)s. The'
m,s- 1e sim5le -o )emem1e)D and m,s- also allow di)e(- a((ess -o indi/id,al eF-ensions
a2-e) dialing -he 1asi( n,m1e). Fo) eFam5leD a- Sha)da (en-e)D 'o, wo,ld wan- -o allow
(alle)s -o di)e(-l' dial -he eF-ension o2 a 5a)-i(,la) em5lo'ee a2-e) (alling -he Sha)da
n,m1e).
F)om -he 5oin- o2 /iew o2 -ele5hone adminis-)a-ionD -he PA+X :P)i/a-e A,-oma-i( +)an(h
EF(hange; is a s,1s()i1e) wi-h se/e)al eF-ensionsD whi(h is a((essed 1' a n,m1e).
Ro,-ing
Ro,-ing is -he 5)o(ess o2 deli/e)ing a message a()oss one o) mo)e ne-wo)3s /ia -he mos-
a55)o5)ia-e 5a-h.
The)e a)e 1asi(all' -wo main me-hods o2 )o,-ing4
FiFed )o,-ing4 The (all is )o,-ed 1ased on a 5)e-de2ined )o,-e. The)e is no (hange
in -he )o,-e )ega)dless o2 -he -ime o2 -he (allD a/aila1ili-' o2 -he )o,-eD o) (all
s-a-is-i(s.
D'nami( )o,-ing4 I- is ne(essa)' -o 2ind o5-imal )o,-ing 5a-hs 2o) -he -)ans5o)- o2
in2o)ma-ion.
235
In d'nami( )o,-ingD -he )o,-ing 5a--e)n /a)ies 1ased on 2a(-o)s s,(h as4
Time4 Calls a)e )o,-ed de5ending on -he -ime o2 -he da'. Fo) eFam5leD no)mall' 'o,
ma' 1e ,sing )o,-e 1 -o )o,-e (alls. %owe/e)D 1e-ween I -o 6K a.mD 'o, ma' de(ide
-o )o,-e <KU o2 -he (alls made /ia )o,-e a and <KU /ia )o,-e 1. These )o,-ing
5a--e)ns a)e 5)e-5lanned and a)e im5lemen-ed a- a 2iFed -ime o2 -he da'.
S-a-e4 Ro,-ing 5a--e)ns (an 1e /a)ied 1ased on ne-wo)3 in2o)ma-ion (olle(-ed 1'
-oll eF(hanges. Fo) eFam5leD i2 a (e)-ain )o,-e o) 5a)- o2 i- is 2o,nd 1,s'D -he -oll
eF(hange (an )o,-e 'o,) (all /ia ano-he) )o,-e.
E/en-4 Ce)-ain e/en-s s,(h as na-,)al (alami-ies o) s5e(ial o((asions s,(h as
Mo-he)s Da' (an a22e(- -he (all s-a-is-i(s. Ro,-ing 5a--e)ns a)e ,5da-ed lo(all'
1ased on (all s-a-is-i(s. On(e 'o, dial a n,m1e)D all eF(hanges in/ol/ed in )o,-ing
-he (all ha/e -o (omm,ni(a-e amongs- -hemsel/es. This is done -h)o,gh -he
5)o(ess o2 signaling.
Inrodu%ion 8 Si"n#$in"
In -ele5hon'D signaling )e2e)s -o -he 5assing o2 in2o)ma-ion and ins-),(-ions 2)om one 5oin-
-o ano-he)D )ele/an- -o -he se--ing ,5 o2 a -ele5hone (all.
To ini-ia-e a (allD -he (alle) li2-s -he handse- o22 -he hoo3. This o22-hoo3 s-a-e is a signal -o
-he eF(hange -o 1e )ead' -o )e(ei/e -he n,m1e) o2 -he (alled s,1s()i1e). As soon as
a55)o5)ia-e )e(ei/ing e?,i5men- is (onne(-ed -o -he lineD -he eF(hange signals -he dial
-one -o -he (alling s,1s()i1e). The s,1s()i1e) (an -hen dial -he des-ina-ion n,m1e). The
s,1s()i1e) )e(ei/es ei-he) a )inging signalD an engaged o) 1,s' -one signalD o) an
e?,i5men- 1,s' -one indi(a-ing (onges-ion 1e-ween -he (alled eF(hange and -he (alling
line. These a)e signals wi-h whi(h -he -ele5hone s,1s()i1e)s -hemsel/es a)e (on(e)ned.
Signaling in/ol/es sending signals 1e-ween /a)io,s swi-(hing s's-emsD -)ansmission
s's-emsD and s,1s()i1e) e?,i5men-s in a ne-wo)3.
Signaling Tones
In olde) eF(hangesD in2o)ma-ion is 5assed /ia a )o-a)' dial 1' a se)ies o2 ma3es and 1)ea3s
o2 -he s,1s()i1e)Ss loo5D in-e)),5-ing (,))en- 2low. In mode)n eF(hangesD /oi(e-2)e?,en('
m,si(al -ones a)e sen- -o -he eF(hange as 5,sh 1,--ons a)e 5)essed. These -ones a)e
,s,all' (alled DTMF :D,al Tone M,l-i-2)e?,en('; as ea(h -ime a 1,--on is 5)essedD -wo
-ones a)e sim,l-aneo,sl' sen- o,- -o -he line. Dis-in(-i/e signaling -ones a)e 5)o/ided in
all a,-oma-i( eF(hanges.
T'5i(all'D -he)e a)e 2o,) dis-in(- signaling -ones4
Dial Tone4 The Dial -one is ,sed -o indi(a-e -ha- -he eF(hange is )ead' -o a((e5- -he
digi-s dialed 1' -he s,1s()i1e). The s,1s()i1e) sho,ld s-a)- dialing -he n,m1e)
onl' on hea)ing -he dial -one. O-he)wiseD -he ini-ial digi-s o2 -he dialed n,m1e) ma'
1e missed 1' -he eF(hange.
236
Ringing Tone4 &hen -he line o2 -he (alled s,1s()i1e) is o1-ainedD -he eF(hange
sends -he )inging (,))en- -o i-s -ele5hone se-. Sim,l-aneo,sl'D -he eF(hange sends
a Ringing -one -o -he (alling s,1s()i1e) -oo. The )inging -one and -he )inging
(,))en- a)e -wo simila)D 1,- inde5enden- ?,an-i-iesD ha/ing a do,1le-)ing 5a--e)n.
The)e2o)eD i- is 5ossi1le -ha- -he (alling s,1s()i1e) hea)s -he )inging -oneD whe)eas
-he (alled s,1s()i1e) ma' no- hea) an' )ing.
N,m1e) ,no1-aina1le -one o) E?,i5men- 1,s' -one4 The N,m1e) ,no1-aina1le
-one ma' 1e sen- -o -he (alling s,1s()i1e) d,e -o a n,m1e) o2 )easons. The (alled
s,1s()i1e) line ma' 1e o,- o2 o)de) o) dis(onne(-edD o) -he)e ma' 1e an e))o) in
dialing. I- ma' also 1e d,e -o (onges-ion 1e-ween -he (alled eF(hange and -he
(alling line.
Ro,-ing -one o) Call-in-5)og)ess -one4 The Ro,-ing -one o) Call-in-5)og)ess -one is
hea)d when -he (all is )o,-ed -h)o,gh a n,m1e) o2 di22e)en- -'5es o2 eF(hanges.
Signaling Te(hni?,es
The -ele(omm,ni(a-ion ne-wo)3 (lassi2ies signaling -e(hni?,es on -he 1asis o2 -he
2ollowing4
T'5e o2 signaling in2o)ma-ion
Lo(al loo5 signaling4 Lo(al loo5 signaling )e2e)s -o signaling in whi(h signals a)e
-)ansmi--ed 1e-ween -ele5hone e?,i5men- and -he eF(hange. Fo) eFam5leD -he O22-
hoo3D On-hoo3D SeiHeD and Clea) signals a)e -)ansmi--ed o/e) -he lo(al loo5.
Sele(-ion signaling4 Sele(-ion signaling (on/e's in2o)ma-ion )ela-ing -o -he )o,-ing
o2 -he (all.
O)igina-ing and -e)mina-ing 5oin-s o2 signaling
S,1s()i1e) signaling4 S,1s()i1e) loo5 signaling de5ends on -he -'5e o2 -ele5hone
ins-),men- ,sedD s,(h as )o-a)' dial -ele5hone o) a d,al -one m,l-i-2)e?,en('
-ele5hone.
In-e)-eF(hange signaling4 This -'5e o2 signaling is in-e)nal -o -he swi-(hing s's-em.
I- de5ends on -he -'5e and design o2 -he swi-(hing s's-em.
Ph'si(al 5a-h ,sed -o -)ansmi- signaling in2o)ma-ion
Channel asso(ia-ed signaling4 Signaling in2o)ma-ion is -)ansmi--ed in -he same
5a-h :(hannel; whe)e s5ee(h signals a)e -)ansmi--ed. In -he (ase o2 SPC :S-o)ed
P)og)am Con-)ol; eF(hangesD -)ansmission o2 signals is in -he same 5a-hD 1,-
(on-)ol is inde5enden- in -he eF(hange.
Common (hannel signaling4 In Common Channel signalingD -he 5h'si(al -ie
1e-ween -he signaling 5a-h and -he -)a22i( (i)(,i- is )emo/ed. All signaling -)ans2e)D
)ela-ed -o a -)ansmission lin3D -a3es 5la(e o/e) a dedi(a-ed signaling (hannel.
%en(eD a (ommon-signaling (hannel handles -he -)ans2e) o2 signaling in2o)ma-ion
2o) n,me)o,s -)a22i( (i)(,i-s.
237
Te(hnolog'
Loo5 dis(onne(- signaling
Voi(e 2)e?,en(' signaling
M,l-i-2)e?,en(' signaling
Common (hannel signaling
Inrodu%ion 8 NeHor<s
A((,)a-e ne-wo)3 o)ganiHa-ion is /e)' essen-ial 2o) (all 5)o(essing and )o,-ing. To ha/e a
well-o)ganiHed ne-wo)3D 'o, need -o 5lan -he ne-wo)3 (a)e2,ll'. O/e) -he 'ea)sD ne-wo)3
5lanning has 3e5- /a)'ing wi-h )es5e(- -o -he n,m1e) o2 s,1s()i1e)s.
In -he 1eginningD -he)e we)e indi/id,al eF(hanges -ha- (onne(-ed limi-ed s,1s()i1e)s in a
s5e(i2i( a)ea. La-e)D -he neigh1o)ing a)eas we)e (onne(-ed -o -hese eF(hanges. &i-h
in()easing s,1s()i1e)sD all -he eF(hanges needed -o 1e ne-wo)3ed.
S-),(-,)e o2 -he Tele5hone Ne-wo)3
Ini-iall'D all eF(hanges we)e (onne(-ed -o ea(h o-he) di)e(-l'. %owe/e)D -he ne-wo)3 was
la-e) modi2ied -o ()ea-e a s's-em o2 di22e)en- le/els. I- was no longe) ne(essa)' 2o) e/e)'
eF(hange -o 1e (onne(-ed -o e/e)' o-he) eF(hange di)e(-l'.
The le/els in a -ele5hone ne-wo)3 a)e4
The Lo(al eF(hange4 The s,1s()i1e) lines a)e (onne(-ed -o -he lo(al eF(hange.
The Tandem swi-(h4 The Tandem swi-(h is ,sed 1asi(all' 2o) -he )o,-ing o5e)a-ion.
As an eF(e5-ionD s,1s()i1e) lines ma' 1e (onne(-ed -o -his eF(hange.
The T),n3 eF(hange4 Long dis-an(e (allsD whi(h need -he ,se o2 -),n3sD go
-h)o,gh -his eF(hange.
The In-e)na-ional ga-ewa'4 This is -he highes- le/el o2 eF(hanges. In-e)na-ional
(alls a)e )o,-ed -h)o,gh -his eF(hange.
S,1s()i1e) Line Ne-wo)3s
The S,1s()i1e) Line Ne-wo)3 is -he ne-wo)3 -ha- (onne(-s -he s,1s()i1e) -o a lo(al
eF(hange. The lo(al eF(hange has -o 1e a1le -o handle si-,a-ions in(l,ding new
s,1s()i1e)s 2)om -he newl' (ons-),(-ed )esiden-ial la'o,-sD and s,1s()i1e)s mo/ing 2)om
one 5la(e -o ano-he). The)e2o)eD -he s,1s()i1e) line ne-wo)3 needs -o 1e /e)' d'nami(.
The s,1s()i1e) line ne-wo)3 a((o,n-s 2o) a1o,- <K 5e)(en- o2 -he whole in/es-men- (os- o2
-he -ele5hone ne-wo)3.
#o,) -ele5hone m,s- ha/e a 5e)manen- (onne(-ion -o -he lo(al eF(hange. %a/ing a wi)e
on a 5ole and a )e-,)n /ia -he ea)-h does -his. +,- when -he n,m1e) o2 -ele5hones
in()easesD -he 5)o/ision 2o) -he 5oles and -hei) asso(ia-ed wi)es 1e(omes eF5ensi/e. The
h,n- 2o) )ed,(ed (os-s and smalle) wi)es has led -o -he ,sage o2 5ai)ed (a1les. :6KD <KD6KK
238
o) mo)e 5ai)s 5e) (a1le;. The e/ol,-ion o2 s,1s()i1e) line ne-wo)3 1egan wi-h -he (on(e5-
o2 Two-wi)e o) -wis-ed 5ai) (a1les.
Then (ame -he Dis-)i1,-ion 5oin-. The Dis-)i1,-ion 5oin- :DP; is -he 5oin- 2)om whi(h -he
(a1les 2)om -he eF(hange a)e (onne(-ed -o 'o,) -ele5hone. ThenD di)e(- lines 2)om -he
s,1s()i1e)Ss -ele5hones a)e -a3en.
The in/en-ion o2 -he C)oss (onne(-ion 5oin- o) MDF :Main Dis-)i1,-ion F)ame; 2ollowed -he
Dis-)i1,-ion Poin-. A- -he C)oss (onne(-ion 5oin-D we (an ha/e mo)e n,m1e) o2 in(oming
s,1s()i1e) lines as (om5a)ed -o -he n,m1e) o2 lines (onne(-ing -o -he eF(hange. Fo)
eFam5leD we (an ha/e 8K 5ai)s -e)mina-ing a- -he ()oss (onne(-ion 5oin-D and onl' 7K
going o,-. As -he 5)o1a1ili-' o2 all lines 1eing 1,s' is lowD we (an ha/e -his deg)ee o2
(on(en-)a-ion.
Adding s,1s()i1e)s -o -he S,1s()i1e) Line Ne-wo)3
I2 s,1s()i1e)s a)e -o 1e added -o -he eFis-ing s,1s()i1e) ne-wo)3D -he 2ollowing -e(hni?,es
a)e ,sed4
Ca1le la'ing4 #o, (an add s,1s()i1e)s -o -he ne-wo)3 sim5l' 1' la'ing mo)e (a1les
1e-ween -he ()oss (onne(-ion 5oin-s o) MDFs and -he eF(hange.
Con(en-)a-o)4 Con(en-)a-o)s o) Sline (on(en-)a-o)sS -ha- (onsolida-e s,1s()i1e)
loo5s a)e )emo-el' o5e)a-ed and -he (on(en-)a-ion o) eF5ansion 5o)-ion o2 -he
swi-(h is 5la(ed a- a )emo-e lo(a-ion. Con(en-)a-ion (an also 1e e22e(-i/el' (a))ied
o,- ,sing (a))ie) -e(hni?,esD ei-he) 5,lse-(ode mod,la-ion :PCM; o) 2)e?,en('
di/ision m,l-i5leFing :FDM;. As all s,1s()i1e)s will no- 1e a((essing -he eF(hange
)eso,)(es sim,l-aneo,sl'D -he' (an 1e (onne(-ed -h)o,gh a line (on(en-)a-o).
Remo-e S,)/i/a1le ,ni-4 Remo-e S,)/i/a1le "ni- :RS"; is a 5a)- o2 -he main
eF(hange lo(a-ed awa' 2)om -he 5a)en- eF(hange. I- (a-e)s -o -he s,1s()i1e)s B,s-
li3e -he 5a)en- eF(hange (a-e)s -o -hemD and (an also wo)3 as a s-andalone
eF(hange wi-h lo(al loo5s. The RS" is se- ,5 -o sha)e -he load o2 -he 5a)en-
eF(hange. Ini-ialiHa-ionD adminis-)a-ionD o5e)a-ionD and main-enan(e a)e done 2)om
-he 5a)en- eF(hange.
Inrodu%ion 8 Tr#((i% En"ineerin"
The 1asi( 5,)5ose o2 -)a22i( enginee)ing is -o de-e)mine -he (ondi-ions ,nde) whi(h
ade?,a-e se)/i(e is 5)o/ided -o s,1s()i1e)s while ma3ing e(onomi(al ,se o2 -he
)eso,)(es 5)o/iding -he se)/i(e. Th,sD i- is im5o)-an- -o (onside) /a)io,s 2a(-o)s 1e2o)e
se--ing ,5 an a(-,al -ele(om ne-wo)3. The design o2 a -ele(omm,ni(a-ion ne-wo)3 is
1ased on -he 5)oBe(-ed -)a22i( o) load -he ne-wo)3 is s,55osed -o handle.
T)a22i( enginee)ing hel5s -o de-e)mine -he e?,i5men- )e?,i)ed -o 5)o/ide a 5a)-i(,la) le/el
o2 se)/i(e 2o) a gi/en ne-wo)3. Fa(-o)s s,(h as -he n,m1e) o2 s,1s()i1e)s ,sing -he
ne-wo)3D -)a22i( gene)a-ed 1' -hemD and -he load on -he ne-wo)3 sho,ld 1e (onside)ed 2o)
-)a22i( meas,)emen-. The load /a)ies d,)ing -he da' wi-h hea/' -)a22i( a- (e)-ain -imes and
low -)a22i( a- o-he) -imes.
239
Tele--)a22i( -heo)'
The Tele--)a22i( -heo)' is one o2 -he mos- im5o)-an- aids 2o) (on-)olling in/es-men- in -he
ne-wo)3.
The -heo)' aims -o 5)o/ide a ma-hema-i(al o)de) -o
Ma3e Tele--)a22i( meas,)emen-s
P)o/ide well-de2ined ,ni-s
Cal(,la-e )ela-ion 1e-ween ?,ali-' o2 se)/i(e and s's-em (a5a(i-'
In Tele--)a22i( -heo)'D (e)-ain 5)o1a1ili-' dis-)i1,-ions a)e de)i/ed. These a)e designed as
ma-hema-i(al models. The models a)e ,s,all' 1ased on ma-hema-i(al )ela-ion 1e-ween
-h)ee 2a(-o)s4
*)ade o2 se)/i(e
T)a22i( in-e)es-
E?,i5men- )e?,i)emen-
Tr#((i% Inensiy
The in-e)na-ional ,ni- o2 -)a22i( is -he E)langD named a2-e) Danish ma-hema-i(ian Agne)
$)a),5 E)langD who laid -he 2o,nda-ion o2 -he -)a22i( -heo)'. An E)lang is eF5)essed as lm
whe)e l is -he a/e)age (alls a))i/al )a-e and m is -he a/e)age (all se)/i(e )a-e. F)om a
5)a(-i(al s-and5oin-D -he E)lang is a meas,)e o2 -)a22i( in-ensi-'D whe)e one E)lang
)e5)esen-s one (i)(,i- o((,5ied 2o) one ho,).
T)a22i( in-ensi-' (an 1e de2ined in -h)ee wa's4
The )a-io 1e-ween -he 5e)iod o2 -ime a swi-(hing de/i(e is o((,5ied -o -he -o-al
5e)iod o2 -ime Fo) eFam5leD i2 a -),n3 (i)(,i- is engaged on di22e)en- (alls 2o) a -o-al
-ime o2 7< min,-es in an ho,)D -he -)a22i( in-ensi-' is de-e)mined as K.9 E)langs.
The n,m1e) o2 sim,l-aneo,sl' o((,5ied de/i(es in a g)o,5 o2 swi-(hing de/i(es
Fo) eFam5leD 2i/e -),n3 (i)(,i-s in a )o,-e a)e engaged a- an' gi/en -ime. The -)a22i(
in-ensi-' is -h,s < E)langs.
The 5)od,(- o2 -he n,m1e) o2 (alls 5e) -ime ,ni- and -he mean holding -ime o2 (alls
:A C ' E s; Fo) eFam5leD in a lo(al eF(hangeD -he -o-al n,m1e) o2 (alls d,)ing 6 ho,)
was 6IKK. The a/e)age holding -ime was 8 min,-es. The)e2o)eD -he -)a22i( in-ensi-'
will 1e (al(,la-ed as 6IKK E 8=K C JK E)langs.
T)a22i( Con(e5-s
The)e a)e -h)ee addi-ional -)a22i( (on(e5-s -ha- a22e(- -he -)a22i( in-ensi-'.
T)a22i( (a))ied-)a22i( /ol,me4 The -o-al -)a22i( (a))ied d,)ing a (e)-ain -ime is (alled
-)a22i( /ol,me. Ma-hema-i(all'D -)a22i( /ol,me is an in-eg)al 5a)- o2 -he -)a22i( (,)/e.
240
T)a22i( o22e)ed4 The (on(e5- o2 -)a22i( o22e)ed is a -heo)e-i(al ?,an-i-' (al(,la-ed on
-he 1asis o2 -he n,m1e) o2 (i)(,i-s -ha- a)e ,sed. I- is -he es-ima-ed 5o-en-ial o2 -he
ne-wo)3.
T)a22i( los-4 The -)a22i( los- is also a -heo)e-i(al ?,an-i-' (al(,la-ed 2)om -he
di22e)en(e 1e-ween -)a22i( o22e)ed and -)a22i( (a))ied.
T)a22i( Vol,me
The -)a22i( /ol,me 3ee5s 2l,(-,a-ing d,)ing -he da'. T)a22i( /ol,me is de5enden- on -he
s,1s()i1e)sS ha1i- o2 ,sing -ele5hones. &hen dimensioning a ne-wo)3D 'o, m,s- (onside)
-he 2ollowing 2a(-o)s4
+,s' ho,)
O((,5a-ion -ime
"ns,((ess2,l (all a--em5-s
*)ade o2 se)/i(e
S,1s()i1e) )ea(-ions
T)a22i( Me-e)ing
Mode)n eF(hange e?,i5men- no)mall' in(l,des 2,n(-ions 2o) -)a22i( me-e)ing. These ma3e
i- 5ossi1le -o (olle(- da-a on -he -)a22i( in -he eF(hange and s-o)e i- on -a5es 2o)
s,1se?,en- 5)o(essing. I- is also 5ossi1le -o (olle(- da-a 2)om man' di22e)en- eF(hanges
in s5e(ial o5e)a-ion (en-e)s. The meas,)emen-s ma' 1e -a3en a- se- /a)io,s 2a(-o)s
(on(e)ning a ne-wo)3D s,(h as (all )a-e. #o, need -o -hin3 a1o,- -he media -h)o,gh whi(h
all -he in2o)ma-ion -)a/els and ma3e a (os-1ene2i- anal'sis o2 /a)io,s media.
Fo)m,lae ,sed in T)a22i( Enginee)ing
The)e a)e -wo main 2o)m,lae ,sed in -)a22i( enginee)ing4
E)lang + and Poisson. The E)lang + 2o)m,la ass,mes -ha- all 1lo(3ed (alls a)e (lea)ed.
This means -ha- -he s,1s()i1e)s do no- )edial when -he' (anno- ge- -h)o,gh. The Poisson
2o)m,la ass,mes -ha- -he s,1s()i1e) sim5l' 3ee5s on )edialing. I2 -he Poisson me-hod is
,sedD 'o, will 1,' mo)e -),n3s -han i2 'o, ,se E)lang +. Poisson -'5i(all' o/e)es-ima-es
-he n,m1e) o2 -),n3s 'o, will need while E)lang + ,nde)es-ima-es -he n,m1e) o2 -),n3s
-ha- 'o, will need. The)e a)e o-he) mo)e (om5leF 1,- mo)e a((,)a-e wa's o2 es-ima-ing
-he n,m1e) o2 -),n3s needed. E)lang C and (om5,-e) sim,la-ion (an 1e ,sed 2o) -his.
Inrodu%ion 8 Tr#nsmission
#o, need -o design a -)ansmission s's-em 2o) ?,ali-' -)ansmission and e22i(ien(' o2
o5e)a-ion. On(e 2a(-o)s s,(h as ne-wo)3 and (ha)ging a)e de-e)minedD 'o, need -o
de-e)mine -he media -h)o,gh whi(h in2o)ma-ion will -)a/el.
T)ansmission s's-ems in(l,de T)ansmission -e(hni?,es and T)ansmission media.
241
Need (or Tr#nsmission Te%+ni6ues
The 1ina)' (ode gene)a-ed 2o) ea(h sam5le 1' -he PCM en(ode) is no- s,i-a1le 2o)
-)ansmission. The)e2o)eD a s,i-a1le -)ansmission -e(hni?,e has -o 1e (hosen -o -)ansmi-
-he signal.
This is 1e(a,se -he 1ina)' o,-5,- 2)om a PCM s's-em no)mall' has a wide )ange o2 1i-
5a--e)nsD in(l,ding s-)ings o2 6s and e/en longe) s-)ings o2 Ks. %owe/e)D 2o) e22e(-i/e
)egene)a-ion o2 -he signalD -he signal sho,ld ha/e a 2)e?,en(' o2 6--o-K and K--o 6
-)ansi-ions.
AlsoD -he -)ansmission o2 -he PCM 1ina)' signalD whi(h is made ,5 o2 He)o and 5osi-i/e
/ol-agesD ()ea-es a line signal wi-h a signi2i(an- amo,n- o2 ene)g' in -he DC and low
2)e?,en(' )ange. The -)ans2o)me)s on -he line s's-em (anno- handle -his. The)e ma' also
1e o-he) 5)o1lems asso(ia-ed wi-h -he -)ansmission o2 -he low 2)e?,en(' 5owe) s5e(-),m
o2 1ina)' signalsD s,(h as in-e)2e)en(e wi-h a,dio signals on adBa(en- (a1les.
The mos- (ommon line (odes a)e %D+8D 9+8TD ADIAMID and CMI.
AMI :Al-e)na-e Ma)3 In/e)sion; Te(hni?,e
AMI is a -)ansmission -e(hni?,e in whi(h s,((essi/e 6Ss a)e )e5)esen-ed wi-h o55osi-e
5ola)i-'. The e22i(ien(' o2 -his (ode (on/e)sion is gi/en 1' -he )a-io o2 -he in2o)ma-ion
(a))ied -o -he (a5a(i-' o2 -he line (ode. AMI has a (ode e22i(ien(' o2 => 5e)(en-
T)ansmission S's-ems4 M,l-i5leFe)s
M,l-i5leFe)sD O5-i(al S's-emsD and &i)eless s's-ems a)e some o2 -he T)ansmission
S's-ems.
A single (on/e)sa-ion does no- ,-iliHe 1andwid-h -o -he maFim,m eF-en-. To ,-iliHe -he
1andwid-h -o -he 2,ll eF-en-D 'o, (an (om1ine man' s,(h (on/e)sa-ions -o -)ansmi-
-h)o,gh a same line 1' -he 5)o(ess o2 M,l-i5leFing. The 5)o(ess o2 (on/e'ing a n,m1e) o2
signals sim,l-aneo,sl' o/e) a single 1ea)e) is -e)med as m,l-i5leFing. FDM s's-ems (an
1e ,sed on di22e)en- -'5es o2 media s,(h as s'mme-)i(al 5ai)ed (a1lesD (oaFial (a1lesD
)adio lin3sD and sa-elli-e lin3s.
M,l-i5leFing (an 1e done 1' -wo -e(hni?,es4
Analog - F)e?,en(' di/ision m,l-i5leFing :FDM;
Digi-al - Time di/ision m,l-i5leFing :TDM;
M,l-i5leFing in a F)e?,en(' Di/ision M,l-i5leFing :FDM; s's-em4 FDM s's-ems (an 1e
,sed on di22e)en- -'5es o2 media in(l,ding s'mme-)i(al 5ai)ed (a1lesD (oaFial (a1lesD
)adio lin3sD and sa-elli-e lin3s.
242
A (a))ie) 2)e?,en(' is mod,la-ed 1' -he signal 2)om a s5ee(h (hannel. The )es,l- is a
n,m1e) o2 2)e?,en(' 1ands. Onl' one o2 -hese 2)e?,en(' 1ands is needed. The o-he)s a)e
2il-e)ed o,-.
No- e/en -he (a))ie) wa/e needs -o 1e -)ansmi--ed. I- (an 1e )e-)ie/ed in -he )e(ei/e) as
long as -he 2)e?,en(' and 5hase a)e eFa(-l' (o))e(-.
FDM was 2)e?,en-l' ,sed in -he 5as-D 1,- now has 1een )e5la(ed wi-h -he digi-al
e?,i/alen- Time Di/ision M,l-i5leFing :TDM;.
M,l-i5leFing in a TDM s's-em4 In ne-wo)3s whe)e high (a5a(i-' is neededD i- is mo)e
e(onomi(al -o g)o,5 a n,m1e) o2 PCM s's-ems ,sing highe)-o)de) m,l-i5leFing. This is
done 1' 1i- in-e)lea/ing. The 1i- )a-es a- di22e)en- m,l-i5leFing le/els in a 8K87 (hannel
s's-em a)e shown 1elow4
The idea is -o (om1ine SnS in5,- signals :2)om ea(h o2 -he SnS (hannels; in-o a single
m,l-i5leFed (hannel. The SnS indi/id,al signals a)e se5a)a-ed and 5)o(essed a- -he
dis-an- end and 2ed -o -he a55)o5)ia-e o,-5,- (hannels. A -ime-di/ision-m,l-i5leFed
s's-em has a (ommon highwa' sha)ed 1' a n,m1e) o2 (hannelsD ea(h o2 whi(h
o((,5ies -he highwa' d,)ing 5e)iodi( sli(es o2 -imeD 3nown as S-ime slo-sS :TS;.
This m,l-i5leFing -e(hni?,e )e?,i)es -ha- sam5ling 1e done -o -he in5,- signal
2i)s-. A n,m1e) o2 s,(h -ime slo-s a)e -hen (om1ined -o 2o)m a 2)ame. Ea(h o2 -hese
-ime slo-s (a))ies in2o)ma-ion 2)om -he (o))es5onding (hannel.

T)ansmission Media
A s,i-a1le medi,m is )e?,i)ed -o -)ansmi- s5ee(h signals )ega)dless o2 -he -e(hni?,e 'o,
,se.
T)ansmission media (an 1e di22e)en-ia-ed in-o -wo main g)o,5s4
&i)ed media
&i)eless media
In-)od,(-ion - Call Cha)ging
The se- ,5 and o5e)a-ion o2 a -ele(omm,ni(a-ion ne-wo)3 in/ol/es high in/es-men-. The
(a5i-al in/es-men- in(l,des landD 1,ildingsD swi-(hing s's-emsD and (a1les. The
o5e)a-ional (os- in(l,des sala)ies o2 s-a22D and (os-s in(,))ed in -he main-enan(e o2 -he
ne-wo)3. The -ele(omm,ni(a-ion se)/i(e )e(ei/es i-s in(ome 2)om i-s s,1s()i1e)s. I- is
-he)e2o)e ne(essa)' -o design a s,i-a1le (ha)ging 5lan -o )e(o/e) -he (os-s 2)om
s,1s()i1e)s.
243
Cha)ging Plan
The (ha)ging 5lan sho,ld 1e designed a((o)ding -o a 5)e-de2ined 5oli('. I2 -ele5hone
se)/i(es a)e (onside)ed a so(ial )igh- and a)e -o 1e made a/aila1le (om5le-el' 2)eeD no
(ha)ging 5lan is needed a- all. %owe/e)D as soon as 'o, de(ide -o -a3e some 5a'men-D a
(ha)ging 5lan is needed.
+e2o)e 'o, design -he (ha)ging 5lanD 'o, sho,ld ha/e a 5oli(' -ha- answe)s -he 2ollowing
?,es-ions4
&ha- 5o)-ion o2 -he (os-s sho,ld -he s,1s()i1e) 5a'?
Sho,ld (ha)ging )a-es de5end on -he (a-ego)' o2 -he s,1s()i1e)?
Sho,ld -he )a-es /a)' wi-h geog)a5hi( lo(a-ion?
Sho,ld -he (om5an' ma3e a 5)o2i-?

T'5es o2 (ha)ges in a (ha)ging 5lan
The (ha)ges le/ied on -he s,1s()i1e) (an 1e (a-ego)iHed in /a)io,s wa's.
Ini-ial (ha)ge 2o) 5)o/iding a ne-wo)3 (onne(-ion
Ren-al (ha)ge
Cha)ges 2o) indi/id,al (alls

The)e a)e ,s,all' -h)ee -'5es o2 (ha)ges in -he (ha)ging 5lan.
Ins-alla-ion (ha)ge4 &hen -he adminis-)a-ion (onne(-s new s,1s()i1e)sD some
ini-ial (os-s a)e in(,))ed s,(h as -he e?,i5men- a- -he eF(hange -ha- has -o 1e
assigned -o -he s,1s()i1e)D a -ele5hone se-D and -he (a1ling. These (ha)ges a)e
o2-en -he same 2o) all ins-alla-ions and a)e inde5enden- o2 -he a(-,al (os- o2 an
ins-alla-ion.
S,1s()i5-ion 2ee4 This is a 2iFed (os- (ha)ged -o -he s,1s()i1e) 2o) -he
main-enan(e o2 -he ne-wo)3D and se)/i(es s,(h as 5)o/iding -he -ele5hone
di)e(-o)'. The s,1s()i5-ion 2ee is ,s,all' (ha)ged on a 5e)iodi( 1asisD s,(h as
mon-hl'.
Call (ha)ges4 Call (ha)ges a)e gene)all' in di)e(- 5)o5o)-ion -o -he n,m1e) o2 (alls
and -he d,)a-ion o2 -hese (alls. Call (ha)ges also /a)' de5ending on whe-he) -he
(all is a lo(al (all o) a -),n3 (all. Calls ma' 1e (ha)ged di22e)en-l' 1ased on -he
-ime o2 -he da' -he (all is made. In some (asesD -he)e a)e no (all (ha)ges 2o) lo(al
(alls. Ins-eadD -he s,1s()i5-ion 2ee is signi2i(an-l' highe).
244
T'5es o2 Cha)ging Plans
The)e a)e di22e)en- -'5es o2 (ha)ging 5lans de5ending ,5on whe-he) 'o, de(ide -o (ha)ge
a((o)ding -o -he n,m1e) o2 (allsD -he d,)a-ion o2 (allsD o) (ha)ge a 2iFed amo,n- 2o) a
5a)-i(,la) -ime 5e)iod.
Fla- )a-e4 The sim5les- 5ossi1le 2o)m o2 (ha)ging is -he 2la- )a-e (ha)ge. In -his
(ha)ging 5lanD (all (ha)ges a)e 2iFed 2o) a 5e)iod o2 -ime. &he-he) 'o, ma3e < o) 7<
(alls a da'D -he (ha)ge is -he same. One o2 -he ad/an-ages o2 -he model is -o
s-im,la-e -he ,se o2 eFis-ing ins-alla-ions. I2 -he (om5an' de(ides -o o5- 2o) -his
modelD -he (ha)ges 2o) ins-alla-ion a)e ,s,all' ?,i-e high. To a/oid ha/ing -o la'
down new (a1les and o-he) (os-s asso(ia-ed wi-h (a-e)ing -o new s,1s()i1e)sD -he
(om5an' ma' de(ide -o (ha)ge a 2la- )a-e. Man' (ons,me)s will -hen ,se -he
eFis-ing 5hones al)ead' ins-alled a- /a)io,s 5la(es.
"ni- 2ee (ha)ging4 Call (ha)ges de5end onl' on -he n,m1e) o2 (allsD no- on o-he)
2a(-o)s s,(h as -he d,)a-ion o2 -he (all o) -he dis-an(e in/ol/ed. The eF(hange
(o,n-s ea(h s,1s()i1e)Ss (alls. E/e)' (all (os-s a 2iFed amo,n- )ega)dless o2
whe)e -he s,1s()i1e) )ings o) how long -he (all las-s. The (os- 5e) (all is alwa's
-he same.
Time (ha)ging4 "nde) Time (ha)gingD -he (all is (ha)ged 1ased on -he d,)a-ion o2
ea(h (all. Th,sD (all (ha)ges de5end ,5on -he amo,n- o2 -ime -he s,1s()i1e) 3e5-
-he eF(hange 1,s'. The g)ea-e) -he dis-an(e 1e-ween -he (alled and (alling
s,1s()i1e)D -he mo)e -he e?,i5men- in/ol/edD and -he mo)e -he (os- o2 -he (all. Fo)
eFam5leD -ho,gh M,m1ai-P,ne is a lo(al (allD -hese (alls a)e -ime (ha)ged a- a
highe) )a-e -han a no)mal lo(al (all wi-hin -he (i-'.
Some (o,n-)ies ha/e 2o)m,la-ed di22e)en- (ha)ges 2o) di22e)en- -imes o2 -he da'D -h,s
ma3ing -he (ha)ging en-i)el' de5enden- on -he -ime o2 -he da'.
C+#r"in" Me+ods
Calls a)e (ha)ged 1' ,sing ei-he) a me-e)ing ins-),men- (onne(-ed -o ea(h s,1s()i1e) line
o) a me-e)ing )egis-e) assigned -o ea(h s,1s()i1e) in (ase o2 ele(-)oni( eF(hanges. The
(o,n- in -he me-e) o) )egis-e) )e5)esen-s -he n,m1e) o2 (ha)ging ,ni-s. The s,1s()i1e) is
1illed 1' m,l-i5l'ing -he n,m1e) o2 (ha)ging ,ni-s 1' -he (ha)ging )a-e. The (o,n- in -he
me-e) is in()emen-ed 1' sending a 5,lse -o -he me-e). Cha)ging me-hods ma' 1e d,)a-ion
de5enden- o) d,)a-ion inde5enden-.
The -wo (ha)ging me-hods 5)e/alen- a)e4
Pe)iodi( P,lse Me-e)ing4 Pe)iodi( P,lse Me-e)ing is 1ased on 5e)iodi(all'
gene)a-ed 5,lses 2)om a (en-)all' si-,a-ed 5,lse gene)a-o). The (ha)ge 2o) -he (all
is 5)o5o)-ional -o i-s d,)a-ion.
I-emiHed +illing4 Fo) e/e)' (allD -he e?,i5men- a- -he eF(hange )e(o)ds -he
n,m1e)s (alling and (alledD -oge-he) wi-h -he d,)a-ionD da-eD -imeD -'5e o2 se)/i(eD
and (ha)ging )a-e. This in2o)ma-ion is ,sed -o (ha)ge s,1s()i1e)s a((o)ding -o -he
(ha)ging 5lan.
245
P)o(ess o2 (ha)ging (alls
A (ha)ging 5oin- is -he eF(hange whe)e a (all is )e(o)ded. In 5)in(i5leD -he (ha)ging 5oin-s
sho,ld 1e as (lose -o -he (alling s,1s()i1e) as 5ossi1le. Fo) lo(al (allsD -he (ha)ging 5oin-
is -he eF(hange. &hen -he (all is wi-hin -he same -a)i22 HoneD -he (all is )e(o)ded wi-hin -he
lo(al eF(hange. &hen -he (all is going -o an eF(hange in ano-he) -a)i22 HoneD a mo)e
)e2ined anal'sis o2 -he )ele/an- (ha)ge has -o 1e (a))ied o,-. %en(eD one eF(hange in -he
Hone 1e(omes -he new (ha)ging 5oin-. As -he )e(o)ding has -o 1e sen- -o -he lo(al
eF(hangeD (ha)ging 5,lses m,s- 1e sen- -o -he lo(al eF(hange.
*lossa)'
Analog4
An analog signal is a (on-in,o,sl' /a)'ing ele(-)omagne-i( wa/e -ha- (an 5)o5aga-e
-h)o,gh a /a)ie-' o2 media.
+i- in-e)lea/ing4
This is a 2o)m o2 Time Di/ision M,l-i5leFing :TDM; 2o) s'n(h)ono,s 5)o-o(ols s,(h as
%DLC. +i- in-e)lea/ing )e-ains -he se?,en(e and n,m1e) o2 1i-s -o a(hie/e (o))e(-
s'n(h)oniHa-ion 1e-ween 1o-h ends.
Called s,1s()i1e)4
In a -ele5hone (on/e)sa-ionD -he 5e)son who )e(ei/es -he (all is 3nown as -he (alled
s,1s()i1e).
Calling s,1s()i1e)4
In a -ele5hone (on/e)sa-ionD -he 5e)son who ini-ia-es -he (all is 3nown as -he (alling
s,1s()i1e).
CCITT4
Cons,l-a-i/e Commi--ee on In-e)na-ional Teleg)a5h and Tele5hone. This is -he 5)in(i5al
in-e)na-ional s-anda)ds-w)i-ing 1od' 2o) digi-al -ele(om ne-wo)3s :ISDN;.
Clea)4
The (lea) signal is sen- -o -he eF(hange a2-e) -he s,1s()i1e) hangs ,5.
Digi-al4
The (on/e)sion o2 /oi(e o) da-a in-o a s-)eam o2 1ina)' in2o)ma-ion :Ks and 6s;.
246
DTMF :D,al Tone M,l-i-F)e?,en(';4
A -e)m ,sed 2o) 5,sh 1,--on o) -o,(h-one :an ATMT -)adema)3; dialing. The 5,shed 1,--on
gene)a-es a -oneD a(-,all' -he (om1ina-ion o2 -wo -onesD one o2 high and -he o-he) o2 low
2)e?,en('. The' a)e ne(essa)' -o a((ess ad/an(ed ne-wo)3 2ea-,)es s,(h as (all 1a))ing
and (all 2o)wa)ding.
%o5 dis-an(e4
Dis-an(e 1e-ween 7 1oos-e)s o) )e5ea-e)s.
M,l-i5leFing4
A -e(hni?,e -ha- allows man' signals -o 1e sen- along -he same -)ansmission 5a-h.
N,m1e)ing A)ea4
The a)ea whe)e -wo s,1s()i1e)s ,se iden-i(al dialing 5)o(ed,)e -o )ea(h an' o-he)
s,1s()i1e) in -he ne-wo)3.
O22-%oo34
A -ele5hone se- in ,se - -he handse- is )emo/ed 2)om i-s ()adleD -h,s sending an ele(-)i(
signal -o -he eF(hange -ha- a (i)(,i- needs -o 1e o5ened.
On-%oo34
The no)mal s-a-e o2 -he -ele5hone in whi(h -he handse- )es-s on -he ()adle and -he (i)(,i-
-o -he eF(hange (ond,(-s no ele(-)i( signal.
!,an-,m Val,es4
Dis()e-e 2ini-e digi-al /al,es (o))es5onding -o -he s5e(i2i( ins-an(e o2 analog signal.
SeiHe4
The seiHe signal is sen- -o -he s,1s()i1e) while -he eF(hange is (he(3ing 2o) )eso,)(es
)e?,i)ed 2o) (all se-,5.
Signal4
A signal is a se?,en(e o2 ele(-)oni( 5,lses.
Signaling4
Signaling is -he -)ansmission o2 in2o)ma-ion 1' means o-he) -han -he ,naided h,man
/oi(e. SignalsD whi(h (an 1e /is,alD a,di1leD o) ele(-)i(D (an 1e made 1' a /a)ie-' o2
247
meansD in(l,ding ligh-ed -o)(hesD smo3eD 2lagsD lam5sD d),msD g,nsD -eleg)a5hD -ele5honeD
and )adio. Signals a)e ,sed -o (on-)ol )ail)oad -)ains and /ehi(,la) -)a22i( on )oads and
highwa's and -o (omm,ni(a-e wi-h shi5sD ai)5lanesD and o-he) /ehi(les. T)ansmission o2
ele(-)i( signals o/e) g)ea- dis-an(es is 3nown as -ele(omm,ni(a-ion.
Swi-(hing S's-em4
A swi-(hing s's-em is ,sed -o es-a1lish a 5a-h 1e-ween a se- o2 in5,- and o,-5,- (i)(,i-s.
Tele--)a22i( Theo)'4
I- is a 1)an(h o2 a55lied 5)o1a1ili-'. The Tele--)a22i( -heo)' is -he ma-hema-i(al des()i5-ion
o2 message 2low in a (omm,ni(a-ions ne-wo)3.
T),n34
I- is -he line o2 (omm,ni(a-ion 1e-ween swi-(hing s's-ems.
&AP :&i)eless A55li(a-ion P)o-o(ol;4
I- is a -e(hnolog' -ha- allows 'o,) mo1ile 5hone -o 1)owse -he &e1. I- is a 5)o-o(ol 2o)
da-a -)ansmission o/e) low 1andwid-h wi)eless ne-wo)3s.
248
/L/,
INTRODUCTION
PL/ was developed by BM in the mid 1960's and was originally named as NPL(New
Programming Language)
t was first introduced in 1964. The name was changed to PL/ to avoid confusion of NPL with
National Physical Laboratory in England.
Previous languages had focussed on one particular area of application, such as Science or
Business. PL/ was not designed as to be used in the same way. t was the first large scale
attempt to design a language that could be used in a variety of application areas.
PL/ is used significantly in both Business and Science applications.
Marathon Oil Company, Ford Motor Company, General Motors are some of the clients.
Unlike many other languages PL/ is completely free-form.
No reserved keywords .e PL/ determines the meaning of the keywords from the context of
usage.
E.g. : t is perfectly valid to declare a variable AREA even though it is also a PL/ keyword.
.ORMAT O. A !*7: STATEMENT
1 :-
Column 2 to 72 are used for coding PL/1 statements. each statement should end
with a semicolon.
2 :-
First statement of a program should be PROCEDURE or PROC. each procedure
statement must begin with a label, 1 to 31 chars.
3 :-
The first character of a label should always be an alphabet and the label should be
followed by a colon.
4 :-
Last statement of a procedure always ends with END. END ends the program and
passes the control to the operating system.
DEC*ARE S#emen
DCL is the statement after proc which means DECLARE and is used to reserve storage for data
or variables indicating the attributes of a variable.
n PL/1 there are 2 basic data types :-
1. Arithmetic data and
2. String data (char strings)
249
DCL A)i-hme-i( da-a i-ems
Form :- DCL variable_name mode scale base precision
Mode of an Arithmetic item is either REAL or COMPLEX. default is REAL.
Scale is either FXED or FLOAT.
Base is either DECMAL or BNARY.
Precision means number of figures that a fixed point data item can hold or in case of floating
point, the minimum number of valid digits to be regarded as significant.

DCL De(imal da-a -'5e
e.g. :- 102.30 Decimal Fixed Point
125.3E5 Decimal Floating Point
A floating point number consists of 2 parts fraction and exponent.
e.g. :- 168325E20 = 168325 * (10**20)
DCL +ina)' da-a i-ems
Binary numbers consists of 1 and 0, to indicate that a constant is a binary, it is followed by a "B".
e.g. :- 101110010B [ precision is (9,0) ]
A binary fixed point variable is declared as
DCL mbinnum fixed bin(16,0);
The maximum number of digits in a binary number is 31. The default for fixed binary variable is
15,0.
DCL S-)ing da-a i-ems
String data can be either character or bit string.
PL/1 recognises string data by the quotation mark which must appear at the start and finish of
each string.
e.g. :- 'the world'
To use quotation in character string, code two of them.
e.g. :- don't as a char string is represented by 'don''t'
To repeat a character string use (n)'char string'
e.g. :- (80)'RAJ' (RAJ will be repeated 80 times.)
Declaration of character string variable is done as DCL name CHAR(15)
To vary not only the context but also the length of a character variable use the attribute VARYNG
or VAR.
e.g. :- DCL addr CHAR(33) VARYNG;
The length can vary from 1 to 33 and no padding of spaces is done, if the length is less than 33.

250
+IT s-)ings
Bit strings are like char strings except that the digits represent one bit (0 and 1). Bit strings must
be enclosed in quotation marks.
Bit strings may too have varying attributes.

e.g. of bit string constants '1011101001'B
'111'B
(24)'0'B
e.g. of bit string variables DCL switch BT(1),
DCL bitstr BT(320) VARYNG;
Exp$#n#ion o( some sym-o$s used in !$7: pro"r#m
Name Symbol - Explenation
COLON : - follows a label
COMMA , - separates list items
SEMCOLON ; - ends a statement
PARENTHESES ( ) - encloses list items
ASTERSK * - multiplication
Di((eren%e -eHeen # -in#ry num-er 5 # -i srin"
A binary number has a value and is treated like a number.
A bit string has no value and is treated like a string of bits.

DE.INED or DE. #ri-ue
t is useful to refer to same pieces of string data (bit or char) by more than one name. it can be
used to overlay or sub-divide areas of string data.

e.g. :- DCL idcode CHAR(8);
DCL area CHAR(3) DEF idcode;
idcode='A02B1506';
PUT LST(area);
Base variable idcode occupies 8 bytes of storage.
Variable area defined over it starts at the same address but it is only 3 bytes long.
Put writes out the first 3 characters of idcode 'A02'.

!OSITION or !OS #ri-ue
With POS, you can make the defined variable start at any position of the base variable.
251
e.g :- DCL idcode CHAR(8),
part1 CHAR(3) DEF idcode,
part2 CHAR(3) DEF idcode POS(4),
part3 CHAR(2) DEF idcode POS(7);
part1 overlays the first 3 characters of idcode;
part2 is over characters 4,5,6;
and part3 is over characters 7,8.

e.g :- DCL whole BT(10),
select BT(3) DEF whole POS(5);
WHOLE='1000111010'B;
contents of select are '111'B

!ICTURE #ri-ue 5 some spe%i#$ %+#r#%ers
Variables which are to hold both types of data must be declared using picture attribute or pic.
9 indicates numeric,
V indicates decimal point.
Picture edit characters must be enclosed in quotation marks.
Minus and Decimal point use storage spaces.
f the number is non-negative, it is replaced by a blank.

e.g :- DCL number PC 'S999V.99'
number = 123.45;
in storage, the number look like +123.45
To edit character strings, you may use 3 edit characters :-
1:- X Position may hold any character.
2:- A Position may hold alphabetic character or a blank.
3:- 9 ndicates that position may hold numeric characters or space.
e.g :- DCL fielda pic '999X99';
fielda = '123.45';
INITIA* or INIT #ri-ue
To assign value to a variable at the start of the program execution use the attribute initial or init.

e.g :- DCL switch BT 1 NT('1'B);
252
DCL whole FXED DEC(5) NT(0);
DCL title CHAR(13) NT('Weekly News');
EFam5les o2 some (ons-an-s
'101110'B - bit string
.25638E20 - decimal floating point number
'34862' - character string
101101B - binary fixed point number
10387 - decimal fixed point number
Expressions
IFD T%EN D ELSE s-a-emen-
Simplest if then else statement :-

form :- F expression THEN then-unit-expression;
ELSE else-unit-expression;
e.g. :- if a=0 then counter = counter + 1;

e.g. :- if A <= B then A=B;
else A=B+100;
e.g. :- DCL switch BT(1);
switch = A;
if switch then goto sub1;
DO in an F statement indicates start of a DO group block.
END in an F statement indicates end of a DO group block.
e.g. :-
x, y = 1;
if a > b then do;

x = 100;
y = 50;
end;
e.g. :-
if a > b then c = 100;
else do;

c = z + 10;
x = y;
end;
253
f character strings of different lengths are compared then the shorter one is padded on the right
with blank spaces.
n case of bit strings; if length differs, the shorter string is padded to the right with '0'B.
NULL statement :- null statement consists of a semicolon. it is used where logically no statement
is necessary.
e.g. :-
if x > y then if m = n then;
else z = 0;
else z = z + 1;
O!ERATORS
(om5a)ison o5e)a-o)s a)e as 2ollows 4-
< less than
> greater than
= equal to
<= less than or equal to
< not less than
> not greater than
= not equal to
>= greater than or equal to
+i- s-)ing o5e)a-o)s a)e as 2ollows 4-
NOT alt-170
AND &
OR |
Concatenation character is ||

DO "roups
terative do group used in an F statement is also used to put several PL/1 statements together,
but in this type of do group these statements are as a rule executed several times over a group.
e.g. :-
do i = 1 to 10;
........
........
end;
The do group will run through 10 times.

254
+# s-a-emen-4-
f the control variable is to be increased by a step other than 1, then you use by statement.
e.g. :- do count = 1 to 20 by 2;
in do groups you can also count downwards.
e.g. :- do i = 25 to 1 by -1;
in addition to constants; variables and expressions can also be written in specification.
e.g. :- do alpha = x to beta * 2 by delta;

M,l-i5le S5e(i2i(a-ion 4-
multiple specifications can be used in a do statement. control passes to the next specification
when previous has finished.
e.g. :- do i = 1 to 5, 20 to 25, 50;
This loop is executed 5 times for i = 1 to 5,
then 6 times for i = 20 to 25,
and then again with i = 50.
Hence the loop is executed totally 12 times.
Often do groups have to be executed until a certain condition is met. these cases can be handled
with while statement.
e.g. :- do while (x < y);
This loop is executed as long as x is less than y.
e.g. :-
do while (x > y) until (z = 100);
............ .....
endo;
This loop runs as long as x > y and z is not equal to 100.
Nes-ed DO g)o,5s 4-
Nesting of do groups to a maximum of 49 is allowed by PL/1 optimizing compiler.
e.g. :-
outer : do i = 1 to 5;
inner : do j = 1 to 3;
.....
end inner;
end outer;
e.g. :- To leave an iterative do group.
255
do i = 1 to 100;
.....
if x > y then leave;
.....
end;
0OTO s#emen
With goto statement you can jump to any statement, which has a label, except an iterative do
group.
e.g. :-
i = 1;
a: if i > 10 then goto b;
......
i = i + 1;
goto a;
b: ......
D## A""re"#es 5 Arr#ys
Da-a Agg)ega-es
Two types of data aggregates are there :-
- arrays
- structures
An ARRAY is a collection of several elements with same attributes. They are arranged in a table
or a matrix.
When you would like to put unequal data elements together in an aggregate, you should use a
STRUCTURE.

Da-a Agg)ega-es :A))a's;
e.g. :- dcl table(50) fixed decimal(3); Table is a one dimensional array of 50 elements. each
element is a decimal fixed point with the precision 3,0. table is to be regarded as a string of 50
elements.
f you want to address a single array element.
e.g. :-
dcl countytab(50) char(10);
dcl countynm char(10);
countynm = countytab(2);
256
Second element of countytab is assigned to countynm.
e.g. :-
DCL numbers(5) fixed dec(3);
do i = 1 to 5;
numbers(i) = i * 2;
end;
Subscripts need not just consist of constants and variables, they can also be whole expressions.
e.g. :-
cost(i+j)
numbers(i+2)
numbers(costs(i))
costs(i+j*2)

+,il--in 2,n(-ions 4-
A built-in function replaces a number of statements which the programmer would otherwise have
to write himself.
For e.g. function ALWAYS return one value and is recognised by PL/1 thru syntax.
e.g. :-
dcl (a,b) fixed dec(9);
dcl x(10) fixed dec(3);
dcl y(12) fixed dec(7);
a = b + sum(x) + sum(y);

M,l-i-Dimensional A))a' 4-
The dimension attribute states the number of the dimensions for an array and the bounds of each
dimension.
e.g. :- dcl table(7,2) fixed decimal(3);
The above mentioned array consists of 7 rows and 2 columns.
e.g. :- dcl parts(3,3,5) char(10);
The above declared parts array consist of 45 elements.
e.g. :-
dcl tab(3,5) fixed binary(15);
do j = 1 to 3;
do k = 1 to 5;
tab(j,k) = 2;
end;
end;
257
x = sum(tab);
Value of 'x' after execution is 30 because each of the 15 elements in this array is set to 2.
All element of array tab can be set to 2 by one single instruction. [ tab = 2 ].

C)oss se(-ion o2 an a))a' 4-
you can also address a cross section of a array.
e.g. :-
dcl figures(5,3) fixed dec;
dcl x(3);
x = figures(2,*);
in the above case * represents all the elements of row 2.
hence x = figures(2,*) is equal to
x(1) = figures(2,1);
x(2) = figures(2,2);
x(3) = figures(2,3);

Da-a Agg)ega-es :S-),(-,)es;
Sim5le S-),(-,)es 4-
When you would like to put unequal data elements together in an aggregate, you should use a
structure.
e.g. :-
dcl 1 personnel,
2 name char(30),
2 salary fixed decimal(7,2);
Name of the whole structure is personnel. Each element in it, has it's own name and it's own
attribute.
During processing elements can be addressed singly or all together using the structure name. A
single element can be addressed by it's name.
for e.g. :-
name = 'Siva Mani';
put file(out) list(personnel);
put file(out) list(name, salary);
The above two statements have the same meaning. write to the file out the values of name and
salary. Maximum number of levels in a structure is 15.

258
A))a's in a S-),(-,)e M !,ali2ied Names 4-
dcl 1 month(12),
2 max fixed dec(7,2),
2 min fixed dec(5,2);
There are 12 occurence of month and each occurence has 2 elements.
f you want to refer the element min in 10th structure.
month(10).min (OR) month.min(10)
Qualified name is month(10).min (OR) month.min(10)

+# NAME o5-ion in a s-),(-,)e
There is one way by which you can use non-identical structures in structure expression. that is by
name option.
By name is used to make assignments from one structure to another, whereby compiler
processes only the elements whose fully qualified names in both structures are identical.
e.g. :-
1
dcl 1 new,
2 name,
2 payment,
3 gross,
3 net,
3 deductions;
2
dcl 1 old,
2 name,
2 address,
2 payment,
3 gross,
3 net,
2 deductions;
There is an assignment for all the elements which have the same qualified names in the
structures new and old.
new = old, by name;
3 elements are assigned in this structure expression.
new.name = old.name;
new.payment.gross = old.payment.gross;
new.payment.net = old.payment.net;

259
Inrodu%ion o Inpu7Oupu
+asi( 2ea-,)es o2 In5,-O,-5,-
*ET 4-
Transmits or gets data from external medium to internal storage.
P"T 4-
Transmits data from internal to external storage.
2 types of transmission are there between internal & external storage :-
sre#m i7o Hi+ "e 5 pu 28
Data item is transmitted singly. advisable for small quantities i.e. screen & card readers.
re%ord inpu7oupu Hi+ re#d 5 Hrie 28
Complete record of data items is transmitted and copy of the record is usually kept in internal
storage. t is preferable for larger qty of data.
+asi( 2ea-,)es o2 In5,-O,-5,-
Syn#x o( ; i7o s#emens 28
stream -> get file(input) list(a,b,c);
record -> read file(input) into(inarea);

openin" 5 %$osin" o( (i$es 28
e.g. :- dcl master file record sequential;
..........
open file(master) output;
..........
close file(master);
En&ironmen #ri-ue
Environment attribute defines the physical organisation of data sets (e.g. record length, blocks)
and the method of processing them.
Default value for the type of organization is consecutive. this type of organization can be
processed only sequentially.

260
e.g. :- dcl purchase record sequential input env(consecutive);
open file(purchase);
Record is an attribute in the declaration. Stream is default for the transmission type.

STREAM Inpu7Oupu
STREAM IO Fea-,)es
A string of characters is transmitted in stream i/o.
Character data type will not cause conversion if it is used in get or put.

S-anda)d 2iles 2o) s-)eam io 4-
the get and the put statements not having data file declarations are linked with standard files for
which there are prescribed file names.
SYSN for input, SYSPRNT for output
hence PUT LST(DATA LST);
is taken as PUT FLE(SYSPRNT) LST(DATA LST);
8 T'5es o2 IO S-)eam
list - always requires data list
data - requires no list
edit - requires data and format list
Lis--Di)e(-ed IO 4-
t is simplest form of stream /O, and is ideal for testing input at the terminal.

e.g. :- get list(c1,c2,c3);
put list(gross,net,gross-net);
e.g. :- dcl temps(7,2) fixed decimal(3);
.....
get list(temps);
14 elements would be read by the get statement.
nput in list directed i/o is in character form. The data items are separated by comma and/or
blanks.
261
Da-a-Di)e(-ed IO 4-
nput data can be read in the form of assignment statements in input stream. a semi colon or the
end of data file ends the transmission of an i/o statement.
e.g. :- A=2, B='XY'; ------> get data(a,b);
A=5; ------> get data(a,b);
B='UV'; ------> get data(a,b);
in first read 'A' is numerical and 'B' is character.
on second get 'A' = 5 and 'B' is unchanged.
on third get 'A' is unchanged and 'B' is 'UV'.

Edi--Di)e(-ed IO 4-
t is the most commonly used type of stream i/o. a data list is needed here as well, to contain the
names of data items, arrays or structures. in addition a format list is required in which the format
of i/o data is described.

e.g. :- put file(output) edit(data list) (format);
get file(sysin) edit(data list) (format);
e.g:-
get edit(qty, price, text) (f(3),x(6),f(5,2),x(5),a(10));
F is used for numeric data item, A for character string, X for space.

!A0E 5 S1I! in EDIT Dire%ed I7O
For preparation of numerical data the format item P can be used with all picture specification.
e.g. :-
dcl no fixed dec(5),
order fixed dec(7,2),
text char(20);
put PAGE edit('Revision List') (A);
put SKP(2) edit(no,order,text)
(f(5), x(2), P'(4)Z9V.99-', x(2), a);
After advancing to next page, a title is printed. then two lines are skipped and the three variables
are printed with 2 spaces in between.
result is fffff ppppp.pp aaaaaaaaaaaaaaaaaaaa

262
*INESI3E 5 !A0ESI3E in EDIT8Dire%ed I7O
print is a file attribute which can be used in connection with stream output.
Some options which can be stated in open statement are :-
option meaning default
linesize(nn) line length 120 chars per line
pagesize(nn) page length 60 lines per page
e.g. :- open file(list) output stream print linesize(100) pagesize(50);
ON ERROR %ondiion
PUT statements without data list, write out all the variables of a program block. they give
programmers an excellent tool to use in searching for tools.

e.g. :- on error begin;
on error system;
put data;
goto exit;
end;
The on error condition must also have been run thru atleast once before it can be executed.
On error system means that in case of an error, the system routine is executed that includes
breaking off the program execution.

Re%ord Inpu7Oupu
O/e)/iew M Di22e)en(es 1e-ween STREAM M RECORD IO
RECORD /O STREAM /O
The data in a data set is considered as a collection of
record.
Data is considered as
a continuous
sequence.
Transmits records just as they are stored.
Data conversion is
possible.
There are no standard files.
SYSN and
SYSPRNT are valid
standard files
Allows various forms of data set organization.
Allows only
sequential form of
data set.
263
RECORD IO Fea-,)es
RECORD /O offers 2 alternative modes of processing (move / locate).
MOVE mode 4- n move mode, a logical record is transmitted by reading from the buffer to an
area (e.g. structure) where it is then processed.
FORM 4- read file(filename) into(area);
using read, a logical record is put into a variable declared in the program.

e.g.:- dcl 1 inrec,
2 part1 char(25),
2 part2 (10) decimal fixed(7,2);

read file(material) into(inrec);
I*NORE o5-ion 4- ignore specifies how many logical records are to be skipped.
2o)m 4- read file(filename) ignore(N);
'N' is the number of records to be skipped.
Re(o)d o,-5,- in MOVE mode4- On each write, a logical record is transmitted from the area to a
buffer. if record (or block) is full, a physical record (for block) is written into the data set.
2o)m 4- write file(filename) from(area);
write statement causes a record to be written from the area specified i.e. the records are put in
blocks.
de(la)a-ion and o5ening o2 2ile 4-
e.g. :- dcl pers file input sequential buffered
env(consecutive FB RECSZE(100)
BLKSZE(500) BUFFERS(3));
FB means fixed record length, blocked
RECSZE means length of the record in bytes
BLKSZE means length of the block in bytes
BUFFERS means number of buffers
The record has 100 characters and block has 500 characters, hence there are 5 records per
block.
Environment attribute describes the physical properties of a data set. consecutive means that
records are stored sequentially.

264
LOCATE mode
n this mode the logical records are directly processed in buffer. here a based variable or a
pointer variable is needed (a structure with the length of a logical record) is like a mask which is
laid over the buffer.
)e(o)d in5,- in lo(a-e mode 4- Files to be processed using locate mode must, like other files be
declared and opened. the first physical record has already been read into the buffer and opened.
,sing 4- read file(filename) set(pointer);
The address of the first record logical pointer is put in the variable pointer.
POINTER Va)ia1le
A pointer variable is a variable (full word, 4 bytes) which contains a storage address. this address
can be assigned to pointer variable in various ways.

e.g. :- dcl xyz pointer;
read file(input) set(xyz);
A pointer is used to point to the position of the next record in a buffer or to another variable.

+ASED Va)ia1le
n the e.g. given below, read places the address of next logical record in the pointer ptr.
e.g. :- dcl 1 efile based(ptr),
2 name char(30),
2 first_name char(20),
2 persno fixed dec(5);
Read file(pers) set(ptr);
The based variable efile is overlaid on the logical record, as it has the attribute based and
contains address as the pointer.
EFam5le o2 Re(o)d )ead in lo(a-e mode
F dcl one file input sequential buffered
env(fb recsize(200) blksize(1000) buffers(1));
dcl q pointer;
dcl record_a char(200) based(q);
.....
read file(one) set(q);
265

F On 6th read, the 2nd physical record is retrieved from the data set and put in buffer.

F you recognize MOVE mode by the option FROM and LOCATE mode by the option SET.
Re(o)d O,-5,- in Lo(a-e mode Re(o)ds )ead in a)e w)i--en o,-
2o)m 4- LOCATE based_variable FLE(filename);
F e.g. :- dcl in file record buffered input
env(fb recsize(100) blksize(1000)
buffers(2));
dcl out file record buffered output
env(fb recsize(100) blksize(1000)
buffers(2));
dcl inrec char(100) based(q);
dcl outrec char(100) based(p);

loop : read file(in) set(q);
locate outrec file(out);
outrec = inrec;
goto loop;

Rew)i-ing o2 a 2ile in MOVE and LOCATE mode
With REWRTE statement, records read in can be changed and written back to the same place
they came from in the data set.

F e.g. :- dcl personnel file sequential buffered
update;
dcl record char(500) based(p);
dcl p pointer;

read file(personnel) set(p);
.......
change record read in .....
.......
rewrite file(personnel);
Va)ia1le leng-h )e(o)d
F f quantity of data per logical record varies a great deal (as for e.g. with addresses) it is a
good idea to store the data in variable length record.

F note :- There is 4 byte record length field (RL)before every variable record.
266
There is a 4 byte block length field before every block.

F e.g. :- suppose the biggest logical record can be 1000 bytes long and that the records are
to
be blocked in such a way that a block is likewise to have the maximum length of 1000
bytes, then environment attribute of file declaration would look like
env(vb recsize(1004) blksize(1008));
SiHe s-a-emen-s a)e (al(,la-ed as 4-

recsize = 1000 bytes + 4 bytes record length
blksize = recsize + 4 bytes block length

F n fixed format, the record length and the block lengthare fixed but in variable format, the
record length and the block length vary

block length is size of the physical record
record length is size of the logical record
f data length of the record is 750, the record sizewill be 754 and the block size will be 758.
SCALAR VAR#IN* o5-ion
f you are using record i/o with variable length strings and locate mode, then scalar varying
option must be stated in env attribute for i/o, so that the 2 byte length area which goes before
each variable length string are taken into consideration.

F e.g. :- dcl pers-file file record output buffered
env(vb recsize(106) blksize(110)
scalarvarying buffers(1));

dcl outrec char(100) varying;


'#nd$in" VSAM .i$es
VSAM da-a se-s
3 Types of VSAM data sets are there :-
1. Key Sequenced Data Set (KSDS)
2. Entry Sequenced Data Set (ESDS)
3. Relative Record Data Set (RRDS)
No-e 4- Sequential is the default file organization, hence vsam should be specified in the ENV
option.
Vsam files are always record files. Records on a vsam file are not held in blocks, hence the
blksize option even if specified is ignored. A recsize option will be checked against the details
267
stored with the file.
The utility DCAMS (access method services) is used to set up a vsam file initially.
Va)io,s DCL 2o) VSAM da-ase-s
e.g. :- dcl vfile file record direct keyed input env(vsam);
Vsam files are all direct access files. associated with every record is a key, which helps in
accessing the record in any order.
e.g. :- dcl vfile file record sequential input env(vsam);
f you want to start at the beginning and process every record, just as with a consecutive file,
specify the file as sequential.
e.g. :- dcl vfile file record sequential keyed input env(vsam);
The first read of the program specifies the key of the record you want to start at. subsequent
sequential read statements are issued without a key.
e.g. :- dcl infile file record direct keyed input env(vsam);
to read a vsam file directly.
e.g. :- dcl infile file record direct update env(vsam password('master'));
When a file is originally set, it can be given one or more passwords. if attribute record is given, it
means that it must be a file, hence the attribute file is implied and therefore optional.

$e' Se?,en(ed Da-a Se- :$SDS;
KSDS is used to hold master file data. identification is by means of key so the attribute DRECT
implies KEYED.
e.g.:- dcl amast file record direct input env(vsam);
Sequential access is possible with ksds.
A ksds has a key which is part of a data record, this is known as an embedded key.
Keys are also stored in another part of data set called as prime index.
The keys are unique since duplication is not allowed.
$SDS Fea-,)es Reading a 3sds di)e(-l' 4- Records are accessed by specifying a value using
the key option.

e.g.:- dcl amast file record direct input env(vsam);
dcl 1 area,
2 kskey char(5),
2 ksname char(15);
read file(amast) into(area) key('00010');
268

"5da-ing a 3sds di)e(-l' 4- The file should be opened as update. you cannot amend the key.
e.g.: dcl kmast file record direct update env(vsam);
dcl 1 area,
2 kskey char(5) init('00081'),
2 ksname char(15);
read file(kmast) into(area) key(kskey);
/* amend */
rewrite file(kmast) from(area) key(kskey);
Dele-e a )e(o)d in 3sds 4- 4- 4- Use delete statement.
e.g. :- kskey = '00056';
delete file(ksds) key(kskey);
Add a )e(o)d in 3sds 4- 4- 4- Use write statement.
e.g. :- kskey = '00024'; ksname = 'Applets';
write file(ksds) from(area) keyfrom(kskey);
F Fi)s- di)e(- a((ess M -hen se?,en-ial a((ess 4-

e.g.: dcl ramp file record sequential keyed
env(vsam);
read file(ramp) into(area) key('123/999/b');
read file(ramp) into(area);
0EN1E4 opion
F e.g. :- dcl vsam file record sequential keyed
env(vsam genkey);
read file(vmast) into(area) key('123');
read file(vmast) into(area);
Assume that the key is defined as nine chars long.
f genkey option is not specified in the environment statement, vsam searches for a record with a
key of '123'.
f genkey option is specified the first read reads the first record of data set beginning with 123.
Second read continues with the record immediately following it.

269
ENTR4 Se6uen%ed D## Se (ESDS)
t is the most likely consecutive non-vsam file. i.e. data is not in a particular order, hence the file is
sequential.
An esds file which already has data on it, may only be opened with either input or update
attributes.
e.g. :- dcl esds file record sequential update env(vsam);
"5da-ing an esds 2ile 4-
t is possible to change records once they have been written to esds file.

e.g. :- read file(esds) into(area);
......
rewrite file(esds) from(area);
Write can also be used and the new records added are always added at the end.
Delete is not allowed.

1eyed #%%ess o #n ESDS (i$e
An esds is a sequential file and has no defined key.
The information that can be used for keyed access is called relative byte address (rba).

record-1 : record-2 : record-3 : record-4
: : :
50 bytes : 40 bytes : 60 bytes : 30 bytes
: : :
rba=0 rba=50 rba=90 rba=150
You have to get hold of rba by using KEYTO option on read and write.

F e.g. :- dcl esds file record sequential keyed update
env(vsam);
dcl rba char(4);
......
write file(esds) from(area) keyto(rba);
Rba must be a 4 byte character string. this will add a new record to the end of the file and place
the relative byte address of the record in the field rba. this is then used as a key on a read or
rewrite. file should be declared as keyed.

270
e.g. :- read file(esds) into(area) key(rba);

F e.g. :- /* example of esds read and rewrite */
dcl esds file record sequential keyed update
env(vsam);
dcl rba char(4);
read file(esds) into(area) keyto(rba);
. . . . . .
rewrite file(esds) from(area) key(rba);
RE*ATIVE Re%ord D## Se (RRDS)
Records are read and can be accessed sequentially or directly with or without keys.
The data set may be thought of as a set of numbered slots each of which may hold record. the
numbering starts at 1 and goes to the maximum specified.
Record number is the relative record number. this is the key to the file.
The key must be declared as a character string of length 8.

F e.g. :- dcl relrecno char(8) init('00000145');

F e.g. :- dcl relrecno char(8) init(' 145');
$e'ed a((ess -o an RRDS
File may be declared as sequential or direct.
f the file is declared as keyed sequential all key options can be used. if you leave key reference,
processing would be just for a sequential file.
e.g:-
dcl rrds file record sequential keyed update env(vsam);
dcl rrkey char(8);
rrkey = ('00000025');
read file(rrds) into(area) key(rrkey); /* read rel.rec.no 25 */
......
rewrite file(rrds) from(area); /* rec.no 25 is rewritten */
......
read file(rrds) into(area) keyto(rrkey); /* requests a */
/* record number. */
/* the next record will */
/* be presented and the */
/* key value will be */
/* placed in rrkey */
&RITE in an RRDS
F e.g. :- /* assume record 5 exists on file rrds. */

271
dcl rrds file record sequential keyed update
env(vsam);

dcl relrecno char(8);
dcl 1 area,
2 ...... ;

relrecno = '00000005';
read file(rrds) into(area) key(relrecno);
......
delete file(rrds) key(relrecno);
......
write file(rrds) from(area)
keyfrom(relrecno);
!ro%essin" o( Srin" D##
S"+STR :+,il--in F,n(-ion;
Substr is used to access a part of a string.
2o)m 4- (string-var., start-pos., length-of-extract)

F e.g. :- dcl data char(50);
dcl field char(10);
......
data='NTERNATONAL BUSNESS MACHNES';
field=substr(data,6,8);
Field will be 'NATONAL'
n SUBSTR parameter 2 and 3 can be expression, resulting to be an integer.
no-e 4- if the parameters represent a value which lies outside the string the result is
unpredictable.

INDEX :+,il--in F,n(-ion;
ndex function is used to look for a certain character or a string of chars in a given string.
2o)m 4- pos. = index(string, search string);
ndex function returns a binary number (15,0). f string to be looked for is not found, the return
value is zero. only first occurence is shown.

F e.g. :- dcl town_country char(25);
......
town_country = 'WEYBRDGE,SURVEY';
icomma=index(town_country,',');
272

icomma will be 10.

e.g. :- dcl (string,part1) char(30);
......
ipos = index(string,'/');
part1 = substr(string,1,ipos-1);
VERIF# :+,il--in F,n(-ion;
VERIF# 2,n(-ion 4- Verify will see that a string will have only certain characters present.
2o)m 4- verify(x, y);
'X' is the string of chars to be checked in Y.
'Y' is the string containing the list of characters which are to be looked for.
A 1ina)' 2iFed 5oin- n,m1e) is )e-,)ned 4-
- zero, if all characters in 'X' appear also in 'Y'.
- A value, which gives the position of the first character in 'X' which does not appear in 'Y'.
F e.g. :- dcl test char(3);
test='BT';
X=verify(test,'ABCDEDFGH');
3 would be returned, because the third character is not in the second parameter of verify.

TRANSLATE :+,il--in F,n(-ion;
2o)m 4- translate(x, y, z)
'X' = character string to be checked
'Y' = string of replacement character
'Z' = chars in 'X' which are to be replaced if found

result is modified character string 'X'.
F e.g. :- dcl (old, new) char(10);
dcl icharacter char(10) init('FRTUX');
dcl tcharacter char(10) init('ANUQT');
......
old = 'FXTURES';
new = translate(old,tcharacter,icharacter);

F new = translate('FXTURES','ANUQT','FRTUX'); = ANTQUES

273
LEN*T% :+,il--in F,n(-ion;
This determines the length of the string. value returned is binary fixed point number (15,0).
2o)m 4- length(x);

F e.g. :- dcl field char(90) varying;
field = 'GOOD LUCK !';
ilength = length(field);

F ilength receives the value 11.
!seudo&#ri#-$es
f a function is on the left in an assignment, you have a pseudovariable. pseudovariables are
functions which may not only manipulate values, but may also receive them.

F e.g. :- substr(tfield,2,5) = gfield;

F e.g. :- dcl x char(10);
x = 'ABCDEFGHJ';
substr(x,6,5) = substr(x,1,5);

/* soln is 'ABCDEABCDE' */

F no-e 4- sqrt(sum) = 2; is not a pseudovariable.
!ro"r#m Or"#niG#ion
T'5es o2 +lo(3s
F PL6 3nows -wo -'5es o2 1lo(3s 4-

1. Procedures
2. Begin-blocks

F P)o(ed,)es a)e o2 -wo -'5es 4-

1. External Procedures
2. nternal Procedures
An EXTERNAL procedure is a block which is not contained in another block.
They are compiled separately but they can joined to make one program by linkage editor, so that
2 programmers can work on it simultaneously.
Option main identifies the main procedure.
i.e. label:proc options(main);
274
An NTERNAL procedure is invoked by a call from a surrounding block and control returns to
statement after the call.
Within an external procedure you can have upto 50 internal procedures.

F e.g. :- outer:proc options(main);
statement1
call inner; --------
----------> statement2 :
: ^ inner:proc; <-------
: : statement3
: : statement4
V ------- end inner;
----------> statement5
statement6
end outer;
+E*IN-1lo(3 4- They always lie within a procedure and are executed where they are. They finish
with an end statement.

F 2o)m 4- A:proc;
......
begin;
......
......
end;
......
end A;
S(o5e o2 De(la)a-ion
Va)ia1les whi(h a)e de(la)ed ha/e -wo s(o5e a--)i1,-es 4-
1. nternal
2. External
f a variable has an NTERNAL scope, then it is known in the block in which it was declared and in
all the blocks which physically lie in that block until it is not declared in one of these subordinate
blocks.

e.g. :- outer:proc options(main);
dcl rate fixed dec(7,3);
dcl minus char(5);
dcl x char(100);
275
......
inner:proc;
dcl minus fixed dec(7,2);
dcl x char(100);
end inner;
end outer;
rate field is addressed in both blocks.
character field minus is not known in block inner.
The variable 'X' has attribute internal and hence you are dealing with 2 variables that are known
within their blocks.
f a variable is to be same in two external procedures, then it must be declared with same
attributes EXTERNAL.

mpro:proc options(main); subpro:proc;
dcl 1 rec external, dcl 1 rec external,
2 a char(30), 2 a char(30),
2 b fixed bin(31); 2 b fixed bin(31);
Structure rec which is declared in both external procedures, occupies the same data area.

S-o)age Class in a Va)ia1le
Using storage class attributes, the programmer defines, when storage space is to be allocated to
a variable and when this storage space is freed.
The)e a)e 9 di22e)en- s-o)age (lass 4-
1. Automatic (default)
2. Static
3. Based
4. Controlled
A"TOMATIC S-o)age Class
An automatic variable has internal attribute.
Storage is allocated when block containing storage declaration is activated and is freed again
when the block is terminated.

e.g. :- x:proc options(main);
......
begin; <-------------------------
...... :
dcl tab(100,100,10,2) char(25); : activated
276
...... :
end; <------------------------- freed
......
end x;
STATIC S-o)age Class
Static variable has external attribute.
Storage is allocated before the execution of the program and remains allocated until end of the
program. This storage class cannot be influenced by the programmer during program execution.

e.g. :- dcl tab(10,10) fixed decimal(7,2) static;
dcl x(10,10) fixed decimal(5,2) based(p);
dcl x char(120) static external;
+ASED S-o)age Class
Based storage class is used in connection with record i/o. Based variable should always have
attribute internal. n locate mode, it was necessary to declare the storage class based for record
to be read in / written out.

e.g. :- dcl in file record buffered input
env(fb recsize(100) blksize(1000) buffers(2));
dcl out file record buffered output
env(fb recsize(100) blksize(1000) buffers(2));
dcl iarea char(100) based(q);
dcl oarea char(100) based(p);
dcl (q,p) pointer;
......
read file(in) set(q);
......
locate oarea file(out);
CONTROLLED S-o)age Class
With controlled variable the programmer has complete control over storage space. Using
ALLOCATE space is assigned and with FREE the storage space is freed again. they can have
the attributes internal or external.

e.g. :- dcl fieldx char(12) controlled;
allocate fieldx; /* storage space is assigned */
fieldx = 'all clear ?';
put file(printer) edit(fieldx) (x(5),A);
free fieldx; /* storage space is freed */
277
Su-rouines 5 .un%ions
Su-rouines
t is always an internal or external procedure. A subroutine is not replaced by a result value after
its execution. A subroutine is always invoked with a call statement. Subroutines are often added
as external procedures.
F e.g. :- mrou:proc options(main);
dcl ......;
call srou1;
......
call srou2;
end mrou;

srou1:proc; srou2:proc
dcl ......; dcl ......;
.... ......
end srou1; end srou2;
A)g,men-s
When a procedure is invoked using a call, it is possible to pass variables which are called as
arguments.
F e.g. :- dcl rec1 char(45);
dcl 1 inrec,
2 part1 char(10),
2 amount fixed dec(7,2);

call srou(rec1,inrec); /* arguments */
Pa)ame-e)s
A program to which arguments are passed when it is invoked, are called as parameters.
F e.g.:- srou:proc(a,b);
dcl a char(100);

dcl 1 b,
2 b1 char(10),
2 b2 fixed dec(7,2);
Here a & b are the parameters where a = rec1 and b = inrec.
The sequence and the attributes of the arguments and parameters must be identical. names may
be different, but they use same area.
No-e 4- null arguments may be indicated by two commas and unnecessary arguments of the end
of the list may be omitted.
278
M,l-i5le En-)' Poin-s
Subroutine may have several entry points.
- primary entry points can be identified by PROC.
- secondary entry points can be identified by ENTRY statements.
Each entry points may have different parameter list.
e.g. :- prog1:proc options(main);
call prog5(a,b);
call ent2(a,b,c);
call ent1(c);
end prog1;

proc5:proc(x,y);
......
ent1:entry(m);
......
ent2:entry(x,y,m);
......
end prog5;
EFi- 2)om P)o(ed,)es
Normal exit for a procedure is END.
Furthur exit can be provided using RETURN.
F e.g. :- srou:proc(x,y);
......
ent2:entry(m,n,o);
......
if x = 0 then return;
......
end srou;
F,n(-ions
Functions are always a part of an expression. A function is replaced by its result after execution.

F e.g. :- /* built-in functions */

x = sum(tab3); /* with an argument */

adds up all elements of array tab.

v = date(); /* with empty arguments */
F A function call is replaced by value returned.
F e.g. :- calc:proc(a,b,c);
279
......
if x > y then return(x*y);
else return(z);
......
end calc;
:ON-"NIT;
On ENDPAGE and on ENDFLE are some important conditions which can be forseen.
F e.g. :- on endpage(sysprint) begin;
n = n + 1;

put edit('page', n) (page, x(70), a, p'z9');
put skip(3);
end;
This writes the current page number when the preceding page is full.
SI*NAL M REVERT
SI*NAL o5-ion 4-With signal statement, a condition can be caused artifically. The program
continues with the statement which comes immediately after signal statement.
2o)m 4- SGNAL condition;
Signal is used to raise conditions deliberately.
e.g. :- on endpage(print3) call overs;
......
signal endpage(print3);
REVERT o5-ion 4- Cancels on-unit for the condition specified.
e.g. :- on error call error1;
/* error1 will be called */
on error call error2;
/* error2 will be called */
revert error;
/* cancels error2, error1 will be called */
Sam5le P)og)ams
S#mp$e !ro"r#m :
run221a:proc options(main);

dcl alpha fixed decimal(7,0),
beta fixed decimal(6,0);
dcl (a,b,c) fixed decimal(5,2),
280
answer fixed decimal(7,2);

alpha = 100;
beta = alpha + 200;

on endfile(sysin) goto fini;

read:get file(sysin) list(a,b,c);
answer=a+b-c;
put file(sysprint) list(a,b,c,answer)
goto read;

fini:end run221a;
S#mp$e !ro"r#m ;
P1M0:proc options(main);
dcl counter fixed dec(1);
dcl total fixed dec(7,2);
dcl number fixed dec(5,2);

on endfile(sysin) goto finish;

counter=0;
total=0;

read:
get file(sysin) list(number);
total = total + number;
counter = counter + 1;
goto read;

finish:
put file(sysprint) list(counter,total);

end p1m0;

S#mp$e !ro"r#m @
P3M0:proc options(main);
dcl (countin, countout) fixed dec(3) init(0);
dcl (totalin, totalout) fixed dec(7,2) init (0);
dcl (averagein, averageout) fixed dec(5,2);
dcl number fixed dec(5,2);

on endfile(sysin) goto finish;

read:get file(sysin) list(number);
281
if number > 100 & number <= 60; then goto in;
totalout = totalout + number;
countout = countout + 1;
goto read;

in: totalin = totalin + number;
countin = countin + 1;
goto read;
finish:
averagein = totalin / countin;
averageout = totalout / countout;

put file(sysprint) list(countin, totalin, averagein);
put file(sysprint) skip list(countout, totalout, averageout);

end;
P6M0:proc options(main);
dcl temp(7,2) fixed dec(3), da(7) fixed dec(3);
dcl wa fixed dec(3), i fixed bin(15), eof bit(1) init('0'B);

on endfile(sysin) eof='1'B;

get file(sysin) list(temp); /* seven pairs of temparature */
do while (eof = '0'B);
do i = 1 to 7;
da(i) = (temp(i,1) + temp(i,2)) / 2;
end;

put file(sysprint) skip list(da); /* write to sysprint */
put file(sysprint) skip list(wa); /* 7 values of da,wa */
get file(sysin) list(temp); /* new input of temp */
end;
end p6m0;
S#mp$e !ro"r#m >
P9M0:PROC OPTONS(MAN);

dcl E1 file record env(F recsize(50), blksize(50));

dcl A CHAR(50) init('THS S A TEST');
write file(E1) from(A); /* output is written to file E1 */

close file(E1);

read file(E1) into(A); /* reads data from file E1 */

put data(A); /* write data item 'A' */
282

put skip list('END of JOB'); /* write to file sysprint */

end P9M0;
S#mp$e !ro"r#m ?
p11m0:
proc options(main);
dcl 1 indet,
2 intype char(1),
2 itemno char(5),
2 uprice fixed dec(3,2),
2 qty fixed dec(3),
2 deptno char(3),
2 code1 fixed dec(3),
2 code2 fixed dec(3),
2 code3 fixed dec(3),
2 iname char(23),
2 dname char(27);
dcl ab char(40);
dcl 1 sta based(addr(ab)),
2 rectype char(4),
2 itemno char(4),
2 uprice fixed dec(3,2),
2 qty fixed dec(3),
2 totval fixed dec(7,2),
2 iname char(23);

dcl 1 stb based(addr(ab)),
2 rectype char(4),
2 deptno char(3),
2 code1 fixed dec(3),
2 code2 fixed dec(3),
2 code3 fixed dec(3),
2 dname char(27);
dcl a1 file record env(fb recsize(40) blksize(400));
dcl (eofi, eofa) bit(1) init('0'b);
on endfile(sysin) eofi = '1'b;
open file(a1) output;
do until (eofi = '1'b);
read file(sysin) into(indet);
if eofi then do;
if intype = 'A' then do;
sta=indet, by name; sta.rectype = 'fap7';
sta.totval = indet.uprice * indet.qty;
end;
else do;
283
stb=indet, by name; stb.rectype = 'fbp7';
end;
write file(a1) from(ab);
end;
else close file(ab);
on endfile(a1) eofa = '1'b;
open file(a1) input;
do until (eofa);
read file(a1) into (ab);
if eofa then
if sta.rectype = 'fap7' then
put skip list(sta);
else put skip list(stb);
else close file(a1);
end;
end p11m0;
S#mp$e !ro"r#m D
P14M0:
proc options(main);
dcl ca char(78);
dcl (name,street,town) char(25);
dcl 1 prline,
2 cc char(1) init(' '),
2 text char(25);
dcl (del1,del2,del3) fixed bin(15);
dcl (sn,ss,st) fixed bin(15);
dcl (ln,ls,lt) fixed bin(15);

do until (eof);
read file(sysin) into(ca);
if eof then do;
del1=index(ca,',');
del2=index(substr(ca,del1+1),',') + del1;
del3=index(substr(ca,del2+1),',') + del2;

sn=1;
ss=del1+1;
st=del2+1;

ln = del1 - sn;
ls = del2 - ss;
lt = del3 - st;

name = substr(ca,sn,ln);
street = substr(ca,ss,ls);
town = substr(ca,st,lt);
284

prline.text = name;
write file(a1) from(prline);

prline.text = street;
write file(a1) from(prline);

if verify(town,'.-ABCDEFGHJKLMNOPQRSTUVWXYZ0123456789') = 0
then prline.text = '*****';
else prline.text = town;

write file(a1) from(prline);
end;
end;
end P14M0;
S#mp$e !ro"r#m I
P16M0:proc P16M0 */
proc options(main);
dcl p16m2 entry;
dcl (number,pvalue) fixed decimal(5,2);
on eof bit(1) init('0'B);
on endfile(sysin) eof = '1'B;
do until(eof);
get list(number);
if eof then do;
call p16m2(number,pvalue);
put skip list(number,pvalue);
end;
end;
end;

P16M2:proc(number,pvalue);
dcl (number,pvalue) fixed decimal(5,2);
if number >= 100
then pvalue = number * 0.05;
else pvalue = number * 0.03;
end
285

You might also like