Download as pdf or txt
Download as pdf or txt
You are on page 1of 198

CONTENTS No 1 2 3 4 5 6 7 # 9 1& 11 12 13 14 15 16 17 1# 19 Particulars TSO Commands COBOL Tutorial COBOL File status Code COBOL Coding Standard JCL

JCL Utilities JCL F !"s C$CS Tutorial C$CS %end Codes C$CS F !"s 'B2 Tutorial 'B2 Utilities 'B2 F !"s C(ange man Tool File) id Tool *nde+or Tool 'omain , Ban-ing and Finan.e 'omain , Tele.om /L0$ Page No 2 9 43 46 49 73 #3 92 116 121 126 144 146 154 172 2&7 214 232 252

TSO Commands

Panel-id show? 1 / 2*L$' 'is3la4s t(e name o5 t(e .urrent 3anel6

Message-id 1 7S8$' 'is3la4s t(e 7essage)id o5 t(e last message6

utomati. REFLIST .an %e a..essed %4 o 9*FL$ST' o 9*FL$STL o 9*F CT' o 9*F CTL T(ese allo: 4ou to 3ull %a.- datasets :it(out seeing t(e intermediate lists6 Commands to ;ui.-l4 add names to 4our 3ersonal lists6 T(ese are 9*FO/*2'< 9*FO/*2L< 9*F '''< and 9*F ''L

RETP ) =ie: t(e sta.- o5 4our t43ed .ommands6 RETF ) /ull %a.- .ommands in re+erse order6 RETRIE E ) /o3 u3 t(e most re.ent t43ed .ommands 5rom t(e sta.-6 CRETRIE ) /o3 u3 t(e most re.ent t43ed .ommands 5rom t(e sta.-6 ISR!!N ) S(o:s t(e .urrent data sets allo.ation 5or our $S/F session6 "MIT T(e TSO0* $ntera.ti+e 'ata Transmission Fa.ilit4 T9 2S7$T .ommand allo:s 4ou to send data sets or messages to 3ersons on ot(er 7=S s4stems +ia 2et:or- Jo% *ntr4 or dire.tl4 to 3ersons on 4our o:n s4stem6 XMIT node.userid DA('your.pds') OUTDA('your.ps')

RECEI E T(e TSO0* $ntera.ti+e 'ata Transmission Fa.ilit4 9*C*$=* .ommand allo:s 4ou to o%tain 5iles transmitted to 4our userid6 T(e 9*C*$=* .ommand ;ueries t(e Jo% *ntr4 Su%s4stem RECEIVE INDS('your xmi.ps')

!SLIST S# E $ !L Sa+e t(e data set list in log data set

%PRINT Sa+e t(e !ui.- 9e5eren.e do.ument in a /'S or /S

TSO PROFILE T(e 3ro5ile .ommand is used eit(er to s3e.i54 to t(e s4stem .ertain user .(ara.teristi.s :(i.( are to %e used to .ontrol t(e 5lo: o5 in5ormation to and 5rom t(e terminal or to list t(e user 3ro5ile6 T(e user 3ro5ile is retained t(roug(out ea.( terminal session unless t(e user :is(es to .(ange it %4 issuing t(e 3ro5ile .ommand again and s3e.i54ing t(e a33ro3riate o3erands6

C&T !ISPL#' T(is .ommand :(en gi+en :(ile a mem%er is o3ened in +ie:0edit mode :ill s(o: t(e Cli3%oard manager6 T(e Cli3%oard .an t(en %e %ro:sed or deleted6

(E'LIST 'is3la4s t(e >e4list utilit46 $n+o-ing (E'LIST OFF .an disa%le it6

(E'S

$5 t(e (E'LIST is ON< it dis3la4s t(e -e4s o5 .urrent >e4list6 $5 t(e (E'LIST is OFF< it dis3la4s t(e /rimar4 -e4s de5inition6 PFS)O*
o o

'is3la4s t(e +alue o5 all t(e /F>*?S on t(e 3anel6 T(e4 .an %e remo+ed 5rom t(e 3anel %4 in+o-ing PFS)O* OFF

SCRN#ME ON 'is3la4s t(e s.reen name o5 t(e To3 Le5t .orner6 @e .an gi+e our o:n s.reen name to an4 s.reen %4 :riting ASCRN#ME m+scrnameA

S*#P LIST 'is3la4s t(e .ti+e $S/F logi.al Sessions6 L#N,&#,E PROCESSIN, COMM#N!S

#SM $n+o-e assem%ler 3rom3ter and assem%ler 5 .om3iler6

C#LC $n+o-e it5B3l01 3ro.essor 5or des- .al.ulator mode6

CO-OL $n+o-e .o%ol 3rom3ter and and .o%ol .om3iler6

FORT $n+o-e 5ortran 3rom3ter and 5ortran i+g1 .om3iler6 PRO,R#M CONTROL COMM#N!S

C#LL Load and eCe.ute t(e s3e.i5ied load module6

LIN( $n+o-e lin- 3rom3ter and lin-age editor6

LO#!,O Load and eCe.ute 3rogram6

R&N Com3ile< load< and eCe.ute 3rogram6

TEST Test user 3rogram6

TEST#&T) Test a35 aut(oriDed 3rograms6 !#T# M#N#,EMENT COMM#N!S

#LLOC#TE LLOC T* ' T S*T @$TE O9 @$TEOUT 2 TT9$BUT* L$ST OF 'CB / 9 7*T*9S6

#LTLI'*F$2* O/T$O2 L< US*9)L*=*L O9 //L$C T$O2)L*=*L S*TS OF L$B9 9$*S CO2T $2$28 S 0/L *F*CS O9 CL$STS6 TE*S* L$B9 9$*S 9* S* 9CE*' @E*2 $7/L$C$TL? $2=O>$28 2 S 0/L *F*C O9 CL$ST6

#TTRILLO@ 'CB / 9 7*T*9S TO B* '?2 7$C LL? $2T9O'UC*' 2' 2 7*' FO9 US* @$TE SUBS*!U*2T LLOC T* CO76

CON ERT S$FT $TF0/L1 2' FO9T9 2 SOU9C*6

COP' CO/? ' T S*T6 GS** 2OT* B*LO@6H

!ELETE '*L*T* ' T S*T6

E!IT C9* T*< *'$T< 2'0O9 *F*CUT* ' T S*T6

FORM#T

FO97 T 2' /9$2T

T*FT ' T S*T6 GS** 2OT* B*LO@6H

FREE 9*L* S* ' T S*T 2'0O9 2 TT9$BUT* L$ST6

LIST '$S/L ? ' T S*T6 GS** 2OT* B*LO@6H

LIST#LC '$S/L ? CT$=* ' T S*TS6

LIST-C '$S/L ? 7*SS 8*S F9O7 O/*9 TO90US*96

LISTC#T '$S/L ? US*9 C T LO8U*' ' T S*TS6

LIST!S '$S/L ? ' T S*T TT9$BUT*S6

MER,E CO7B$2* ' T S*TS6 GS** 2OT* B*LO@H6

PRINT!S /9$2T ' T S*T6

PROTECT / SS@O9' /9OT*CT ' T S*TS6

REN#ME 9*2 7* ' T S*T6

TSOLI'*F$2* O/T$O2 L S* 9CE L*=*L TE T TSO0* US*S @E*2 S* 9CE$28 FO9 CO77 2'S 2' /9O89 7S6 S'STEM CONTROL COMM#N!S

#CCO&NT 7O'$F?0 ''0'*L*T* US*9 TT9$BUT*S6

CONSOLE /L C* T*97$2 L $2 CO2SOL* 7O'*6

OPER#TOR /L C* T*97$2 L $2 O/*9 TO9 7O'*6

P#RMLIL$ST0U/' T* TSO0* '*F ULTS6

R#CON RT U 'S TO 9 CF ' T B S* CO2=*9S$O2 UT$L$T?6

S'NC S?2CE9O2$I* TE* B9O 'C ST ' T S*T @$TE US*9 $'S F9O7 TE* U 'S 2' 9 CF ' T B S*6 SESSION CONTROL

CONSPROF '*F$2* US*9 CO2SOL* CE 9 CT*9$ST$CS6

E"EC $2=O>* CO77 2' /9OC*'U9*6

E"EC&TIL LT*9 9*FF *2=$9O27*2T6

)ELP $2=O>* E*L/ /9OC*SSO96

LO,OFF *2' T*97$2 L S*SS$O26

LO,ON

ST 9T T*97$2 L S*SS$O26

PROFILE '*F$2* US*9 CE 9 CT*9$ST$CS6

SEN! S*2' 7*SS 8* TO O/*9 TO90US*96

TERMIN#L '*F$2* T*97$2 L CE 9 CT*9$ST$CS6

TIME LO8 S*SS$O2 US 8* T$7*6

TSOE"EC *F*CUT* 2 UTEO9$I*' O9 U2 UTEO9$I*' CO77 2' F9O7 @$TE$2 2 U2 UTEO9$I*' *2=$9O27*2T6

*)EN CO2'$T$O2 LL? *F*CUT* 2*FT CO77 2'6 FORE,RO&N! INITI#TE! -#C(,RO&N! COMM#N!S

C#NCEL C 2C*L B C>89OU2' JOB6

O&TP&T '$9*CT OUT/UT 7*'$U7 FO9 B C>89OU2' JOB6

ST#T&S L$ST ST TUS OF B C>89OU2' JOB6

S&-MIT SUB7$T B C>89OU2' JOB6

INTER#CTI E ' T T9 2S7$SS$O2 F C$L$T?6

RECEI E 9*C*$=* ' T S*2T TO ?OU B? T9 2S7$T CO77 2'6

TR#NSMIT T9 2S7$T 7*SS 8*S 2'0O9 ' T S*TS =$ 2O'*S '*F$2*' TO J*S CO-OL Tutorial

Compu er !ro"r#mmin" /rogram is a set o5 instru.tions t(at ena%les a .om3uter to 3ro.ess data< t(ere are t:o t43es o5 .om3uter 3rograms :(i.( are 1) O3erating s4stem 3rograms< :(i.( .ontrol t(e o+erall o3eration o5 t(e s4stem and 2) 33li.ations 3rograms< it is t(e a.tuall 3rogram tas-s re;uried %4 t(e users6 T(e term used to des.rie%e all t43e o5 3rograms is .alled so5t:are in general a33li.ation 3rogram reads in3ut < 3ro.ess it< and 3rodu.e in5ormation or out 3ut t(e user neads6 set o5 .om3uteriDed %usiness 3ro.edures in an a33li.ation area is .alled an in5ormation s4stems6 App$i%# ion pro"r#m de&e$opmen pro%ess 16 'etermain 3rogram s3e.i5i.ations6 26 'esign t(e 3rogram 3lanning tools6 36 Code and enter t(e 3rogram6 46 Com3ile t(e 3rogram6 56 Test t(e 3rogram6 66 'o.ument t(e 3rogram6 'is ory o( Co)o$. 'e+elo3ed %4 1959 %4 a grou3 .alled COn5eren.e on 'ata S4stems Language GCO' S?LH6 First COBOL .om3iler :as released %4 'e.em%er 19596 First 2S$ a33ro+ed +ersion 196# 7odi5ied 2S$ a33ro+ed +ersion 1974 GOS0=S COBOLH 7odi5ied 2S$ a33ro+ed +ersion 19#5 G=S COBOL 2H In erdu% ion o Co)o$ COBOL is a (ig()le+el 3rogramming language 5irst de+elo3ed %4 t(e CO' S?L Committee GCon5eren.e on 'ata S4stems LanguagesH in 196&6 Sin.e t(en< res3onsi%ilit4 5or de+elo3ing ne: COBOL standards (as %een assumed %4 t(e meri.an 2ational Standards $nstitute G 2S$H6 T(e :ord COBOL is an a.ron4m t(at stands 5or COmmon Business Oriented Language6 s t(e t(e eC3anded a.ron4m indi.ates< COBOL is designed 5or de+elo3ing %usiness< t43i.all4 5ile) oriented< a33li.ations6 $t is not designed 5or :riting s4stems 3rograms6 For instan.e 4ou :ould not de+elo3 an o3erating s4stem or a .om3iler using COBOL

T(is %oo- is :ritten %ased on $B7 COBOL 5or OS039& =2926

Codin" S*ee . 1)6 /age0line num%ers ) O3tional Gautomati.all4 assigned %4 .om3ilerH 7 Continuit4 G)H< Comment GJH< Starting a ne: 3age G0H< 'e%ugging lines G'H #)11 Column )'i+ision< Se.tion< /aragra3(< &1<77 de.larations must %egin (ere6 12)72 Column B ) ll t(e ot(er de.larations0statements %egin (ere6 73)#& $denti5i.ation 5ield6 $t :ill %e ignored %4 t(e .om3iler %ut +isi%le in t(e sour.e listing6 +#n"u#"e S ru% ure. 'igits G&)9H< l3(a%ets G )IH< S3a.e G%H< S3e.ial C(ara.ters GK ) J 0 G H 1 L M A N O C(ara.ter Set B) 6 <H @ord B) One or more .(ara.ters) User de5ined or 9eser+ed6 Clause B) One or more :ords6 $t s3e.i5ies an attri%ute 5or an entr46 Statement B) One or more +alid :ords and .lauses6 Senten.e B) One or more statements terminated %4 a 3eriod6 /aragra3( B) One or more senten.es6 Se.tion B) One or more 3aragra3(s6 'i+ision B) One or more se.tions or 3aragra3(s6 /rogram B) 7ade u3 o5 5our di+isions6 Di&isions in CO,O+. T(ere are 5our di+isions in a COBOL 3rogram and 'ata di+ision is o3tional6

16 26 36 46

$denti5i.ation 'i+ision6 *n+ironment 'i+ision6 'ata 'i+ision6 /ro.edure 'i+ision6

Iden i(i%# ion Di&ision. T(is is t(e 5irst di+ision and t(e 3rogram is identi5ied (ere6 /aragra3( /9O89 7)$' 5ollo:ed %4 user)de5ined name is mandator46 ll ot(er 3aragra3(s are o3tional and used 5or do.umentation6 T(e lengt( o5 user)de5ined name 5or $B7 COBOL is *$8ET6

I!ENTIFIC#TION !I ISION. /9O89 7)$'6 /9O89 7 2 7*6 UTEO96 CO77*2T *2T9?6 $2ST LL T$O26 CO77*2T *2T9?6 ' T*)@9$TT*26 CO77*2T *2T9?6 ' T*)CO7/$L*'6 CO77*2T *2T9?6 S*CU9$T?6 CO77*2T *2T9?6 Se.urit4 does not 3ertain to t(e o3erating s4stem se.urit4< %ut t(e in5ormation t(at is 3assed to t(e user o5 t(e 3rogram a%out t(e se.urit4 5eatures o5 t(e 3rogram6

En&ironmen Di&ision. Onl4 ma.(ine de3endant di+ision o5 COBOL 3rogram6 $t su33lies in5ormation a%out t(e (ard:are or .om3uter e;ui3ment to %e used on t(e 3rogram6 @(en 4our 3rogram mo+es 5rom one .om3uter to anot(er .om3uter< t(e onl4 se.tion t(at ma4 need to %e .(anged is *2=$9O27*2T di+ision6 $t su33lies in5ormation .on.erning t(e .om3uter on :(i.( t(e 3rogram :ill %e .om3iled GSOU9C*)CO7/UT*9H and eCe.uted GOBJ*CT)CO7/UT*9H6 $t .onsists o5 t(ree 3aragra3(s ) SOU9C* CO7/UT*9< OBJ*CT)CO7/UT*9 and S/*C$ L)2 7*S6 T(is is O/T$O2 L se.tion 5rom COBOL #56 $B7)43#1 GCom3uter and model P su33lied %4 manu5a.turerH SOU9C*) @$TE '*BU88$28 7O'* .lause s3e.i5ies t(at t(e CO7/UT*96 de%ugging lines in t(e 3rogram Gstatements .oded :it( Q'Q in .olumn 7H are .om3iled6 OBJ*CT) $B7)43#1 GUsuall4 same as sour.e .om3uterH CO7/UT*96 Con5iguration T(is 3aragra3( is used to relate (ard:are names to user) Se.tion6 s3e.i5ied mnemoni. names6 16 Su%stitute .(ara.ter 5or .urren.4 sign6 GCU99*2C? S$82 $S litearal)1H 26 Comma .an %e used as de.imal 3oint6 G'*C$7 L)/O$2T S/*C$ L) $S CO77 H 2 7*S6 36 'e5ault .ollating se;uen.e .an %e .(anged6 $t :ill %e eC3lained later 6 46 2e: .lass .an %e de5ined using CL SS -e4:ord6 GCL SS '$8$T is A&A t(ru A9AH $t .ontains in5ormation regarding t(e 5iles to %e used in t(e 3rogram and it .onsists o5 t:o 3aragra3(s F$L*)CO2T9OL R $)O CO2T9OL6 F$L* Files used in t(e 3rogram are identi5ied in t(is 3aragra3(6 CO2T9OL6 $t s3e.i5ies :(en .(e.- 3oints to %e ta-en and storage areas t(at $)O CO2T9OL6 are s(ared %4 di55erent 5iles6

$n3ut)Out3ut Se.tion6

D# # Di&ision. 'ata di+ision is used to de5ine t(e data t(at need to %e a..essed %4 t(e 3rogram6 $t (as t(ree se.tions6

F$L* S*CT$O2 des.ri%es t(e re.ord stru.ture o5 t(e 5iles6 @O9>$28)STO9 8* S*CT$O2 is used to 5or de5ine intermediate +aria%les6 is used to a..ess t(e eCternal data6 L$2> 8* S*CT$O2 *CB 'ata 3assed 5rom ot(er 3rograms or 5rom / 97 o5 JCL6

1&

+i er#$s- Cons #n s- Iden i(ier16 Literal is a .onstant and it .an %e numeri. or non)numeri.6 26 2umeri. literal .an (old 1# digits and non)numeri. literal .an (old 16& .(ara.ters in it6 GCOBOL74 su33orts 12& .(ara.ters onl4H 36 Literal stored in a named memor4 lo.ation is .alled as +aria%le or identi5ier6 46 Figurati+e Constant is a COBOL reser+ed :ord re3resenting 5re;uentl4 used .onstants6 T(e4 are I*9O0I*9OS0I*9O*S< !UOT*0!UOT*S< S/ C*0S/ C*S< LL< E$8E)= LU*0E$8E) = LU*S< LO@)= LU*0LO@)= LU*S6 *Cam3leB &1 @S)= 91 /$C FG&4H = LU* Q7US Q6 Q7US Q is a non)numeri. literal6 @S)= 91 is a identi5ier or +aria%le6

De%$#r# ion o( &#ri#)$e Le+elP L S=aria%le0FillerT L /i.ture .lause L =alue .lause L Usage Clause L S4n. .lause6

Le/el0 $t s3e.i5ies t(e (ierar.(4 o5 data :it(in a re.ord6 $t .an ta-e a +alue 5rom t(e set o5 integers %et:een &1)49 or 5rom one o5 t(e s3e.ial le+el)num%ers 66 77 ## &1 le+el &2)49 le+els 66 le+el 77 le+el ## le+el S3e.i5ies t(e re.ord itsel56 $t ma4 %e eit(er a grou3 item or an *lementar4 item6 $t must %egin in rea 6 S3e.i54 grou3 or elementar4 items :it(in a re.ord6 8rou3 le+el items must not (a+e B) 3i.ture .lause6 B) $denti54 t(e items t(at .ontain t(e 9*2 7*S .lause6 B) $denti54 inde3endent data item6 B) Condition names6 B)

aria1le name and %uali2ier =aria%le name .an (a+e 1)3& .(ara.ters :it( at least one al3(a%et in it6 E43(en is t(e onl4 allo:ed s3e.ial .(ara.ter %ut it .annot %e 5irst or last letter o5 t(e name6 2ame s(ould %e uni;ue :it(in t(e re.ord6 $5 t:o +aria%les :it( same name are t(ere< t(en use OF ;uali5ier o5 (ig( le+el grou3ing to re5er a +aria%le uni;uel46 *CB 7O=* %alan.e OF re.ord)1 TO %alan.e OF re.ord)26 FILLER @(en t(e 3rogram is not intended to use sele.ted 5ields in a re.ord stru.ture< de5ine t(em as F$LL*96 F$LL*9 items .annot %e initialiDed or used in an4 o3eration o5 t(e 3ro.edure di+ision6

11

PICT&RE Clause 'es.ri%es t(e attri%utes o5 +aria%le6 2umeri. 2umeri. *dited 2on 2umeri. *C.lusi+e sets 9 G'igitH< = G$m3lied de.imal 3ointH< S GSignH K G/lus SignH< ) G7inus SignH< C9 'B GCredit 'e%it SignH< Q6Q G/eriodH< % GBlan-H< Q<QG.ommaH< & GIeroH< 0 GSlas(H BL 2> @E*2 I*9O G$nsert %lan- :(en data +alue is &H< I GI*9O su33ressionH< J G ST*9$S>H< LGCurren.4 SignH Gal3(a%etH< B GBlan- insertion C(ara.terH< FG l3(a numeri.H< 8G'BCSH 16 K ) C9 'B 26 = Q6Q 36 L K ) I J GBut L Can a33ear as 5irst 3la.e and J as 5loating6 LJJJ6JJH

'BCS G'ou%le B4te C(ara.ter SetH is used in t(e a33li.ations t(at su33ort large .(ara.ter sets6 16 %its are used 5or one .(ara.ter6 *CB Ja3anese language a33li.ations6

Re(res*in" ,#si%s 2i%%le B) 4 Bits is one ni%%le6 $n 3a.-ed de.imal< ea.( ni%%le stores one digit6 B4te B) # Bits is one %4te6 B4 de5ault< e+er4 .(ara.ter is stored in one %4te6 Eal5 :ord B) 16 %its or 2 %4tes is one (al5 :ord6 G7=SH Full :ord B) 32 %its or 4 %4tes is one 5ull :ord6 G7=SH 'ou%le :ord B) 64 %its or # %4tes is one dou%le :ord6 G7=SH &sage Clause '$S/L ? B) 'e5ault6 2um%er o5 %4tes re;uired e;uals to t(e siDe o5 t(e data item6 Binar4 re3resentation o5 data item6 /$C .lause .an .ontain S and 9 onl46 CO7/ B) S9G&1H ) S9G&4H Eal5 :ord6 S9G&5H ) S9G&9H Full :ord6 S9G1&H ) S9G1#H 'ou%le :ord6 7ost signi5i.ant %it is O2 i5 t(e num%er is negati+e6

CO7/)1 B) Single :ord 5loating 3oint item6 /$C Clause s(ould not %e s3e.i5ied6 CO7/)2 B) 'ou%le :ord 5loating)3oint item6 /$C Clause s(ould not %e s3e.i5ied6 /a.-ed 'e.imal re3resentation6 T:o digits are stored in ea.( %4te6 Last ni%%le is 5or CO7/)3 B) sign6 GF 5or unsigned 3ositi+e< C 5or signed 3ositi+e and ' 5or signed negati+eH Formula 5or B4tesB $nteger GGn02H K 1HH 1N n is num%er o5 9s6 $t is used 5or 3reser+e t(e indeC +alue o5 an arra46 /$C Clause s(ould not %e $2'*F B) s3e.i5ied6 #L&E Clause $t is used 5or initialiDing data items in t(e :or-ing storage se.tion6 =alue o5 item must not eC.eed 3i.ture siDe6 $t .annot %e s3e.i5ied 5or t(e items :(ose siDe is +aria%le6

12

= LU* $S literal6 S4ntaCB = LU*S 9* literal)1 TE9U U TE9OU8E literal)2 = LU*S 9* literal)1< literal)2 Literal .an %e numeri. :it(out ;uotes O9 non)numeri. :it(in ;uotes O9 5igurati+e .onstant6 SI,N Clause S4ntaC ) S$82 $S GL* '$28H S*/ 9 T* CE 9 CT*9 GT9 $L$28H6 $t is a33li.a%le :(en t(e 3i.ture string .ontain QSQ6 'e5ault is T9 $L$28 @$TE 2O S*/ 9 T* CE 9 CT*96 So QSQ doesnQt ta-e an4 s3a.e6 $t is stored along :it( last digit6 K11 < K21B< K31C< K41'< K51*< K61F< K718< K#1E< K91$< )&1T< )11 J< )21 >< )31L< )417< )512< )61O< )71/< )#1!< )919 2um%er T9 $L$28 S$82 G'e5aultH L* '$28 S$82 L* '$28 S*/ 9 T* )125 122 J25 )125 K125 12* 25 K125 S'NC Clause and Slac3 -+tes S?2C .lause is s3e.i5ied :it( CO7/< CO7/)1 and CO7/)2 items6 T(ese items are eC3e.ted to start at (al505ull0dou%le :ord %oundaries 5or 5aster address resolution6 S?2C .lause does t(is %ut it ma4 introdu.e sla.- %4tes Gunused %4tesH %e5ore t(e %inar4 item6 &1 @S)T*ST6 1& @S)= 91 /$C FG&2H6 1& @S)= 92 /$C S9G6H CO7/ S?2C6 ssumes @S)T*ST starts at relati+e lo.ation & in t(e memor4< @S)= 91 o..u3ies Dero and 5irst %4te6 @S)= 92 is eC3e.ted to start at se.ond %4te6 s t(e .om3 item in t(e eCam3le needs one :ord and it is .oded :it( S?2C .lause< it :ill start onl4 at t(e neCt :ord %oundar4 t(at is 4t( %4te6 So t(is introdu.es t:o sla.- %4tes %et:een @S)= 91 and @S)= 926

REDE.INES T(e 9*'*F$2*S .lause allo:s 4ou to use di55erent data des.ri3tion entries to des.ri%e t(e same .om3uter storage area6 9ede5ining de.laration s(ould immediatel4 5ollo: t(e rede5ined item and s(ould %e done at t(e same le+el6 7ulti3le rede5initions are 3ossi%le6 SiDe o5 rede5ined and rede5ining need not %e t(e same6 *Cam3leB

&1 @S)' T* /$C9G&6H6 &1 @S)9*'*F)' T* @S)' T*6 &5 @S)?* 9 /$C9G&2H6 &5 @S)7O2 /$C9G&2H6

13

&5 RENAMES

@S)' ?

/$C9G&2H6

$t is used 5or regrou3ing o5 elementar4 data items in a re.ord6 $t s(ould %e de.lared at 66 le+el6 $t need not immediatel4 5ollo:s t(e data item< :(i.( is %eing renamed6 But all 9*2 7*S entries asso.iated :it( one logi.al re.ord must immediatel4 5ollo: t(at re.ordQs last data des.ri3tion entr46 9*2 7*S .annot %e done 5or a &1< 77< ## or anot(er 66 entr46

&1

@S)9*/SO2S*6 &5 @S)CE 9143 /$CFG&3H6 &5 @S)CE 94 /$CFG&4H6 66 '')9*/SO2S* 9*2 7*S @S)CE 91436

CONDITION n#me $t is identi5ied :it( s3e.ial le+el Q##Q6 .ondition name s3e.i5ies t(e +alue t(at a 5ield .an .ontain and used as a%%re+iation in .ondition .(e.-ing6 &1 S*F /$C F6 ## 7 L* = LU* Q1Q ## F*7 L* = LU* Q2Q Q3Q6

$F S*F11 .an also %e .oded as $F 7 L* in /ro.edure di+ision6 QS*T F*7 L* TO T9U* Q mo+es +alue 2 to S*F6 $5 multi3le +alues are .oded on = LU* .lause< t(e 5irst +alue :ill %e mo+ed :(en it is set to true6 /USTI.IED RI0'T T(is .lause .an %e s3e.i5ied :it( al3(anumeri. and al3(a%eti. items 5or rig(t Vusti5i.ation6 $t .annot %e used :it( 66 and ## le+el items6 OCCURS C$#use OCCU9S Clause is used to allo.ate 3(4si.all4 .ontiguous memor4 lo.ations to store t(e ta%le +alues and a..ess t(em :it( su%s.ri3t or indeC6 'etail eC3lanation is gi+en in Ta%le Eandling se.tion6 +IN1A0E SECTION $t is used to a..ess t(e data t(at are eCternal to t(e 3rogram6 JCL .an send maCimum 1&& .(ara.ters to a 3rogram t(ru / 976 Lin-age se.tion 7UST %e .oded :it( a (al5 :ord %inar4 5ield< 3rior to a.tual 5ield6 $5 lengt( 5ield is not .oded< t(e 5irst t:o %4tes o5 t(e 5ield .oded in t(e lin-age se.tion :ill %e 5illed :it( lengt( and so t(ere are .(an.es o5 2 %4tes data trun.ation in t(e a.tual 5ield6

14

&1

L>)' T 6 &5 L>)L*28TE /$C S9G&4H CO7/6 &5 L>)= 9$ BL* /$C FG&#H6

!ro%edure Di&ision. T(is is t(e last di+ision and %usiness logi. is .oded (ere6 $t (as user)de5ined se.tions and 3aragra3(s6 Se.tion name s(ould %e uni;ue :it(in t(e 3rogram and 3aragra3( name s(ould %e uni;ue :it(in t(e se.tion6 /ro.edure di+ision statements are %roadl4 .lassi5ied into 5ollo:ing .ategories6 Statement T43e $m3erati+e Conditional Com3iler 'ire.ti+e *C3li.it S.o3e terminator $m3li.it S.o3e terminator MOVE S # emen $t is used to trans5er data %et:een internal storage areas de5ined in eit(er 5ile se.tion or :or-ing storage se.tion6 Syn #x2 7O=* identi5ier10literal105igurati+e).onstant TO identi5ier2 Gidenti5ier3H 7ulti3le mo+e statements .an %e se3arated using .omma< semi.olons< %lan-s or t(e -e4:ord TE*26 Numeric mo/e rules4 numeri. or numeri.)edited item re.ei+es data in su.( a :a4 t(at t(e de.imal 3oint is aligned 5irst and t(en 5illing o5 t(e re.ei+ing 5ield ta-es 3la.e6 Un5illed 3ositions are 5illed :it( Dero6 Iero su33ression or insertion o5 editing s4m%ols ta-es 3la.es a..ording to t(e rules o5 editing 3i.tures6 $5 t(e re.ei+ing 5ield :idt( is smaller t(an sending 5ield t(en eC.ess digits< to t(e le5t and0or to t(e rig(t o5 t(e de.imal 3oint are trun.ated6 #l5hanumeric Mo/e Rules4 l3(a%eti.< al3(anumeri. or al3(anumeri.)edited data 5ield re.ei+es t(e data 5rom le5t to rig(t6 n4 un5illed 5ield o5 t(e re.ei+ing 5iled is 5illed :it( s3a.es6 @(en t(e lengt( o5 re.ei+ing 5ield is 7eaning 'ire.t t(e 3rogram to ta-e a s3e.i5i. a.tion6 *CB 7O=* '' *F$T 8O TO 'e.ide t(e trut( or 5alse o5 relational .ondition and %ased on it< eCe.ute di55erent 3at(s6 *CB $F< *= LU T* 'ire.ts t(e .om3iler to ta-e s3e.i5i. a.tion during .om3ilation6 *CB CO/? S>$/ *J*CT Terminate t(e s.o3e o5 .onditional and im3erati+e statements6 *CB *2') '' *2')$F *2')*= LU T* T(e 3eriod at t(e end o5 an4 senten.e< terminates t(e s.o3e o5 all 3re+ious statements not 4et terminated6

15

s(orter t(an t(at o5 sending 5ield< t(en re.ei+ing 5ield a..e3ts .(ara.ters 5rom le5t to rig(t until it is 5illed6 T(e una..omodated .(ara.ters on t(e rig(t o5 t(e sending 5ield are trun.ated6 @(en an al3(anumeri. 5ield is mo+ed to a numeri. or numeri.)edited 5ield< t(e item is mo+ed as i5 it :ere in an unsigned numeri. integer mode6 CO99*S/O2'$28 .an %e used to trans5er data %et:een items o5 t(e same names %elonging to di55erent grou3)items %4 s3e.i54ing t(e names o5 grou3) items to :(i.( t(e4 %elong6 7O=* CO99*S/O2'$28 grou3)1 TO grou3)2 ,rou5 Mo/e rule @(en 7O=* statement is used to mo+e in5ormation at grou3 le+el< t(e mo+ement o5 data ta-es 3la.e as i5 %ot( sending and re.ei+ing 5ields are s3e.i5ied as al3(anumeri. items6 T(is is regardless o5 t(e des.ri3tion o5 t(e elementar4 items .onstituting t(e grou3 item6 Sam3les 5or understanding 7O=* statement G7O=* TO BH /i.ture o5 /$C 99=99 /$C 99=99 /$C99=999 /$C9G&5H=9G&3H /$C9G&4H=9G&2H /$C99=99 /$CFG&4H =alue o5 12635 12635 126345 543216543 23624 &&634 7US /i.ture o5 B =alue o5 B a5ter 7o+e /$C 999=99 &12635 /$C 9999=9999 &&12635&& /$C9=99 2634 /$C 9G&3H=9G&3H 3216543 /$CIII9969 2362 /$CLLL699 L634 FBFBFB 7US

ARIT'METIC VER,S ll t(e 3ossi%le arit(meti. o3erations in COBOL using ''< SUBT9 CT< 7ULT$/L? and '$=$'* are gi+en %elo:B rit(meti. O3eration '' TO B '' B C TO ' '' B C 8$=$28 ' '' TO B C SUBT9 CT F9O7 B SUBT9 CT B F9O7 C SUBT9 CT B F9O7 C 8$=$28 ' 7ULT$/L? B? B 7ULT$/L? B? B 8$=$28 C '$=$'* $2TO B '$=$'* $2TO B 8$=$28 C '$=$'* B? B 8$=$28 C '$=$'* $2TO B 8$=$28 C 9*7 $2'*9 ' B KB B B C C KBKCK' KBKC C '

KB KC B) B C)G KBH B C C)G KBH JB B JB B0 B B0 B 0B B $nteger GB0 H $nteger remainder

16

8$=$28 is used in t(e 5ollo:ing .asesB 16To retain t(e +alues o5 o3erands 3arti.i3ating in t(e o3eration6 26T(e resultant +alue o5 o3eration eC.eeds an4 o5 t(e o3erand siDe6 ROUNDED op ion @it( 9OU2'*' o3tion< t(e .om3uter :ill al:a4s round t(e result to t(e /$CTU9* .lause s3e.i5i.ation o5 t(e re.ei+ing 5ield6 $t is usuall4 .oded a5ter t(e 5ield to %e rounded6 $t is 3re5iCed :it( 9*7 $2'*9 -e4:ord O2L? in '$=$'* o3eration6 '' B 8$=$28 C 9OU2'*'6 CautionB 'onQt use 5or intermediate .om3utation6

ON SI3E ERROR $5 12& G/$C 9G&2HH and B19& G/$C 9G&2HH< '' TO B :ill result 1& in B :(ere t(e eC3e.ted +alue in B is 11&6 O2 S$I* *99O9 .lause is .oded to tra3 su.( siDe errors in arit(meti. o3eration6 $5 t(is is .oded :it( arit(meti. statement< an4 o3eration t(at ended :it( S$I* error :ill not %e .arried out %ut t(e statement 5ollo:s O2 S$I* *99O9 :ill %e eCe.uted6 '' TO B O2 S$I* *99O9 '$S/L ? Q*99O9WQ6 COM!UTE Com3leC arit(meti. o3erations .an %e .arried out using CO7/UT* statement6 @e .an use arit(meti. s4m%ols t(an -e4:ords and so it is sim3le and eas4 to .ode6 K For ''< ) 5or SUBT9 CT< J 5or 7ULT$/L?< 0 5or '$=$'* and JJ 5or eC3onentiation6 9uleB Le5t to rig(t ) 16/arent(eses 26*C3onentiation 367ulti3li.ation and 'i+ision 46 ddition and Su%tra.tion CautionB @(en 9OU2'*' is .oded :it( CO7/UT*< some .om3iler :ill do rounding 5or e+er4 arit(meti. o3eration and so t(e 5inal result :ould not %e 3re.ise6 77 /$C 999 = LU* 1& CO7/UT* 9OU2'*' 1 G K2695H J1&699 9esultB G9OU2'*'G9OU2'*'G12695H J 9OU2'*'G1&699HH 112& or 9OU2'*'G142632&5H 1 142 So t(e result .an %e 12& or 1426 Be .autious :(en using 9OU2'*' -e4:ord :it( CO7/UT* statement6 ll arit(meti. o3erators (a+e t(eir o:n eC3li.it s.o3e terminators6 G*2') ''< *2') SUBT9 CT< *2')7ULT$/L?< *2')'$=$'*< *2')CO7/UT*H6 $t is suggested to use t(em6 CO99*S/O2'$28 is a+aila%le 5or '' and SUBT9 CT onl46 INITIA+I3E = LU* .lause is used to initialiDe t(e data items in t(e :or-ing storage se.tion :(ereas $2$T$ L$I* is used to initialiDe t(e data items in t(e 3ro.edure di+ision6 $2$T$ L$I* sets t(e al3(a%eti.< al3(anumeri. and al3(anumeri.)edited items to S/ C*S and numeri. and numeri.)

17

edited items to I*9O6 T(is .an %e o+erridden %4 9*/L C$28 o3tion o5 $2$T$ L$I*6 F$LL*9< OCCU9S '*/*2'$28 O2 items are not a55e.ted6 $2$T$ L$I* identi5ier)1 9*/L C$28 G L/E B*T$C0 L/E 2U7*9$C0 L/E ) S4ntaCB 2U7*9$C)*'$T*' 2U7*9$C02U7*9$C)*'$T*'H ' T B? Gidenti5ier)2 0Literal) 2H ACCE!T CC*/T .an trans5er data 5rom in3ut de+i.e or s4stem in5ormation .ontain in t(e reser+ed data items li-e ' T*< T$7*< ' ?6 CC*/T @S)= 91 GF9O7 ' T*0T$7*0' ?0OTE*9 S?ST*7 = 9SH6 $5 F9O7 Clause is not .oded< t(en t(e data is read 5rom terminal6 t t(e time o5 eCe.ution< %at.( 3rogram :ill B*2' i5 t(ere is no in)stream data 5rom JCL and t(ere is no F9O7 .lause in t(e CC*/T .lause6 ' T* o3tion returns siC digit .urrent date in ????77'' ' ? returns 5 digit .urrent date in ??''' T$7* returns # digit 9U2 T$7* in EE77SSTT ' ?)OF)@**> returns single digit :(ose +alue .an %e 1)7 G7onda4)Sunda4 res3e.ti+el4H

DIS!+A4 $t is used to dis3la4 data6 B4 de5ault dis3la4 messages are routed to S?SOUT6 S4ntaCB '$S/L ? identi5ier1U literal1 GU/O2 mnemoni. nameH STO! RUN- EXIT !RO0RAM 5 0O ,AC1 STO/ 9U2 is t(e last eCe.uta%le statement o5 t(e main 3rogram6 $t returns .ontrol %a.- to OS6 *F$T /9O89 7 is t(e last eCe.uta%le statement o5 su%)3rogram6 $t returns .ontrol %a.- to main 3rogram6 8OB C> .an %e .oded in main 3rogram as :ell as su%)3rogram as t(e last statement6 $t Vust gi+es t(e .ontrol %a.- 5rom :(ere it re.ei+ed t(e .ontrol6 Co$$# in" Se6uen%e T(ere are t:o 5amous Collating Se;uen.e a+aila%le in .om3uters6 $B7 and $B7 Com3ati%le ma.(ine use *BC'$C .ollating se;uen.e :(ereas most mi.ro and man4 main5rame s4stems use SC$$ .ollating se;uen.e6 T(e result o5 arit(meti. and al3(a%eti. .om3arison :ould %e same in %ot( .ollating se;uen.es :(ereas t(e same is not true 5or al3(anumeri. .om3arison *BC'$C G s.ending OrderH SC$$ G s.ending OrderH S3e.ial C(ara.ters S3e.ial C(ara.ters a)D &)9 )I )I &)9 a)D

1#

'e5ault .ollating se;uen.e .an %e o+erridden %4 an entr4 in OBJ*CT)CO7/UT*9 and S/*C$ L 2 7*S 3aragra3(s6 16 Code t(e /9O89 7 COLL T$28 S*!U*2C* Clause in t(e O%Ve.t .om3uter 3aragra3(6 /9O89 7 COLL T$28 S*!U*2C* $S al3(a%et)name 26 7a3 t(e al3(a%et)name in t(e S/*C$ L)2 7*S 3aragra3( as 5ollo:sB L/E B*T al3(a%et)name is ST 2' 9')1 U 2 T$=* 2 T$=* stands 5or .om3uterQs o:n .ollating se;uen.e :(ereas ST 2' 9')1 stands 5or SC$$ .ollating se;uen.e6 I.7T'EN7E+SE7END8I. T(e most 5amous de.ision ma-ing statement in all language is Q$FQ6 T(e s4ntaC o5 $F statement is gi+en %elo:B $F .an %e .oded :it(out an4 *LS* statement6 TE*2 is a noise :ord and it is o3tional6 $5 O9s R 2's are used in t(e same senten.e< 2's are e+aluated 5irst 5rom le5t to rig(t< 5ollo:ed %4 O9s6 T(is rule .an %e o+erridden %4 using 3arent(eses6 T(e 3ermitted relation .onditions are 1< O< N< O1< N1< ON CO2T$2U* is no o3eration statement6 T(e .ontrol is Vust 3assed to neCt ST T*7*2T6 2*FT S*2T*2C* 3asses t(e .ontrol to t(e neCt S*2T*2C*6 $5 4ou 5orgot t(e di55eren.e %et:een statement and senten.e< re5er t(e 5irst 3age6 $t is ad+ised to use *2')$F< eC3li.it s.o3e terminator 5or t(e $F statements t(an 3eriod< im3li.it s.o3e terminator6 $F .ondition1 2' .ondition2 TE*2 Statement)Blo.-)1 *LS* $F .ondition3 TE*2 CO2T$2U* *LS* $F .ondition4 TE*2 Statement)Blo.-)2 *LS* 2*FT S*2T*2C* *2')$F *2')$F *2')$F Statement)Blo.-)2 :ill %e eCe.uted onl4 :(en .ondition 1< 2 and 4 are T9U* and .ondition 3 is F LS*6 $m3lied o3erandB $n .om3ound .onditions< it is not al:a4s ne.essar4 to s3e.i54 %ot( o3erands 5or ea.( .ondition6 $F TOT L17 or # is a..e3ta%le6 Eere TOT L1# is im3lied o3eration6 SI,N test and CL#SS test S$82 test is used to .(e.- t(e sign o5 a data item6 $t .an %e done as 5ollo:s ) $F identi5ier is /OS$T$=*02*8 T$=*0I*9O CL SS test is used to .(e.- t(e .ontent o5 data item against 3re)de5ined range o5 +alues6 $t .an %e done as 5ollo:s )

19

$F identi5ier is 2U7*9$C0 L/E B*T$C0 L/E B*T$C)E$8E*90 L/E B*T$C)LO@*9 ?ou .an de5ine 4our o:n .lasses in t(e s3e.ial names 3aragra3(6 @e (a+e de5ined a .lass '$8$T in our s3e.ial names 3aragra3(6 $t .an %e used in t(e 5ollo:ing :a46 $F identi5ier is '$8$T Ne"# ed %ondi ions. n4 sim3le< relational< .lass< sign test .an %e negated using 2OT6 But it is not al:a4s true t(at 2OT 2*8 T$=* is e;ual to /OS$T$=*6 G*Cam3le I*9OH EVA+UATE @it( COBOL#5< :e use t(e *= LU T* +er% to im3lement t(e .ase stru.ture o5 ot(er languages6 7ulti3le $F statements .an %e e55i.ientl4 and e55e.ti+el4 re3la.ed :it( *= LU T* statement6 5ter t(e eCe.ution o5 one o5 t(e :(en .lauses< t(e .ontrol is automati.all4 .ome to t(e neCt statement a5ter t(e *2')*= LU T*6 n4 .om3leC .ondition .an %e gi+en in t(e @E*2 .lause6 Brea- statement is not needed< as it is so in ot(er languages6 8eneral S4ntaC

*= LU T*

su%Ve.t)1 G LSO su%Ve.t266H @E*2 o%Ve.t)1 G LSO o%Ve.t266H @E*2 o%Ve.t)3 G LSO o%Ve.t466H @E*2 OTE*9 im3erati+e statement

*2')*= LU T*6 162um%er o5 Su%Ve.ts in *= LU T* .lause s(ould %e e;ual to num%er o5 o%Ve.ts in e+er4 @E*2 .lause6 26Su%Ve.t .an %e +aria%le< eC3ression or t(e -e4:ord T9U*0 FL S* and res3e.ti+el4 o%Ve.ts .an %e +alues< T9U*0F LS* or an4 .ondition6 36$5 none o5 t(e @E*2 .ondition is satis5ied< t(en @E*2 OTE*9 3at( :ill %e eCe.uted6 Sam3le *= LU T* S!LCO'* LSO T9U* @E*2 1&& LSO 1B im3erati+e statement @E*2 )3&5 LSO G 0C14H im3erati+e statement @E*2 OTE*9 im3erati+e statement

*2')*= LU T*6 !ER.ORM STATEMENTS /*9FO97 :ill %e use5ul :(en 4ou :ant to eCe.ute a set o5 statements in multi3le 3la.es o5 t(e 3rogram6 @rite all t(e statements in one 3aragra3( and in+o-e it using /*9FO97 :(ere+er needed6 On.e t(e 3aragra3( is eCe.uted< t(e .ontrol .omes %a.- to neCt statement 5ollo:ing t(e /*9FO976

2&

6.SIMPLE PERFORM. /*9FO97 / 9 )16 '$S/L ? Q/ 9 )1 eCe.utedQ STO/ 9U26 / 9 )16 Statement16 Statement26 $t eCe.utes all t(e instru.tions .oded in / 9 )1 and t(en trans5ers t(e .ontrol to t(e neCt instru.tion in se;uen.e6 7. INLINE PERFORM.

@(en set o5 statements are used onl4 in one 3la.e t(en :e .an grou3 all o5 t(em :it(in /*9FO97 *2')/*9FO97 stru.ture6 T(is is .alled $2L$2* /*9FO976 T(is is e;ual to 'O66*2' stru.ture o5 ot(er languages6
/*9FO97 '' TO B 7ULT$/L* B B? C '$S/L ? Q= LU* OF KBJC Q C *2')/*9FO97 8. PERFORM P#R#-6 T)R& P#R#-N. ll t(e 3aragra3(s %et:een / 9 )1 and / 9 )2 are eCe.uted on.e6 9. PERFORM P#R#-6 T)R& P#R#-N &NTIL condition:s;. T(e identi5iers used in t(e U2T$L .onditionGsH must %e altered :it(in t(e 3aragra3(GsH %eing 3er5ormedM ot(er:ise t(e 3aragra3(s :ill %e 3er5ormed inde5initel46 $5 t(e .ondition in t(e U2T$L .lause is met at 5irst time o5 eCe.ution< t(en named 3aragra3(GsH :ill not %e eCe.uted at all6 <. PERFORM P#R#-6 T)R& P#R#-N N TIMES. 2 .an %e literal de5ined as numeri. item in :or-ing storage or (ard .oded .onstant6 =. PERFORM P#R#-6 T)R& P#R#-N #R'IN, identi2ier6 F9O7 identi5ier2 B? identi5ier3 U2T$L .onditionGsH $nitialiDe identi5ier1 :it( identi5ier2 and test t(e .onditionGsH6 $5 t(e .ondition is 5alse eCe.ute t(e statements in / 9 )1 t(ru / 9 )2 and in.rement identi5ier1 B? identi5ier3 and .(e.- t(e .onditionGsH again6 $5 t(e .ondition is again 5alse< re3eat t(is 3ro.ess till t(e .ondition is satis5ied6

21

>.PERFORM P#R#-6 *IT) TEST -EFORE$#FTER &NTIL condition:s;. @it( T*ST B*FO9*< Condition is .(e.-ed 5irst and i5 it 5ound 5alse< t(en / 9 )1 is eCe.uted and t(is is t(e de5ault6 GFun.tions li-e 'O) @E$L*H @it( T*ST FT*9< / 9 )1 is eCe.uted on.e and t(en t(e .ondition is .(e.-ed6 GFun.tions li-e 'O)U2T$LH EXIT s # emen . COBOL reser+ed :ord t(at 3er5orms 2OTE$286 $t is used as a single statement in a 3aragra3( t(at indi.ate t(e end o5 3aragra3(GsH eCe.ution6 *F$T must %e t(e onl4 statement in a 3aragra3( in COBOL74 :(ereas it .an %e used :it( ot(er statements in COBOL#56 0O TO Us#"e2 $n a stru.tured to3)do:n 3rogramming 8O TO is not 3re5era%le6 $t o55ers 3ermanent .ontrol trans5er to anot(er 3aragra3( and t(e .(an.es o5 logi. errors is mu.( greater :it( 8O TO t(an /*9FO976 T(e reada%ilit4 o5 t(e 3rogram :ill also %e %adl4 a55e.ted6 But still 8O TO .an %e used :it(in t(e 3aragra3(s %eing 3er5ormed6 i6e6 @(en using t(e TE9U o3tion o5 /*9FO97 statement< %ran.(es or 8O TO statements< are 3ermitted as long as t(e4 are :it(in t(e range o5 named 3aragra3(s6 /*9FO97 1&&)ST*/1 TE9U ST*/)4 1&&)ST*/)16 '' TO B 8$=$28 C6 $F ' 1 I*9O '$S/L ? Q7ULT$/L$C T$O2 2OT 'O2*Q 8O TO 3&&)ST*/3 *2')$F6 2&&)ST*/)26 7ULT$/L? C B? '6 3&&)ST*/)36 '$S/L ? Q= LU* OF CBQ C6 Eere 8O TO used :it(in t(e range o5 /*9FO976 T(is -ind o5 Controlled 8O TO is 5ine :it( stru.tured 3rogramming alsoW TA,+ES n OCCU9S .lause is used to indi.ate t(e re3eated o..urren.es o5 items o5 t(e same 5ormat in a stru.ture6 OCCU9S .lause is not +alid 5or &1< 77< ## le+els6 $t .an %e de5ined as elementar4 or grou3 item6 $nitialiDation o5 large ta%le o..urren.es :it( s3e.i5i. +alues are usuall4 done using 3er5orm loo3s in 3ro.edure di+ision6 Sim3le ta%les .an %e initialiDed in t(e 5ollo:ing :a46 &1 @**>) 99 ? = LU* Q7O2TU*@*'TEUF9$S TSU2Q6 &5 @S)@**>)' ?S OCCU9S 7 T$7*S /$C FG&3H6

22

'4nami. arra4 is t(e arra4 :(ose siDe is de.ided during runtime Vust %e5ore t(e a..ess o5 5irst element o5 t(e arra46 &1 @S)7O2TE)' ?)C L6 &5 @S)' ?S OCCU9S 31 T$7*S '*/*2'$28 O2 @S)OCCU9*2C*6

$F 7O2TE 1 QF*BQ 7O=* Q2#Q to @S)OCCU99*2C*6 rra4 $tems .an %e a..essed using $2'*F or su%s.ri3t and t(e di55eren.e %et:een t(em are listed in t(e ta%le6 9elati+e su%s.ri3ts and relati+e indeCes are su33orted onl4 in COBOL#56 Literals used in relati+e su%s.ri3ting0indeCing must %e an unsigned integer6 '' @S)S LGSUBH @S)S LGSUB K 1H TO @S)S LGSUB K 2H6

Sl Su%s.ri3t P 1 @or-ing Storage item 2 $t means o..urren.e O..urren.e< in turn translated to dis3la.ement to 3 a..ess elements and so slo:er t(an $2'*F a..ess6 $t .an %e used in an4 arit(meti. o3erations or 5or 4 dis3la46 Su%s.ri3ts .an %e modi5ied %4 an4 arit(meti. 5 statement6

$ndeC $nternal $tem)2o need to de.lare it6 $t means dis3la.ement Faster and e55i.ient6 $t .annot %e used 5or arit(meti. o3eration or 5or dis3la4 3ur3ose6 $2'*F .an onl4 %e modi5ied :it( S*T< S* 9CE and /*9FO97 statements6

Sometimes< 4ou ma4 5a.e a ;uestion li-e (o: to randoml4 a..ess t(e in5ormation in t(e se;uential 5ile o5 5& re.ords t(at .ontains all t(e designation and t(e res3e.ti+e lo:er and (ig(er salar4 in5ormation6 O%+iousl4< OS does not allo: 4ou to randoml4 a..ess t(e se;uen.e 5ile6 ?ou (a+e to do %4 4oursel5 and t(e %est :a4 is< load t(e 5ile into a :or-ing storage ta%le in t(e 5irst se.tion o5 t(e 3rogram and t(en a..ess as 4ou :is(6 T(e ta%le loo-)u3 .an %e done in t:o :a4s6 )Se;uential sear.(6 )Binar4 sear.(6

Se?uential SE#RC) 'uring S*9$ L S* 9CE< t(e 5irst entr4 o5 t(e ta%le is sear.(ed6 $5 t(e .ondition is met< t(e ta%le loo-)u3 is .om3leted6 $5 t(e .ondition is not met< t(en indeC or su%s.ri3t is in.remented %4 one and t(e neCt entr4 is sear.(ed and t(e 3ro.ess .ontinues until a mat.( is 5ound or t(e ta%le (as %een .om3letel4 sear.(ed6 S*T indeCname)1 TO 16 S* 9CE identi5ier)1 T *2' dis3la4 Qmat.( not 5oundBQ @E*2 .ondition)1 im3erati+e statement)1 02*FT S*2T*2C* @E*2 .ondition)2 im3erati+e statement)2 02*FT S*2T*2C* *2')S* 9CE $denti5ier)1 s(ould %e OCCU9S item and not &1 item6

23

Condition)1< Condition)2 .om3ares an in3ut 5ield or sear.( argument :it( a ta%le argument6 T(oug( T *2' Clause is o3tional< it is (ig(l4 re.ommended to .ode t(at6 Be.ause i5 it is not .oded and element loo-ing 5or is not 5ound< t(en t(e .ontrol sim3l4 .omes to t(e neCt statement a5ter S* 9CE :(ere an in+alid ta%le item .an %e re5erred and t(at ma4 lead to in.orre.t results 0 a%normal ends6 S*T statement S4ntaCB S*T indeC)name)1 TO0U/ B?0'O@2 B? integer)16 -inar+ SE#RC) @(en t(e siDe o5 t(e ta%le is large and it is arranged in some se;uen.e )eit(er as.ending or des.ending on sear.( 5ield< t(en B$2 9? S* 9CE :ould %e t(e e55i.ient met(od6 S* 9CE LL identi5ier)1 T *2' im3erati+e)statement)1 @E*2 dataname)1 1 identi5ier)20literal)10arit(meti. eC3ression)1 2' dataname)2 1 identi5ier)30literal)20arit(meti. eC3ression)2 *2')S* 9CE6 $denti5ier)2 and identi5ier)3 are su%s.ri3ted items and dataname)1 and dataname)2 are :or-ing storage items t(at are not su%s.ri3ted6 Com3are t(e item to %e sear.(ed :it( t(e item at t(e .enter6 $5 it mat.(es 5ine< else re3eat t(e 3ro.ess :it( t(e le5t or rig(t (al5 de3ending on :(ere t(e item lies6 Sl Se;uential S* 9CE Binar4 S* 9CE P 1 S* 9CE S* 9CE LL 2 Ta%le s(ould (a+e $2'*F6 Ta%le s(ould (a+e $2'*F6 Ta%le need not %e in Ta%le s(ould %e in sorted order o5 t(e sear.(ing argument6 T(ere 3 SO9T*' order6 s(ould %e SC*2'$280'*SC*2'$28 Clause6 7ulti3le @E*2 4 Onl4 one @E*2 .ondition .an %e .oded6 .onditions .an %e .oded6 n4 logi.al .om3arison is 5 Onl4 1 is 3ossi%le6 Onl4 2' is 3ossi%le in .om3ound .onditions6 3ossi%le6 $ndeC s(ould %e set to 1 6 $ndeC need not %e set to 1 %e5ore S* 9CE LL6 %e5ore using S* 9CE /re5er :(en t(e ta%le siDe 7 /re5er :(en t(e ta%le siDe is signi5i.antl4 large6 is small Mu$ i Dimension#$ Arr#ys COBOL74 su33orts arra4 o5 maCimum o5 t(ree dimensions :(ereas COBOL#5 su33orts u3 to se+en dimensions6 T(e lo:est) le+el OCCU9S data)name or an item su%ordinate to it is used to a..ess an entr4 in t(e arra4 or t(e ta%le6 $5 :e use S* 9CE 5or a..essing multi)dimension ta%le< t(en $2'*F*' B? must %e used on all OCCU9S le+els6 *C3anded nested 3er5orm is a+aila%le 5or 3ro.essing multi le+el ta%les6 T(e s4ntaC o5 t(is 3er5orm is gi+en %elo:B /*9FO97 3ara)1 t(ru 3ara)n = 9?$28 indeC)1 5rom 1 B? 1 U2T$L indeC)1 N siDe) o5) outer) o..urs FT*9 = 9?$28 indeC)2 5rom 1 %4 1 until indeC)2 N siDe o5 inner o..urs6

24

S* 9CE eCam3le 5or multi le+el ta%lesB

&1 &5

77

*7/)T BL*6 '*/T2U7B*9 OCCU9S 1& T$7*S $2'*F*' B? $16 1& *7/)'*T $L OCCU9S 5& T$7*S $2'*F*' B? $26 15 *7/)2U7B*9 /$C 9G&4H6 15 *7/)S L 9? /$C 9G&5H6 *7/2U7B*9)$2 /$C 9G&4H = LU* Q2&52Q6

/*9FO97 1&&)S* 9CE)*7/)S L = 9?$28 $1 F9O7 1 B? 1 U2T$L $1 N 1& O9 @S)FOU2' 1&&)S* 9CE)*7/)S L6 S*T $2 TO $6 S* 9CE *7/)'*T $L T *2' '$S/L ? Q2OT FOU2'Q6 11 N Lo:est O..urs @E*2 *7/2U7B*9)$2 1 *7/)2U7B*9G$1<$2H6 '$S/L ? QS L 9? $SBQ *7/)S L 9?G$1<$2H6 S*T @S)FOU2' TO T9U*6 11 N Sear.( ends *2')S* 9CE6 NESTED !RO0RAMS- 0+O,A+- EXTERNA+ One 3rogram ma4 .ontain ot(er 3rogramGsH6 T(e .ontained 3rogramGsH ma4 t(emsel+es .ontain 4et ot(er 3rogramGsH6 ll t(e .ontained and .ontaining 3rograms s(ould end :it( *2' /9O89 7 statement6 /87B is nested a 3rogram in t(e eCam3le %elo:B $'*2T$F$C T$O2 '$=$S$O26 *Cam3leB /9O89 7)$'6 /87 66666 $'*2T$F$C T$O2 '$=$S$O26 /9O89 7)$'6 /87B 66666 *2' /9O89 7 /87B6 6666 *2' /9O89 7 /87 6 $5 4ou :ant a..ess an4 :or-ing storage +aria%le o5 /87 in /87B< t(en de.lare t(em :it( t(e .lause Q$S 8LOB LQ in /87 6 $5 4ou :ant to a..ess an4 :or-ing storage +aria%le o5 /87B in /87 < de.lare t(em :it( t(e .lause Q$S *FT*92 LQ in /87B6 2ested /rograms are su33orted onl4 in COBOL#56 $5 t(ere is a 3rogram /87C inside /87B< it .annot %e .alled 5rom /87 unless itQs 3rogram id is ;uali5ied :it( -e4:ord CO77O26 SORT #nd MER0E T(e 3rogramming SO9T is .alled as internal sort :(ereas t(e sort in JCL is .alled eCternal sort6 $5 4ou :ant to mani3ulate t(e data %e5ore 5eeding to sort< 3re5er internal sort6 $n all ot(er .ases<

25

eCternal sort is t(e good .(oi.e6 $nternal sort< in turn in+o-es t(e SO9T 3rodu.t o5 4our installation6 G'FSO9TH6 $n t(e run JCL< allo.ate at least t(ree sort :or- 5iles6 GSO9T)@>nn 1N nn .an %e &&)99H6 F STS9T .om3iler o3tion ma-es t(e 'FSO9T to do all 5ile $)O o3eration t(an 4our COBOL 3rogram6 $t :ould signi5i.antl4 im3ro+e t(e 3er5orman.e6 T(e result o5 t(e SO9T .an %e .(e.-ed in SO9T)9*TU92 register6 $5 t(e sort is su..ess5ul< t(e +alue :ill %e & else 166 Syn #x2 SO9T SO9TF$L* O2 SC*2'$28 0'*SC*2'$28 >*? sd)-e4)1 sd)-e42 US$28 5ile1 5ile2 0 $2/UT /9OC*'U9* $S se.tion)1 8$=$28 5ile3 0 OUT/UT /9OC*'U9* is se.tion)2 *2')SO9T File1< File2 are to)%e)sorted in3ut 5iles and File3 is sorted)out3ut 5ile and all o5 t(em are de5ined in F'6SO9TF$L* is 'is- SO9T @or- 5ile t(at is de5ined at S'6 $t s(ould not %e eC3li.itl4 o3ened or .losed6 $2/UT /9OC*'U9* and US$28 are mutuall4 eC.lusi+e6 $5 US$28 is used< t(en 5ile1 and 5iles s(ould not %e o3ened or 9* ' eC3li.itl46 $5 $2/UT /9OC*'U9* is used t(en File1 and 5ile2 need to %e O/*2ed and 9* ' t(e re.ords one %4 one until end o5 t(e 5ile and 3ass t(e re;uired re.ords to sort):or-)5ile using t(e .ommand 9*L* S*6 Syn #x2 9*L* S* sort):or-)re.ord 5rom in3ut)5ile)re.ord6 OUT/UT /ro.edure and 8$=$28 are mutuall4 eC.lusi+e6 $5 8$=$28 is used< t(en 5ile3 s(ould not %e o3ened or @9$T* eC3li.itl46 $5 OUT/UT 3ro.edure is used< t(en File3 s(ould %e O/*2ed and t(e re;uired re.ords 5rom sort :or- 5ile s(ould %e 9*TU92ed to it6 On.e T *2' is rea.(ed 5or sort):or-)5ile< .lose t(e out3ut 5ile6 Syn #x2 9*TU92 sort):or-)5ile)name T *2' im3erati+e statement6 INP&T PROCE!&RE s O&TP&T PROCE!&RE Sometimes it :ould %e more e55i.ient to 3ro.ess data %e5ore it is sorted< :(ereas ot(er times it is more e55i.ient to 3ro.ess a5ter it is sorted6 $5 :e intend to eliminate more re.ords< t(en it :ould %e %etter 3re3ro.ess t(em %e5ore 5eeding to SO9T6 $5 :e :ant to eliminate all t(e re.ords (a+ing s3a.es in t(e -e4 5ield t(en it :ould %e e55i.ient i5 :e eliminate t(em a5ter sorting6 Be.ause t(e re.ords :it( %lan- -e4 .omes 5irst a5ter sorting6 MER0E $t is same as sort6 US$28 is mandator46 T(ere s(ould %e minimum t:o 5iles in US$286 7*98* Sort):or-)5ile O2 SC*2'$28 >*? dataname1 dataname2 US$28 5ile1 5ile2

26

8$=$28 5ile3 0 OUT/UT /9OC*'U9* is se.tion)1 *2')7*98* !ro"r#m sor re"is ers (#nd i s e6ui&#$en D.SORT p#r#me er7me#nin") SO9T)F$L*)S$I* GF$LSIH< SO9T)CO9*)S$I* G9*S$2=H< SO9T)7S8G7S8''2H SO9T)7O'*)S$I* GS7S1nnnnnH SO9T)9*TU92Greturn).ode o5 sortH and SO9T)CO2T9OL G2ames t(e 5ile o5 .ontrol .ard ) de5ault is $8IS9TC'H STRIN, M#NIP&L#TION string re5ers to a se;uen.e o5 .(ara.ters6 String mani3ulation o3erations in.lude 5inding a 3arti.ular .(ara.ter0su%)string in a string< re3la.ing 3arti.ular .(ara.ter0su%)string in a string< .on.atenating strings and segmenting strings6 ll t(ese 5un.tions are (andled %4 t(ree +er%s $2S/*CT< ST9$28 and U2ST9$28 in COBOL6 *F 7$2* is t(e o%solete +ersion o5 $2S/*CT su33orted in COBOL746 INSPECT- FOR CO&NTIN, $t is used to tall4 t(e o..urren.e o5 a single .(ara.ter or grou3s o5 .(ara.ters in a data 5ield6 $2S/*CT identi5ier)1 T LL?$28 identi5ier)2 FO9 LL0L* '$28 literal)1Uidenti5ier)3 XB*FO9*U FT*9 $2$T$ L identi5ier)4Uliteral)2Y ) O3tional6 $2S/*CT identi5ier)1 T LL?$28 identi5ier)2 FO9 CE 9 CT*9S XB*FO9*U FT*9 $2$T$ L identi5ier)4Uliteral)2Y ) O3tional6 7ain String is identi5ier)1 and .ount is stored in identi5ier)26 Literal)1 or $denti5ier)3 is a .(ara.ter or grou3)o5).(ara.ters 4ou are loo-ing in t(e main)string6 $2S/*CT 5urt(er ;uali5ies t(e sear.( :it( B*FO9* and FT*9 o5 t(e initial o..urren.e o5 identi5ier)4 or literal)26 *Cam3leB @S)2 7* ) Q7UTEU S 9 = 2 SU9? CE 2'9 '*=$Q $2S/*CT @S)2 7* T LL?$28 @S)COU2T LL QSQ B*FO9* $2$T$ L QS 9 = 2 Q FT*9 $2$T$ L QCE 2'9 Q *2')$2S/*CT 9esultB @S)COU2T .ontains ) 1 INSPECT- FOR REPL#CIN, $t is used to re3la.e t(e o..urren.e o5 a single .(ara.ter or grou3s o5 .(ara.ters in a data 5ield6 $2S/*CT identi5ier)1 9*/L C$28 LLUL* '$28 literal)1Uidenti5ier)2 B? identi5ier)3Uliteral)2 XB*FO9*U FT*9 $2$T$ L identi5ier)4Uliteral)2Y ) O3tional6 $2S/*CT identi5ier)1 9*/LC$28 CE 9 CT*9S B? identi5ier)2 B*FO9*U FT*9 $2$T$ L identi5ier)3Uliteral)1 $2S/*CT)FO9 COU2T$28 2' 9*/L C$28 $t is a .om%ination o5 t(e a%o+e t:o met(ods6 $2S/*CT identi5ier)1 T LL?$28 Gtall4ing 3art H 9*/L C$28 Gre3la.ing 3artH

27

STRIN0 ST9$28 .ommand is used to .on.atenate one or more strings6 Syn #x2 ST9$28 identi5ier)1 0 literal)1< identi5ier)20 literal)2 '*L$7$T*' B? Gidenti5ier)30literal) 30S$I*H $2TO identi5ier)4 *2')ST9$286 &1 = 91 /$C FG1&H = LU* Q7UTEU Q &1 = 92 /$C FG1&H = LU* QS 9 Q &1 = 92 /$C FG2&H6 To get dis3la4 Q7UTEU<S 9 Q ST9$28 = 91 '*L$7$T*' B? Q Q Q<Q '*L$7$T*' B? S$I* = 92 '*L$7$T*' B? Q Q $2TO = 93 *2')ST9$286 T(e re.ei+ing 5ield must %e an elementar4 data item :it( no editing s4m%ols and JUST 9$8ET .lause6 @it( ST9$28 statement< s3e.i5i. .(ara.ters o5 a string .an %e re3la.ed :(ereas 7O=* re3la.es t(e 5ull string6 &1 8*)OUT /$C FG12H = LU* Q12 ?* 9S OL'Q6 ST9$28 Q1#Q '*L$7$T*' B? S$I* $2TO 8*)OUT6 1N 1# ?* 9S OL'6

Re(eren%e Modi(i%# ion 8 e6ui&#$en o( SU,STR Q9e5eren.e modi5i.ationQ is used to retrie+e or o+er:rite a su%)string o5 a string6 QBQ is -no:n as re5eren.e modi5i.ation o3erator6 Syn #x2 String GStarting)/ositionBLengt(H 7O=* Q1#Q TO 8*)OUTG1B2H does t(e same as :(at :e did :it( ST9$28 .ommand6 @(en it is used in arra4 elements< t(e s4ntaC is rra4)element Go..urren.eH GStarting) /ositionBLengt(H UNSTRIN0 U2ST9$28 .ommand is used to s3lit one string to man4 strings6 Syn #x2 U2ST9$28 identi5ier)1 X'*L$7$T*' B? G LL0H identi5ier20literal1 X<O9 G LL0H Gidenti5ier) 30literal)2H<66YY $2TO identi5ier)4 X<'*L$7$T*9 $2 identi5ier)5< COU2T $2 identi5ier)6Y X<identi5ier)7 X<'*L$7$T*9 $2 identi5ier)#< COU2T $2 identi5ier)9Y &1 @S)' T /$C FG12H = LU* Q1&02&&03&&01Q6 U2ST9$28 @S)' T '*L$7$T*' B? Q0Q $2TO @S)FL'1 '*L$7$T*9 $2 @S)'1 COU2T $2 @S)C1 @S)FL'2 '*L$7$T*9 $2 @S)'2 COU2T $2 @S)C2

2#

@S)FL'3 '*L$7$T*9 $2 @S)'3 COU2T $2 @S)C3 *2')U2ST9$286 Resu$ 2 @S)FL'1 1 1& @S)FL'2 12&& @S)FL'313&& @S)C1 1 2 @S)C213 @S)C313 @S)'1 1 Q0Q @S)'21Q0Q @S)'3 1Q0Q O2 O=*9FLO@ .an %e .oded :it( ST9$28 and U2ST9$286 $5 t(ere is ST9$28 trun.ation t(en t(e im3erati+e statements 5ollo:ed O2 O=*9FLO@ :ill %e eCe.uted6 CO!4 S # emen CO/? statement is used to %ring a series o5 3re:ritten COBOL entries t(at (a+e %een stored in li%rar4< into a 3rogram6 16Common routines li-e error routine< date +alidation routine are .oded in a li%rar4 and %ring into t(e 3rogram %4 CO/?6 26 7aster 5iles are used in multi3le 3rograms6 T(eir la4out .an %e 3la.ed in one .o34%oo- and %e 3la.ed :(ere+er t(e 5iles are used6 $t 3romotes 3rogram standardiDation sin.e all t(e 3rograms s(are t(e same la4out and t(e same data names6 T(is redu.es .oding and de%ugging time6 C(ange in la4out needs .(ange in .o34%oo- onl46 $t is enoug( i5 :e Vust re.om3ile t(e 3rogram 5or ma-ing t(e ne: .o34 e55e.ti+e6 Syn #x2 CO/? .o34%oo-)name XGOF0$2H li%rar4 nameY X9*/L C$28 string)to)%e)re3la.ed B? re3la.ing)stringY Co34%oo-s are stored as mem%ers in /'S li%rar4 and during .om3ilation time< t(e4 are in.luded into t(e 3rogram6 B4 de5ault< t(e .o34%oo- li%rar4 is S?SL$B and it .an %e .(anged using $2 or OF o5 CO/? statement6 Co34%oo-s .an %e used in t(e 5ollo:ing 3aragra3(s6 SOU9C*)CO7/UT*9< OBJ*CT)CO7/UT*9< S/*C$ L)2 7*S< F$L*)CO2T9OL< $O) CO2T9OL< F' S*CT$O2< / 9 89 /ES $2 /9OC*'U9* '$=$S$O26 $5 t(e same .o34%oo- is used more t(an on.e in t(e 3rogram< t(en t(ere :ill %e Adu3li.ate data de.larationA error during .om3ilation< as all t(e 5ields are de.lared t:i.e6 $n t(is .ase< one .o34%oo- .an %e used :it( 9*/L C$28 +er% to re3la.e (ig()le+el ;uali5ier o5 t(e all t(e +aria%les :it( anot(er ;uali5ier6 Ex#mp$e2 CO/? CUSTO7*9 9*/L C$28 QCUST1)Q B? QCUST2)Q6 'elimiter Q1 1Q s(ould %e used 5or re3la.ing 3seudo teCts6 T(e re3la.ing o3tion does not alter t(e 3re:ritten entries in t(e li%rar4M t(e .(anges are made to t(e userQs sour.e 3rogram onl46 CA++ s # emen (Su)8!ro"r#ms) @(en a s3e.i5i. 5un.tionalit4 need to %e 3er5ormed in more t(an one 3rogram< it is %est to :rite t(em se3aratel4 and .all t(em into ea.( 3rogram6 Su% /rograms .an %e :ritten in an4

29

3rogramming language6 T(e4 are t43i.all4 :ritten in a language %est suited to t(e s3e.i5i. tasre;uired and t(us 3ro+ide greater 5leCi%ilit46 Main Program Changes4 C LL statement is used 5or eCe.uting t(e su%)3rogram 5rom t(e main 3rogram6 sam3le o5 C LL statement is gi+en %elo:B C LL Q/872Q US$28 B? 9*F*9*2C* @S)= 91< B? CO2T*2T @S)= 926 /872 is .alled (ere6 @S)= 91 and @S)= 92 are :or-ing storage items6 @S)= 91 is 3assed %4 re5eren.e6 @S)= 92 is 3assed %4 Content6 B? 9*F*9*2C* is de5ault in COBOL and need not %e .oded6 B? CO2T*2T L*28TE 3(rase 3ermits t(e lengt( o5 data item to %e 3assed to a .alled 3rogram6 Su1-Program Changes4 @S)= 91 and @S)= 92 are :or-ing storage items o5 main 3rogram6 s :e (a+e alread4 mentioned< t(e lin-age se.tion is used 5or a..essing eCternal elements6 s t(ese :or-ing storage items are o:ned %4 main 3rogram< to a..ess t(em in t(e su%)3rogram< :e need to de5ine t(em in t(e lin-age se.tion6 L$2> 8* S*CT$O26 &1 L$2> 8* S*CT$O26 &5 L>)= 91 /$C 9G&4H6 &5 L>)= 92 /$C 9G&4H6

$n addition to de5ine t(em in lin-age se.tion< t(e 3ro.edure di+ision s(ould %e .oded :it( t(ese data items 5or address)a%ilit46 /9OC*'U9* '$=$S$O2 US$28 L>)= 91<L>)= 92 T(ere is a one)one .orres3onden.e %et:een 3assed elements and re.ei+ed elements GCall using< lin-age and 3ro.edure di+ision usingH B? /OS$T$O26 T(is im3lies t(at t(e name o5 t(e identi5iers in t(e .alled and .alling 3rogram need not %e t(e same G@S)= 91 R L>)= 91H %ut t(e num%er o5 elements and 3i.ture .lause s(ould %e same6 T(e last statement o5 4our su%)3rogram s(ould %e *F$T /9O89 76 T(is returns t(e .ontrol %a.- to main 3rogram6 8OB C> .an also %e .oded instead o5 *F$T /9O89 7 %ut not STO/ 9U26 *F$T /9O89 7 s(ould %e t(e onl4 statement in a 3aragra3( in COBOL74 :(ereas it .an %e .oded along :it( ot(er statements in a 3aragra3( in COBOL#56 /9O89 7)$'6 $S $2$T$ L /9O89 76 $5 $S $2$T$ L /9O89 7 is .oded along :it( 3rogram)id o5 su% 3rogram< t(en t(e 3rogram :ill %e in initial stage e+er4 time it is .alled GCOBOL#5 5eatureH6 lternati+el4 C 2C*L issued a5ter C LL< :ill set t(e su%)3rogram to initial state6 $5 t(e su% 3rogram is modi5ied t(en it needs to %e re.om3iled6 T(e need 5or main 3rogram re.om3ilation is de.ided %4 t(e .om3iler o3tion used 5or t(e main 3rogram6 $5 t(e '?2 7 .om3iler is used< t(en t(ere is no need to re.om3ile t(e main 3rogram6 T(e modi5ied su%routine :ill %e in e55e.t during t(e run6 2O'?2 7 is de5ault t(at eC3e.ts t(e main 3rogram re.om3ilation6

3&

'i55eren.e %et:een /ass)%4)re5eren.e and /ass)%4).ontent

Sl /assl B4 9e5eren.e P C LL Qsu%1Q US$28 B? 9*F*9*2C* 1 @S)= 91 $t is de5ault in COBOL6 B? 2 9*F*9*2C* is not needed6 3 ddress o5 @S)= 91 is 3assed T(e su%)3rogram modi5i.ations on t(e 4 3assed elements are +isi%le in t(e main 3rogram6

/ass B4 Content C LL Qsu%1Q US$28 B? CO2T*2T @S)= 91 GB? CO2T*2T -e4:ord is neededH B? CO2T*2T -e4 :ord is mandator4 to 3ass an element %4 +alue6 =alue o5 @S)= 91 is 3assed T(e su%)3rogram modi5i.ations on t(e 3assed elements are lo.al to t(at su%)3rogram and not +isi%le in t(e main 3rogram6

'i55eren.e %et:een Stati. Call and '4nami. Call Sl ST T$C Call P 1 $denti5ied %4 Call literal6 *CB C LL Q/871Q6 '?2 7$C Call

3 4 5 6 7 #

$denti5ied %4 Call +aria%le and t(e +aria%le s(ould %e 3o3ulated at run time6 &1 @S)/87 /$C FG&#H6 7o+e Q/871Q to @S)/87 C LL @S)/87 $5 4ou :ant .on+ert t(e literal .alls into '?2 7$C< 'e5ault Com3iler o3tion is 2O'?2 7 t(e 3rogram s(ould %e .om3iled :it( '?2 7 and so all t(e literal .alls are .onsidered o3tion6 B4 de5ault< .all +aria%les and an4 un)resol+ed as stati. .alls6 .alls are .onsidered as d4nami.6 $5 t(e su%3rogram undergoes .(ange< su% $5 t(e su%3rogram undergoes .(ange< re.om3ilation 3rogram and main 3rogram need to %e o5 su%3rogram is enoug(6 re.om3iled6 Su% modules are lin- edited :it( main Su% modules are 3i.-ed u3 during run time 5rom t(e module6 load li%rar46 SiDe o5 load module :ill %e large SiDe o5 load module :ill %e less6 Fast Slo: .om3ared to Stati. .all6 Less 5leCi%le6 7ore 5leCi%le6 Su%)3rogram :ill not %e in initial stage t(e neCt time it is .alled unless 4ou /rogram :ill %e in initial state e+er4 time it is .alled6 eC3li.itl4 use $2$T$ L or 4ou do a C 2C*L a5ter ea.( .all6

$2T9$2S$C FU2CT$O2SB L*28TE 7 F 7$2 2U7= L 2U7= L)C 9eturns t(e lengt( o5 t(e /$C .lause6 Used 5or 5inding lengt( o5 grou3 item t(at s3anned a.ross multi3le le+els6 B) 9eturns t(e .ontent o5 t(e argument t(at .ontains t(e maCimum +alue B) 9eturns t(e .ontent o5 t(e argument t(at .ontains t(e minimum +alue 9eturns t(e numeri. +alue re3resented %4 an al3(anumeri. .(ara.ter string B) s3e.i5ied in t(e argument6 Same as 2U7= L %ut .urren.4 and de.imal 3oints are ignored during B) .on+ersion6 B)

31

CU99*2T ' T* $2T*8*9 OF ' T* $2T*8*9 OF ' ? ' T* OF $2T*8*9 ' ? OF $2T*8*9

B) 9eturns 21 C(ars al3(anumeri. +alue , ????77''EE77SSnnnnnn B) 9eturns $2T*8*9 e;ui+alent o5 8regorian date 3assed6 B) 9eturns $2T*8*9 e;ui+alent o5 Julian date 3assed6 B) 9eturns 8regorian date 5or t(e integer 3assed6 B) 9eturns Julian date 5or t(e integer 3assed6

2oteB FU2CT$O2 $2T*8*9 OF ' T* G&1)&1)16&1H returns 16 .I+E 'AND+IN0 data 5ile is .olle.tion o5 rele+ant re.ords and a re.ord is .olle.tion o5 rele+ant 5ields6 T(e 5ile (andling in COBOL 3rogram in+ol+es 5i+e ste3s6 Ste5s in 2ile-handing 16 llo.ationB T(e 5iles used in t(e 3rogram s(ould %e de.lared in F$L*)CO2T9OL 3aragra3( o5 en+ironment di+ision6 T(e ma33ing :it( JCL ''2 7* is done (ere6 T(e 5ile is allo.ated to 4our 3rogram %4 t(is statement6 26'e5inition6 T(e la4out o5 t(e 5ile and its attri%utes are de5ined in t(e F$L* S*CT$O2 o5 ' T '$=$S$O26 36O3enB 'ataset is .onne.ted0readied to 4our 3rogram using O/*2 statement6 T(e mode o5 O/*2 de.ides t(e o3eration allo:ed and t(e initial 3ointer in t(e dataset6 For eCam3le< *FT*2' mode allo:s onl4 :rite a..ess and t(e 3ointer is -e3t on t(e end o5 5ile to a33end6 46/ro.essB /ro.ess t(e 5ile as 3er re;uirement< using t(e $)O statements 3ro+ided %4 COBOL6 G9* '< @9$T*< 9*@9$T* and '*L*T*H 56 CloseB 5ter t(e 3ro.essing< .lose t(e 5ile to dis.onne.t it 5rom t(e 3rogram6 #llocation o2 2ile - SELECT Statement G*2=$9O27*2T)N $2/UT)OUT/UT)N F$L*)CO2T9OLH S*L*CT XO/T$O2 LY F$L*2 7* SS$82 to ''2 7* O98 2$I T$O2 $S S*!U*2T$ L0$2'*F*'09*L T$=* CC*SS $S S*!U2*T$ L09 2'O70'?2 7$C 9*CO9' >*? $S F$L*)>*?1 9*L T$=* >*? $S @S)992 LT*92 9* 9*CO9' >*? $S F$L*)>*?2 @$TE 'U/L$C T*S LT*92 9* 9*CO9' >*? $S F$L*)>*?3 @$TEOUT 'U/L$C T*S F$L* ST TUS $S @S)F$L*)ST T1 X<@S)F$L*)ST T2Y B) LL Files B) LL Files B) LL Files B) >S'S B) 99'S B) >S'S B) $F B) LL Files B) =S 7 Files

32

SE+ECT S # emen 8 O!TIONA+ C$#use T(is .an %e .oded onl4 5or in3ut 5iles6 $5 O/T$O2 L is not .oded< t(en t(e in3ut 5ile is eC3e.ted to 3resent in JCL6 $5 not< an eCe.ution error :ill o..ur6 $5 O/T$O2 L is .oded< t(en i5 t(e 5ile is not ma33ed in JCL< it is .onsidered as em3t4 5ile and t(e 5irst read results end o5 5ile6 T(e 5ile .an also %e d4nami.all4 allo.ated instead o5 stati. allo.ation in JCL6 SE+ECT S # emen 8 ASSI0N TO F$L*2 7* is t(e logi.al name used inside t(e 3rogram and ''2 7* is t(e logi.al name in t(e JCL< ma33ed :it( 3(4si.al dataset6 ''2 7* .an %e 3re5iCed :it( QS)Q to indi.ate !S 7 5ile< Q) SQ to indi.ate *S'S 5ile and :it( no 3re5iC to indi.ate >S'S099'S 5ile6 JCL Ste3 eCe.uting t(e 3rogram s(ould (a+e a dataset :it( ''2 7* as la%el 00''2 7* '' 'S21B/7 $26*7/LO?**6' T < '$S/1SE9

SE+ECT S # emen 8OR0ANI3ATION $t .an %e S*!U*2T$ L G/S or =S 7 *S'SH< $2'*F*' G=S 7 >S'SH< 9*L T$=* G=S 7 99'SH6 'e5ault is Se;uential6 SE+ECT S # emen 8ACCESS MODE SE%&ENTI#L. $t is de5ault a..ess mode and it is used to a..ess t(e re.ords O2L? in se;uential order6 To read 1&&t( re.ord< 5irst 99 re.ords need to %e read and s-i33ed6 R#N!OM. 9e.ords .an %e randoml4 a..essed in t(e 3rogram using t(e 3rimar40alternate -e4 o5 indeCed 5ile organiDation or relati+e re.ord num%er o5 relati+e organiDation61&&t( re.ord .an dire.tl4 %e read a5ter getting t(e address o5 t(e re.ord 5rom t(e $2'*F 3art 5or $2'*F*' 5iles61&&t( re.ord .an dire.tl4 %e read 5or 9*L T$=* 5iles e+en :it(out an4 indeC6 !'N#MIC. $t is miCed a..ess mode :(ere t(e 5ile .an %e a..essed in random as :ell as se;uential mode in t(e 3rogram6 *Cam3leB 9eading t(e details o5 all t(e em3lo4ees %et:een 1&&&)2&&&6 First randoml4 a..ess 1&&&t( em3lo4ee re.ord< t(en read se;uentiall4 till 2&&&t( em3lo4ee re.ord6 ST 9T and 9* ' 2*FT .ommands are used 5or t(is 3ur3ose in t(e 3ro.edure di+ision6 SE+ECT S # emen 8RECORD 1E4 IS $t is 3rimar4 -e4 o5 =S 7 >S'S 5ile6 $t s(ould %e uni;ue and 3art o5 indeCed re.ord stru.ture6

33

SE+ECT S # emen 8A+TERNATE RECORD 1E4 IS T(is 3(rase is used 5or >S'S 5iles de5ined :it( $F6 dd t(e .lause @$TE 'U/L$C T*S i5 t(e $F is de5ined :it( du3li.ates6 9e5erring to =S 7 %asi.s< e+er4 alternate indeC re.ord (as an asso.iated / TE and t(e 3at( s(ould %e allo.ated in t(e JCL t(at in+o-es t(is 3rogram6 T(e ''2 7* o5 t(e 3at( s(ould %e ''2 7* o5 t(e %ase .luster su55iCed :it( 1 5or t(e 5irst alternate re.ord .lause< su55iCed :it( n 5or nt( LT*92 T* 9*CO9' >*? .lause in S*L*CT .lause6 SE+ECT S # emen 8.I+E STATUS IS 9S8.I+E8STAT:-9S8.I+E8STAT; @S)F$L*)ST T1 s(ould %e de5ined as /$C FG&2H in :or-ing storage se.tion6 5ter e+er4 5ile o3eration< t(e 5ile status s(ould %e .(e.-ed 5or allo:a%le +alues6 @S)F$L*)ST T2 .an %e .oded 5or =S 7 5iles to get t(e =S 7 return .ode G2 %4tesH< =S 7 5un.tion).ode G1 %4teH and =S 7 5eed%a.- .ode G3 %4tesH6 T(is is a 6) %4te 5ield in :or-ing storage6 RESERVE C$#use. 9*S*9=* .lause X9*S*9=* integer 9* Y .an %e .oded in t(e S*L*CT statement6 T(e num%er o5 %u55ers to %e allo.ated 5or t(e 5ile is .oded (ere6 B4 de5ault t:o %u55ers :ill %e allo.ated i5 t(e .lause is not .oded6 Sin.e similar o3tion is a+aila%le in JCL< t(is is not .oded in 3rogram6 9*S*9=* 1 9* allo.ates one %u55er< 5or t(e 5ile in t(e S*L*CT statement6 'e5ining t(e 5ile in F$L* S*CT$O2 ) F' F' F$L*2 7* 9*CO9'$28 7O'* $S =0=B0F0FB 9*CO9' CO2T $2S 7 CE 9 CT*9S GTO 2 CE 9 CT*9SH BLOC> CO2T $2S F CE 9 CT*9S09*CO9'S GTO ? CE 9 CT*9S09*CO9'SH L B*L 9*CO9'S 9* O7$TT*'0ST 2' 9' ' T 9*CO9' $S F$L*)9*CO9'6 &1 F$L*)9*CO9' /$C FGnnnH6 F!-RECOR! CONT#INS $t s3e.i5ies t(e lengt( o5 t(e re.ord in terms o5 %4tes6 G$t :ill %e 9*CO9' .ontains m to n CE 9 CT*9S 5or +aria%le 5ormat 5ilesH F!--LOC( CONT#INS $t s3e.i5ies t(e 3(4si.al re.ord siDe6 $t .an %e mentioned as num%er o5 logi.al re.ords O9 num%er o5 .(ara.ters< t(at is multi3le o5 logi.al re.ord lengt(6 $t is suggested to .ode BLOC> CO2T $2S & 9*CO9'S so t(at s4stem :ill de.ide t(e o3timum siDe 5or t(e 5ile %ased on t(e de+i.e used 5or storing t(e 5ile6 BLOC> CO2T $2S .lause is treated as .omments 5or =S 7 5iles6

34

Ad&#n #"e o( ,$o%<in"2 16$)O time is redu.ed as n num%ers o5 re.ords are read into main memor4 %u55er during an $)O6 26$nter re.ord ga3 is remo+ed and t(e ga3 eCist onl4 %et:een %lo.-s6 So memor4 :astage due to $98 is a+oided6 F!-RECOR!IN, MO!E IS $t .an %e F GF$F*'H =G= 9$ BL*H FBGF$F*' BLOC>H =BG= 9$ BL* BLOC>*'H V#ri#)$e re%ord (i$e iden i(i%# ion2 $5 t(ere is no re.ording mode0re.ord .ontains .lause< it is still 3ossi%le to identi54 +aria%le lengt( re.ords6 $5 t(ere is an OCCU9S de3ending on .lause or t(ere are multi3le &1 le+els and e+er4 &1 le+el is o5 di55erent siDe< t(en t(e 5ile :ould %e o5 +aria%le lengt(6 7ulti3le &1 le+el in File se.tion is an eCam3le 5or im3li.it rede5inition6 F!-L#-EL RECOR!S Clause s a general rule< L B*L 9*CO9'S are ST 2' 9' is .oded 5or 'is- and Ta3e 5iles< L B*L 9*CO9'S 9* O7$TT*' is .oded 5or 3rinter 5iles6 $n COBOL74< t(is .lause is a mandator4 .lause :(ereas COBOL#5 made t(is as o3tional6 F!-!#T# RECOR! IS Clause $t is used to name t(e data re.ordGsH o5 t(e 5ile6 7ore t(an one re.ord .an %e .oded (ere6 OPEN ST#TEMENT Syn #x2 O/*2 O/*27O'* F$L*2 7* O/*27O'* .an %e $2/UT OUT/UT $)O *FT*2'

$2/UT OUT/UT $)O *FT*2'

B) File .an %e used O2L?)FO9)9* ' 3ur3ose6 B) File .an %e used O2L?)FO9)@9$T* 3ur3ose6 B) File .an %e used FO9 9* '< @9$T* and 9*@9$T* 3ur3ose6 B) File .an %e used FO9 a33ending re.ords using @9$T*6

C+OSE s # emen . T(e used 5iles are .losed using CLOS* statement6 $5 4ou donQt .lose t(e 5iles< t(e .om3letion o5 t(e 3rogram .loses all t(e 5iles used in t(e 3rogram6 Syn #x2

35

CLOS* F$L*2 7* O!EN #nd C+OSE (or TA!E (i$es 8 Ad&#n%ed $5 more t(an one 5ile is stored in a reel o5 ta3e< it is .alled as multi)5ile +olume6 @(en one 5ile is stored in more t(an one reel o5 ta3e< it is .alled as multi)+olume la%el6 One reel is -no:n as one +olume6 @(en t(e end o5 one +olume is rea.(ed< automati.all4 t(e neCt +olume o3ens6 So t(ere is no s3e.ial .ontrol is needed 5or multi +olume 5iles6 O/*2 $2/UT 5ile)1 O/*2 OUT/UT 5ile)2 CLOS* 5ile)3 CLOS* 5ile)3 X@$TE 2O 9*@$2' U 9*=*9S*'Y X@$TE 2O 9*@$2'Y XS9**LUU2$TT X@$TE 2O 9*@$2'U FO9 9*7O= LY X@$TE 2O 9*@$2'ULOC>Y

UNIT #nd REE+ #re synonyms. 5ter o3ening a T /* 5ile< t(e 5ile is 3ositioned at its %eginning6 @(en o3ening t(e 5ile i5 t(e .lause 9*=*9S*' is .oded< t(en t(e 5ile .an %e read in t(e 9*=*9*S* dire.tion6 G/ro+ided (ard:are su33orts t(is 5eatureH @(en 4ou .lose t(e 5ile< t(e ta3e is normall4 re:ound6 T(e 2O 9*@$2' .lause s3e.i5ies t(at t(e T /* s(ould %e le5t in its .urrent 3osition6 CLOS* statement :it( 9**L o3tion .loses t(e .urrent reel alone6 So t(e neCt 9* ' :ill get t(e 5irst re.ord o5 neCt 9**L6 T(is :ill %e use5ul :(en 4ou :ant s-i3 all t(e re.ords in t(e 5irst reel a5ter n num%er o5 re.ords 3ro.essing6 Sin.e T /* is se;uential de+i.e< i5 4ou .reate multi3le 5iles in t(e same T /*< t(en %e5ore o3ening t(e se.ond 5ile< 5irst 5ile s(ould %e .losed6 t an4 3oint o5 time< 4ou .an (a+e onl4 one 5ile is a.ti+e in t(e 3rogram6 $n addition to t(is< 4ou (a+e to .ode 7ULT$/L* F$L* .lause in t(e $)O .ontrol 3aragra3( o5 en+ironment di+ision6 7ULT$/L* F$L* T /* CO2T $2S OUT)F$L*1 /OS$T$O2 1 OUT)F$L*3 /OS$T$O2 36 T(e 5iles OUT)F$L*1 and OUT)F$L*3 used in t(e 3rogram are 3art o5 a same T /* and t(e4 eCist in 5irst and t(ird 3osition in t(e ta3e6 lternati+el4< t(is in5ormation .an %e 3assed 5rom JCL using L B*L 3arameter6 READ s # emen 9* ' statement is used to read t(e re.ord 5rom t(e 5ile6 Syn #x2 9* ' F$L*2 7* X$2TO :s)re.ordY X>*? $S F$L*)>*?1Y X T *2'0$2= L$' >*? im3erati+e statement1Y X2OT T *2'02OT $2= L$' >*? im3erati+e statement2Y *2')9* ' $5 $2TO .lause is .oded< t(en t(e 5ile is dire.tl4 read into :or-ing storage se.tion re.ord6 $t is 3re5erred as it a+oids anot(er mo+e o5 5ile)se.tion)re.ord to :or-ing)storage)re.ord 5ollo:ed %4 sim3le 9* '6 9* ')$2TO is not 3re5erred 5or +aria%le siDe re.ords :(ere t(e lengt( o5 t(e

36

re.ord %eing read is not -no:n6 >*? $S .lause is used :(ile a..essing a re.ord randoml4 using 3rimar40alternate re.ord -e46 T *2' and 2OT T *2' are used during se;uential 9* ' o5 t(e 5ile6 $2= L$' >*? and 2OT $2= L$' >*? are used during random read o5 t(e 5ile6 Be5ore a..essing t(e 5ile randoml4< t(e -e4 5ield s(ould (a+e a +alue %e5ore 9* '6 9RITE S # emen @rite statement is used to :rite a ne: re.ord in t(e 5ile6 $5 t(e 5ile is o3ened in *FT*2' mode< t(e re.ord :ill %e a33ended6 $5 t(e 5ile is o3ened in OUT/UT mode< t(e re.ord :ill %e added at t(e .urrent 3osition6

Syn #x2 @9$T* F$L*)9*CO9' XF9O7 :s)re.ordY X$2= L$' >*? im3erati+e statement1Y *2')@9$T* F9O7 .lause a+oids t(e eC3li.it mo+e o5 :or-ing storage re.ord to 5ile se.tion re.ord %e5ore @9$T*6 RE9RITE S # emen 9*@9$T* is used to u3date an alread4 read re.ord6 To u3date a re.ord in a 5ile< t(e 5ile s(ould %e o3ened in $)O mode6 Syn #x2 9*@9$T* F$L*)9*CO9' XF9O7 :s)re.ordY X$2= L$' >*? im3erati+e statement1Y *2')9*@9$T* START S # emen ST 9T is used :it( d4nami. a..ess mode o5 indeCed 5iles6 $t esta%lis(es t(e .urrent lo.ation in t(e .luster 5or 9* ' 2*FT statement6 ST 9T itsel5 does not retrie+e an4 re.ord6 Syn #x2 ST 9T F$L*2 7* >*? is *!U L TO02OT L*SS TE 2089* T*9 TE 2 -e4)name X$2= L$' >*? im3erati+e statement1Y *2')ST 9T6

37

DE+ETE S # emen '*L*T* is used to delete t(e most re.entl4 read re.ord in t(e 5ile6 To delete a re.ord< t(e 5ile s(ould %e o3ened in $)O mode6 Syn #x2 '*L*T* F$L*2 7* 9*CO9' X$2= L$' >*? im3erati+e statement1Y *2')'*L*T*6 .i$e Error 8 '#nd$in" T(ere are .(an.es 5or 5ailure o5 an4 5ile $)O 3ro.essing6 T(e 5ailure o5 an $)O o3eration .an %e a..e3ted or .annot %e tolerated6 T(e se+erit4 o5 5ailure (as to %e de5ined in t(e 3rogram design stage6 Let us assume t(at :e donQt (a+e an4 error (andling in our 3rogram6 $n t(is .ase< 5or eCam3le< i5 4ou donQt (a+e a s3e.i5i. re.ord in t(e 5ile< t(e random read o5 t(at re.ord :ould immediatel4 terminate t(e 3rogram :it( error Qre.ord not 5oundQ6 Error )andling Clauses Pro/ided 1+ CO-OL. T(e sudden termination .an %e a+oided %4 (andling t(is error< :it( $2= L$' >*? .lause o5 9* '6 Based on t(e im3ortan.e o5 t(e re.ord and %usiness rule< :e .an .ontinue our 3rogram :it( neCt re.ord or terminate t(e 3rogram 3ro3erl46 T *2' is anot(er error (andling .lause 3ro+ided %4 COBOL6 But t(ere is no :a4 to (andle all su.( errors in t(is :a46 #ssign 2ile-status and ta3e the res5onsi1ilit+. T(e se.ond met(od is< assigning 5ile)status to t(e 5ile in t(e S*L*CT .lause and .(e.-s t(e 5ile status a5ter ea.( and e+er4 $)O and ensures t(at t(e +alue o5 status .ode is one o5 t(e allo:a%le +alues6 $5 it is not an allo:a%le return .ode< t(en a%normall4 end t(e 3rogram :it( error statements t(at :ould %e easier to de%ug6 But :e (a+e to do t(is .(e.-ing a5ter ea.( and e+er4 $)O o3eration6 T(is is 7OST /9*F*99*' *99O9 E 2'L$28 7*TEO' in stru.tured 3rogramming6 !eclarati/es - &SE statement COBOL 3ro+ides an o3tion to grou3 all t(e 3ossi%le errors o5 s3e.i5i. o3erationGsH in a 3la.e and t(at :ill %e automati.all4 in+o-ed during t(e res3e.ti+e o3erationGsH o5 an4 5ile6 T(is a+oids redundant .ode6 T(is is done in '*CL 9 T$=* se.tion o5 t(e 3ro.edure di+ision6 '*CL 9 T$=* s(ould %e t(e 5irst se.tion in t(e 3ro.edure di+ision i5 .oded6 /9OC*'U9* '$=$S$O26 '*CL 9 T$=*S6 US*)/9OC*'U9* S*CT$O26 US* FT*9 *FC*/T$O2 /9OC*'U9* O2 $2/UT6

3#

*99O9)/9OC*'U9*6 C(e.- t(e 5ile)status .ode 5or +alidit46 *2')'*CL 9 T$=*S6 @(ene+er t(ere is an error in t(e 3ro.essing o5 2? F$L* o3ened in $2/UT mode< t(en t(e .ontrol .omes to *99O9)/9OC*'U9*6 T(e +alidit4 o5 error s(ould %e .(e.-ed in t(is 3aragra3( and allo: or restri.t t(e 3ro.ess do:n< %ased on se+erit4 o5 error .ode6 Syn #x2 US* FT*9 ST 2' 9' *99O9U*FC*/T$O2 /9OC*'U9* O2 $2/UTUOUT/UTU$)OU *FT*2'U 5ile)1 $5 $2/UT is .oded< t(e 5ollo:ing 3ro.edure :ill %e eCe.uted 5or e+er4 o3eration in+ol+ed in an4 5ile t(at is o3ened in $2/UT mode6 OUT/UT< $)O and *FT*2' (a+e t(e same meaning %ut t(e mode is di55erent6 $5 5ile name G5ile)1H is .oded in t(e US* statement< t(en all t(e in3ut)out3ut o3eration o5 t(at s3e.i5i. 5ile :ill %e .(e.-ed6 *99O9 and *FC*/T$O2 are s4non4ms6 T(e /ro.edure :ritten in a '*CL 9 T$=* se.tion s(ould not re5er to an4 non)de.larati+e 3ro.edure :ritten a5ter t(e end 3ro.edure and +i.e)+ersa6 I-O-CONTROL - S#ME #RE# #N! S#ME RECOR! #RE# 9*S*9=* .lause o5 S*L*CT statement s3e.i5ies t(e num%er o5 %u55ers to %e allo.ated 5or a 5ile6 S 7* 9* allo:s more t(an one 5ile to use t(e same %u55er area6 T(is :ill %e +er4 use5ul :(en t(e 3rogram must :or- :it( a limited memor4 s3a.e6 But t(e 3ro%lem is onl4 one 5ile s(ould %e o3en at a time i5 S 7* 9* is .oded6 Syn #x2 S 7* 9* FO9 5ile)1 5ile)2 5ile)36 $5 S 7* 9*CO9' 9* is .oded< t(en t(e %u55er is not s(ared %ut onl4 t(e re.ord area is s(ared6 So more t(an one 5ile .an %e in o3en state6 @e s(ould %e .are5ul :(ile 5illing in t(e re.ord area o5 t(e out3ut 5ile6 T(is ma4 destro4 t(e re.ord read most re.entl46 Syn #x2 S 7* 9*CO9' 9* FO9 5ile)1 5ile)2 5ile)36 S#ME SORT #RE# allo:s more t(an one sort0merge :or- 5iles to use t(e same area6 T(e sort :or- 5iles are automati.all4 allo.ated :(en 5ile is o3ened and de)allo.ated :(en 5ile is .losed6 s t(e sort 5ile is automati.all4 o3ened and .losed during a SO9T and t:o sort 5iles .annot %e o3ened at a time< t(is .lause ma4 not %e use5ul6 Syn #x2 S 7* SO9TUSO9T)7*98* 9* 5or 5ile)1 5ile)26 File)1 or 5ile)2 s(ould %e a S' 5ile6

39

I8O CONTRO+8 RERUN C$#use 9*9U2 O2 res.ue FO9 *=*9? integer 9*CO9'S on 5ile)1 T(is :ill .ause .(e.-3oint to %e ta-en 5or e+er4 interger)1 re.ords 3ro.essing o5 5ile)16 $5 t(e 3rogram B*2'*' %e5ore t(e .om3lete 3ro.essing o5 t(e 5ile)1< t(en t(e 3rogram :ill restart 5rom integerK1ST re.ord instead o5 5irst re.ord6 T(e res.ue 5ile details s(ould %e mentioned outside t(e 3rogram and it +aries 5rom installation to installation6 ENTR4 s # emen *2T9? statement esta%lis(es an alternate *2T9? 3oint in a COBOL .alled su%)3rogram6 @(en a C LL statement naming t(e alternate entr4 3oint is eCe.uted in a .alling 3rogram< .ontrol is trans5erred to t(e neCt eCe.uta%le statement 5ollo:ing t(e entr4 statement6 *C.e3t :(en a C LL statement re5ers to an entr4 name< t(e *2T9? statements are ignored at run)time6 Matching Logic $5 4ou (a+e %een gi+en t:o 5iles o5 similar t43e< sa4 master and transa.tion 5ile and 4ou are re;uested to u3date t(e master 5ile :it( transa.tion 5ile in5ormation 5or eCisting re.ords and 3re3are a re3ort o5 ne: transa.tions and deleted transa.tions< t(en 4ou s(ould go 5or :(at is .alled 7at.(ing logi.6 T(is is also -no:n as .o)se;uential 3ro.essing6 Sort %ot( t(e 5iles on -e4 and .om3are t(e -e4s6 $5 t(e -e4s are mat.(ing t(en u3date t(e 5ile6 $5 4ou 5ind an4 re.ord t(at is 5ound in transa.tion %ut not in master 5ile< t(en t(at is ne: addition and t(e re+erse is deletion6 $5 t(e master -e4 is greater t(an transa.tion -e4< t(en t(at .orres3onds to t(e 5irst .ase and re+erse is t(e se.ond .ase6 T(is .an %e easil4 done in JCL using $C*TOOL6

4&

FILE ST#T&S CO!ES File 9esult Status 2 5 7 = L$' 'U/L$C T* LT*92 T* >*? '*T*CT*'6 *C3lanation 20

TT*7/T TO O/*2 F$L* TE T 20 $S 2OT = $L BL*6 $2CO2S$ST*2C? $2 STO9 8* '*=$C*6 20 se;uential 9* ' statement :as attem3ted and no neCt logi.al re.ord eCisted in t(e 5ile %e.ause t(e end o5 t(e 5ile (ad %een rea.(ed< or t(e 5irst 9* ' :as attem3ted on an o3tional in3ut 5ile t(at :as not 3resent6

1&

*2' OF F$L* 9* CE*'

14

$2= L$' 9* ' TT*7/T O2 se;uential 9* ' statement :as attem3ted 5or a 9*L T$=* F$L*6 TE* 8$=*2 992 relati+e 5ile and t(e num%er o5 signi5i.ant digits in 2U7B*9 $S L 98*9 TE 2 TE* t(e relati+e re.ord num%er :as larger t(an t(e siDe o5 9*L T$=* >*?6 t(e relati+e -e4 data item des.ri%ed 5or t(e 5ile6 9* ' @ S TT*7/T*' @E*2 T TE* *2' CO2'$T$O2 $S 20 T9U*6 $2= L$' >*?6 20 se;uen.e error eCists 5or a se;uentiall4 a..essed indeCed 5ile6 T(e 3rime re.ord -e4 +alue (as %een .(anged %4 t(e 3rogram %et:een t(e su..ess5ul eCe.ution o5 a 9* ' statement and t(e eCe.ution o5 t(e neCt 9*@9$T* statement 5or t(at 5ile< or t(e as.ending re;uirements 5or su..essi+e re.ord -e4 +alues :ere +iolated6 n attem3t :as made to :rite a re.ord t(at :ould .reate a du3li.ate -e4 in a relati+e 5ileM or an attem3t :as made to :rite or re:rite a re.ord t(at :ould .reate a du3li.ate 3rime re.ord -e4 or a du3li.ate alternate re.ord -e4 :it(out t(e 'U/L$C T*S 3(rase in an indeCed 5ile6 T(is -e4 +alue a33lies to an indeCed 5ile in :(i.( t(e alternate -e4 (as %een de.lared QU2$!U*Q6 n attem3t :as made to randoml4 a..ess a re.ord t(at does not eCist in t(e 5ile< or a ST 9T or random 9* ' statement :as attem3ted on an o3tional in3ut 5ile t(at :as not 3resent6

16 2&

21

9*CO9' OUT OF S*!U*2C*

22

'U/L$C T* >*?

23

9*CO9' 2OT FOU2'

24

n attem3t :as made to :rite %e4ond t(e eCternall4 de5ined %oundaries o5 a relati+e or indeCed 5ile6 Or< a 2O 7O9* S/ C* LLOC T*' TO se;uential @9$T* statement :as attem3ted 5or a F$L*6 @9$T$28 B*?O2' TE* relati+e 5ile and t(e num%er o5 signi5i.ant digits in LLOC T$O2 OF TE* F$L*6 t(e relati+e re.ord num%er :as larger t(an t(e siDe o5

41

42

Co1ol Coding ,ood CO-OL Coding 5ractices 2or 1etter Modularit+ and Per2ormance. 16 'o not use 66 le+el6 /lanning o5 data de5inition s(ould ma-e t(is redundant 26 'o not use 77 le+el6 Colle.t all t(ese toget(er and grou3 under a &1 le+el6 36 Use ## le+el a33ro3riatel46 For .onditional names6 ll le+el num%ers in.rement %4 an odd num%er in order to allo: 5or t(e insertion o5 eCtra le+els during modi5i.ationsM t(is redu.es t(e need 5or :(olesale renum%ering o5 t(e le+els :it( all t(e 3ro%lems t(at t(is entails6 46 &1 L*=*L)16 &5 L*=*L)26 1& L*=*L)3

/$C 9G&2H CO7/)3 = LU* I*9O*S6

/ 9 89 /Es or S*CT$O2s s(ould %e usedM t(e4 s(ould not %e miCed eC.e3t :(en t(e 56 / 9 89 /E names are used to su%di+ide t(e S*CT$O26 $5 t(is is used t(en onl4 t(e S*CT$O2s s(ould %e 3er5ormed6 $t .orres3onds to t(e se;uen.e0logi.al 3osition in t(e stru.ture o5 t(e .ode6 T(is ena%les t(e lo.ation 66 to %e easil4 as.ertained in a listing and also allo:s t(e user to see :(ere t(e 3rogram (as 3rogressed to in t(e e+ent o5 an4 3ro%lems6 T(e SO9T and 7*98* statements s(ould %e a+oided i5 at all 3ossi%le< it is more e55i.ient to use an eCternal sort< e6g6 S?2CSO9T0'FSO9T< rat(er t(an .alling t(e internal sort :(i.( also uses one o5 t(ese sorts6 T(is is %e.ause :it( an internal sort< .ontrol is 3assed %a.- to t(e 3rogram a5ter ea.( 76 re.ord redu.ing t(e s3eed o5 t(e sort6 $t is also easier to de%ug a COBOL 3rogram t(an it is to de%ug t(e dum3 5rom an internal sort a%end6 $5 SO9T routines are used t(en t(e maCimum -e4 lengt( is 4&92 %4tes :it( no maCimum num%er o5 -e4s6 To in.rease t(e e55i.ien.4 o5 t(e sort< -ee3 t(e -e4 5ields at t(e start o5 t(e re.ord and as .ontiguous as 3ossi%le6 8OTO s(ould ne+er %e usedM a stru.tured 3rogram s(ould not need to use t(is .ommand6 $5 (o:e+er %e.ause o5 .oding or 3ro.essing .onstraints< t(en t(e onl4 3ossi%le use is to trans5er #6 .ontrol to t(e end o5 t(e S*CT$O2 or / 9 89 /E %eing 3ro.essed6 $t 7UST 2OT %e used in an4 ot(er .ase6 2ested $F statements s(ould %e a+oided and .onsideration s(ould %e gi+en to t(e use o5 *= LU T* as an alternati+e6 T(e ot(er o3tion is to restru.ture t(e logi. o5 t(e 3rogram so t(at t(e i5 statement is eit(er eliminated or sim3li5ied6 T(e @E*2 OTE*9 must al:a4s %e .odedM i5 t(is is 96 not 3resent t(en i5 none o5 t(e 3rior .onditions are satis5ied t(en t(e 3rogram :ill 5all t(roug( :it( no 3ro.essing o..urring6 T(e @E*2 OTE*9 statement s(ould al:a4s %e t(e last o3tionM i5 it is not t(en all .onditions 5ollo:ing are irrele+ant as t(e4 :ill not %e tested6 Care s(ould %e ta-en :(en using ST9$28 and U2ST9$28 as t(is ma4 (ide data stru.tures6 @(en using t(ese o3erations t(en t(e O2 O=*9FLO@ .lause s(ould al:a4s %e usedM i5 t(is is not used 1&6 t(en 4ou are not noti5ied o5 t(e in.om3lete o3eration and .ontrol 3asses to t(e neCt se;uential statement6 116 ll stru.tures are terminating :it( *2')FFF6

43

@CL:@o1 Control Language;

6. *)#T IS @CL? 6.6 @O- CONTROL L#N,&#,E .onsists o5 .ontrol statements t(atB

introdu.e a .om3uter Vo% to t(e o3erating s4stem re;uest (ard:are de+i.es dire.t t(e o3erating s4stem on :(at is to %e done in terms o5 running a33li.ations and s.(eduling resour.es

JCL is not used to :rite .om3uter 3rograms6 $nstead it is most .on.erned :it( in3ut0out3ut))) telling t(e o3erating s4stem e+er4t(ing it needs to -no: a%out t(e in3ut0out3ut re;uirements6 $t 3ro+ides t(e means o5 .ommuni.ating %et:een an a33li.ation 3rogram and t(e o3erating s4stem and .om3uter (ard:are6

44

6.7 IS @CL !IFFIC&LT? ... NOT NECESS#RIL'A T(e role o5 JCL sounds .om3leC and it is)))JCL .an %e do:nrig(t di55i.ult6 JCL .an %e di55i.ult %e.ause o5 t(e :a4 it is used6 normal 3rogramming language< (o:e+er di55i.ult< soon %e.omes 5amiliar t(roug( .onstant usage6 T(is .ontrasts :it( JCL in :(i.( language 5eatures are used so in5re;uentl4 t(at man4 ne+er %e.ome 5amiliar6 JCL .an %e di55i.ult %e.ause o5 its design ) JCLB

.onsists o5 indi+idual 3arameters< ea.( o5 :(i.( (as an e55e.t t(at ma4 ta-e 3ages to des.ri%e (as 5e: de5aults))must %e told eCa.tl4 :(at to do re;uires s3e.i5i. 3la.ement o5 .ommas and %lan-s is +er4 un5orgi+ing))one error ma4 3re+ent eCe.ution

JCL is not ne.essaril4 di55i.ult %e.ause most users onl4 use a small set o5 similar JCL t(at ne+er .(anges 5rom Vo% to Vo%6 6.8 )O* !O 'O& SEN! INFORM#TION TO T)E COMP&TER? B TCE /9OC*SS$28 =S6 $2T*9 CT$=* /9OC*SS$28 Interacti/e Processing means t(at 4ou gi+e t(e .om3uter a .ommand and t(e .om3uter res3onds to 4our .ommand re;uest6 $t is more li-e a .on+ersation6 -atch Processing means t(at 4ou gi+e t(e .om3uter a :(ole grou3 o5 .ommands< usuall4 in t(e 5orm o5 some sort o5 3rogram 4ou (a+e :ritten< and (a+e t(e .om3uter 3ro.ess t(is grou3 o5 .ommands6 $t is more li-e :riting a letter6 7. -#SIC S'NT#" OF @CL ST#TEMENTS 002 7* U name 5ield O/*9 T$O2 U o3eration 5ield O/*9 2'<O/*9 2'<O/*9 2' CO77*2TS U o3erand 5ield U .omment 5ield

name 5ield ) identi5ies t(e statement so t(at ot(er statements or t(e s4stem .an re5er to it6 T(e name 5ield must %egin immediatel4 a5ter t(e se.ond slas(6 $t .an range 5rom 1 to # .(ara.ters in lengt(< and .an .ontain an4 al3(anumeri. G to IH or national GZ L PH .(ara.ters6 o3eration 5ield ) s3e.i5ies t(e t43e o5 statementB JOB< *F*C< ''< or an o3erand .ommand6 o3erand 5ield ) .ontains 3arameters se3arated %4 .ommas6 /arameters are .om3osites o5 3res.ri%ed :ords G-e4:ordsH and +aria%les 5or :(i.( in5ormation must %e su%stituted6 .omments 5ield ) o3tional6 Comments .an %e eCtended t(roug( .olumn #&< and .an onl4 %e .oded i5 t(ere is an o3erand 5ield6

45

0ener#$ /C+ Ru$es2


7ust %egin :it( 00 GeC.e3t 5or t(e 0J statementH in .olumns 1 and 2 $s .ase)sensiti+e Glo:er).ase is Vust not 3ermittedH 2 7* 5ield is o3tional must %egin in .olumn 3 i5 used must .ode one or more %lan-s i5 omitted O/*9 T$O2 5ield must %egin on or %e5ore .olumn 16 O/*9 T$O2 5ield stands alone O/*9 2'S must end %e5ore .olumn 72 O/*9 2'S are se3arated %4 .ommas ll 5ields< eC.e3t 5or t(e o3erands< must %e se3arated %4 one %lan-6

7.6 CONTIN&#TION OF @CL ST#TEMENTS 00L 00 00 00 B*L O/*9 T$O2 O/*9 2'< O/*9 2'< O/*9 2'<O/*9 2'< O/*9 2'< O/*9 2'

@(en t(e total lengt( o5 t(e 5ields on a .ontrol statement eC.eeds 71 .olumns< .ontinue t(e 5ields onto one or more 5ollo:ing statements6

$nterru3t t(e 5ield a5ter a .om3lete o3erand Gin.luding t(e .omma t(at 5ollo:s itH at or %e5ore .olumn 71 Code 00 in .olumns 1 and 2 o5 t(e 5ollo:ing line Continue t(e interru3ted statement %eginning an4:(ere in .olumns 4 to 166

7.7 COMMENTIN, @CL 00J TE$S $S CO77*2T L$2*

JCL s(ould %e .ommented as 4ou :ould an4 3rogramming language6 T(e .omments statement .ontains 00J in .olumns 1 to 3< :it( t(e remaining .olumns .ontaining an4 desired .omments6 T(e4 .an %e 3la.ed %e5ore or a5ter an4 JCL statements 5ollo:ing t(e JOB statement to (el3 do.ument t(e JCL6 Comments .an also %e .oded on an4 JCL statement %4 lea+ing a %lan- 5ield a5ter t(e o3erand 5ield6 8. T)REE T'PES OF @CL ST#TEMENTS JOB $denti5ies t(e %eginning o5 a Vo% *F*C $ndi.ates :(at :or- is to %e done '' 'ata 'e5inition< i6e6< $denti5ies :(at resour.es are needed and :(ere to 5ind t(em 9. T)E @O- ST#TEMENT

46

T(e JOB statement in5orms t(e o3erating s4stem o5 t(e start o5 a Vo%< gi+es t(e ne.essar4 a..ounting in5ormation< and su33lies run 3arameters6 *a.( Vo% must %egin :it( a single JOB statement600Vo%name JOB US*91userid Vo%name ) a des.ri3ti+e name assigned to t(e Vo% %4 t(e user :(i.( is t(e %anner on 4our 3rintout ) an4 name 5rom 1 to # al3(anumeri. G )I<&)9H or national GL<Z<PH .(ara.ters ) 5irst .(ara.ter must %e al3(a%eti. or national JOB ) indi.ates t(e %eginning o5 a Vo% Userid ) a 1 to 7 .(ara.ter user identi5i.ation assigned to a..ess t(e s4stem 9.6 #!!ITION#L OPER#N!S OF T)E @O- ST#TEMENT $$Bo1name @O- &SERCuseridD TIMECmD MS,CL#SSCclassD NOTIF'Cuserid US*91userid $denti5ies to t(e s4stem t(e user eCe.uting t(e Vo% T$7*1m Total ma.(ine GmHinutes allo:ed 5or a Vo% to eCe.ute 7S8CL SS1.lass Out3ut .lass 5or t(e Vo% log 2OT$F?1userid User to re.ei+e a TSO message u3on .om3letion o5 a Vo% =.:.: MS0C+ASS T(e 7S8CL SS 3arameter allo:s 4ou to s3e.i54 t(e out3ut .lass to :(i.( t(e o3erating s4stem 7=S is to :rite t(e Vo% log or Vo% entr4 su%s4stem GJ*SH messages6 $5 4ou do not .ode t(e 7S8CL SS 3arameter< 7S8CL SS1J is t(e de5ault and :ill %e used6 7S8CL SS1J indi.ates t(e out3ut :ill %e 3rinted on # 102A %4 11A (ole 3a3er6 T(is in.ludes t(e 5ollo:ingB 16 Jo% *ntr4 Su%s4stem GJ*SH 7essages 26 *rror 7essages 36 JCL Statements 46 'ataset 'is3ositions 56 ..ounting in5ormation Eere is a list o5 a+aila%le out3ut .lassesB

green%ar 3a3er 5)9 TSO (eld out3ut C)I $B7 3age 3rinter out3ut .lasses6 See .(art in se.tion AS4s)out Classes 5or $B7 /rintA on 3age 2#6

47

<. T)E E"EC ST#TEMENT Use t(e *F*C GeCe.uteH statement to identi54 t(e a33li.ation 3rogram or .ataloged or in)stream 3ro.edure t(at t(is Vo% is to eCe.ute and to tell t(e s4stem (o: to 3ro.ess t(e Vo%6 00ste3name *F*C 3ro.edure<9*8$O21PPPP> 00ste3name *F*C /8713rogram<9*8$O21PPPP> ste3name ) an o3tional 1 to # .(ara.ter :ord used to identi54 t(e ste3 *F*C ) indi.ates t(at 4ou :ant to in+o-e a 3rogram or .ataloged 3ro.edure 3ro.edure ) name o5 t(e .ataloged 3ro.edure to %e eCe.uted 3rogram ) name o5 t(e 3rogram to %e eCe.uted 9*8$O21PPPP> ) amount o5 storage to allo.ate to t(e Vo% <.6 PRO,R#MS #N! C#T#LO,E! PROCE!&RES 00 *F*C /8713gmname 3rogram re5erred to on t(e *F*C /871 statement is a .om3iled and lin-ed +ersion o5 a set o5 sour.e language statements t(at are read4 to %e eCe.uted to 3er5orm a designed tas-6 $t is also -no:n as an eCe.uta%le load module6 $t must reside in a 3artitioned dataset6 00 *F*C .ataloged)3ro.edure)name Be.ause t(e same set o5 JCL statements are o5ten used re3eatedl4 :it( little or no .(ange t(e4 .an %e stored in .ataloged 3ro.edures6 JCL 3ro+ides 3rogrammers :it( t(e o3tion o5 .oding t(ese statements onl4 on.e< re.ording and .ataloging t(e statements under an a33ro3riate name in a 3ro.edure li%rar4< and t(en in+o-ing t(ese statements t(roug( an *F*C statement6 Su.( a 3re+iousl4 esta%lis(ed set o5 JCL statements is -no:n as a A.ataloged 3ro.edure6A T(e e55e.t o5 using a .ataloged 3ro.edure is t(e same as i5 t(e JCL statements in t(e 3ro.edure a33eared dire.tl4 in t(e in3ut stream in 3la.e o5 t(e *F*C statement .alling t(e 3ro.edure6 T(is sa+es t(e user 5rom :riting lengt(4 error)3rone JCL statements6 $n s(ort< t(is is JCL t(at does not (a+e to %e in.luded in %at.( Vo%s6 J 2ote t(at :it(in .ataloged 3ro.edures a 3rogram :ill %e eCe.uted6 >.:.: Modi(yin" C# #$o"ed !ro%edures dditional statements ma4 %e added to t(e JCL .om3rising a .ataloged 3ro.edure at t(e time o5 in+o.ation6 lso< o3erand +alues on eCisting JCL statements ma4 %e altered or 3arameters de5ined in t(e 3ro.edure ma4 %e su%stituted at in+o.ation time6 or

4#

T(e +alue in t(e o+erride statement re3la.es t(e +alue 5or t(e same 3arameter in t(e .ataloged 3ro.edure6 Cataloged 3ro.edure statements must %e o+erridden in t(e same order as t(e4 a33ear in t(e 3ro.edure6 003ro.ste3name6ddname '' 3arameter1+alue ?ou .an modi54 .ataloged 3ro.edures %4B

O+erriding 3arameters in an eCisting '' statement dding '' statements to t(e 3ro.edure6 To add ne: '' statements let t(em 5ollo: an4 .(anged '' .ards 5or t(at ste36

To modi54 an eCisting '' statement< onl4 t(ose o3erands to %e .(anged need %e .oded on t(e modi54ing '' statement6 T(e remaining o3erands o5 t(e '' statement :it(in t(e 3ro.edure :ill %e un.(anged6 $5 more t(an one '' statement in a 3ro.edure is to %e modi5ied< t(e modi54ing '' statements must %e 3la.ed in t(e same order as t(e original '' statements o..ur in t(e 3ro.edure6 To add a '' statement to an eCisting 3ro.edure< 3la.e t(e '' statement a5ter t(e 3ro.dure in+o.ation *F*C statement and an4 modi5ied '' statements :it(in t(e Vo% ste36 00 *F*C S S 002*@'' '' 'S21user65ile<'$S/1SE9 @(en loo-ing at 4our out3ut< t(e 5ollo:ing s4m%ols :ill determine :(at -ind o5 statement is indi.ated :(en 4our Vo% runsB 00 $ndi.ates JCL statements FF $ndi.ates .ataloged 3ro.edure statements F0 $ndi.ates a modi5ied .ataloged 3ro.edures statement

=. !#T# !EFINITION :!!; ST#TEMENT '' G'ata 'e5initionH statement must %e in.luded a5ter t(e *F*C statement 5or ea.( data set used in t(e ste36 T(e '' statement gi+es t(e data set name< $0O unit< 3er(a3s a s3e.i5i. +olume to use< and t(e data set dis3osition6 T(e s4stem ensures t(at re;uested $0O de+i.es .an %e allo.ated to t(e Vo% %e5ore eCe.ution is allo:ed to %egin6 T(e '' statement ma4 also gi+e t(e s4stem +arious in5ormation a%out t(e data setB its organiDation< re.ord lengt(< %lo.-ing< and so on6

49

00ddname '' o3erand<o3erand<et.6 ddname ) a 1 to # .(ara.ter name gi+en to t(e '' statement '' ) '' statement identi5ier o3erand ) 3arameters used to de5ine t(e in3ut or out3ut dataset T(e '' Statement

a33ears a5ter an *F*C statement gi+es t(e s4stem in5ormation on man4 t(ings< in.luding t(e dataset attri%utes< t(e dis3osition o5 t(e dataset :(en t(e Vo% .om3letes< and :(i.( in3ut0out3ut de+i.eGsH to use

661 '' ST T*7*2T FO9 $2ST9* 7 ' T $nstream data is 3er(a3s t(e most .ommon 5orm o5 in3ut6 To in.lude data in t(e in3ut stream< .odeB $$ddname !! E . . . $E :to s5eci2+ end o2 data; S?S$2 is o5ten used as a ddname 5or instream data6 T(e 0J mar-s t(e end o5 t(e data6 =.7 E"#MPLE PRO,R#MS *IT) INSTRE#M !! ST#TEMENTS ?.;.: .or r#n Ex#mp$e $n t(is eCam3le< t(e userid U8US*9 is eCe.uting a Fortran 3ro.edure :it( t(e Fortran 3rogram inserted a5ter t(e FO9T6S?S$2 line and t(e data inserted a5ter t(e 8O6S?S$2 line6 00FO9T9U2 JOB US*91U8US*9 00 *F*C FO9T=CL8<9*8$O2115&&> 00FO9T6S?S$2 '' J FO9T9 2 statements 0J 008O6S?S$2 '' J data lines 0J 00 ?.;.; SAS Ex#mp$e

5&

$n t(is eCam3le< t(e userid U8$B7 is eCe.uting a S S 3ro.edure :it( t(e S S 3rogram inserted a5ter t(e S?S$2 line6 00S S9U2 JOB US*91U8$B7 00 *F*C S S<9*8$O2115&&> 00S?S$2 '' J S S statements 0J 00 =.8 !#T# !EFINITION :!!; ST#TEMENT FOR !IS( !#T#SETS 00ddname '' U2$T1unitt43e< 00 'S21userid6name< 00 '$S/1G%eginning<normal)end<a%normal)endH< 00 S/ C*1GT9><G3rimar4<se.ondar4<dire.tor4HH< 00 9*CF71CC<L9*CL144<787TCL S1retainC ddname ) data de5inition nameM a 1)# .(ara.ter :ord o5 4our .(oi.e< must %egin :it( a letter or L< Z< P !! ) '' statement identi5ier &NIT C unitt+5e ) an $0O unit is a 3arti.ular t43e o5 $0O de+i.eB a dis-< ta3e< et.6 U2$T1S?S' re5ers to t(e neCt a+aila%le dis- storage de+i.e6 !SNCuserid.name 'S2 3arameter names t(e data set6 'ata sets .an %e tem3orar4 or nontem3orar46 tem3orar4 data set is .reated and deleted :it(in t(e Vo%< :(ereas nontem3orar4 data sets .an %e retained a5ter t(e Vo% .om3letes6 data set name .an .ontain u3 to 44 .(ara.ters in.luding 3eriods6 *C6 U8$B76' T mgmtclas ) 787TCL S s3e.i5ies t(e name o5 t(e 7anagement Class :(i.( is a set o5 s3e.i5i.ations 5or t(e :a4 t(e storage o..u3ied %4 t(e data set s(ould %e treated %4 S7S6 8enerall4< t(is deals :it( (o: long 4ou :ant to -ee3 t(is data set around6 UC2S (as set u3 t(e 5ollo:ing management .lassesB

787TCL S 9*T $2& 9*T $21 9*T $22

'a4s 9etention & G'*F ULTH 1 2

787TCL S 9*T $2# 9*T $29 9*T $21&

'a4s 9etention # 9 1&

51

9*T 9*T 9*T 9*T 9*T

$23 $24 $25 $26 $27

3 4 5 6 7

9*T $214 9*T $22# 9*T $256 9*T $295 ST 2' 9'

14 2# 56 95 G1# mont(s 3ast last useH

=.9 !#T# !EFINITION :!!; ST#TEMENT FOR T#PE !#T#SETS 00ddname '' U2$T1unitt43e<=OL1S*91unitname< 00 'S215ilename< 00 '$S/1G%eginning<normal)end<a%normal)endH< 00 'CB1G9*CF71CC<L9*CL144<BL>S$I*1DD<'*21densit4H< 00 L B*L1G5ileP<la%elt43e<<modeH ddname ) data de5inition nameM a 1)# .(ara.ter :ord o5 4our .(oi.e< must %egin :it( a letter or L< Z< P !! ) '' statement identi5ier &NITCunitt+5e ) an $0O unit is a 3arti.ular t43e o5 $0O de+i.eB dis-< ta3e< et.6 T /*16 re5ers to a 16&& %3i ta3e dri+e T /*62 re5ers to a 625& %3i ta3e dri+e T /*C re5ers to a 3#> or FF .atridge ta3e dri+e OLCSERCunitname ) =OL1S*9 3arameter is needed i5 t(e data set is to %e 3la.ed on a s3e.i5i. ta3e +olume6 T(is re5ers to t(e +olume serial num%er on an internal ta3e la%el6 !SNC2ilename ) 'S2 3arameter names t(e 5ile on t(e ta3e6 T(e 5ilename .an %e 5rom 1 to 17 .(ara.ters in lengt(6 *C6 CO@' T ?.=.: Disposi ion (DIS!) !#r#me ers T(e '$S/ 3arameter des.ri%es t(e .urrent status o5 t(e data set Gold< ne:< or to %e modi5iedH and dire.ts t(e s4stem on t(e dis3osition o5 t(e dataset G3ass< -ee3< .atalog< un.atalog< or deleteH eit(er at t(e end o5 t(e ste3 or i5 t(e ste3 a%normall4 terminates6 '$S/ is al:a4s re;uired unless t(e data set is .reated and deleted in t(e same ste36

$$

!ISP C :1eginningD normal-termination Da1normal-termination; [[[[[[[[[ [[[[[[[[[[[[[[[[[ [[[[[[[[[[[[[[[[[[[ U U U 2*@ C TL8 '*L*T* OL' >**/ >**/

52

SE9 7O'

/ SS '*L*T* U2C TL8

C TL8 U2C TL8

?.=.:.: ,e"innin" Disposi ions T(is is t(e status o5 t(e data set at t(e %eginning o5 t(e ste36 $5 t(e data set is ne:< t(e s4stem .reates a data set la%elM i5 it is old< t(e s4stem lo.ates it and reads its la%el NE* .reates a ne: data set OL! designates an eCisting data setM it .an %e an in3ut data set or an out3ut data set to re:rite S)R identi.al to OL' eC.e3t t(at se+eral Vo%s ma4 read 5rom t(e data set at t(e same time6 MO! modi5ies a se;uential data set ) 3ositions t(e 3ointer at t(e end o5 t(e data set in order to add ne: data to t(e data set6 ?.=.:.; Norm#$ Termin# ion #nd A)norm#$ Termin# ion Disposi ions 2ormal dis3osition< t(e se.ond term in t(e '$S/ 3arameter< indi.ates t(e dis3osition o5 t(e data set :(en t(e data set is .losed or :(en t(e Vo% terminates normall46 T(e a%normal dis3ositions< e55e.ti+e onl4 i5 t(e ste3 a%normall4 terminates< are t(e same as normal dis3ositions eC.e3t t(at / SS is not allo:ed6 P#SS 3asses t(e data set on to su%se;uent Vo% ste3s< and ea.( ste3 .an use t(e data set on.e6 (EEP -ee3s nontem3orar4 data sets6 !ELETE deletes data sets6 C#TL, .atalogs a nontem3orar4 data set6 C TL8 is similar to >**/ eC.e3t t(at t(e unit and +olume o5 t(e data set are re.orded in t(e .atalog along :it( t(e data set name6 &NC#TL, un.atalogs a data set6 U2C TL8 is t(e same as >**/ eC.e3t t(at t(e data set name is remo+ed 5rom t(e .atalog6 ?.=.:.@ Ex#mp$es o( DIS! p#r#me ers 00 '$S/1SE9 00 '$S/1OL' 00 '$S/1G2*@<C TL8<'*L*T*H 00 '$S/1GOL'</ SSH 00 '$S/17O'

read 5rom :rite to .reate and .atalogM delete i5 t(ere is a s4stem a%end dataset alread4 eCistsM 3ass it to t(e neCt ste3 :rite to t(e %ottom o5 an eCisting dataset

53

?.=.; S!ACE !#r#me er ll ne: data sets on dis- +olumes must %e allo.ated s3a.e6 Storage on dis- +olumes .an %e allo.ated in units o5 %lo.-s< .4linders< tra.-s< -ilo%4tes and %4tes6 T(e s3a.e ma4 %e re;uested as a 3rimar4 and a se.ondar4 amount6 T(e 3rimar4 amount is allo.ated :(en t(e data set is o3ened :it( a dis3osition o5 2*@6 T(e se.ondar4 amount is allo.ated i5 t(e 3rimar4 amount is eC.eeded6 T(e 3rimar4 amount .an %e .onser+ati+e< :it( t(e se.ondar4 amount 3ro+iding a reser+e6 T(e se.ondar4 amount 3ro+ides 5or data set gro:t( o+er time6 $$ SP#CEC:TR(D :5rimar+D secondar+D director+;; 5rimar+ re.ei+e t(is amount o5 s3a.e initiall4

secondar+ re.ei+e t(is amount o5 s3a.e ea.( time more is needed Gu3 to 15 timesH director+ reser+e t(is amount o5 %lo.-s to -ee3 t(e dire.tor4 o5 a 3artitioned dataset G2OT US*' 5or a se;uential datasetH 1 dire.tor4 %lo.- allo:s 5or 5 mem%ers in a 3artitioned dataset Total S3a.e 1 G1 J 3rimar4H K G15 J se.ondar4H ?.=.;.: !#r i ioned D# #se &s. Se6uen i#$ D# #se n4 named .olle.tion o5 data is .alled a data set6 3artitioned dataset .onsists o5 multi3le 5iles :it(in one data stru.ture6 se;uential dataset .onsists o5 one 5ile :it(in a data stru.ture6 /artitioned 'ataset

indi+idual mem%ers are read0mani3ulated :it(out distur%ing ot(er mem%ers it is ad+isa%le to ne+er :rite dire.tl4 to a 3artitioned dataset in 4our 3rogram on '' statememtB 'S21userid65ileGmem%erH .all 5rom editorB 5ileGmem%erH

Se;uential 'ataset

dataset must %e read 5rom to3 to %ottom on '' statementB 'S21userid65ile .all 5rom editorB 5ile / 9T$T$O2*' ' T S*T 'S21Quserid6data)set) nameGmem%erHQ [[[[[[[[[[[[[[ U '$9*CTO9? U S*!U*2T$ L ' T S*T 'S21Quserid6data)set)nameQ [[[[[[[[[[[[[[ U U

54

U)))))))))))))))))U 7*7B*91 U U)))))))))))))))))U U 7*7B*92 U U)))))))))))))))))U U 6666666 U U)))))))))))))))))U U 7*7B*9n U U))))))))))))))))))))))))))U U[[[[[[[[[[[[[[[U U

U U U U U ' T S*T U U U U U U U U U U U U[[[[[[[[[[[[[[[U

3artitioned dataset di55ers 5rom a se;uential dataset in t(at it (as a dire.tor4 o5 its mem%ers6 @(ene+er 4ou re5er to a mem%er o5 a 3artitioned dataset< 4ou in.lude t(e mem%er name in 3arent(eses6 ?.=.;.; D.SMS (Sys em M#n#"ed D# #se s) On t(e TSO ser+i.e< data sets are t43i.all4 .reated and reside on dis- +olumes6 +olume is a standard unit o5 storage6 T(ese dis- +olumes are re5erred to as ' S'< :(i.( stands 5or 'ire.t ..ess Storage 'e+i.e6 *a.( %lo.- o5 data on a ' S' +olume (as a distin.t lo.ation and a uni;ue address< ma-ing it 3ossi%le to 5ind an4 re.ord :it(out eCtensi+e sear.(ing6 One ' S' +olume .an %e used 5or man4 di55erent data sets< and s3a.e on it .an %e reallo.ated and reused6 t t(e Uni+ersit4 o5 8eorgia< 4ou are no: re;uired to utiliDe t(e 'ata Fa.ilities Storage 7anagement Su%s4stem G'FS7SH to esta%lis( 3ermanent data sets6 T(e Storage 7anagement Su%s4stem GS7SH is an o3erating en+ironment t(at automates t(e management o5 storage6 @it( S7S< users .an allo.ate data sets more easil46 T(e data sets allo.ated t(roug( t(e Storage 7anagement Su%s4stem are .alled s4stem)managed6 S4stem)managed means t(at t(e s4stem determines data 3la.ement and automati.all4 manages data a+aila%ilit4< 3er5orman.e< s3a.e< re.lamation< and se.urit46 One o5 t(e most %ene5i.ial goals o5 S4stem)managed storage is to relie+e users o5 3er5orman.e< a+aila%ilit4< s3a.e< and de+i.e management details6 'FS7S stores data in a de+i.e)inde3endent 5ormat so t(at it .an easil4 mo+e t(e data to an4 o5 t(e 5ollo:ing de+i.esB

349&* 7agneti. Catridge Ta3e ' S' 5or models 33#& and 339&

T(e migration and mo+ement o5 data de3ends on su.( 5a.tors asB


7anagement Class 'ata set Usage 7inimum 3er.ent 5ree s3a.e on a ' S' =olume 9e;uest %4 storage administrator or user

55

'FS7S re.ords t(e lo.ation o5 ea.( dataset it mo+es in a .ontrol data set6 T(e a.tual migration is (andled %4 'FES7 G'ata Fa.ilities Eierar.(i.al Storage 7anagerH6 'FES7 is a ' S' management 3rodu.t tool 5or managing lo:)a.ti+it4 and ina.ti+e data6 'ata sets t(at (a+e rea.(ed t(e end o5 t(eir retention 3eriod GeC3iredH :ill %e deleted6 'ata sets :it( a management .lass o5 ST 2' 9' :ill %e deleted i5 t(e data set (as not %een re5eren.ed 5or a 3eriod o5 eig(teen mont(s6 noti5i.ation :ill %e sent to t(e user a5ter a ST 2' 9' data set (as not %een re5eren.ed 5or siC mont(s in5orming t(e user o5 t(e ST 2' 9' deletion 3oli.46 t t(is time t(e data set :ill %e mo+ed to ta3e6 ll data sets t(at (a+e a management .lass o5 9*T $295 or ST 2' 9' :ill %e automati.all4 %a.-ed u3 %4 'FES76 T:o .o3ies o5 ea.( :ill %e -e3t6 T(e .(ange indi.ator :ill trigger t(e %a.-u3 a5ter t(e 5irst %a.-u3 is made6 user .an use t(e EB C> .ommand to add non) ST 2' 9' and non)9*T $295 data sets to t(is6 ?.=.;.@ S!ACE !#r#me er (!#r i ioned D# #se ) $$ SP#CEC:TR(D:5rimar+Dsecondar+Ddirector+;; T(is S/ C* eCam3le allo:s a total o5 4& tra.-s 5or t(e dataset :it( 1 %lo.- o5 s3a.e reser+ed 5or t(e dire.tor46 00 S/ C*1GT9><G1&<2<1HH Total S3a.e 1 G1J1&H K G15J2H 1 1& K 3& 1 4& tra.-s 'ire.tor4 1 G1J5H 1 5 mem%ers0dataset

T(is S/ C* eCam3le allo:s a total o5 1&& tra.-s 5or t(e dataset :it( # %lo.-s reser+ed 5or t(e dire.tor46 00 S/ C*1GT9><G25<5<#HH Total S3a.e 1 G1J25H K G15J5H 1 25 K 75 1 1&& tra.-s 'ire.tor4 1 G#J5H 1 4& mem%ers0dataset J 2ote t(at t(e tra.- .a3a.it4 5or 33#& is 1 tra.- 1 47<476 .(ara.ters6 ?.=.;.= S!ACE !#r#me er (Se6uen i#$ D# #se ) $$ SP#CEC:TR(D:5rimar+Dsecondar+;;

T(is S/ C* eCam3le allo:s a total o5 53 tra.-s 5or t(e dataset6 00 S/ C*1GT9><G#<3HH Total S3a.e 1 G1J#H K G15J3H 1 # K 43 1 53 tra.-s

56

T(is S/ C* eCam3le allo:s a total o5 52&&&& %4tes 5or t(e dataset6 00 S/ C*1G#&<G5&&&<1&&HH Total S3a.e 1 G1J4&&&&&H K G15J#&&&H 1 4&&&&& K 12&&&& 1 52&&&& %4tes J 2ote t(at dire.tor4 %lo.-s are al:a4s & 5or se;uential datasetsM t(ere5ore< t(e dire.tor4 3arameter is 2OT US*' 5or se;uential datasets6 ?.=.@ D# # Se A ri)u es @it( S7S< 4ou do not need to use t(e 'CB 3arameter to s3e.i54 data set attri%utes6 LL o5 t(e 'CB -e4:ord su%3arameters Gre.ord lengt(< re.ord 5ormat< and %lo.-siDeH .an %e s3e.i5ied :it(out t(e need to .ode 'CB16 For eCam3le< t(e 5ollo:ing '' statementB 00 'CB1G9*CF71FB<L9*CL1#&<BL>S$I*1#&&&H .an %e s3e.i5ied asB 00 9*CF71FB<L9*CL1#& T(e %lo.-siDe 3arameter .an %e omitted %e.ause S7S :ill sele.t t(e o3timum %lo.-siDe6 RECFMCFF s3e.i5ies t(e re.ord 5ormat6 T(e 5ormat .an %e one or more o5 t(e 5ollo:ing .(ara.tersB F 5iCed)lengt( re.ords = +aria%le)lengt( re.ords U unde5ined)lengt( re.ords FB 5iCed and %lo.-ed FB 5iCed< %lo.-ed< :it( 2S$ .arriage .ontrol .(ara.ters =B +aria%le and %lo.-ed =B +aria%le< %lo.-ed< :it( 2S$ .arriage .ontrol .(ara.ters LRECLC++ s3e.i5ies t(e lengt( o5 re.ords e;ual to t(e re.ord lengt( 5or 5iCed)lengt( re.ords e;ual to t(e siDe o5 t(e largest re.ord 3lus t(e 4 %4tes des.ri%ing t(e re.ordQs siDe 5or +aria%le)lengt( re.ords omit t(e L9*CL 5or unde5ined re.ords L9*CL .an range 5rom 1 to 3276& %4tes

57

-L(SIGECHH s3e.i5ies t(e %lo.-siDe i5 4ou :is( to %lo.- re.ords


must %e a multi3le o5 L9*CL 5or 5iCed)lengt( re.ords must %e e;ual to or greater t(an L9*CL 5or +aria%le)lengt( re.ords must %e as large as t(e longest %lo.- 5or unde5ined)lengt( re.ords BL>S$I* .an range 5rom 1 to 3276& %4tes

?.=.@.: .ixed ,$o%< 00 9*CF71FB<L9*CL1#&<BL>S$I*19&4& T(is dataset :ill (a+e 5iCed lengt( re.ords :it( a lengt( o5 #&6 T(ere :ill %e 113 re.ords o5 data 3er %lo.-6 BL>S$I*0L9*CL 1 9&4&0#& 1 113 re.ords o5 data 3er %lo.-

?.=.@.; V#ri#)$e ,$o%< 00 9*CF71=B<L9*CL1255< BL>S$I*1312& T(is dataset :ill (a+e +aria%le lengt( re.ords :it( a maCimum o5 255 .(ara.ters6 T(e %lo.-siDe o5 t(e dataset :ill %e 312&6

?.=.= DC, #nd +A,E+ !#r#me ers (or T#pes RECFMCFF s3e.i5ies t(e re.ord 5ormat6 T(e 5ormat .an %e one or more o5 t(e 5ollo:ing .(ara.tersB F 5iCed)lengt( re.ords = +aria%le)lengt( re.ords U unde5ined)lengt( re.ords FB 5iCed and %lo.-ed FB 5iCed< %lo.-ed< :it( 2S$ .arriage .ontrol .(ara.ters =B +aria%le and %lo.-ed =B +aria%le< %lo.-ed< :it( 2S$ .arriage .ontrol .(ara.ters LRECLC++ s3e.i5ies t(e lengt( o5 re.ords e;ual to t(e re.ord lengt( 5or 5iCed)lengt( re.ords e;ual to t(e siDe o5 t(e largest re.ord 3lus t(e 4 %4tes des.ri%ing t(e re.ordQs siDe 5or +aria%le) lengt( re.ords omit t(e L9*CL 5or unde5ined re.ords L9*CL .an range 5rom 1 to 3276& %4tes

5#

-L(SIGECHH s3e.i5ies t(e %lo.-siDe i5 4ou :is( to %lo.- re.ords must %e a multi3le o5 L9*CL 5or 5iCed)lengt( re.ords must %e e;ual to or greater t(an L9*CL 5or +aria%le)lengt( re.ords must %e as large as t(e longest %lo.- 5or unde5ined)lengt( re.ords BL>S$I* .an range 5rom 1 to 3276& %4tes !ENCdensit+ measures t(e num%er o5 %its t(at are stored in a unit o5 measurement on t(e ta3e6 T(is measurement is .ommonl4 re5erred to as B/$ G%its 3er in.(H6 densities are re3resented in t(e '*2 3arameter as 5ollo:sB 2 #&& B/$ 3 16&& B/$ 4 625& B/$ J 3#> O9 FF B/$ :(en adding 5iles to an eCisting ta3e all ne: 5iles :ill %e :ritten at t(e same densit4 as t(e 5irst 5ile no matter i5 4ou s3e.i54 di55erentl46 T(e L B*L 3arameter tells t(e t43e o5 la%el< t(e relati+e 5ile num%er on t(e ta3e< and :(et(er t(e data set is to %e 3rote.ted 5or in3ut or out3ut6 $$ L#-ELC:2ile0Dla1elt+5eDDmode; 2ile ) t(e relati+e 5ile num%er on t(e ta3e G1)4 digitsH t+5e ) t(e t43e o5 la%el on t(e ta3e 2L 2o La%el SL Standard La%el L meri.an 2ational Standard La%el BL/ B43ass La%el /ro.essing mode $20OUT 3arameter $2 3rote.ts t(e 5ile 5rom %eing o3ened 5or out3ut OUT 3rote.ts it 5rom %eing o3ened 5or in3ut 00 L B*L1G3<SL<<$2H File 3 on a SL ta3e .an onl4 %e read 00 L B*L1G1<2L<<OUTH File 1 on a 2L ta3e is o3en 5or out3ut

=.< E"#MPLE PRO,R#MS *IT) !! ST#TEMENTS ?.>.: .or r#n /o) (or Re#din" (rom Dis< D# #se $n t(is eCam3le< t(e userid U8$B7 is eCe.uting a Fortran 3ro.edure :it( t(e Fortran 3rogram inserted a5ter t(e FO9T6S?S$2 line< and t(e data is %eing read %4 U2$T 3 5rom t(e data set U8$B76FOO'6

59

00FO9T9U2 JOB US*91U8$B7 00 *F*C FO9T=CL8< 9*8$O212&&&> 00FO9T6S?S$2 '' J readG3<1&H C<4 1& 5ormatG1C<5461<1C<5461H 0J 008O6FT&3F&&1 '' 'S21U8$B76FOO'<U2$T1S?S' <'$S/1SE9 0J 00 =.<.7 S#S @o1 2or Reading 2rom !is3 !ataset $n t(is eCam3le< t(e userid U8$B7 is eCe.uting a S S 3ro.edure :it( t(e S S 3rogram inserted a5ter t(e S?S$2 line and t(e data is %eing read 5rom t(e data set U8$B76' T 6 00S S9U2 JOB US*91U8$B7 00 *F*C S S<9*8$O212&&&> 00OL'' T '' 'S21U8$B76' T <U2$T1S?S' <'$S/1SE9 00S?S$2 '' J data oneM in5ile olddataM in3ut C 4 DM 0J 00 ?.>.@ .or r#n /o) (or 9ri in" o Dis< D# #se $n t(is eCam3le< t(e userid U8 BC is eCe.uting a Fortran 3ro.edure :it( t(e Fortran 3rogram inserted a5ter t(e FO9T6S?S$2 line< and t(e results are :ritten %4 U2$T # to t(e data set U8 BC62*@F$L*6 T(is dataset :ill onl4 %e retained 5or 7 da4s6 $5 t(e user de.ides to -ee3 t(e dataset 5or a longer 3eriod o5 time< t(e LT*9 .ommand .an %e issued6 For eCam3le< LT*9 QU8 BC62*@F$L*Q 787TCL SG9*T $214H< :ill -ee3 t(e dataset around 5or anot(er :ee-6 Sin.e t(e BL>S$I* is not s3e.i5ied< S7S :ill determine t(e most e55i.ient %lo.-siDe6 00FO9T9U2 JOB US*91U8 BC 00 *F*C FO9T=C8<9*8$O212&&&> 00FO9T6S?S$2 '' J :riteG#<1&H C<4 5ormatG1C<5461<1C<5461H

1&

0J 008O6FT&#F&&1 '' 'S21U8 BC62*@F$L*<U2$T1S?S' < 00 '$S/1G2*@<C TL8<'*L*T*H<

6&

00 S/ C*1GT9><G4&<1&H<9LS*H< 00 9*CF71FB<L9*CL1#&<787TCL S19*T $27 0J 00 ?.>.= SAS /o) (or 9ri in" o Dis< D# #se $n t(is eCam3le< t(e userid U8F?I is eCe.uting a S S 3ro.edure :it( t(e S S 3rogram inserted a5ter t(e S?S$2 line and t(e results are :ritten to t(e data set U8F?I6S S6' T 6 T(is dataset< %ased on t(e management .lass o5 standard< :ill %e retained on t(e s4stem as long as t(e user utiliDes it6 00S S9U2 JOB US*91U8F?I 00 *F*C S S<9*8$O212&&&> 002*@' T '' U2$T1S?S' < 00 'S21U8F?I6S S6' T <'$S/1G2*@<C TL8<'*L*T*H< 00 S/ C*1GT9><G4&<1&H<9LS*H< 00 9*CF71FB<L9*CL1#&<787TCL S1ST 2' 9' 00S?S$2 '' J data eCam3leM in3ut C 4 DM .ardsM 123 456 M data [null[M set eCam3leM 5ile ne:dataM 3ut C 4 DM returnM 0J 00 >. !! ST#TEMENT FOR PRINTE! O&TP&T T(e S?SOUT 3arameter 3ro+ides a .on+enient means o5 routing out3ut to 3rinters or ot(er de+i.es6 $$ddname !! S'SO&TCclass ddname ) a 1 to # .(ara.ter name gi+en to t(e '' statement '' ) '' statement identi5ier S?SOUT1.lass ) de5ines t(is data set as a s4stem out3ut data set< usuall4 .alled a s4sout data set and assigns t(is s4sout data set to an out3ut .lass6 Eere is a list o5 a+aila%le out3ut .lassesB

61

green%ar 3a3er 5)9 TSO (eld out3ut C)I $B7 3age 3rinter out3ut .lasses6 See .(art in se.tion AS4sout Classes 5or $B7 /rintA on 3age 2#6

J same .lass as s3e.i5ied on t(e 7S8CL SS 3arameter J 2ote t(at i5 a s4sout data set (as t(e same .lass as t(e 7S8CL SS 3arameter< t(e Vo% log a33ears on t(e same out3ut listing as t(is s4sout data set6 >.6 S'SO&T CL#SSES FOR I-M PRINT

S?SOUTJ / /*9 O9$*2T T$O2 S$'*S $7 8*S CE 90L$2* L$2*S0$7 8* CL SS C (ole lands.a3e 1 1 132 62 ' (ole 3ortrait 1 1 #& 62 F %ond lands.a3e 2 1 132 62 8 %ond 3ortrait 2 1 #& 62 E %ond lands.a3e 2 2 9& #& $ %ond 3ortrait 2 1 #& 7& J (ole lands.a3e 2 1 132 62 > (ole 3ortrait 2 1 #& 62 ! %ond lands.a3e 1 1 132 62 S %ond 3ortrait 1 1 #& 62 @ (ole 3ortrait 2 2 132 62 F %ond 3ortrait 2 2 132 62 ? %ond lands.a3e 2 1 132 62 I (ole lands.a3e 2 1 132 62 8ra4%ar O+erla4B T(e 3a3er used 5or .lasses C<F<E<J< and ! is s(aded to mimi. standard green%ar 3a3er6 Ser+i.e Site /age /rintersB To route 4our out3ut to one o5 t(e 3age 3rinters in t(e Journalism or der(old sites< 4ou must use a S?SOUT .lass or message .lass G7S8CL SSH :it( a 3a3er t43e o5 A(oleA GC< '< J< >< @< or IH6 Line /rinter S?SOUT ClassB To route 4our out3ut to a line 3rinter< use a S?SOUT .lass or message .lass G7S8CL SSH o5 6 ?our out3ut :ill %e 3rinted on green%ar 3a3er6 S3e.ial Eold ClassesB To route 4our out3ut to a (old ;ueue< use a S?SOUT .lass or message .lass G7S8CL SSH o5 5< 6< 7< #< or 96 ))))))))))))))))))))))))

62

J S?SOUT .lass +alues ma4 %e used 5or message .lass G7S8CL SSH6

I. O&TP&T @CL ST#TEMENT T(e OUT/UT statement is used to s3e.i54 3ro.essing o3tions 5or a s4stem out3ut data set6 T(ese o3tions are used onl4 :(en t(e OUT/UT statement is eC3li.itl4 or im3li.itl4 re5eren.ed %4 a s4sout '' statement6 $$name O&TP&T FORM!EFC2de2DP#,E!EFC5de2DC)#RSCchDFORMSC2ormD $$ COPIESCnD!ESTCdestD!EF#&LTCdd name ) a 1 to # .(ara.ter name gi+en to t(e OUT/UT statement O&TP&T ) OUT/UT statement identi5ier FORM!EFC2de2 ) s3e.i5ies :(et(er to use du3leC or sim3leC and o+erla4 'U/1 du3leC< no o+erla4 'U/2 du3leC< gre4 %ar o+erla4 S7/1 sim3leC< no o+erla4 S7/2 sim3leC< gre4 %ar o+erla4 P#,E!EFC5de2 ) s3e.i5ies t(e logi.al 3age lengt( and :idt(< 5onts< lines :it(in a 3age< and multi3le logi.al 3ages on a 3(4si.al 3age /O91 3ortrait< 62 lines at 6 lines 3er in.( /O92 3ortrait< 7& lines at 6 lines 3er in.( /O93 3ortrait< 2 u3 5ormat< 62 lines 3er 5rame L 21 lands.a3e< 62 lines at # lines 3er in.( L 22 lands.a3e< 2 u3 5ormat< #& lines 3er 5rame C)#RSCch ) names t(e .(ara.ter set 8T12 8ot(i. 5ont at 12 .(ara.ters 3er in.( 8T13 8ot(i. 5ont at 13 .(ara.ters 3er in.( 8T1# 8ot(i. 5ont at 1# .(ara.ters 3er in.( FORMSC2orm - s3e.i5ies t(e t43e o5 5orm BO2' 3lain %ond 3a3er EOL* 3 (ole drilled %ond 3a3er COPIESCn ) s3e.i5ies (o: man4 .o3ies o5 t(e s4sout data set are to %e 3rinted !ESTCdest ) s3e.i5ies a 3rinter destination 5or t(e s4sout data set LOC L Bo4d 8raduate Studies SSS&2 Journalism Building

63

SSS&3 der(old Building 2CT19 Broo-s Eall !EF#&LTCdd ) s3e.i5ies t(at t(is OUT/UT statement .an or .annot %e re5eren.ed %4 a s4sout '' statement ?*S s3e.i5ies t(at t(is is t(e de5ault OUT/UT statement 5or 5or all 3rint 5iles :it(in a Vo% 2O s3e.i5ies t(at t(is is not t(e de5ault OUT/UT statement J 2ote i5 4ou are going to EOL' a 3rint dataset :it( an OUT/UT statement asso.iated :it( it< 4ou :ill (a+e to 5ull4 s3e.i54 all o5 t(e 3arameters on t(e OUT/UT statement6 Conta.t t(e UC2S Eel3des- 5or more details6

I.6 E"#MPLES OF T)E O&TP&T ST#TEMENT To re;uest t(at t(e Agra4 %arA o+erla4 not 3rint on a lands.a3e s4sout .lass 5or all 3rint 5iles< .odeB 00OUT1 OUT/UT FO97'*F1'U/1<'*F ULT1?*S

To re;uest sim3leC Gone sidedH 3rinting 5or a du3leC s4sout .lass 5or all 3rint 5iles< .odeB 00OUT1 OUT/UT FO97'*F1S7/1<'*F ULT1?*S

To re;uest multi3le .o3ies o5 a 3rint 5ile< .odeB 00OUT1 OUT/UT CO/$*S112 ) :it( ) 00ddname '' S?SOUT1F<OUT/UT1J6OUT1

J. @ES8 CONTROL ST#TEMENTS J.6 $$EM#IN ST#TEMENT T(e 00J7 $2 statement is used to de5ine t(e 3ro.essor re;uirements 5or t(e .urrent Vo%6 $t s3e.i5ies :(at time t(e Vo% :ill %e eCe.uted< (o: man4 lines in t(e Vo%< and :(ere t(e Vo% is to %e 3rinted6 $$EM#IN CL#SSCFDLINESC+DOR,C&,#I-M6.org

64

CL#SSCF s3e.i5ies t(e Vo% .lass 5or t(is Vo% B Bat.( Gde5aultH n4time dail4 2$T* 6B&& /7 until 7B&& 7 dail4 @**>*2' 6B&& /7 Frida4 until 7B&& 7 7onda4 I 1B3& 7 until 7B&& 7 dail4< :ee-ends< (olida4s BL 6B&& /7 until 7B&& 7 dail4< more t(an # 7*8 region IL 1B3& 7 until 7B&& 7 dail4< more t(an # 7*8 region LINES s3e.i5ies t(e maCimum num%er o5 lines o5 data to %e 3rinted 5rom t(is Vo% in multi3les o5 a t(ousand Gde5ault 1 5&&&H OR,C&,#I-M6.org s3e.i5ies a 3rinter destination 5or t(e s4sout dataset LOC L Bo4d 8raduate Studies SSS&2 Journalism Building SSS&3 der(old Building 2CT19 Broo-s Eall J.7 @O- SC)E!&LIN, SPECIFIC#TIONS Sin.e TSO is a time s(aring o3erating s4stem< it allo:s man4 3eo3le to use t(e .om3uter at t(e same time in su.( a :a4 t(at ea.( is una:are t(at t(e .om3uter is %eing used %4 ot(ers6 Time s(aring attem3ts to to maCimiDe an indi+iduals use o5 t(e .om3uter< not t(e e55i.ien.4 o5 t(e .om3uter itsel56 $n order to do t(is< Vo% s.(eduling is used to assign Vo%s to a .ertain .lass in order to maCimiDe t(e resour.es a+aila%le to ea.( user6 /riorit4 ))))))) [[[[[[[[[[[ B TCEU 4 U U [[[[[[[[[[ 3 [[[[ 2$T* U [[[[ 2

n4 Vo% .an %e s.(eduled to run at nig(t or on t(e :ee-end %4 .odingB 00J7 $2 CL SS12$T* or 00J7 $2 CL SS1@**>*2' A.;.: T#)$e o( Resour%e +imi # ions (or /o) S%*edu$in" /riorit4 C/U Time Gse.ondsH 9egion G>H *stimated Lines Setu3s 9e;uired

65

6 4 3 2

&)3& 32)12& 121)3&& 3&1K

&)2&4# 2&49)3&72 3&73)4&96 4&97K

&)5&&& 5&&1)1&&&& 1&&&1)4&&&& 4&&&&K

& & 1)3 4K

J.8 $$EOPER#TOR ST#TEMENT T(e 00JO/*9 TO9 statement is 3rimaril4 used to issue a message to t(e o3erator re;uesting t(at t(e ta3e :it( t(e s3e.i5i. =92< =S2 and >*?@O9' is to %e mounted 5or t(e Vo%6 00JO/*9 TO9 =921P9999 =S21U9999 >*?1E*L/ =92 :ill %e assigned :(en t(e ta3e is .(e.-ed in6 T(is identi5ies t(e ta3e in t(e ta3e li%rar46 Cartridge Ta3es must (a+e PC in t(e 5irst t:o .olumn 3ositions on t(e +rn 3arameter6 =S2 t(e +olume serial num%er on t(e t(e internal la%el o5 a standard la%eled ta3e6 T(is must %e t(e a.tual internal la%el6 For non)la%eled ta3es< t(is .an %e an4 ar%itrar4 name6 $n %ot( .ases< t(e =S2 must mat.( t(e =OL1S*9 3arameter on t(e '' .ard6 >*? is a 3ass:ord t(at 4ou :ill assign to t(e ta3e 5or se.urit4 3ur3oses6 T(e o3erator :ill .(e.t(e -e4:ord in 4our JCL against t(e -e4:ord on t(e ta3e %e5ore mounting t(e ta3e6 T(e 00JO3erator statement in t(e JCL stream is 3la.ed a5ter t(e JOB or 00J7 $2 statement and %e5ore t(e *F*C statement6 *a.( 00JO3erator statement s(ould %e re5eren.ed %4 a '' statement to read or :rite a 5ile to t(e ta3e6 T(e 5ollo:ing eCam3le illustrates t(e o3erator .ard :it( t(e re5eren.ing '' statement6 2ote t(at t(e =S2 and t(e =OL1S*9 must %e t(e same6 $n t(is eCam3le< t(e user is going to read t(e 5irst 5ile on a standard la%eled GSLH ta3e :it( t(e name CO@' T 6 T(e ta3e is going to %e read on a 625& B/$ ta3e dri+e6 00S*7$2 9 JOB US*91US*9$' 00J7 $2 L$2*S12& 00JO/*9 TO9 =921P1111 =S21&211II >*?1>FJ' 00ST*/1 *F*C 666 00$2F$L* '' U2$T1T /*62<=OL1S*91&211II< 00 L B*L1G1<SL<<$2H< 00 'S21CO@' T < 00 '$S/1GOL'</ SSH

66

6K. E"#MPLE FORTR#N #N! S#S PRO,R#MS 6K.6 E"#MPLE FORTR#N PRO,R#M $n t(is eCam3le< t(e userid U8 &&1 is eCe.uting a Fortran 3ro.edure :it( t(e Fortran 3rogram inserted a5ter t(e FO9T6S?S$2 line and t(e data inserted a5ter t(e 8O6S?S$2 line6 T(is Vo% :ill not %egin eCe.uting until a5ter 6B&&/7< and t(e out3ut :ill %e (eld to t(e terminal %4 t(e 7S8CL SS166 00CO2=*9T JOB US*91U8 &&1<7S8CL SS16<2OT$F?1U8 &&1 00J7 $2 CL SS12$T*<L$2*S14&<O981U8 $B716LOC L 00 *F*C FO9T=CL8<9*8$O212&&&> 00FO9T6S?S$2 '' J readG5<1&H .ent 1& 5ormatG5662H 5a(r1G.entJ905HK32 :riteG6<2&H .ent<5a(r 2& 5ormatG5662<Q .ent 1 Q<56<2<Q5a(rQH 0J 008O6S?S$2 '' J 1&&6&& 0J 00 6K.7 E"#MPLE S#S PRO,R#M $n t(is eCam3le< t(e userid 9*S9CE is eCe.uting a S S 3ro.edure :it( t(e S S 3rogram inserted a5ter t(e S?S$2 line and t(e data is %eing read 5rom t(e 5irst 5ile o5 a standard la%eled .artridge ta3e :it( t(e 5ile name o5 ' T F$L6 T(e out3ut :ill go dire.tl4 to t(e 3rinter :it( t(e s4sout .lass o5 S6 00 2 L?S$S JOB US*919*S9CE<2OT$F?19*S9CE<T$7*13<7S8CL SS1S 00J7 $2 L$2*S11& 00JO/*9 TO9 =921PC1234 =S21@8CF >*?1>FJ' 00 *F*C S S<9*8$O2125&&> 00S 7/' T '' U2$T1T /*C <=OL1S*91@8CF< 00 L B*L1G1<SL<<$2H<

67

00 'S21' T F$L< 00 '$S/1GOL'</ SSH 00S?S$2 '' J data oneM in5ile sam3dataM in3ut a % . dM 3ro. 3rintM 0J 00 66. SO&RCES OF )ELP 66.6 &CNS )ELP!ES( T(e UC2S Eel3des-< lo.ated in t(e Com3uter Ser+i.es nneC on t(e .orner o5 *ast Cam3us 9oad and Cedar Street and on t(e 5irst 5loor o5 t(e Bo4d 8raduate Studies 9esear.( Center< 5un.tion as t(e initial .onta.t 3oint 5or all .om3uter related needs asso.iated :it( t(e Uni+ersit4 o5 8eorgia .om3uter s4stems6 T(e 3rimar4 3ur3ose o5 t(e Eel3des- is to aid 5a.ult4< sta55< and students :it( t(e use o5 our .om3uter s4stems t(roug( general .onsulting and in5ormation re;uests6 ssistan.e is 3ro+ided t(roug( tele3(one .onta.ts< :al-ins< and ele.troni. mail6 EoursB 7onda4 ) Frida4< #B&& 7 ) 5B&&/7 /(oneB G4&4H 542)31&6 *)mail ddressB E*L/'*S>ZU8 $nternet ddressB E*L/'*S>Z 9CE*S6U8 6*'U Limited assistan.e is a+aila%le at all sta55ed UC2S Com3uter Ser+i.e Sites6

66.7 )ELPF&L I!S !OC&MENTS


Common $B7 S4stem *rror 7essages and %end Codes T(e Case o5 t(e Sinister S4ntaC *rror Fa.ilit4 ..ess and Ser+i.es 8uide

66.8 -#SIC @CL REFERENCES

$B7 7=S JCL /u%li.ation 2o6 8C2#)13&& ) T(is manual is t(e %asi. re5eren.e do.ument on t(e s4ntaC and usage o5 $B7 JCL6 T(is manual is a+aila%le 5or re5eren.e at t(e Client Ser+i.es Eel3 'es-6 S4stem037& Jo% Control Language %4 8ar4 'e:ard Bro:n ) T(is re5eren.e is a standard and 3o3ular teCt%oo- 5or introdu.ing $B7 JCL to 3ersons 5amiliar :it( .om3uters %ut not ne.essaril4 $B7 37& s4stems6

6#

@CL &tilities4@CL :@o1 Control Language; JCL or Jo% Control Language is used to .ommuni.ate :it( t(e .om3uter"s o3erating s4stem6 JOB is a unit o5 :or- t(e .om3uter is to 3er5orm6 JOB ST9* 7 .onsists o5 JCL statements< 3rograms t(at are to %e eCe.uted< and data t(at are to %e 3ro.essed6 T(e data in.luded in t(e Vo% stream are .alled $2/UT ST9* 7 ' T @CL statements 4@O- statement 4- T(e 5irst statement in a Vo% stream must %e a Vo% statement :(ose 5un.tion is to identi54 t(e Vo% to t(e s4stem6 E"EC statement 4- T(e Vo% statement is usuall4 5ollo:ed %4 an eCe. statement6 T(e eCe. statement names t(e 3rogram or t(e 3ro.edure t(at is to %e eCe.uted6 !! statement 4- Follo:ing t(e eCe. statement are t(e '' statements Gdata de5initionH statements6 T(e '' statements des.ri%e t(e data used %4 t(e 3rogram6 T(e ot(er JCL statements are delimiter< null< .omment< 3ro. R 3end6 n *F*C statement and its '' statements ma-e u3 a Vo% ste36 Vo% ma4 .onsist o5 255 Vo% ste3s6 T(e Vo%< eCe. R '' statements (a+e a .ommon 5ormat :(i.( is B) $$name o5eration o5erand comments Jo% eCe.utes 3ro.edures< 3ro.edures (a+e +arious ste3s to eCe.ute +arious 3rograms< :(i.( use 3arameters and 3arameter 5iles6

Naming con/entions 4Jo%s :ill %e (eld in datasets :it( 6.ntl or 6V.l eCtension e6g6 O9S'*=/69*LP156JCL /ro.edures :ill %e (eld in datasets :it( 3ro.li% or 3ro. eCtension e6g6 O9ST*ST69*LP156/9OCL$B

69

/arameters used :ill %e (eld in datasets :it( 63arm or 3armli% eCtensions e6g O9SL$=*69*LP16/ 97S

Parameters 4There are two 3inds o2 5arameters in the o5erand 2ield 4- 5ositional and 3e+word 3arameters6 T(e o3erating s4stem re.ogniDes 3ositional 3arameters %4 t(eir 3osition in t(e o3erand 5ield6 >e4:ord 3arameters .an %e .oded in an4 order6 /ositional 3arameters must %e .oded in a s3e.i5i. order %e5ore an4 -e4:ord 3arameter6 Consider the Bo1 statement 4Positional 5arameters 16 e6g66 a..ounting in5ormation R 3rogrammers name6 26 a..ounting in5ormation must 3re.ede t(e 3rogrammers name6 36 i5 a 3ositional 3arameter 0su% 3arameter is omitted a .omma must %e .oded in its 3la.e6 Controlling ste5 eFecution T(e CON! 3arameter6 T(e CO2' 3arameter o55ers a met(od o5 testing t(e return .odes issued %4 t(e 3re+ious ste3s to determine :(et(er a ste3 :ill %e eCe.uted6 T(e 5ormat o5 a sim3li5ied +ersion o5 t(e CO2' 3arameter is CON! C:/alueDo5erator;6 =alue is a no6 %et:een K and 9KJ< and o3erator .ould %e gt< ge< e?< ne< lt< le6 T(e CO2' 3arameter .auses t(e +alue entered to %e tested against t(e return .odes 5rom t(e 3re+ious ste3s< using t(e o3erator 3ro+ided6 $5 t(e test .ondition is true< t(e ste3 is s-i33ed6 $5 t(e test .ondition is 5alse< t(e ste3 is eCe.uted6 S+m1olic 5arameters S4m%oli. 3arameters o55er a .on+enient :a4 o5 .(anging a 3ro.edure to 5it 4our re;uirement6 Consider t(e eCam3le 3ro.edure)3roglod< s4s.tl< s4m< et.6 are all s4m%oli. 3arameters6 S4m%oli. 3arameter names ma4 .onsist o5 5rom one to se+en al3(anumeri. or national .(ara.ters 3re.eded %4 an am3ersand6 T(e 5irst .(ara.ter (o:e+er must %e al3(a%eti. 0 national6 *Ce. statement -e4:ord 3arameters ma4 not %e used as names o5 s4m%oli. 3arameters6 For e6g6< R 9*8$O26 T(is restri.tion does not eCtend to '' statement -e4:ord 3arameters6 For e6g6 R'S2 .an %e used as s4m%oli. 3arameter6 Lin3age 5arameter Lin-age 3arameters are used in COBOL 3rograms6 Lin-age 3arameters are 3assed on to t(e COBOL 3rograms t(roug( JCL %4 .oding \3arm1\ 3arameter in t(e eCe. statement6 @(ene+er (e+word 5arameters 16 e6g66 .lass R msgle+el6 26 7S8L*=*L1G1<1H indi.ates 3rint all t(e in3ut JCL R t(e JCL 5rom .atalogued 3ro.edures R 3rint all allo.ation messages6 36 T?/9U21SC 2 .auses t(e Vo%"s JCL to %e .(e.-ed 5or s4ntaC errors R 3re+ents t(e Vo% 5rom eCe.uting6

7&

lin-age 3arameters (a+e to %e used< Lin-age se.tion (as to %e .oded in t(e COBOL 3rogram a5ter t(e data di+ision and t(e 3ro.edure di+ision s(ould s3e.i54 t(e use o5 lin-age se.tion6 00''4&&S&1 *F*C /871''4&&9&&</ 971QR/9OCT?/*R'B27*R'$CT27*Q ,eneration !ata ,rou5s:,!,; generation data grou5 is a .olle.tion< or grou3< o5 .ataloged data sets (a+ing t(e same name and related to one anot(er .(ronologi.all46 *a.( o5 t(ese datasets is .alled a generation data set or< sim3l4< a generation6 *a.( generation data set is distinguis(ed %4 ot(ers %4 t(e generation num1er6 T(e main ad+antage o5 using a 8'8 is t(at t(e same JCL .an %e reused :it(out .(ange6 ,eneration grou5 indeF .ontains in5ormation on (o: man4 generations are to %e retained and :(at to do :(en t(e indeC gets 5ull6 !e2ining a generation grou5 indeF using I!C#MS 4$'C 7S is t(e name o5 t(e a..ess met(od ser+i.es utilit4 3rogram t(at 3er5orms 5un.tions +ital to t(e +irtual storage a..ess met(od G=S 7H6 $'C 7S re;uires a region o5 3&&>< a S?S/9$2T '' statement 5or messages and a S?S$2 '' statement 5or .ontrol statements6 T(e command 5ormat B)!EFINE ,!, :P#RMS;6 !e2ine ,!, 5arameters /arameter 2 7*

%%r+ 7eaning 8'' name6 T(e no6 O5 generations 3ermitted 5or t(is gdg L$7$T L$7 T(e maC is 2556 $5 em3t4 is s3e.i5ied< all data sets are to %e remo+ed *7/T? *7/ 5rom t(e indeC :(en t(e limit is rea.(ed6 2O*7/T? 2*7/ 2O*7/T? is t(e de5ault6 O@2*9 User identi5i.ation Go3tionalH6 $5 S.rat.( is s3e.i5ied< t(e dataset is s.rat.(ed :(en SC9 TCE SC9 t(e dataset is remo+ed 5rom t(e indeC 2OSC9 TCE 2SC9 2OSC9 TCE is t(e de5ault6 TO Gdate 'ataset retention 3eriod6 FO9Gda4sH 'ataset retention 3eriod6

Creating and accessing a generation T(e generation num%er ma4 %e relati+e or a%solute6 $5 t(e 'S name in t(e grou3 is !!SN&S.!E T! .!!9=K8K7D t(en to a..ess t(e .urrent generation< 4ou .ode !SNC!!SN&S.!E T! .!!9=K8K7:K;6 To a..ess t(e 3re+ious generation< 4ou .ode !SNC !!SN&S.!E T! .!!9=K8K7:-6; t(e generation %e5ore :ould %e !SNC !!SN&S.!E T! .!!9=K8K7:-7;6

71

$5 4ou :ant to .reate a ne: generation< 4ou .ode !SNC !!SN&S.!E T! .!!9=K8K7:L6;. T(e a%solute no6 used %4 t(e s4stem is in t(e 5orm ,"""" ''<:(ere FFFF is a generation no. 5rom KKKK to JJJJ and ++ is a /ersion no. 5rom KK to JJ6 T(us t(e generation s3e.i5ied as !SNC !!SN&S.!E T! .!!9=K8K7:K; mig(t a33ear to t(e s4stem< 5or e6g66 <as !!SN&S.!E T! .!!9=K8K7.,KKK= KK6 T(en t(e data set :it( a relati+e no6 o5 :-6; :ould %e !!SN&S.!E T! .!!9=K8K7.,KKK< KK< :L6; :ould %e !SN&S.!E T! .!!9=K8K7.,KKK> KK.

Li1raries not(er name 5or a li%rar4 is a 3artitioned data setG/'SH6 Li%raries .an %e .reated<a..essed R modi5ied using utilit4 3rograms li-e IEF-R69< IE-,ENER< IE-PTPC)< IE-&P!TE< IE-COP'< et.6 $*FB914< $*B8*2*9 R $*BCO/? are t(e most 5re;uentl4 used utilities on an4 3roVe.t6

IE.,R:= Stri.tl4 s3ea-ing it is not a utilit4 3rogram %e.ause it does not(ing6 $t .lears register 15 and B9G%ran.(H 146 $t is used to .reate or delete a li%rar4 %ased on t(e '' statement 3arameters6

IE,0ENER IE-,ENER uses 5our data sets des.ri%ed %4 S?S/9$2T< S?S$2< S?SUT1 R S?SUT26 S'SPRINT is t(e !!N#ME o5 t(e data set t(at $*B8*2*9 uses to :rite messages6 S'SIN is t(e !!N#ME o5 t(e data set t(at .ontains t(e .ontrol statements to tell $*B8*2*9 (o: t(e in3ut data set s(ould %e modi5ied :(ile it is %eing .o3ied6 S'S&T6 is t(e !!N#ME o5 t(e in3ut data set t(at $*B8*2*9 is to .o346 S'S&T7 is t(e !!N#ME o5 t(e out3ut data set t(at is to %e .reated6

IE,CO!4 IE-COP' is a utilit4 3rogram t(at ma4 %e used to .o34 one or more mem%ers 5rom an eCisting /'S to a ne: or eCisting /'S< to ma-e a %a.-u3 .o34 o5 a /'S< and to reorganiDe a /'S in order to re.laim t(e unused s3a.e6 D.SORT Sorting means 3utting re.ords in a data set into a s3e.i5ied order6 Merging is .losel4 related to sortingM it means .om%ining re.ords 5rom t:o or more sorted

72

datasets into one data set t(at is in t(e same order6 T(e sort 3rogram re;uires t(ree 3ie.es o5 in5ormationB :(ere to 5ind t(e in3ut data< :(i.( 5ields in t(e re.ords to do t(e sorting on< and :(ere to 3ut t(e sorted out3ut data set6 Sort control statements T(e most .ommonl4 used sort .ontrol statements are SORT and MER,E6 t43i.al .ontrol statement :ould loo- li-e B SORT FIEL!SC:6D6KDC)D#;6 T(e s+ntaF 5or t(e 5ields 3arameter is FIEL!SC:5ositionDlengthD2ormatDse?uence...; or FIEL!SC:5ositionDlengthDse?uence...;< FORM#TC2ormat6 Position is t(e starting %4te o5 t(e .ontrol 5ield in t(e re.ord6 Length is t(e lengt( in %4tes o5 t(e .ontrol 5ield6 Format is t(e 5ormat o5 t(e data in t(e .ontrol 5ield6 Commonl4 used +alues 5or 5ormat are I' 5or Doned de.imal< /' 5or 3a.-ed de.imal< B$ 5or %inar4< C 5or SC$$ .(ara.ter< CE 5or *BC'$C .(ara.ter< ! 5or *BC'$C .(ara.ter using alternati+e .ollating se;uen.e6 Se?uence is eit(er 5or as.ending or ' 5or des.ending6 The include M omit statements T(e in.lude R omit statements are used to sele.t t(e re.ords to %e in.luded in t(e sort6 B4 sele.ting re.ords 5or t(e sort< 4ou .an de.rease t(e amount o5 time t(e sort re;uires6 Onl4 one in.lude or omit statement is 3ermitted in a sort6 T(e s4ntaC is include condC:test; R omit condC:test; T(e onl4 di55eren.e %et:een in.lude R omit is in t(e result6 $5 test .oded :it( in.lude is true 5or a 3arti.ular re.ord< t(at re.ord is in.luded in t(e sortM :(ereas i5 test .oded :it( omit is true< t(at re.ord is omitted 5rom t(e sort6 $n eit(er .ase test is .oded as 5ollo:s testC:5ositionDlengthD2ormatDo5eratorD/alue; T(e 3osition<lengt( R 5ormat su% 3arameters s3e.i54 a 5ield in t(e re.ord<Vust as in sort 5ields 3arameter6 T(e o3erator su% 3arameter ma4 %e ,T< ,E< E%< NE< LT R LE6 T(e last su% 3arameter< +alue< ma4 %e eit(er a 5ield in t(e re.ord)s3e.i5ied %4 its o:n 3osition< lengt( R 5ormat< or a .onstant6 2umeri. .onstants are .oded as sim3le +alues< su.( as 15 or )2&6 C(ara.ter .onstants are en.losed in a3ostro3(es and 3re.eded %4 a .<as in ."de."6 EeCade.imal .onstants are en.losed in a3ostro3(es and 3re.eded %4 an C<as in C"5152.3"6 $5 more t(an one test is .oded< t(e tests are Voined %4 t(e %oolean o3erator #N! or OR66 # t+5ical include statement would loo3 li3e B INCL&!E CON!C:7JD6DC)DE%DCNLN; The INREC M O&TREC statements B T(ese statements are used to re5ormat t(e re.ords6 T(e INREC statement is used %e5ore sort to s(orten t(e re.ords %4 eliminating un:anted 5ields6 T(is results in 5aster sorting6 T(e O&TREC statement is used a5ter t(e sort to im3ro+e reada%ilit46 INREC M O&TREC ha/e identical 2ormatsB INREC FIEL!SC:n"D5ositionDlengthDalignD...; O&TREC FIEL!SC:n"D5ositionDlengthDalignD...; T(e 5irst su% 3arameter<n"<is o3tionalM it s3e.i5ies t(e no6 o5 s3a.es to %e inserted in t(e re5ormatted re.ord6 T(e neCt t:o 3arameters< 5osition R length< s3e.i54 t(e 5ield in t(e in3ut re.ord6 T(e t(ird su% 3arameter< align< is o3tionalM t(e 3ossi%le +alues %eing E< F< and ' s3e.i54

73

alignment on a (al5):ord< 5ull):ord< and dou%le):ord %oundar4 res3e.ti+el46

Merging @(en 4ou merge< 4ou start :it( t:o or more sorted data sets and .reate a ne: data set t(at is in t(e same sorted order6 @(ile merging 4ou must s3e.i54 more t(an one in3ut data set6 T(ese data sets (a+e t(e '' names SORTINnn< :(ere nn ma4 range 5rom &1 to 166 S(IPREC R E%&#LS 0 NOE%&#LS o3tions are not used on t(e merge statement6 T(e sort .ontrol statements are normall4 .oded in a 3arameter 5ile6

VSAM D# # se s T(ere are t(ree t43es o5 =S 7 data sets B -e4 se;uen.e data sets<entr4 se;uen.e data sets< and relati+e re.ord data sets6 For =S 7 data sets< unli-e non)+sam data sets< a utilit4 3rogram< $'C 7S is used to 3er5orm 5un.tions li-e B 16 26 36 46 56 llo.ating s3a.e on ' S' Su33l4 des.ri3tion o5 t(e data set Set t(e data set"s dis3osition Load t(e data set /rint t(e data set

!EFINE CL&STER is t(e .ommand using :(i.( all t(e des.ri3ti+e in5ormation a%out t(e =S 7 data set is su33lied6 REPRO .ommand ma4 %e used to load data into a =S 7 data set6 PRINT .ommand is used to o%tain a listing o5 a =S 7 data set6 FILE-#I! utilit4 5rom $S/F 3rimar4 menuG+61H .an %e used to allo.ate 0 manage =S 7 data sets6

74

@CL Error Codes n $0O error o.urred6 C(e.- reason .ode 5or eCa.t .ause6 *Cam3les are tr4ing to read %e4ond *nd o5 File< tr4ing to :rite to an in3ut 5ile or a 5ile lengt( error6 $n+alid $0O re.ord< eg attem3ting to :rite a re.ord t(at is longer t(an t(e maCimum re.ord lengt(6 *rror o..ured during O/*26 *g $n+alid 'CB6 *rror O/*2ing a dataset< eg /'S mem%er does not eCist< re.ord lengt( in 3rogram doesn"t mat.( dataset"s re.ord lengt(6 O3eration *C.e3tion6 C(e.- 5or su%s.ri3t errors< missing '' .ard< 5ile not o3ened6 /rote.tion *C.e3tion0Storage =iolation6 Tr4ing to a..ess storage not a+aila%le to t(e 3rogram6 Can %e .aused %4 a su%s.ri3ting error or reading0:riting a 5ile t(at isn"t o3en6 /rogram C(e.- *C.e3tion ) 'ata6 C(e.- 5or s3a.es in a 3a.-ed de.imal or numeri. 5ield6 C(e.- to see i5 re.ord la4outs or 5ile la4outs (a+e %een .(anged6 Jo% (as %een .an.elled6 T(e +alue o5 C :ill +ar4 de3ending on t(e :a4 t(e Vo% :as .an.elled6 S222 means Vo% :as .an.elled %4 a user or o3erator :it(out a dum36 $5 a TSO session times out 4ou :ill 3ro%a%l4 get an S522 a%end .ode6 Una%le Lin- or Load6 T(e Vo% :as una%le to 5ind t(e s3e.i5ied load module6 C(e.- t(at t(e Vo% is loo-ing at t(e .orre.t Load Li%raries< s3e.i54 a ST*/L$B i5 re;uired6 2ot enoug( =irtual Sorage to satis54 a 8*T7 $2 or F9**7 $2 re;uest6 Una%le to o%tain to o%tain enoug( s3a.e to satis54 a 9*8$O21 re;uest 7a4 need to .(ange 9*8$O2 statement in t(e JCL66 2ot enoug( storage a+aila%le to satis54 a 8*T7 $2 or F9**7 $2 re;uest66 Jo% :as ana%le to allo.ate an area o5 memor4 o5 t(e .orre.t siDe6 Tr4 S3e.i54ing or amending t(e \9*8$O21" JCL statement6 ?ou are tr4ing to a..ess a dataset :(i.( 4ou are not aut(oriDed to use6 Una%le to allo.ate enoug( storage 5or a dataset6 ?ou mig(t need to in.rease t(e amount o5 3rimar4 and se.ondar4 s3a.e to %e allo.ated 5or a dataset in t(e \S/ C*1" 3arameter< or 4ou ma4 (a+e to mo+e t(e dataset to a di55erent ' S' de+i+e :(i.( (as enoug(t s3a.e to store t(e dataset6 \C" :ill +ar4< li-el4 %ends are SB37< S'37 or S*376 $0O Logi. error6 T43i.al reasons areM tr4ing to :rite to a 5ile o3ened as in3utM 9e:rite :it(out a 3re+ious read6 See t(e message $8I&2&$ 5or

S&&1 S&&2 S&&4 S&13 S&C1 S&C4 S&C7

SC22

S#&6 S#& S#22 S#7# S913 SC37 U1&2&

75

U1&35

details o5 t(e eCa.t reason6 $na+lid O/*20CLOS*6 C(e.- t(ere is a '' statement 5or t(e 5ile6 See t(e message $8I&35$ 5or more detailed in5ormation6

&&1 &&2 &&4 &&# &13 &2# &CF 7&6 #&4 #&6 #& #7# 737 14 B37 '37 *37

$0O *99O9 $0O $2= L$' 9*CO9' O/*2 *99O9 $0O S?2 ' *99O9 O/*2 *99O9 / 8$28 $0O *99O9 /9O89 7 CE*C> *FC*/T$O2SB &C1 O/*9 T$O2 &C4 /9OT*CT$O2 0 ''9*SS$28 &C5 ''9*SS$28 2O2)*F*CUT BL* /9O89 7 $2SUFF$C$*2T =$9TU L STO9 8* U2 BL* TO LO ' GL$2> *TCH /9O89 7 $2SUFF$C$*2T =$9TU L STO9 8* $2SUFF$C$*2T =$9TU L STO9 8* $0O *99O9 $0O *99O9 $2SUFF$C$*2T ' S' S/ C* $2SUFF$C$*2T ' S' S/ C* $2SUFF$C$*2T ' S' S/ C*

VSAM +o"i%#$ error %odes T(ese .odes indi.ate =S 7 errors6 T(e4 a33ear on t(e JOB log6 &&4G&4H &&#G&#H &12G&CH 9ead 3ast end o5 5ile ?ou attem3ted to store a re.ord :it( a 'u3li.ate >e4< or t(ere is a du3li.ate re.ord 5or an alternate indeC :it( t(e uni;ue -e4 o3tion6 ?ou attem3ted to store a re.ord out o5 s.ending >e4 Se;uen.e in S-i3)Se;uential 7odeM re.ord (ad a 'u3li.ate >e4M 5or S-i3) Se;uential 3ro.essing 4our 8*T< /UT< and /O$2T 9e;uests are not re5eren.ing re.ords in s.ending Se;uen.eM or< 5or S-i3)Se;uential

76

&16G1&H &2&G14H &24G1#H &2#G1CH &36G24H &4&G2#H &6#G44H &74G4 H &76G4CH &#&G5&H &#4G54H

&##G5#H

92G5CH 96G6&H

1&4G6#H 112G7&H 116G74H 12&G7#H 136G##H 14&G#CH 144G9&H 14#G94H 152G9#H 156G9CH 192GC&H

9etrie+al< t(e -e4 re;uested is lo:er t(an t(e 3re+ious -e4 re;uested6 For S(ared 9esour.es< %u55er 3ool is 5ull6 9e.ord not 5ound6 9e.ord alread4 (eld in eC.lusi+e .ontrol %4 anot(er re;uester6 9e.ord resides on a +olume t(at .annot %e mounted6 'ata set .annot %e eCtended %e.ause =S 7 .anQt allo.ate additional 'ire.t) ..ess Storage S3a.e6 *it(er t(ere is not enoug( s3a.e le5t to ma-e t(e se.ondar4 allo.ation or 4ou attem3ted to in.rease t(e siDe o5 a data set :(ile 3ro.essing SE9O/T14 and '$S/1SE96 >e4 9anges :ere s3e.i5ied 5or t(e data set :(en it :as de5ined %ut no range :as s3e.i5ied t(at in.ludes t(e re.ord to %e inserted6 $nsu55i.ient =irtual Storage to .om3lete t(e re;uest6 &44G2 H @orarea too small6 &64G4&H ll a+aila%le strings are in use6 ?ou attem3ted to use a t43e o5 3ro.essing GOut3ut or Control)$nter+al /ro.essingH t(at :as not s3e.i5ied :(en t(e data set :as o3ened6 Tr4ing to use -e4s on *S'S or 99'S6 ?ou issued an ddressed or Control)$nter+al /UT to add to a >e4) Se;uen.ed data set< or issued a Control)$nter+al 3ut to a 9elati+e 9e.ord data set6 Tr4ing to delete 5rom *S'S6 Using O/TCO'*1LOC 5or a /UT6 ?ou issued a Se;uential 8*T re;uest :it(out (a+ing .aused =S 7 to %e 3ositioned 5or it< or 4ou .(anged 5rom ddressed ..ess to >e4ed ..ess :it(out .ausing =S 7 to %e 3ositioned 5or >e4ed) Se;uential 9etrie+alM t(ere :as no Se;uential /UT insert 5or a 9elati+e 9e.ord data set< or 4ou attem3ted an illegal s:it.( %et:een 5or:ard and %a.-:ard 3ro.essing6 /UT 5or u3date or an *9 S* :as issued :it(out a 3re+ious 8*T 5or u3date< or a /UT$F :as issued :it(out a 3re+ious 8*T$F6 C(anging t(e /rime >e4 or >e4 o5 9e5eren.e :(en ma-ing an u3date6 1&&G64 Tr4ing to .(ange re.ord lengt(6 (e 9/L o3tions are eit(er in+alid or .on5li.ting6 1&#G6CH 9*CL*2 s3e.i5ied :as larger t(an t(e maCimum allo:ed< e;ual to &< or smaller t(an t(e sum o5 t(e lengt( and t(e dis3la.ement o5 t(e -e4 5ieldM 9*CL*2 :as not e;ual to re.ord GSLOTH siDe s3e.i5ied 5or a 9elati+e 9e.ord data set6 $n+alid -e4 lengt(6 Tr4ing to u3date an em3t4 dataset6 9e;uest :as su%mitted %4 t(e :rong tas-6 132G#4H n attem3t :as made in Lo.ate 7ode to retrie+e a S3anned 9e.ord6 ?ou attem3ted an ddressed 8*T o5 a S3anned re.ord in a >e4) Se;uen.ed data set6 $n.onsistent S3anned re.ord6 $n+alid 3ointer Gno asso.iated %ase re.ordH in an lternate $ndeC6 7aCimum num%er o5 lternate $ndeC 3ointers eC.eeded6 2ot enoug( %u55ers a+aila%le6 $n+alid .ontrol inter+al6 $n+alid 9elati+e 9e.ord num%er in a 99'S dataset6

77

196GC4H 2&&GC#H 2&4GCCH 252GFCH

ddressed a..ess to a 9elati+e 9e.ord G99'SH dataset is not allo:ed6 ddressed ..ess or 8eneri. Ba.-:ard 3ro.essing %4 >e4 t(ru a 3at( is not allo:ed6 ttem3ting a /UT in %a.-:ard mode6 9e.ord mode 3ro.essing is not allo:ed 5or a Linear data set6

S#M O5en error codes 136G##H 144G9&H 14#G94H 152G9#H 164G 4H 16#G #H 176GB&H 1#&GB4H 1#4GB#H 1##GBCH 192GC&H 232G*#H 236G*CH 244GF4H 2ot enoug( =irtual)Storage S3a.e is a+aila%le 5or @or- reas< Control Blo.-s< or Bu55ers6 n un.orre.ta%le $0O error o..urred :(ile =S 7 :as 9eading or @riting a .atalog re.ord6 2o re.ord 5or t(e data set to %e o3ened :as 5ound in t(e a+aila%le .atalogGsH or an unidenti5ied error o..urred :(ile =S 7 :as sear.(ing t(e .atalog6 Se.urit4 =eri5i.ation 5ailedM t(e 3ass:ord s3e.i5ied in t(e ..ess) 7et(od Control Blo.- 5or a s3e.i5ied le+el o5 a..ess does not mat.( t(e 3ass:ord in t(e .atalog 5or t(at le+el o5 a..ess6 n un.orre.ta%le $0O error o..urred :(ile =S 7 :as 9eading t(e =olume La%el6 T(e data set is not a+aila%le 5or t(e t43e o5 3ro.essing 4ou s3e.i54< or an attem3t :as made to o3en a 9eusa%le data set :it( t(e 9eset o3tion :(ile anot(er user (ad t(e data set6 n error o..urred :(ile =S 7 :as attem3ting to 5iC a 3age o5 =irtual storage in 9eal storage6 =S 7 .atalog s3e.i5ied in JCL eit(er does not eCist or is not o3en< and no re.ord 5or t(e data set to %e o3ened :as 5ound in an4 ot(er .atalog6 n un.orre.ta%le $0O error o..urred :(ile =S 7 :as .om3leting an $0O re;uest6 T(e data set indi.ated %4 t(e ..ess)7et(od Control Blo.- is not o5 t(e t43e t(at ma4 %e s3e.i5ied %4 an ..ess)7et(od Control Blo.-6 n unusa%le data set :as o3ened 5or out3ut6 9eset :as s3e.i5ied 5or a nonreusa%le data set and t(e data set is not em3t46 3ermanent Staging error o..urred in 7SS G .;uireH6 T(e =olume .ontaining t(e Catalog 9e.o+er4 area :as not mounted

7#

and +eri5ied 5or out3ut 3ro.essing6

@CL F#%Os 4!uestionB @(at is t(e 3arameter to %e 3assed in t(e Vo% .ard 5or t(e unlimited time< irres3e.ti+e o5 t(e Vo% .lass] ns:erB T$7*1144& !uestionB Eo: do 4ou su%mit JCL +ia a Co%ol 3rogram] ns:erB Use a 5ile 00dd1 '' s4sout1GJ<intrdrH :rite 4our JCL to t(is 5ile6 !uestionB 'e5inition o5 CO2' 3)r in JCL and a .orre.tion to a 3re+iousl4 3osted ;uestion ns:erB CO2' is a .ondition 3arameter< .onsists o5 2 su%3arameters< 1st ) return .ode 5rom t(e 3re+ious ste3< 2nd ) .ondition6 $5 CO2' is true< t(e ste3 on :(i.( CO2' is .oded :ill %e B?/ SS*'6 !uestionB !H @E T $S 7* 2T B? S&C7 2' S&C3& S?ST*7 B*2' CO'*S6 ns:erB H S&C7 ) 'ata eC.e3tion error ) 4ou :ill get it :(ene+er 4ou are tr4ing to mo+e t(e lo: +alues or s3a.es into t(e numeri. 5ield< or .om3are t(e numeri. 5ields :it( lo: +alues< or tr4

79

to do some arit(meti. o3erations on t(e lo: +alues6 To a+oid t(is 4ou (a+e to al:a4s initialiDe t(e numeri. 5ields ot(er:ise t(e4 :ill .ontain t(e lo: +alues6 BHS&C 3& ) $ (a+e ne+er (eard o5 it< let 4ou -no: i5 $ .ome a..ross it6 !uestionB Eo: to 3ass t(e tem3 dataset 5orm one JOB ste3 to anot(er] ns:erB B4 s3e.i54ing t(e '$S/ as / SS 5or t(e tem3 dataset !uestionB @(at is a CO2' 3arameter in JCL] ns:erB CO2' means .ondition 3arameter6 $t is .om3ared :it( s4stem return .ode o5 3re+ious ste36 00ste31 eCe. 3gm1a%.d00ste32 eCe. 3gm1C4D< .ond1G4<ltH ste32 :ill %e eCe.uted :(en s4stem return .ode o5 ste31 is less t(an 46 !uestionB @9$T* JCL TO *F*CUT* JOB B? 7 67 O2 J 2 2&<19#6]

ns:erB TE* .ode $SB 00J7 $2 '* 'L$2*1G&7&&<B< &12&#6H !uestionB EO@ 7 2? T?/*S OF L$B9 9$*S 9* TE*9* $2 JCL] ns:erB L$B9 9$*S 9* OF TE9** T?/*S6 16S?T*7 L$B9 9$*SB SUCE S S?S16L$2>L$B 26/9$= T* L$B9 9$*SB S/*C$F$*' $2 JOBL$B O9 ST*/L$B '' ST T*7*2TS6 /9*=$OUS ST*/ OF TE* JOB6

36T*7/O9 9? L$B9 9$*SB C9* T*' $2

!uestionB @E T U 7* 2S B? $2CLU'* ST T*7*2T $2 JCL] ns:erB 2 $2CLU'* ST T*7*2T $'*2T$F$*S 7*7B*9 /F /'S O9 /'S* TE T CO2T $2S6TE$S S*T OF JCL ST T*7*2TS $S C LL*' 2 $2CLU'* 89OU/6TE* S?ST*7 9*/L C*S TE* $2CLU'* ST T*7*2T @$TE TE* ST T*7*2TS $2 TE* $2CLU'* 89OU/6 !uestionB TE* 7 F$7U7 2U7B*9 OF $2)ST9* 7 /9OC*'U9* ?OU C 2 CO'* $2 2? JCL $S] ns:erB 156 !uestionB @(at 4ou mean %4 s-eleton J.l]

#&

ns:erB Jell :(i.( .(anges during run time i6e6 t(e +alues 5or t(e Vell su.( as 3igm4 name< did name :ill .(ange 6i6e6 same Vell .an %e used 5or +arious Vo%< e;ui+alent to d4nami. s;l666 !uestionB Eo: do 4ou su%mit a JCL under C$CS en+ironment] ns:erB *dit t(e JCL in *Ctra 3artition T'! and su%mit t(e same using some s4stem .ommand Gnot sureH under C$CS su%s4stem6 T(is is :(at i t(in-< 3lease .lari546666 !uestionB :(at is JCL ns:erB $t is inter5a.e %et:een o3erating s4stem Gm+sH R a33li.ation 3rogram6 :(en 2 related 3rograms are .om%ined toget(er on .ontrol statements is .alled Vo% .ontrol language !uestionB @(at is t(e maC %lo.-siDe 5or a Ta3e 5ile] ns:erB $t is 32<76&6Based on t(at :e .an .al.ulate e55i.ient num%er o5 9e.ords in a Blo.-

!uestionB @(at are t(e %asi. JCL Statements 5or a Jo%] ns:erB 16JOB B $denti5ies a Vo% and su33lies a..ounting in5o6 26*F*CB $denti5ies a Vo% ste3 %4 indi.ating t(e name o5 t(e 3rogram to %e eCe.uted6 36''B $denti5ies a data set to %e allo.ated 5or t(e Vo% ste36 46'elimiter G0JHB 7ar-s t(e end o5 an in)stream dataset6 562ull G00HB7ar-s t(e end o5 a Vo%6 66Comments G00JHB /ro+ides Comments6 76/9OC B 7ar-s t(e %eginning o5 a 3ro.edure6 #6/*2' B 7ar-s t(e end o5 a 3ro.edure6 96OUT/UTB Su33lies o3tions 5or S?SOUT 3ro.essing6 !uestionB @(at does t(e statementsB t43e run1s.an and t43e run1(old doing a JCL statement

#1

ns:erB T43run1s.an .(e.-s t(e JCL 5or errors< T43run1(old (olds t(e Vo% until 5urt(er noti.e6 !uestionB @(i.( o5 t(e 5ollo:ing is online transa.tion] C$CS< 'B2 and JCl ns:erB C$CS !uestionB Eo: man4 /*9FO97Qs are t(ere in COBOL)$$] ns:erB 5 !uestionB :(i.( is t(e most :idel4 used %at.( 3er5orman.e monitor 5or 'B2] ns:erB 'B2/7 !uestionB @(at is !S 7 error usuall4 :(en it is o..urs] ns:erB Usuall4 it is o..urs at t(e time o5 Vo% su%mission6 !uestionB :(at is t(e 3ur3ose o5 in.lude statement in a V.l] ns:erB $t is used as an alternati+e 5or ste3li%6@(en :e s3e.i54 t(e dataset name in in.lude< it :ill sear.( in all t(e datasets s3e.i5ied in t(e in.lude dataset6 !uestionB $S $T /OSS$BL* TO >2O@ TE* 9*7 $2$28 F9** S/ C* $2 2 CO2T9OL $2T*9= L0CO2T9OL 9* O2C* 2 $2S*9T$O2 E S B**2 7 '*6 ns:erB 2OT /OSS$BL* !uestionB :(at does so.&4 error mean] ns:erB T(is error is 5a.ed :(en :e eCe.ute t(e .o%ol 3rogram6t(e main reason 5or t(is error is t(at a +aria%le is de5ined :it( less .(ara.ters and :e are tr4ing to mo+e data :(i.( is larger t(an t(e a.tual storage s3a.e6 !uestionB @(at is JCL ns:erB JCL is Jo% Control Language and is used 5or Bat.( 3ro.essing6 T(e startu3 3ro.edures o5 OS and standard 3rodu.ts li-e C$CS et. are :ritten in JCL6 !uestionB $n :(i.( ta%le /L 2 is registered in] ns:erB 9CT

#2

!uestionB 8'8] ns:erB 8'8 ) grou3 o5 dataset t(at are logi.all4 or .(ronologi.all4 related< re5erred %4 name and a relati+e generation num%er ) an integer :(i.( identi5ies t(e generation o5 a dataset and is .oded in 3arent(eses a5ter dataset name6 %solute 8'8 name ) 8CCCC=44< :(ere CCCC)a%solute gen6num%er< 44)+ersion num%er6 Can %e se;uential< dire.t< 3artitioned6 G=S 7 ) noH6 7ust al:a4s %e .ataloged6 d+antage ) all datasets (a+e t(e same name and s4stem -ee3s tra.- o5 adding ne: and retaining 3re+ious generations and deleting oldest su..essi+e generation6 To .reate a 8'8 :e .reate a 8'8 indeC in t(e s4stem .atalog :it( $'C 7S utilit4 and t(en a model G3rotot43e< 'SCBH on t(e same +olume to su33l4 'CB in5ormation6 *m3t4 ) :(en limit is rea.(ed all mem%ers are remo+ed 5rom t(e indeC< ot(er:ise)onl4 oldest6 S.rat.()remo+ed mem%ers are un.ataloged R deleted< ot(er:ise ) remo+ed R un.ataloged< %ut remain in t(e s4stem Gnot mem%ers o5 8'8 an4 moreH6 8'8 num%er is u3dated at t(e end o5 t(e Vo%6 $5 num%er is not s3e.i5ied all generations :ill %e 3ro.essed 5rom t(e %eginning6

!uestionB :(at is V.l ns:erB $t is used to .ommuni.ate %et:een t(e terminals6 !uestionB :(at do 4ou mean B4 s3ooling] *C3and S/OOL] ns:erB T(is is managed %4 J*S6T(is is used 5or !ueuing t(e Out3uts t(at are intended 5or /rinting and are 5irst stored in S/OOL' S'6 T(is .an %e managed Using !uestionB Eo: man4 $nstream)/ro.eduresG3ro.sH .an %e Coded in a single Jo%] ns:erB T(e ns:er isB 15 !uestionB FO9 EO@ LO28 7 $2F9 7* ns:erB 24# ' ?S !uestionB Eo: ma4 di+isions are t(ere in JCL)COBOL] ns:erB S$F !uestionB 7 F6 2O OF '' ST T*7*2TS $2 JOB JOB C 2 B* *F*CUT*' CO2T$2U*OUSL? $2

#3

ns:erB 3273 !uestionB EO@ 7UCE S/ C* OS LLOC T*S @E*2 ?OU C9* T* ns:erB 56 >B !uestionB 7$2 2O OF ' T S*T 2 7*SG/'SH $2 O2* '$9*CTO9? BLOC>] ns:erB S$F !uestionB TE* 7 F$7U7 2U7B*9 OF ST*/S $2 ns:erB 255 !uestionB Eo: mu.( is memor4 s3a.e in+ol+ed< :(en :e .ode BLOC>S$I*< T9> R C?L ns:erB One %lo.- .onstitutes 32>B o5 5ormatted memor40 42>B o5 Un5ormatted memor4< 6 %lo.-s ma-es one Tra.- R 15 Tra.-s ma-es one .4linder6 !uestionB @(at is 'S2'B&6] ns:erB T(is is t(e /la.e :(ere 'B2 Catalog resides6 !uestionB @(at is t(e use o5 'S2'B&7] ns:erB T(is is t(e area :(ere sorting ta-es 3la.e in 'B26 !uestionB @(at is t(e 3ur3ose o5 $denti5i.ation 'i+ision] ns:erB 'o.umentation6 !uestionB @E T $S ' T CO7 'B] ns:erB $T $S ' T B S* US*' @$TE =S*6 JOB] /S O9 /'S]

!uestionB @(at is a 'umm4 Utilit4 and :(at it does ] ns:erB $*FB914 is a 'umm4 utilit4 and it is used 5or t(e ta-e o5 *F*C /871 6666 Statement in JCLX:(en used it :ouldnQt 3er5orm an4 tas-Y6 e6g6 @(ile llo.ating a dataset 4ou donQt (a+e to run an4 utilit4 Xt(is .ould %e done %4 gi+ing dis31ne: in '' statementY6 But 5or a /87 name must %e gi+en in *F*C statement< it is used6 !uestionB @(at 3 guidelines do :e (a+e to 5ollo: :(en .on.atenating '' statements]

#4

ns:erB 16 'atasets must %e o5 t(e same t43e Gdis- or ta3eH 26 ll datasets must (a+e t(e same logi.al re.ord lengt( 36 T(e dataset :it( t(e largest %lo.- siDe must %e listed 5irst6 !uestionB On t(e '' statement< :(at is t(e main di55eren.e %et:een .reating a ne: se;uential 5lat 5ile and a 3artitioned dataset] ns:erB S/ C*1Gn<mH 5or a se;uential 5ile< S/ C*1Gn<m<3H 5or a /'S :(ere n< m< and 3 are num%ers6 T(e 3 designates (o: man4 dire.tor4 %lo.-s to allo.ate6 !uestionB @(at is t(e di55eren.e %et:een $*B8*2*9< $*BCO/? and 9*/9O in $'C 7S utilit4] ns:erB $*B8*2*9 )) T(is is a dataset utilit4 5or .o34ing se;uential datasets :(i.( 3rodu.es a /'S or a mem%er 5rom a se;uential dataset6 $*BCO/? )) T(is is a dataset utilit4 5or .o34ing one /'S to anot(er or to merge /'Ss6 9*/9O )) T(is is 5or .o34ing se;uential datasets6 !uestionB Eo: do 4ou su%mit JCL +ia a Co%ol 3rogram] ns:erB Use a 5ile 00dd1 '' s4sout1GJ<intrdrH :rite 4our JCL to t(is 5ile6 /l some on tr4 t(is out6 !uestionB Eo: to eCe.ute a set o5 JCL statements 5rom a COBOL 3rogram ns:erB Using *F*C C$CS S/OOL @9$T*G+ar)nameH *2')*F*C .ommand6+ar)name is a COBOL (ost stru.ture .ontaining JCL statements6 !uestionB @(at is t(e di55eren.e %et:een stati. .all R '4nami. .all ns:erB $n t(e .ase o5 Stati. .all< t(e .alled 3rogram is a stand along 3rogram< it is an eCe.uta%le 3rogram 6 'uring run time :e .an .all it in our .alled 3rogram6 s a%out '4nami. .all< t(e .alled 3rogram is not an eCe.uta%le 3rogram it .an eCe.uted t(ru t(e .alled 3rogram !uestionB @(at is t(e di55eren.e %et:een .atalouge 3ro.edure and $n)Stream 3ro.edure] ns:erB $n Stream 3ro.edures are set o5 JCL statements :ritten %et:een JOB and *F*C statements< start :it( /9OC and end :it( /*2' statement6 7ainl4 used to test .atalog 3ro.edures6 Cataloged 3ro.edure is .ataloged on t(e 3ro.edure li%rar4 and is .alled %4 s3e.i54ing t(e 3ro.edure name on t(e *F*C statement6

#5

!uestionB @(at do 4ou 5eel ma-es a good 3rogram] ns:erB 3rogram t(at 5ollo:s a to3 do:n a33roa.(6 $t is also one t(at ot(er 3rogrammers or users .an 5ollo: logi.all4 and is eas4 to read and understand6 !uestionB Can :e %ro:se or edit t(e 8'8 dataset i5 it is a ta3e entr4] ns:erB 2o !uestionB @(at are t(e maCimum and minimum siDes o5 an4 CO2T9OL 9* datasetsH ] ns:erB 7inimum SiDeB 1 tra.- 7aCimum siDeB 1 .4linder !uestionB EO@ TO 8*T CU9SO9 /OS$T$O2 F9O7 S?ST*7 $2 C$CS *2=$9O27*2T] ns:erB 8*T $T F9O7 *$BCU9/OSW !uestionB Eo: man4 3arameters are t(ere to a '$S/ statement and :(at are t(eir uses6 ns:erB T(ere are t(reeG3H 3arameters6 /arameter 1B .urrent data set dis3osition Gne:< s(r< old< modH /arameter 2B normal .lose a.tion 5or data set G.atlg< -ee3< deleteH /arameter 3Ba%end a.tion 5or data set G.atlg< -ee3< deleteH6 !uestionB @(at is t(e error .ode SOC&1 indi.ate] ns:erB O3eration eC.e3tion error For eg a dataset o3en error !uestionB @E T $S CO77] ns:erB CO77 ) E LF @O9' B$2 9? !uestionB @(at is a 3ro.edure] ns:erB set o5 3re.oded JCL t(at .an %e modi5ied t(roug( t(e use o5 3arameters or o+erride .ards6 2oteB /ro.edures .an %e .atalogued or instream6 !uestionB @(at is t(e di55eren.e %et:een s3e.i54ing '$S/1OL' and '$S/1SE9 5or a dataset] G=S 7

#6

ns:erB OL' s3e.i5ies eC.lusi+e use o5 a dataset< SE9 allo:s multi3le Vo%s to .on.urrentl4 a..ess t(e dataset 2oteB @(en u3dating a dataset< 4ou :ould normall4 use OL'6 !uestionB @(at are t(e t(ree %asi. t43es o5 statements in a Vo% stream] ns:erB JOBGone 3er Vo% streamH *F*CGone or more 3er Vo%H ''Gone or more 3er Vo%ste3H !uestionB @(at does S?S$2 J indi.ate] ns:erB $nstream data 5ollo:s t(is .ard and is terminated :(en 5ollo:ed %4 a .ard .ontaining 00 or 0J in .olumns 1 and 26 !uestionB @(at are t(ree maVor t43es o5 JCL statements] @(at are t(eir 5un.tions] ns:erB JOB< *F*C< ''6 JOB ) indi.ates start o5 Vo%stream to t(e o3erating s4stem and t(roug( 3arms .oded on it< .ertain details a%out t(e Vo% Gtime< region< message le+el< Vo% a..ounting dataH6 *F*C ) indi.ates t(e start o5 eCe.ution o5 a 3arti.ular Vo% ste3< %e t(at ste3 a 3rogram or a 3ro.6'' ) is a data de5inition< :(i.( is used to des.ri%e t(e attri%utes o5 a data set Gname< unit< t43e< s3a.e< dis3ositionH6 !uestionB @(at (a33ens i5 t(e Time s3e.i5ied is eC.eeded] ns:erB T(e Vo% ends :it( t(e B*2' .ode S3226 !uestionB %%re+iation o5 ST6 ns:erB ST stands 5or ST TUS6 !uestionB @(at is ST*/L$B< JOBL$B] @(at is it used 5or] @(at is order o5 sear.(ing o5 t(e li%raries in a JCL] ns:erB S3e.i5ies t(at t(e 3ri+ate li%rar4 Gor li%rariesH s3e.i5ied s(ould %e sear.(ed %e5ore t(e de5ault s4stem li%raries in order to lo.ate a 3rogram to %e eCe.uted6 ST*/L$B a33lies onl4 to t(e 3arti.ular ste3< JOBL$B to all ste3s in t(e Vo%6 First an4 3ri+ate li%raries as s3e.i5ied in t(e ST*/L$B or JOBL$B< t(en t(e s4stem li%raries su.( as S?S16L$2>L$B6 T(e s4stem li%raries are s3e.i5ied in t(e lin-list6 !uestionB @(at is 3rimar4 allo.ation 5or a data set] ns:erB T(e s3a.e is allo.ated :(en t(e data set is 5irst .reated6 !uestionB @(at is t(e di55eren.e %et:een 3rimar4 and se.ondar4 allo.ations 5or a data set]

#7

ns:erBSe.ondar4 allo.ation is done :(en more s3a.e is re;uired t(an :(at (as alread4 %een allo.ated6 !uestionB Eo: man4 eCtents are 3ossi%le 5or a se;uential 5ile ] For a =S 7 5ile ] ns:erB16 eCtents on a +olume 5or a se;uential 5ile and 123 5or a =S 7 5ile6 !uestionB @(at does a dis3osition o5 G2*@<C TL8< '*L*T*H mean] ns:erB T(at t(is is a ne: dataset and needs to %e allo.ated< to C TL8 t(e 'ata set i5 t(e ste3 is su..ess5ul and to delete t(e data set i5 t(e ste3 a%ends

CICS Tutorial 4CICS INTRODUCTION -#TC) M ONLINE S'STEM ON+INE S4STEM !EFINITION 4 O2L$2* 3ro.essing allo:s a user to intera.t :it( a .om3uter and a..ess its resour.es +ia a terminal6 EFam5le 4 9ail:a4 9eser+ation s4stem6 -#TC) M ONLINE S'STEM B TCE O2L$2* 'ata 5rom .ard ta3e< dis- Bat.(ed< 'ata 5rom terminal random< se;uential< s.(eduled .on.urrent

$n3ut

##

O3erator Gor o3erating s4stemH initiates t(e On.e C$CS is initialiDed< entering Vo%6 Ot(er Vo%s in t(e same region must transa.tion id triggers t(e transa.tion :ait6 to start6 /ro.essing Single tas- single t(read6 /riorit4 in Vo% 7ulti tas- multi t(read6 /riorit4 7ode s.(eduling 3ro.essing6 *a.( transa.tion6 On.e C$CS is *nd o5 Vo% *a.( Vo% terminated< no transa.tions .an %e entered6 3rinted re3orts< out3ut 5iles6 User must :ait 7essage terminals u3dated 5iles< Out3ut 5or %at.( Vo%s to 3rodu.e re3orts Gda4< s4stem $nstant 5eed %a.:ee-< mont(H 9esour.e Usage Less 7ore *Cam3le o5 7ont(l4 sales re3ort irline reser+ation s4stem a33li.ation Start o5 Vo% *)#T IS CICS?

Customer $n5ormation Control S4stem GC$CSH :as de+elo3ed in 196& %4 $B7 O2L$2* CO2T9OL S?ST*7 8eneral 3ur3ose data .ommuni.ation .ontrol s4stem /ro+ides ser+i.es to (andle all t(e s3e.ial re;uirements 5or online 3ro.essing

Note 4 9ole o5 C$CS is to inter5a.e %et:een a33li.ation 3rograms and t(e 'B0'C .ontrol s4stem6 CICS SERVICES 5 T'E O!ERATIN0 S4STEM

9e;uests 5or 5ile $0/< O0/ 9e;uests 5or data%ase $0/< O0/ 9e;uests 5or terminal $0/< O0/

CICS CONTRO+ !RO0RAM AND TA,+ES CICS CONTROL PRO,R#M


C$CS CO2T9OL /9O89 7 G$B7 SU//L$*'H FC/ GF$L* CO2T9OL /9O89 7H JC/ GJOU92 L CO2T9OL /9O89 7H >C/ GT S> CO2T9OL /9O89 7H /C/ G/9O89 7 CO2T9OL /9O89 7H SC/ GSTO9 8* CO2T9OL /9O89 7H TC/ GT*97$2 L CO2T9OL /9O89 7H T'/ GT9 2S$*2T ' T /9O89 7H TS/ GT*7/O9 9? STO9 8* /9O89 7H OTE*9S

CICS CONTROL T#-LES

C$CS CO2T9OL T BL*S GUS*9 S/*C$F$*'H

#9

FCT GF$L* CO2T9OL T BL*H JCT GJOU92 L CO2T9OL T BL*H /CT G/9O89 7 CO2T9OL T BL*H //T G/9OC*SS$28 /9O89 7 T BL*H TCT GT*97$2 L CO2T9OL T BL*H 'CT G'*ST$2 T$O2 CO2T9OL T BL*H TST GT*7/O9 9? STO9 8* T BL*H

CICS ST#RT &P


C$CS is su%mitted as a %at.( Vo%6 C$CS S4stem $nitialiDation 3rogram GS$/H is t(e main Vo% ste3 S$/ loads S4stem $nitialiDation Ta%le GS$TH S$/ 5urt(er loads all .ontrol 3rograms and ta%les ) /er5orm initial (ouse-ee3ing tas-s

CICS S)&T!O*N

7aster terminal transa.tion is entered :it( s(utdo:n o3tion C$CS Vo% 3rodu.es +arious logs< statisti.s< dum3s and ot(er re3orts and ends 2o transa.tion .an %e eCe.uted a5ter t(at

ROLE OF CICS

7ULT$ T S>$28 o 7ore t(an one tas- .an %e eCe.uted .on.urrentl46 7ULT$ TE9* '$28 o Tas-s s(are t(e same 3rogram under t(e multi tas-ing en+ironment6 9*)*2T9 2T /9O89 7 o /rogram :(en does not modi54 itsel5 in an4 :a4 during eCe.ution6 !U S$ 9*)*2T9 2T o $s a reentrant 3rogram under t(e C$CS en+ironment6 MA!S AND DIS!+A4S

INTRO!&CTION TO -MS

To ma-e t(e a33li.ation 3rogram de+i.e inde3endent and 5ormat inde3endent C$CS 3ro+ides Basi. 7a33ing Su33ort GB7SH B7S is a standard 5a.ilit4< to deal :it( t(e 5ormatted s.reen o3erations S.reen de5ined t(roug( B7S is .alled a A7 /A

P)'SIC#L #N! S'M-OLIC M#P Ph+sical Ma5

/rimaril4 used %4 C$CS

9&

*nsures de+i.e inde3enden.e in t(e a33li.ation 3rogram For in3ut o3erations< it de5ines t(e maCimal data lengt( and starting 3osition o5 ea.( 5ield to %e read and allo:s B7S to inter3ret an in3ut data stream For out3ut o3erations it de5ines starting 3osition< lengt(< 5ield .(ara.teristi.s G ttri%ute B4tesH and de5ault data 5or ea.( 5ield< and allo:s B7S to .onstru.t an out3ut data stream6 /(4si.al ma3 is a 3rogram in t(e 5orm o5 Load module /(4si.al ma3 is .oded using B7S ma.ros B7S ma.ros are assem%led se3aratel4 and lin- edited into t(e C$CS load li%rar4

S'M-OLIC M#P 16 *nsures t(e de+i.e and 5ormat inde3enden.e to t(e a33li.ation 3rograms 26 la4out .(ange in t(e 5ormatted s.reen .an %e done inde3endent o5 t(e a33li.ation 3rogram .oding as long as 5ield name and lengt( remain t(e same 36 S4m%oli. ma3 is in.luded in t(e 3rogram %4 issuing a COBOL CO/? statement USIN0 MA!S IN A !RO0RAM S'M-OLIC M#P ,ENER#TION

S4m%oli. ma3 is a .o34 li%rar4 mem%er $n.luded in a33li.ation 3rogram 5or de5ining t(e s.reen 5ields6 B7S 7a.ros are .oded< assem%led and .atalogued into a CO/? li%rar4

S?7BOL$C 7 / S&FFI"ES

Eal5:ard %inar4 Contain t(e lengt( o5 data entered %4 t(e terminal o3erator F One %4te 5lag 5ield $ Contains t(e data entered %4 t(e o3erator One %4te 5ield t(at .ontains ttri%ute %4te O Contains data to %e sent to terminal L S?7BOL$C 7 / FORM#T

12 %4te T$O 3re5iC is automati.all4 3ro+ided6 @(en 3er5orming in3ut 5un.tions 5ields su55iCed :it( ^L_< ^F_< and ^$_ are meaning5ul6 @(en 3er5orming OUT/UT 5un.tions< t(e 5ields su55iCed :it( ^ _ and ^O_ are meaning5ul6 Contains t(e data to %e sent to t(e terminal6

91

O&TP&T M#PPIN, PM#P ONL'Q *F*C C$CS S*2' 7 / G^ma3name1"H 7 /S*T G\ma3set1"H 7 /O2L? *2')*F*C P!#T# ONL'Q *F*C C$CS S*2' 7 / G\ma3name1"H 7 /S*T G\ma3set1"H ' T O2L?6 *2')*F*C6 16 7 / O2L? o3tion6 o Use t(e 3(4si.al ma3 onl46 o Field (eadings< attri%ute %4tes< and t(e lo.ation o5 :(ere all in5ormation is to %e 3la.ed is sent6 26 ' T O2L? o Use t(e s4m%oli. ma3 onl4 o onl4 t(e data in t(e s4m%oli. ma3 is sent to t(e s.reen6 36 2eit(er ^ 7 /O2L? 2O9 ' T O2L?A *F*C C$CS S*2' 7 / G\ma3)name1"H 7 /S*T G\ma3set1"H *2')*F*C
o

T(e 3(4si.al ma3 and t(e data 5rom s4m%oli. ma3 is sent to t(e terminal6

Ot(er o3tions o5 SEN! .ommand6

*9 S*B Current s.reen is erased %e5ore t(e ma3 s3e.i5ied a33ears on t(e s.reen *9 S* U/B erase all t(e un3rote.ted 5ields6 F9**>BB to 5ree t(e -e4%oard L 97B to ma-e an alarms sound6 F9S*TB to reset 7'T to Dero CU9SO9B to 3la.e t(e .ursor in a s3e.i5ied 5ield

C&RSOR POSITIONIN,

Stati. 3ositioning o $5 $C o3tion is s3e.i5ied in t(e TT9B 5ield o5 'FE7'F ma.ro t(e .ursor :ill %e 3la.ed at t(is 5ield6 '4nami. 0 s4m%oli. 3ositioning6

92

/la.e G)1H into t(e 5ield lengt( 5ield G^L_ su55iCH6 Cursor :ill %e 3la.ed in t(e 5ield6 '4nami. 0 9elati+e 3ositioning6 o Cursor Gdata)+alueH o3tion is used6 o 'ata)=alue :ill (a+e t(e +alue at :(i.( t(e .ursor (as to %e 3ositioned6 o *6g66 *F*C C$CS S*2' 7 / G`66H 7 /S*T G`66H CU9SO9 G1&&H *9 S* *2')*F*C6 7 /F $L .ondition :ill .aused in 9*C*$=* 7 / .ommand6 o $5 t(e data to %e ma33ed (as a lengt( o5 Dero6 o $5 t(e o3erator 3resses an4 -e4 G.lear< / < /F< *2T*9< >e4sH :it(out entering an4 data6
o

#CCESSIN, #N! !ISPL#'IN, M#P FIEL!S M#P STOR#,E #RE#S

/la.ing ma3s in t(e /rogram o n4 o5 t(e t(ree 3lans 5or rede5inition o5 ma3s ma4 %e used :it( eit(er o5 t(e 2 alternati+es 5or 3la.ing ma3s in 4our 3rogram6 @O9>$28 ) STO9 8* S*CT$O2 o Co34ing a s4m%oli. des.ri3tion ma3 stru.ture (ere ma-es t(e area automati.all4 a+aila%le :(ene+er t(e 3rogram is in+o-ed6

L$2> 8* S*CT$O2 o Co34ing a s4m%oli. des.ri3tion ma3 stru.ture (ere does 2OT mean t(e storage :ill %e a+aila%le6 Some met(ods 5or 3ro+iding storage are 3assing a CO77 9* < a.;uiring tem3orar4 storage :it( t(e S*T o3tion< or using a 8*T 7 $2 .ommand6

SEN! $ RECEI E

Sending 2rom the S+m1olic descri5tion ma5 S*2' 7 / Ga7 /1QH 7 /S*TGaS*T1QH 7O=* a7 /1Q TO 7 /= 9 7O=* aS*T1Q TO S*T= 9 S*2' 7 / G7 /= 9H 7 /S*TGS*T= 9H F9O7 G7 /1OH o SEN! M#P Coding #lternati/es ?ou .an .ode t(e S*2' 7 / .ommand to lo.ate t(e s4m%oli. des.ri3tion ma3 in se+eral :a4sB

93

Using .onstants in t(e name 5ield 5or 7 / and 7 /S*TGF9O7 is not re;uiredH Using +aria%les in t(e name 5ield 5or 7 / and 7 /S*T GT(is ma-es F9O7 a re;uired 3arameterH Using onl4 t(e 7 / 3arameter6 $n t(is .ase t(e name in t(e 7 / o3tion must %e t(e 7 /S*T name6 RECEI IN, into the s+m1olic descri5tion ma5

9*C*$=* 7 /Ga7 /1QH 7 /S*TGaS*T1QH 666 7 /1 $ 7o+e a7 /1Q to 7 /= 9 7o+e aS*T1Q to S*T= 9 66666 7 /1 $ 9*C*$=* 7 / G7 /= 9H 7 /S*TGS*T= 9H $2TO G7 /1 $H 9e.ei+e 7 / GaS*T1QH 666 S*T1 $ o RECEI E M#P coding alternati/es ?ou .an .ode t(e 9*C*$=* 7 / .ommand to lo.ate t(e s4m%oli. des.ri3tion ma3 in se+eral :a4sB Using .onstants in t(e name 5ield 5or ma3 and ma3set G$2TO0S*T is not re;uiredH T(is is t(e most .ommonl4 used 5ormat6 Using +aria%les in t(e name 5ield 5or 7 / and 7 /S*T6 T(is ma-es $2TO Gdata%aseH or S*T a re;uired 3arameter6 Using onl4 t(e 7 / 3arameter6 $n t(is .ase t(e name in t(e 7 / o3tion must %e t(e 7 /S*T name6 Lin-age Se.tion6 &1 'FECO77 9* &1 LST &2 /T9)2)L$ST /$C S 9G#H CO7/6 &2 /T9)2)B7S /$C S 9G#H CO7/6 9*C*$=* 7 / Ga7 /1QH 7 /S*T GaS*T1QH S*T G/T9)2)B7SH 66666 7 /1 $ Using t(e S*T o3tion re;uests C$CS to get t(e storage and return a 3ointer to it6 T(e s4m%oli. des.ri3tion ma3 must %e in t(e L$2> 8* S*CT$O26 O&T-O&N! F&NCTIONS S*2' 7 / Ga7 / QH 7 /S*T GaS*T QH X*9 S*0 *9 S* U/Y XF9**>BY X L 97Y XF9S*TY X/9$2TY *9 S* *rase Bu55er< 3la.e .ursor in u33er le5t .orner t(en :rite *9 S* U/ *rase all t(e un3rote.ted 5ields %e5ore t(e @rite F9**>B Unlo.- >e4%oard a5ter t(e :rite L 97 .ti+e alarm :it( t(e :rite F9S*T Set all 7'T .urrentl4 on to o55 /9$2T Start t(e 327& 3rint o3eration6

94

Control Functions4

T43i.all4 t(e 5irst t43e o5 .ommand in t(e 3rogram is a S*2' 7 /6 Certain .ontrol 5un.tions ma4 %e in.luded in t(at .ommand6 *9 S* U/ :ill .lear out ea.( 5ield :(ose attri%ute is un3rote.ted6 $t :ill 2OT alter an4 attri%ute settings6 $5 4ou do not 5ree t(e -e4%oard using F9**>B< t(e o3erator :ill (a+e to 3ress t(e 9*S*T -e4 %e5ore entering data6 $5 4ou .ode F9S*T< all attri%ute %4tes .urrentl4 (a+ing 7odi5ied 'ata Tags G7'TH set on :ill %e set o556 Sele.ti+e resetting o5 t(e 7'TQs must %e done anot(er :a46 @(en sending data to a 327& s.reen t(e a.tual 3rinting 5rom t(e %u55er :ill o..ur :(en t(e /9$2T 5un.tion is re;uested6

#ttri1utes 4

T(e a Q su55iCed 5ield is an attri%ute 5ield :(i.( .ontrols t(e 5ollo:ingB /9OT*CT*'0U2/9OT*CT*' S>$/ 2U7 7'T 2on 'is3la4 Gdar-H'$S/L ? Gnormal0%rig(tH $5 t(e .olor or (ig(lig(ting o5 a 5ield (as to %e .(anged< additional s4m%oli. 5ields are needed :(i.( are .alled t(e *FT*2'*' TT9$BUT*S6

E"TEN!E! #TTRI-&TES

'S TTS G5or s4m%oli. ma3H and 7 / TTS G5or 3(4si.al ma3H su33ort t(e eCtended attri%ute .(ara.teristi.s T(e 7 / TTS allo:s 4ou to set u3 t(e 3(4si.al ma3 :it( an4 o5 t(e .(ara.teristi.GsH .oded6 T(e 'S TTS :ill .reate a33ro3riate su55iCed la%els 5or t(e attri%ute .(ara.teristi.GsH .oded6

IN-O&N! F&NCTIONS - #I!$C&RSOR CONTROL

ttention $denti5ier G$'H and CursorB o On a 9*C*$=*< C$CS u3dates t(e *$B :it( t(e 5ollo:ing in5ormationB T(e s.reen .ursor 3osition relati+e to Dero is 3la.ed is *$BC/OS26 T(e name o5 t(e in3ut -e4 t(e terminal o3erator 3ressed is 3la.ed in t(e 5ield *$B $'6

EI-#I!$C&RSOR

@O9>$28)STO9 8* S*CT$O26 CO/? 'FE $'6 666666 /9OC*'U9* '$=$S$O26

95

$F *$B $' 1 'FE/F12 TE*2 666666 $F *$B $' 1 'FE*2T*9 TE*2 666666 $F *$BC/OS2 L*SS TE 2 #& TE*2 666666

@(en 4ou 5irst enter 4our 3rogram as a result o5 a transa.tion id< 4ou .an test *$B $' and0or *$BC/OS26 T(is ma4 %e done 3rior to issuing a 9*C*$=* .ommand< i5 so .(osen6

#I!$C&RSOR - S#MPLE CO!IN, :CONTROL;


$5 t(e o3erator uses an4 / -e4 or 3resses t(e CL* 9 -e4< no data is transmitted *$B $' is use5ul :(en 5un.tion -e4s are de5ined 5or t(e user6 5or eg6 /F12 ma4 %e t(e eCit 5un.tion /F3 ma4 %e an u3date 5un.tion et.6 T(us testing 5or t(e t43e o5 $' :ill alter t(e logi. 5lo:6 *$BC/OS2 .an %e used to determine :(ere t(e .ursor :as 3ositioned on t(e s.reen6 T(is in5ormation is es3e.iall4 use5ul :it( s.reens .ontaining an a.tion %ar6

C&RSLOC

Sam5le Ma5 7 /S*T 'FE7S' T?/*1RS?S/ 97< 7O'*1 $2OUT< T*971 LL< L 281COBOL< T$O /FF1?*S< STO9 8*1 UTO 7 /1 'FE7'$ S$I*1G24<#&H< L$2*11< COLU7211< CU9SLOC1?*S 'FE7'F /OSG2<1H< L*28TE14< $2$T$ L1a2 7*Q< TT9$B1 S>$/ 2 7* 'FE7'F /OSG2<6H<L*28TE12&< TT9B1GU2/9OT< $CH 'FE7'F /OSG2<27H< L*28TE11< TT9B1/9OT

CU9SLOC1 ?*S allo:s 4ou to determine a5ter a 9*C*$=* 7 / .ommand< :(i.( ma3 5ield (ad t(e .ursor in it6 CU9SLOC12O is t(e de5ault6 CU9SLOC1G2O0?*SH ma4 %e .oded on t(e 'FE7S' or t(e 'FE7'$ ma.ro6 $5 .oded on t(e 'FE7S' ma.ro< it :ill 3ro+ide a de5ault 5or all t(e ma3s in t(at ma3set6

96

@(en CU9SLOC1?*S< B7S :ill set t(e aFQ su55iC 5ield to FQ&2Q indi.ating t(at 5ield .ontained t(e .ursor6 $5 t(e .ursor is in a 5ield 5or :(i.( t(ere is no s4m%oli. la%el i6e6 a 'FE7'F :it( no la%el t(e 3rogram :ill not %e noti5ied6 2ote B T(e aFQ su55iC 5ield .ontinues6 To %e used to indi.ate t(e o3erator 3ressed t(e erase to end o5 5iCed G*OFH -e4 %4 %eing set to FQ#&Q6 T(ere5ore< i5 CU9SLOC1?*S it is 3ossi%le to (a+e %ot( t(ese .onditions o..ur 5or t(e same 5ield< in :(i.( .ase t(e aFQ su55iC 5ield :ill .ontain a FQ#2Q6

E!ITIN,

7a3 5ield 'e5inition /$C$20/$COUT Built in 5un.tion 'e)edit .ommand6 @(en data is sent out +ia t(e aOQ su55iC 5ields or re.ei+ed into t(e a$Q su55iC 5ields 4ou ma4 :ant a de5inition ot(er t(an /$C C6 /$C$2 2' /$COUT allo:s t(e user to use ot(er COBOL /$CS su.( as L<I et.6 $5 t(e date .ontains s3e.ial .(ara.ters< 4ou ma4 :ant to remo+e t(em using t(e B$F '**'$T .ommand6

PIC IN$PIC O&T


$5 /$C$20/$COUT is not .oded in t(e ma.ro< t(e 3i. generated is al:a4s /$C F Glengt( o5 5ieldH B4 using /$C$20/$COUT B7S .an %e 5or.ed to generate t(e a33ro3riate /$C6 /$C$2 tells B7S (o: to mo+e data into t(e a$Q su55iC 5ield6 /$COUT tells COBOL (o: to edit 4our data mo+e to t(e aOQ su55iC 5ield6

FIEL! E!IT -&ILT-IN F&NCTION mount B$F mount L54316#& *'$T &&5431#& *F*C C$CS B$F '**'$T F$*L' GamountH L*28TE G#H *2')*F*C6

B$F '**'$T is used to remo+e t(e s3e.ial .(ara.ters 5rom t(e in3ut 5ield6 T(e mount 5ield dis3la4ed (as a dollar sign and a de.imal 3oint B4 using B$F '**'$T dollar sign and de.imal 3oint is remo+ed6 T(us t(e num%er .an %e used 5or arit(meti. o3erations6 COBOL .om3iler re;uires L*28TE s3e.i5i.ationB =S COBOL)$$ uses t(e im3lied lengt( o5 t(e data)area used in t(e 5ield 3arameter6

97

CICS !RO0RAM COM!ONENTS O-@ECTI ES


Stru.ture o5 C$CS 33li.ation /rogram C$CS 7anagement Fun.tions Starting a TasCon+ersationalR /seudo .on+ersational transa.tions C$CS /rogram 3re3aration C$CS /rogram testing R 'e%ugging C$CS .ommands /assing 'ata a.ross tas-s

STR&CT&RE OF CICS #PPLIC#TION PRO,R#M Identi2ication !i/ision Program - I! re?uired

Ot(er .omments as %elo:< are o3tional %ut re.ommended6 o ut(or o 'ate)@ritten o 'ate).om3iled o 9emar-s

En/ironment !i/ision

Onl4 (eader is re;uired

Ot(er re;uirementsB

COBOL statements and C$CS .ommands s(ould %e .oded T(e 5ollo:ing COBOL statements are 3ro(i%ited6 CC*/T< CU99*2T)' T*< ' T*< ' ?< '$S/L ?< *FE$B$T< STO/ 9U2< T9 C* n4 $0O StatementsGO/*2< CLOS*< 9* '< @9$T*< 9*@9$T*< '*L*T*< ST 9TH 9*/O9T @9$T*9 5eature SO9T 5eature C LL statement is allo:ed i5 t(e .alled 3rogram does not issue an4 C$CS .ommands or in(i%ited COBOL statements mentioned a%o+e6 TERMIN#TION ST#TEMENTS

Notes 4T(is is not t(e :a4 to terminate a C$CS 3rogram6 C$CS (as a .ommand 5or t(at 3ur3ose6 2e+ert(eless< COBOL and =S COBOL $$ (a+e t(ree statements to .on.lude 3rograms6

Control must not %e allo:ed to 3ass %e4ond t(e last statement o5 a C$CS /rogram6 STO/ 9U2 in COBOL uses o3erating s4stem 5a.ilities< and t(ere5ore< is dis.ouraged6 *F$T 3rogram is ignored i5 t(e 3rogram (as not %een .alled6

9#

C$CS 9*TU92 CO77 2' and0or 8OB C> statement is re.ommended6

CICS M#N#,EMENT F&NCTIONS


Transa.tions Tas/rogram

Transactions n eC.(ange %et:een a terminal and a data %ase re3resenting an a33li.ation 3ro.ess6 For eCam3le< an in;uir4 or a de3osit and %alan.e u3date Tas3 s3e.i5i. instan.e o5 a transa.tion i6e6 a uni;ue unit o5 :or-6 Program /re3ared statements .om3iled or assem%led into an eCe.uta%le module o5 ma.(ine instru.tions6 CON ERS#TION#L TR#NS#CTION

/rogram uses a 3air o5 S*2' and 9*C*$=* .ommands6 /rogram :aits until t(e user res3onds6 9esour.es are (eld until t(e user res3onds6 =er4 ine55i.ient :a4 o5 .on+ersing :it( t(e user6

PSE&!O CON ERS#TION#L TR#NS#CTION


T(e tas- is terminated a5ter a message is sent :it( a lin-age 5or t(e neCt tas-6 C$CS 3ro+ides a 5a.ilit4 GCO77 9* H to made it easier to a..om3lis( t(is6 @(en t(e user .om3letes res3onse G%4 3ressing enterH reset tas- is automati.all4 initiated %4 C$CS6 T(e tas- re.ei+es t(e message 5rom t(e terminal R 3ro.esses it6 T(is is a multitas- o3eration 5rom s4stemQs 3oint o5 +ie:6

PRO,R#M PREP#R#TION

9unning t(e 'B2 3re.om3iler 5irst is t(e 3re5erred met(od6 'B2 3re.om3iler 3re.edes anot(er 3ro.ess< %inding< not mentioned (ere6 Out3ut o5 t(e 'B2 3re.om3iler .an ser+e as in3ut to t(e translator6 Out3ut o5 t(e translator :ill %e in3ut to t(e .om3iler6 7essages or :arnings are 3ro+ided on all t(e listings6 T9 2SL TO9 re.ogniDes *F*C C$CS and *F*C 'L$ statements6 T(e4 are .ommented out and re3la.ed :it( statements in t(e a33ro3riate language6 Eere< COBOL 7O=* instru.tions and a C LL are inserted and 3assed on to t(e COBOL .om3iler6

99

'B2 /re.om3iler is su33lied %4 t(e relational data %ase managers< 'B2 and S!L0'S6 $t re.ogniDes *F*C S!L statements :(i.( it :ill .omment out and re3la.e :it( in our .ase6 COBOL /*9FO97 and C LL statements6 Out3ut o5 t(e transa.tion is i03 to t(e .om3iler T(e o03 o5 t(e lin-age editor is eCe.uta%le6 T(e load module is 3la.ed in t(e C$CS online 3rogram li%rar46 7essages or :arnings are 3ro+ided on all t(e listings6 T(e .om3iler listing is or limited use i5 t(e translator listing :ould not 3ro.ess all .ommands6

TESTIN, C*7T set 3rogram G3rg1H 2e: .om3 Or C*7T S /9 G3rg1H 2

5ter ma-ing .(anges to a 3rogram t(e ne: +ersion re3la.es old +ersion< %ut C$CS :(i.( is .urrentl4 eCe.uting (as no :a4 o5 -no:ing t(is automati.all46 T(e C$CS 3ro.essing 3rogram ta%le //T still 3oints to t(e old)+ersion6 To a+oid testing :it( t(e old +ersion< 4ou must use t(e C$CS)3ro+ided C*7T transa.tion to u3date t(e 3ointer to t(e 3rogram6

COMMON FORM#T

C$CS .ommand .onsists o5 a -e4:ord 3(rase< delimiter< 5un.tion< o3tions and t(eir argument +alues6 Be .are5ul a%out 3eriods6 +oid t(em a5ter *2')*F*C6 @(ere 4ou donQt reall4 :ant t(em6 For eg6 :it(in an I2 .... then ... else statement T(e translator :ill 3la.e a 3eriod into t(e generated .ode i5 a 3eriod 5ollo:s end)eCe.6

#R,&MENT #L&ES /$C S9G4H .om3 Eal5:ord %inar4 data ) +alue /$C S9G#H .om3 Full:ord %inar4 /$C FG15H .(ara.ter string .onstants 3ermitted COBOL data name G2ot a .onstantH eg B) data ) area &1 9e.ord)area6 &5 Fld 1 &5 Fld 2 name COBOL data name C(ara.ter string la%el /aragra3( name /$C S9G7H .om3 3 ((mmss /a.-ed de.imal BLL .ell 3ointer)re5 Usage 3ointer

1&&

RECEI E COMM#N! *F*C C$CS 9*C*$=* $2TO Gdata areaH L*28TEGmlH *2')*F*C

9*C*$=* .ommand is used to re.ei+e in.oming data 5rom t(e terminal to :(i.( t(is C$CS transa.tion is asso.iated6 re.ei+ing area must %e de5ined in :or-ing storage se.tion and (as to %e s3e.i5ied in t(e $2TO 3arameter6 Lengt( 5ield must %e de5ined in :or-ing storage se.tion as a S9G4H .om36 $t (as to %e s3e.i5ied in lengt( o3tion6

SEN! COMM#N! *F*C C$CS S*2' F9O7 Gdata areaH L*28TEGlnH *2')*F*C

T(e data to %e sent must %e stored in :or-ing storage se.tion< and t(is 5ield name (as to %e s3e.i5ied in t(e F9O7 3arameter6 Lengt( must %e s3e.i5ied t(e same as t(at o5 t(e 9e.ei+e .ommand6

E"CEPTION#L CON!ITIONS

9*S/ o3tion o 'e5ine a 5ull :ord %inar4 5ield S9G#H .om3 in t(e :or-ing storage se.tion as t(e res3onse 5ield6 o /la.e 9*S/ o3tion :it( t(e res3onse 5ield in an4 C$CS .ommand6 o 5ter .ommand eCe.ution< .(e.- t(e res3onse .ode in t(e res3onse 5ield :it( 'FE9*S/ GCCCCH:(ere CCCC is 2O97 L 5or normal .om3letion or n4 eC.e3tional .ondition

)#N!LE CON!ITION

Eandle .ondition .ommand is used to trans5er .ontrol to t(e 3ro.edure la%el s3e.i5ied i5 t(e eC.e3tional .ondition< s3e.i5ied o..urs6 9emains a.ti+e until t(e end o5 3rogram or anot(er (andle .ondition re;uest o+errides it6

I,NORE CON!ITION

$gnore .ondition .ommand .auses no a.tion to %e ta-en i5 t(e .ondition s3e.i5ied o..urs in t(e 3rograms6 9e;uest %4 t(e $82O9* CO2'$T$O2 .ommand is +alid until t(e su%se;uent E 2'L* CO2'$T$O2 .ommand 5or t(e same .ondition6

1&1

NO )#N!LE OPTION

$5 2OE 2'L* o3tion is s3e.i5ied in an4 C$CS .ommand< no a.tion :ill %e ta-en 5or an4 eC.e3tional .ondition o..urring during eCe.ution o5 t(is .ommand6 o *g B *F*C C$CS S*2' From G666H Lengt( G666H 2OE 2'L* *2')*F*C

FORM#TTIN, TIME #N! !#TE

S>T$7* Command o used to re;uest t(e .urrent date and time o *$B' T* and *$BT$7* 5ields (a+e t(e +alues at t(e tas- initiation time6 FO97 T EXEC CICS AS1TIME END8EXEC

FORM#T TIME COMM#N!

Used to re.ei+e t(e in5ormation o5 data and time in +arious 5ormats6 o Format X??''' Gdata ) areaHY X??77'' Gdata ) areaHY X??''77 Gdata ) areaHY X77''?? Gdata ) areaHY X''77?? Gdata ) areaHY X' T*S*/Gdata ) +alueHY X' ? OF @**> Gdata ) areaHY X' ? OF 7O2TE Gdata ) areaHY X7O2TE OF ?* 9 Gdata ) areaHY X?* 9 Gdata ) areaHY XT$7* Gdata ) areaHY XT$7*S*/ Gdata ) +alueHY ' T*S*/ re3resents data se3arator Gde5ault is A0AH6 T$7*S*/ re3resents time se3arator Gde5ault is ABAH6 T(e data area 5or t(e BST$7* o3tion o5 S>T$7* and FO97 TT$7* .ommands must %e a 15)digit 3a.-ed de.imal data t43e6

!EL#' COMM#N!

used to dela4 t(e 3ro.essing o5 a tas- 5or t(e s3e.i5ied time inter+al or until t(e s3e.i5ied time6 FO97 T *F*C C$CS '*L ? $2T*9= L G&&2&&&H T$7* G152&&&H

1&2

*nd ) *F*C

Tas- :ill %e sus3ended 5or 2& minutes i5 $2T*9= L is s3e.i5ied or until 15B2&B&& i5 T$7* is s3e.i5ied6

COMM#RE#

/assing data +ia t(e CO77 9* 3seudo .on+ersational tas- to tasLin-ing 3rogram to 3rogram

PSE&!O CON ERS#TION#L /seudo .on+ersational te.(ni;ue is uses t(e multi3le transa.tion identi5iers G3.t entriesH and multi3le 3rogram G3.t entriesH6 $t 3er5orms t(e terminal .on+ersation in t(e 5ollo:ing :a4B .on+ersational 3rogram is logi.all4 and 3(4si.all4 di+ided into se3arte 3rograms a5ter sending a message and %e5ore re.e+ing t(e message6 For ea.( se3arate 3rogram< a uni;ue .i.s tras.tion identi5ier is assigned6 %e5ore terminating t(e 3rogram< ea.( 3rogram issues t(e 9*TU92 .ommand :it( t(e neCt transa.tion identi5ier :(i.( is asso.iated :it( t(e neCt 3rogram< unless it is t(e least return to C$CS itsel56 in t(is :a4< a series o5 terminal .on+ersations .an %e .arried out .ontinuousl46 P#SSIN, !#T# TO NE"T T#S(

Notes 4 T(e 5irst time .ommarea is 3assed< it must %egin as an area o5 storage in t(e :or-ing storage se.tion o5 t(e 3rogram 3assing it6 o .ommarea 3arameter in t(e 9*TU92 :ill 3ass t(e area to t(e 3rogram asso.iated :it( t(e su%se;uent transa.tion6 $n t(is .ase< itsel56 o T(e su%se;uent 3rogram Gin t(is .ase t(e same 3rogramH must de5ine a..ess to all t(e .ommarea t(at :as 3assed to it6 / ?9OLL as %ot( t(e sender and t(e re.ei+er o5 t(e CO77 9* needs t(e :or-ing storage de5inition to send and t(e lin-age se.tion 'FECO77 9* to re.ei+e6 / ?9OLL must t(ere5ore %e a%le to distinguis( %et:een F$9ST T$7* into t(e 3rogram6 @(en t(ere is no CO77 9* and su%se;uent times in6 @(ere one eCists in t(e Lin-age se.tion6 T(e *$B 5ield< *$BC L*2 indi.ates t(e lengt( o5 t(e .ommarea6
o

EI-C#LEN

First time into t(e 3rogram no .ommarea eCists< t(ere5ore *$BC L*2 1 & @(ile returning t(e .ontrol to C$CS t(e :or-ing storage is loaded and t(is is sent +ia t(e .ommarea 3arameter in t(e 9*TU92 Transid6 On su%se;uent entr4< .ommarea eCists and is automati.all4 made addressa%le %4 C$CS in t(e lin-age se.tion o5 'FECO77 9*

1&3

P#SSIN, !#T# &SIN, LIN(


To 3ass .ontrol 5rom one 3rogram to anot(er and t(en return to t(e original li-e eCe.uting a su%routine6 T(e lin- .ommand 3asses .ontrol to anot(er 3rogram de5ined in C$CS //T eC3e.ting t(at t(e 3rogram :ill return to t(e lin-ing 3rogram instru.tion 5ollo:ing t(e L$2> .ommand6 T(is (a33ens :(en t(e lin-ed 3rogram issues a 9*TU92 .ommand6 'ata ma4 %e 3assed using t(e .ommarea6 T(e .ommarea is s(ared %et:een t(e t:o 3rogram regains .ontrol ma4 .(anges made to t(e .ommarea %4 t(e lin-ed 3rogram are a..essi%le6 T(e t:o 3rograms eCe.uti+e under t(e same tas-6 T(e :or-ing storage se.tion 5or t(e lin-ing 3rogram is retained6 @or-ing storage 5or t(e lin-ed 3rogram is automati.all4 released a5ter its 9*TU92 .ommand is eCe.uted6 To 3ass .ontrol 5rom one 3rogram to anot(er and t(en return to t(e original li-e eCe.uting a su%routine6 T(e lin- .ommand 3asses .ontrol to anot(er 3rogram de5ined in C$CS //T eC3e.ting t(at t(e 3rogram :ill return to t(e lin-ing 3rogram instru.tion 5ollo:ing t(e L$2> .ommand6 T(is (a33ens :(en t(e lin-ed 3rogram issues a 9*TU92 .ommand6 Re#din" Ex ern#$ D# #

Functional o/er/iew

'$9*CT 9*T9$*= o =S 7 ' T '$9*CT 9*T9$*= o 9*L T$O2 B9O@S* o =S 7 ' T B9O@S* o 9*L T$O2

L ST9UCTU9*S L L T BL* 9O@ ST9UCTU9* L T BL* 9O@S

*ntr4 5or =S 7 5ile (as to %e t(ere in FCT GFile Control Ta%leH *a.( entr4 .ontains all des.ri3ti+e in5ormation 5or t(e 5ile it re3resents6 So< 3rogrammer need not de5ine t(e 3(4si.al organiDation and ot(er attri%utes o5 t(e 5iles6 o T(e File 3arameter .oded in t(e 3rogram must %e t(e same as t(e 5ile name in t(e FCT6 o $nter5a.e %et:een C$CS and 9elational 'ata%ase is .alled C$CS atta.(ment Fa.ilit46 Statement are .oded in S!L language in t(e a33li.ation 3rogram to Communi.ate data re;uests to t(e data%ase6

TOPICS

'$9*CT 9*T9$*= L o =S 7 F$L* 9*CO9' o 9*L T$O2 L T BL* 9O@

1&4

B9O@S* o =S 7 F$L* 9*CO9'S o S*T OF 9*L T$O2 L T BL* @O9>S

S#M !#T# STR&CT&RES

C$CS uses t(e 5ollo:ing =S 7 stru.tures o >e4 se;uen.ed data set G>S'SH o *ntr4 se;uen.ed dataset G*S'SH o 9elati+e re.ord dataset G99'SH

PRO,R#M OR,#NIG#TION

File attri%utes are de5ined in t(e FCT 5or ea.( 5ile Files are o3ened %4 C$CS o $mmediatel4 a5ter s4stem initialiDation i5 s3e.i5ied in t(e FCT6 o $n res3onse to a 5ile a..ess re;uest 5rom an a33li.ation i5 t(e 5ile is .losed o $n res3onse to a master terminal C*7T re;uest 5rom an o3eration6 33li.ation 3rogram is not res3onsi%le 5or o3en 0 .lose o5 5iles

RECOR! I!ENTIFIC#TION

9*CO9' >*? 9*L T$=* B?T* ''9*SS 9*L T$=* 9*CO9' 2U7B*9 / 9T$ L >*? o -e4 o5 t(e re.ord to %e read is s3e.i5ied in t(e 9$'FL'6 5or >S'S o >e4 s3e.i5ied .an %e a 5ull -e4 or 3artial -e4 o $5 3artial -e4< -e4 lengt( (as to %e 3ro+ided o 9B G9elati+e B4te ddressH o Can also %e used instead o5 a.tual -e4 +alue For *S'S o 9$'FL' .ontain a 4 %4te 9B For 99'S o 9$'FL' .ontains 4 B4te %inar4 relati+e re.ord num%er6

RECOR! (E' !EFINITION E"#MPLE @O9>$28 ) STO9 8* S*CT$O26 &5 9*C>*? /$C FG6H6 /9OC*'U9* '$=$S$O26 7O=* = LU* TO 9*C>*?6

9$'FL' must %e set to t(e +alue o5 t(e -e4 o5 t(e re.ord to %e retrie+ed6 9$'FL' must %e large enoug( to (old a 5ull re.ord -e4 e+en :(en a 3artial -e4 is used6

1&5

RE#! COMM#N!

9* ' .ommand :it( $2TO O3tion6 GFULL >*?H o 9eads t(e re.ord s3e.i5ied %4 t(e 5ull -e46 o T(e data .ontent o5 t(e re.ord is mo+ed into t(e s3e.i5ied data)area de5ined in t(e :or-ing storage se.tion6 o FO97 T *F*C C$CS 9* ' ' T S*T GnameH U F$L* GnameH $2TO Gdata)areaH US*TG3tr)re5H 9$'FL' Gdata)areaH X L*28TE Gdata)+aluesH Y *2' ) *F*C6 ' T S*T 0 F$L* names t(e 5ile6 $t must %e de5ined in FCT6 $2TO names t(e 5ield in t(e :or-ing storage se.tion :(ere t(e data (as to %e 3la.ed6 9$'FL' is t(e -e4 5ield6 L*28TE is (al5 :ord %inar46 $t indi.ates maCimum lengt( o5 t(e re.ord to %e read6 $t is o3tional6

EXCE!TIONA+ CONDITIONS

'U/>*? B $5 du3li.ate re.ord is 5ound 5or t(e s3e.i5ied -e46 2OTF2' B $5 t(e re.ord is not 5ound 5or t(e -e4 s3e.i5ied6 L*28*9 9 L*28*99 B T(e s3e.i5ied lengt( Gin L*28TE O/T$O2H is s(orter t(an t(e a.tual re.ord lengt(6 2OTO/*2 B @(en 5ile s3e.i5ied is not o3en6

T(e eC.e3tional .ondition .an %e tra33ed using 9*S/ o3tion in t(e 9* ' .ommand6

ADDRESSA,I+IT4 TEC'NIBUES *F*C C$CS FCTL /9O89 7 G/9O89 7 2 7*H 9*S/ G*FC*/T$O2H *2')*F*C6 $F *FC*/T$O2 1 'FE9*S/ G/87$'*99H

a module gi+en .ontrol t(roug( t(e use o5 a C$CS FCTL .ommand :ill not return to t(e 3rogram t(at issued t(e FCTL6 T(e re;uired6 3rogram name is .(ara.ter string .onstant GmaC # .(ara.tersH T(e /87$'*99 eC.e3tion .ondition o..urs :(en t(e name is not in t(e //T6

1&6

+O0ICA+ +EVE+S

T(e lin-ed to 3rogram runs at a ne: logi.al le+el and returns to a logi.al le+el %a.- to t(e lin-ing 3rogram6 T(e lin-ing 3rogram and its storage area remain a+aila%le6

Notes 4

To ;uit t(e re3eated eCe.ution sim3l4 9*TU92 :it(out t(e T9 2S$' o3tion6 n4 lin-ed 3rogram .ould use t(e same CO77 9* o5 t(e 3arameters so indi.ated6 T(e transid R .ommarea o3tion eas4 enoug( to use to ma-e t(is met(od 3ra.ti.al6

PRO,R#MS TO PRO,R#M TR#NSITION


C$CS L$2> C$CS FCTL COBOL C LL lternati+e to FCTL or L$2> ] COBOL C LLb COBOL C LL 3asses .ontrol to ot(er 3rograms6

P#SSIN, !#T# &SIN, INP&T MS,


$2/UT 7S8 R $2/UT L*2 / 9 7*T*9S US*' @$TE FCTL O9 L$2>6 9e.ei+er uses *F*C C$CS 9*C*$=* .ommand

P#SSIN, !#T# &SIN, LIN( 9* 1 /$C C G2&&H G3rog1H dotted Lin-age Se.tion G3rog2H &1 'FECO77 9* &5 9* 2 /$C FG2&&H

1ST /rogram ) CO77 9* ) Lengt( 1&& 'ata +iolation as 2nd /rogram Gre.ei+esH tries to mo+e 2&& .(ar

P#SSIN, # COMM#RE# *IT) "CTL


$5 data is to %e 3assed to t(e FCTLed 3rogram< a CO77 9* .an %e used6 'ata area is to %e lo.ated in t(e Lin-age Se.tion o5 t(e re.ei+ing 3rogram6 CO77 9* used :it( 9*TU92< L$2> R FCTL

#!!RESS#-ILIT'

'FECO77 9* R 'FE*$BL> B ddressa%le automati.all4 %4 C$CS '4nami.all4 a.;uired storage B ddressa%le %4 3rogram 2ot ne.essar4 to al:a4s do a *F*C C$CS 8*T7 $2 eC3li.itl4

1&7

CICS BUEUEIN0 .ACI+ITIES


T:o 5a.ilities to store data t(at are tem3orar4 in nature6 T(is data is .reated or .olle.ted %4 one or more online transa.tion to %e used later %4 t(e same transa.tion or %4 a di55erent transa.tion or e+en later 3assed to a %at.( 3rogram6 T(e4 are o Transient data !ueue GT'!H o Tem3orar4 storage !ueue GTS!H6

TRANSIENT DATA BUEUE


T(e4 are identi5ied %4 a 4 .(ara.ter $' .alled destination $' 'estination $' and ot(er .(ara.teristi.s o5 T'! are de5ined in t(e destination .ontrol ta%le G'CTH %4 t(e s4stem 3rogrammer6 2 t43es o5 T'!"s o $ntra /artition T'! o *Ctra /artition T'! $ntra /artition T'! ) /ro.essed onl4 :it(in t(e same C$CS region *Ctra /artition T'! ) $ndi+idual Se;uential Files 3ro.essed %et:een t(e transa.tion o5 t(e C$CS region and t(e s4stem outside o5 t(e .i.s region6

INTRA !ARTITION TDB ll $ntra 3artition T'! are stored in onl4 1 3(4si.al 5ile G=S 7H

9e.ord 5rom t(e ;ueue .an %e returned se;uentiall46 9e.ord .an %e :ritten se;uentiall46 9e.ords .an %e o5 +aria%le lengt( 5ormat Se+eral tas-s .an :rite to t(e same T'! %ut onl4 one tas- .an read 5rom T'!6

$ntra /artition T'! is used in a33li.ation su.( as


$nter5a.e among C$CS transa.tion6 33li.ation 3rogram 1 T'! 33l 6 /gm 2 re3ort utomati. tas- $nitiation G T$H 7essage routing 7essage Broad .ast6

EXTRA !ARTITION TDB *Ctra 3artition T'! is a se3arate 3(4si.al 5ile R ma4 %e a dis-< ta3e or re3orter6

'CT determines t(e initial o3en 0 .lose status o5 a 5ile :(ile t(e 5ile .an %e o3ened or .losed t(roug( t(e master terminal transa.tion during C$CS session6 T'! .an %e de5ined as an $n3ut or out3ut %ut not %ot(6 9e.ords are 5iCed< +aria%le< %lo.-ed or un%lo.-ed6

1&#

TRANSIENT DATA OUT!UT


33ears onl4 5or $ntra)3artition T'!6 'eletes all re.ords asso.iated :it( t(e named destination6 ll asso.iated storage is released6

E"CEPTION#L CON!ITIONS 16 S3e.ial (andling re;uired L*28*99 ) lengt( s3e.i5ied is greater t(an t(e maCimum re.ord lengt( s3e.i5ied in 'CT 26 !Dero ) 'estination em3ties or end o5 T'! error !lderr ) T(e dest ld s3e.i5ied .annot %e 5ound in 'CT6 TEM!ORAR4 STORA0E

TS! is a ;ueue o5 stored re.ords6 Created R deleted d4nami.all4 %4 a33li.ation 3rogram6 Used as a s.rat.( 3ad !ueue $' is o5 lengt( 1)# %4tes TS! is o5 +aria%le lengt( 9e.ords .an %e stored in main or auCiliar4 storage T(e re.ords on.e :ritten remains a..essi%le until t(e entire TS! is deleted 9e.ords .an %e read se;uentiall4 or dire.tl4 9e.ords .an %e re)read R u3dated6

*RITE% TS

To :rite or re):rite a re.ord in TS! *F*C C$CS @9$T*! TS !U*U* G2 7*H L*28TE G' T )= LU*H X$T*7 G' T ) 9* H X9*@9$T*Y X7 $2 U UF$L$ 9?Y *2')*F*C6 $T*7 ) $5 t(is o3tion is .oded C$CS :rite return t(e item num%er assigned to t(e re.ord Vust :ritten6 9*@9$T* ) is used to re:rite t(e re.ord identi5ied %4 $T*76 7ain 0 uCiliar4 ) To s3e.i54 t(e storage medium6 @ill %e stored in main i5 auCiliar4 storage not su33orted6

RE#!% TS

Can %e used to read re.ords eit(er se;uentiall4 or dire.tl46S4ntaC *F*C C$CS 9* '! TS

1&9

!U*U* G2 7*H $2TO G' T ) 9* H L*28TE G' T )= LU*H X$T*7 G' T )= LU*H U 2*FTY X2U79*C G' T ) 9* HY *2')*F*C6 2*FT ) to retrie+e t(e neCt ) logi.al re.ord in t(e TS!6 mutuall4 eC.lusi+e to t(e item o3tion 2U79*C ) t(e data area is de5ined as /$C 9G4H .om36 to 5ind t(e Total no6 o5 re.ords in t(e TS!6 $tem ) 5or dire.t a..ess s3e.i54 t(e item no o5 t(e re.ord6

DE+ETEB TS o( TSB

*F*C C$CS '*L*T*! TS !U*U* G2 7*H *2')*F*C6 ll re.ords is TS! are deleted6 ll asso.iated storage is released6

E"CEPTION#L CON!ITIONS

S3e.ial (andling re;uired o $temerr ) $tem num%er s3e.i5ied is not in t(e range o5 entr4 num%er assigned 5or t(e !ueue6 o Lengerr ) Lengt( s3e.i5ied is greater t(an t(e maCimum re.ord lengt(6 error ! iderr ) s3e.i5ied is !ueue id not 5ound6 TESTIN0 5 'AND+IN0 EXCE!TIONS

COMM#N!S FOR TESTIN, #PPLIC#TION PRO,R#MS

C*C$ GCommand Le+el $nter3reterH is a C$CS ) su33lied transa.tion :(i.( 3er5orms s4ntaC .(e.-ing o5 a C$CS .ommand6 $5 t(e s4ntaC is satis5ied< it :ill eCe.ute t(e .ommand6 C*B9 GTem3orar4 Storage Bro:seH is a C$CS ) su33lied transa.tion :(i.( %ro:ses Tem3orar4 Storage !ueue GTS!H6 C*'F is a C$CS ) su33lied transa.tion :(i.( monitors t(e eCe.ution o5 an a33li.ation 3rogram as an intera.ti+e de%ugging aid6

#PPLIC#TION PRO,R#M S&PPORT


9*S/ and 2OE 2'L* $82O9* CO2'$T$O2 E 2'L* CO2'$T$O2

11&

E 2'L* $' E 2'L* B*2'

COMM#N! LE EL INTERPRETER For in+o-ing C*C$< t43e C*C$ :it( t(e C$CS .ommand to %e inter3reted6

T(e 5irst s.reen lists all t(e 3ossi%le C$CS .ommands6 8i+ing ;uestion mar- G]H %e5ore t(e .ommand re;uests a s4ntaC .(e.- onl46 2o eCe.ution6 *C6 C*C$ S*2' 7 / GaS/OO7/OQH 7 /S*T GaS/OO7SOQH *9 S*

-RO*SIN, CICS %&E&ES


C*B9 .an %e in+o-ed :(ile 4ou are alread4 in t(e C*'F mode6 /ress t(e /F5 -e4 to dis3la4 t(e :or-ing storage se.tion6 T(en< 3ress /F12 -e4 to in+o-e C*B96 C*B9 allo:s to %ro:se in5ormation in Tem3orar4 Storage GTSH ;ueues6 Eel3 G/F1H gi+e 4ou a list o5 C*B9 .ommands on t(e s.reen6 TS ;ueues are retained until 3urged6

E"CEPTION )#N!LIN, C$CS to res3ond to eC.e3tional .onditions in one o5 t(ree :a4sB

9*S/ o3tionB ) T(e 9*S/ o3tion .an %e s3e.i5ied in an4 C$CS .ommand6 $ts 5un.tion is similar to t(e return .ode in t(e %at.( 3rogram6 o 'e5ine a 5ull:ord %inar4 5ield GS9G#HCO7/H in t(e :or-ing storage se.tion as a res3onse 5ield6 /la.e t(e 9*S/ o3tion :it( t(e res3onse 5iled in a .ommand6 5ter .ommand eCe.ution< .(e.- t(e res3onse .ode in t(e res3onse 5ield :it( 'FE9*S/ GCCCCH< :(ere CCCC is t(e ) 2O97 L ) n4 eC.e3tional .ondition E 2'L* CO2'$T$O2 T(is .ommand is used to trans5er .ontrol to t(e 3ro.edure la%el s3e.i5ied i5 t(e eC.e3tional .ondition s3e.i5ied o..urs6 $82O9* CO2'$T$O2 T(is .ommand .auses no a.tion to %e ta-en i5 t(e .ondition s3e.i5ied o..urs in t(e 3rogram6 *F*C C$CS E 2'L* CO2'$T$O2 Condition GLa%elH XCondition GLa%elHY X*rror GLa%elHY *2')*F*C6 or *F*C C$CS $82O9* CO2'$T$O2 Condition

111

XConditionY *2')*F*C6 B*2' CO'* $5 an eC.e3tional .ondition o..urs during eCe.ution o5 a C$CS a33li.ation 3rogram and i5 t(e 3rogram does not .(e.- t(e eC.e3tional .ondition< C$CS ma4 .ontinue eCe.uting t(e 3rogram or terminate a%normall4 t(e eCe.ution o5 t(e 3rogram< de3ending on t(e eC.e3tional .ondition and t(e .ommand in+ol+ed6

O!TION .OR EXCE!TION 'AND+IN0


CO'* 9*S/ -e4:ord in .ommandsB CE*C> US*9)SU//L$*' F$*L' $2 @O9>$28 ) STO9 8*6 CO'* 2OE 2'L* >*?@O9' $2 CO77 2'S6 E 2'L* CO2'$T$O2 CO77 2'S $82O9* CO2'$T$O2 S?ST*7 '*F ULT )) B*2'

112

CICS #dend Codes 4- *Ce.ute $nter5a.e Blo.- and .i.s a%end .odes Some o5 t(e more common CICS a1ends are %rie5l4 des.ri%ed %elo:6 T(ese are onl4 %rie5 des.ri3tions and do not .o+er all 3ossi%le reasons6 ASRA T(is is t(e most .ommon a%end in C$CS6 $t indi.ates a /rogram C(e.- *C.e3tion< roug(l4 e;ui+alent to (a+ing an S&C7 in a %at.( 3rogram6 C(e.- 5or s3a.es in a 3a.-ed de.imal numeri. 5ield and .(anges to t(e 5ile and re.ord la4outs6 AEIx #nd AE4x T(ere are numerous a%ends t(at start :it( *$ or *?6 T(e4 indi.ate t(at an eC.e3tion (as o..ured< and 9*S/ Gor 2OE 2'L*H is not is use6 T(e last .(ara.ter indi.ates t(e eCa.t error AEIC indi.ates a /87$'*996 AEIA is a 7 /F $L .ondition< AEIO indi.ates a du3li.ate -e4 G'U/>*?H .ondition6 AEIN indi.ates a du3li.ate%re.ord G'U/9*CH .ondition6 AEID indi.ates an *nd o5 5ile .ondition6 AEIS indi.ates t(at a 5ile is not o3en G2OTO/*2H AEI! indi.ates an in+alid re;uest .ondition G$2=9*!H AE4D indi.ates t(at 4ou are not aut(orised to use a resour.e G2OT UTEH

113

CICS F#%Ns4CICS .ABS !uestionB :(at is di55eren.e %et:een .all and lin-] ns:erB $n .ase o5 .all< :(ene+er 4ou do .(anges to t(e .alled 3rogram 4ou need to .om3ile t(e .alling 3rogram also6 $n .ase o5 lin-< it is not needed6 !uestionB :(at are t(e di55eren.es %et:een d5(.ommarea and ts;] ns:erB %ot( are used to sa+e data among tas-s6 %ut 16.ommarea is 3ri+ate to t(at transa.tion onl4 6 li-e e+er4 transa.tion (as its o:n .ommarea .reated %4 .i.s as soon as t(e transa.tion is initiated 6 (o:e+er ts; < i5 td; is -no:n .an %e a..essed %4 ot(er transa.tions also 26.ommarea lengt( is s9G4H .om3 ie 65- 6 %ut ts; .an (a+e an4 lengt(6 36.ommarea is a+aila%le onl4 during t(e transa.tion is running6 ts; i5 .reated :it( auCiliar4 o3tion resides in auC memor4 and a+aila%le e+en i5 main memor4 .ras(es6 46 normall4 .ommarea is used to tran5er data 5rom one tas- to anot(er :(ile ts; is used :idel4 :it(in t(e tas- as a s.rat.( 3ad6 !uestionB @(at is Communi.ation rea] ns:erB Communi.ation rea is used to 3ass data %et:een t(e 3rogrammer %et:een t(e tas-6 !uestionB @(i.( o5 t(e 5ollo:ing statements .orre.tl4 des.ri%e t(e s4ntaC o5 C$CS .ommand language] ns:erB 16 $5 an *F*C C$CS .ommand must %e .ontinued onto a se.ond line a (43(en G)H must %e .oded in .olumn 7 o5 t(e .ontinued line6 26 $5 an *F*C C$CS .ommand must %e .ontinued onto a se.ond line an QFQ must %e .oded in .olumn 72 o5 ea.( line to %e .ontinued6 36 n *F*C C$CS .ommand C 22OT %e .oded :it(in a COBOL $F statement< %et:een t(e $F .ommand and t(e 3eriod G6H ending it6 46 T(e *2')*F*C delimiter is o3tional and ne+er needs to %e 3la.ed at t(e end o5 a C$CS .ommand6 56 T(e o3tions s3e.i5ied :it(in an *F*C C$CS .ommand .an %e in an4 order6 For eCam3le Q*F*C C$CS S*2' F9O7G7S81H L*28TEG3&H *2')*F*CQ .an also %e .oded Q*F*C C$CS S*2' L*28TEG3&H F9O7G7S81H *2')*F*CQ !uestionB 6 C$CS 3rogram B*2'S :it( an S9 ns:erB 16 26 36 46 56 B*2' .ode6 @(at is its meaning]

lin- :as issued to a 3rogram :(ose name does not eCist in t(e //T G/rogram /ro.essing Ta%leH6 3rogram attem3ted to use a ma3 t(at is not de5ined in t(e /CT G/rogram Control Ta%leH6 se.urit4 +iolation (as o..urred6 T(e o3erator is not de5ined :it( t(e 3ro3er aut(orit4 in t(e S2T GSign)on Ta%leH to use a 3arti.ular 5ile6 3rogram interru3t G&C& or &C1 or &C2 or 666H (as o..urred in a C$CS 3rogram6 n $0O error (as o..urred :(en attem3ting to use a =S 7 5ile 5rom a C$CS 3rogram

114

!uestionB @(i.( o5 t(e 5ollo:ing .ommands< :(en issued %4 2 di55erent 3rograms running at t(e same time< :ill 3re+ent simultaneous use o5 resour.e QS$28L*Q] ns:erB 16 26 36 46 *F*C C$CS /9OT*CT 9*SOU9C*GQS$28L*QH L*28TEG6H *2')*F*C6 *F*C C$CS EOL' 9*SOU9C*GQS$28L*QH L*28TEG6H *2')*F*C6 *F*C C$CS T S> S$28L*GQS$28L*QH L*28TEG6H *2')*F*C6 *F*C C$CS *FCLUS$=* 9*SOU9C*GQS$28L*QH L*28TEG6H *2')*F*C6

!uestionB Eo: .an 4ou a..om3lis( %ra4-3oint in intertest] ns:erB U)5or un.ondis(ional %ra4-3oint< C)5or .onditional %ra-e3oint<and )5or automati. %ra-e3oint !uestionB (o: man4 :a4s are t(ere 5or initiating a transa.tion] :(at are t(e4] ns:erB T(ere are siC :a4s in initiating a transa.tion6 t(e4 are as 5ollo:s6 16 26 36 46 em%edding 5our .(ara.ter transid on t(e to3 le5t most .orner o5 t(e s.reen6 ma-ing use o5 *F*C C$CS ST 9T T9 2S$' G H ma-ing use o5 *F*C C$CS 9*TU92 T9 2S$' G H B4 de5ining t(e transid in 'CT G destination .ontrol ta%leH to ena%le T$ G UTO7 T$C T S> $2$T$ T$O2H 56 7a-ing use o5 /LT G 3rogram list ta%leH 66 B4 asso.iating 5our .(ara.ter transid in /CT G3rogram .ontrol ta%leH !uestionB :(i.( t43e o5 T'! is read destru.ti+e] ns:erB intra3artition td; is read destru.ti+e6 eCtra3artition td; is not read destr.ti+e6 !uestionB T(e error .ode aei+] ns:erB t(is is t(e error .ode 5or lengt(< i5 lengt( o5 t(e sour.e data is more t(an t(e re.ei+ing 5ield< t(is error :ill o..ur6 t(is is t(e .orre.t ans:er< 3re+iousl4 i mentioned it as 3rogram id error6 sorr4 5or t(e :rong in5ormation6 !uestionB @E T U 7* 2 B? *$=] ns:erB TE$S $S TE* *99O9 CO'* 8$=*2 B? TE* S?ST*7< $T 7* 2S /9O89 7 $' *99O96 !uestionB @E T $S TE* S$I* OF CO77 9* ns:erB TE* '*F ULT CO77 9* S$I* $S 65>6 !uestionB @(at is S9 B*2' in C$CS] ns:erB $t o..urs :(en 3rogram interu3tion ta-es 3la.e6e6g6B :(en al3(anumeri. string mo+ed to numeri. data item O9 :(en arit(meti. .al.ulations 3er5ormed on nonnumeri. data item O9 :(en an attem3t made to read an o..uran.e o5 a ta%le %e4ond t(e de5ind o..uran.es6 !uestionB @(at is a t:o /(ase .ommit in C$CS] ns:erB T(is o..urs :(en a 3rogrammer $ssues a *Ce. C$CS S4n.3oint .ommand6 t(is is .alled t:o 3(ase %e.ause C$CS :ill 5irst .ommit .(anges to t(e resour.es under its .ontrol li-e =S 7

115

5iles6 and t(e 'B2 .(anges are .ommitted6 Usuall4 C$CS signals '%2 to .om3lete t(e neCt 3(ase and release all t(e lo.-s6 !uestionB ns:er to 2O2Qs ;uestion< di5eren.e %et:een TS! R T'! ns:erB T'! is read destru.ti+e< TS! is not6 TS! .an %e .reated d4nami.all4< T'! .annot %e .reated d4nami.all46 TS! is tem3orar4 in nature Gi6e6< it :ill %e deleted :(en t(e 3rogram 5inis(es eCe.ution< unless it is made 3ermanent %4 ma-ing a entr4 in t(e Tem3orar4 Storage Ta%leH< T'! is not6 Eo3e t(is :ill su55i.e !uestionB @(at is *2! in C$CS] ns:erB $5 an4 one :ant to restri.t Trans)$d to single user< enter trans)id :it( *2!6 $t :onQt allo: an4 one else to use t(e same trans)id6 !uestionB $n S?7BOL$C Cursor /ositioning a5ter mo+ing )1 to t(e lengt( 5ield also t(e .ursor is not 3ositioned in t(at 3arti.ular 5ield6 8i+e reasons] ns:erB ?ou (a+e to eC3li.itl4 s3e.i54 t(e :ord CU9SO9 %et:een 4our *F*C C$CS and *2') *F*C in t(e 3rogram6 !uestionB @(at does *$B mean] ns:erB T(e *$B is t(e *F*CUT$=* $2T*9F C* BLOC>6 $t is not t(e *F*CUT* $2T*9F C* BLOC>6 ll T/ monitors or transa.tion 3ro.essors are -no: as *F*CUT$=*s as t(e4 .arr4 out 3ro.ess on %e(al5 o5 a 3rogram module6 C$CS and 'B2 are eC.uti+es6 !uestionB Eo: man4 eC.e3tional .ondition .an %e gi+en in a E 2'L* CO2'$T$O2] ns:erB 7aC6 o5 12 eC.e3tional .onditions .an %e gi+en in a single E 2'L* CO2'$T$O26 !uestionB @(at .ommand do 4ou issue to delete a re.ord in a transient data ;ueue ] ns:erB 9* '! T'< t(e read is destru.ti+e6 ?es it is .orre.t %ut t(ere is a restri.tion6 U .an deletet(e re.ords se;uentiall466 For eCam3le i5 one :ant to delete 1& t( re.ord dire.tl4 it is not 3ossi%le :it( t(is66 !uestionB Eo: do 4ou a..ess t(e re.ords randoml4 in TS!] ns:erB B4 s3e.i54ing t(e $T*7 o3tion !uestionB @(at .ommand do 4ou issue to delete a re.ord in a transient data ;ueue] ns:erB 9* '! T'< t(e read is destru.ti+e6 !uestionB @E T 9* '$FF*9*2T @ ?S OF $2$T$ T$28 T9 2S CT$O2 $2 C$CS ns:erB @* C 2 $2$T$ T* C$CS T9 2S CT$O2 16 B? 8$=$28 T9 2S CT$O2 $' 26 B? 8$=$28 C$CS ST 9T CO77 2' 36 UTO7 T$C T S> $2$T$ T$O26 !uestionB @(at is t(e di55eren.e %et:een L$2> and FCTL ] ns:erB T(e FCTL .ommand 3asses .ontrol to anot(er 3rogram< %ut t(e resour.es re;uested %4 t(e 5irst 3rogram ma4 still %e allo.ated6 tas- does not end until a 9*TU92 statement is

116

eCe.uted6 @(ile in L$2> .ommand< 3rogram .ontrol resumes its instru.tion 5ollo:ing t(e L$2> 3arameter6 T(e disad+antage o5 L$2> is t(at it re;uires t(at %ot( t(e .alling 3rogram and t(e .alled 3rogram remain in main memor4 e+en t(oug( %ot( are no longer needed6 !uestionB @(at is t(e di55eren.e %et:een C$CS /rogram Control Ta%le G/CTH and C$CS /ro.essing /rogram Ta%le G//TH ] ns:erB /CT .ontains a list o5 +alid transa.tion $'6 *a.( transa.tion $' is 3aired :it( t(e name o5 t(e 3rogram <C$CS :ill load and eCe.ute :(en t(e transa.tion is in+o-ed6 On t(e ot(er (and< //T indi.ates ea.( 3rogramQs lo.ation :(i.( 3ertains to a storage address i5 t(e 3rogram (as alread4 %een loaded or a dis- lo.ation i5 t(e 3rogram (asnQt %een loaded6 //T :ill also %e used to determine :(et(er it :ill load a ne: .o34 o5 t(e 3rogram :(en t(e transa.tion is in+o-ed6 !uestionB @(at are t(e 3 .ommon :a4s to .reate ma3s] ns:erB T(e 5irst :a4 is to .ode a 3(4si.al ma3 and t(en .ode a mat.(ing s4m%oli. ma3 in 4our COBOL 3rogram6 T(e se.ond :a4 to .reate a 3(4si.al ma3 along :it( a mat.(ing s4m%oli. ma3 is to .ode onl4 t(e 3(4si.al ma3 using t(e RS?S/ 97 o3tion< C$CS :ill automati.all4 .reate a mem%er in a CO/? li%rar46 nd t(e t(ird :a4 is to use a ma3 generator su.( as S'F GS.reen 'e5inition Fa.ilit4H !uestionB @(at is !uasi)reentran.4] ns:erB T(ere are times :(en man4 users are .on.urrentl4 using t(e same 3rogram< t(is is :(at :e .all 7ultiT(reading6 For eCam3le< 5& users are using 3rogram < C$CS :ill 3ro+ide 5& @or-ing storage 5or t(at 3rogram %ut one /ro.edure 'i+ision6 nd t(is te.(ni;ue is -no:n as ;uasi)reentran.4 !uestionB @(at is t(e di55eren.e %et:een a 3(4si.al B7S ma3set and a logi.al B7S ma3set] ns:erB T(e 3(4si.al ma3set is a load module used to ma3 t(e data to t(e s.reen at eCe.ution time6 T(e s4m%oli. ma3 is t(e a.tual .o34%oo- mem%er used in t(e 3rogram to re5eren.e t(e in3ut and out3ut 5ields on t(e s.reen6 !uestionB Eo: To Set 7'TG7odi5ied 'ata TagH T(ru 33li.ation /rogram]G'4nami.all4H6 ns:erB ?ou (a+e to mo+e t(e 5ollo:ing ma.ro 'FEB7FS* to t(e ttri%ute 5ield o5 t(at 3arti.ular =aria%le6 !uestionB @(at C$CS 5a.ilities .an 4ou use to sa+e data %et:een t(e transa.tions] ns:erB CO77O2 9* < TS! R T'!6 !uestionB Eo: :ould 4ou release .ontrol o5 t(e re.ord in a 9* ' 5or U/' T*] ns:erB B4 issuing a 9*@9$T*<'*L*T*< or U2LOC> .ommand or %4 ending t(e tas-6 !uestionB Eo: :ould 4ou release .ontrol o5 t(e re.ord in a 9* ' 5or U/' T*] ns:erB B4 issuing a 9*@9$T*<'*L*T*< or U2LOC> .ommand or %4 ending t(e tas-6 !uestionB @(at is t(e di55eren.e %et:een a 9*TU92 :it( T9 2S$' and FCTL ]For eCam3le 3rog6 is issuing 9*UT92 :it( T9 2S$' to 3rog B6 /rog 6 is issuing FCTL to 3rog B6 ns:erB $n 9*TU92 :it( T9 2S$' t(e .ontrol goes to t(e C$CS region and t(e user (a+e to trans5er t(e .ontrol to 3rog6 B %4 3ressing an4 o5 t(e $' >*?S6$n FCTL t(e .ontrol is dire.tl4 trans5er to 3rog6 B6

117

!uestionB @(at is t(e maCimum num%er o5 eC.e3tions t(at .an %e s3e.i5ied :it( a single E 2'L* CO2'$T$O2 .ommand in C$CS ] ns:erB S$FT**2 G16H !uestionB @E T @$LL B* TE* L*28TE OF TE* *$BC L*2 <$F TE* T9 2S CT$O2 $S US*' TO C$CS F$9ST T$7*] ns:erB TE* L*28TE @$LL B* &GI*9OH 6 !uestionB @E T $S 'FE*$BL>] ns:erB 'FE*$BL> is *Ce.ute $nter5a.e Blo.-6 $t is 3la.ed in t(e lin-age se.tion automati.all4 %4 C$CS translator 3rogram6 $t must %e t(e 5irst entr4 in lin-age se.tion6 C$CS 3la.es +alues 3rior to gi+ing .ontrol to t(e 3rogram and :e .an 5ind almost an4 in5ormation a%out our transa.tion6 !uestionB @(at is t(e di55eren.e %et:een t(e FCTL and L$2> .ommands] ns:erB T(e L$2> .ommand anti.i3ates return o5 .ontrol to t(e .alling 3rogram< t(eFCTL .ommand does not6 9eturn to t(e .alling 3rogram :ill %e t(e result o5 t(e C$CS 9*TU92 .ommand< s3e.i54ing T9 2S$'Gname o5 t(e .alling 3rogramH6 !uestionB @(at C$CS .ommand :ould 4ou use to read a =S 7 >S'S se;uentiall4 in as.ending order] ns:erB First issue a ST 9TB9Gstart %ro:seH< :(i.( :ill 3osition t(e %ro:se at t(e desired re.ord6 9etrie+e re.ords %4 using su%se;uent 9* '2*FT .ommands6 $ndi.ate t(e end o5 se;uential 3ro.essing :it( t(e *2'B9 .ommand6 $5 t(e generi. -e4 is s3e.i5ied in t(e ST 9TB9 .ommand 3ositioning in t(e 5ile :ill %e %e5ore t(e 5irst re.ord satis54ing t(e generi. -e46For reading in des.ending order use t(e 9* '/9*= instead o5 9* '2*FT6 !uestionB @(at is t(e di55eren.e %et:een 3seudo).on+ersational and .on+ersational] ns:erB /seudo).on+ersational :ill start a ne: tas- 5or ea.( in3ut6 B4 .oding a C$CS 9*TU92 .ommand s3e.i54ing T9 2S$'Gitsel5H6 Con+ersational :ill (a+e an a.ti+e tas- during t(e duration o5 t(e data entr46 !uestionB @(at is t(e CO77 9* G.ommuni.ations areaH] ns:erB n area used to trans5er data %et:een di55rent 3rograms or %et:een su%se;uent eCe.utions o5 t(e same 3rogram6 2eeds to %e de5ined in t(e Lin-age Se.tion6

11#

!-7 Tutorial 4In rodu% ion o D# #)#ses *hat is data?

re3resentation o5 5a.ts or instru.tion in a 5orm suita%le 5or .ommuni.ation6 *hat is a data1ase? $t is a re3ositor4 5or stored data6 *hat is a data1ase S+stem? n integrated and s(ared re3ositor4 5or stored data or .olle.tion o5 stored o3erational data used %4 a33li.ation s4stems o5 some 3arti.ular enter3rise6 2ot(ing more t(an a .om3uter)%ased re.ord -ee3ing s4stem #d/antages o2 !-MS o/er File Management S+stems 'ata redundan.4 7ulti3le =ie:s S(ared data 'ata inde3enden.e Glogi.al0/(4si.alH 'ata di.tionar4 Sear.( +ersatilit4 Cost e55e.ti+e Se.urit4 and Control 9e.o+er4< restart R Ba.-u3

119

Con.urren.4

T+5es o2 !ata1ases : or Models; Eierar.(i.al 7odel 2et:or- 7odel 9elational 7odel O%Ve.t)Oriented 7odel )IER#RC)IC#L MO!EL To3 do:n stru.ture resem%ling an u3side)do:n tree6 /arent .(ild relations(i3 First logi.al data%ase 7odel +aila%le on most o5 t(e 7ain5rame .om3uters *Cam3lesB $7S NET*OR( MO!EL 'oes not distinguis( %et:een 3arent and .(ild6 n4 re.ord t43e .an %e asso.iated :it( an4 num%er o5 ar%itrar4 re.ord t43es *n(an.ed to o+er.ome limitations o5 ot(er models %ut in realit4 t(ere is minimal di55eren.e due to 5re;uent en(an.ement *Cam3leB $'7S REL#TION#L MO!EL 'ata stored in t(e 5orm o5 ta%le .onsists o5 multi3le ro:s and .olumns6 *Cam3lesB 'B2<O9 CL*< S?B S*

12&

O-@ECT-ORIENTE! MO!EL 'ata attri%utes and met(ods t(at o3erate on t(ose attri%utes are en.a3sulated instru.tions .alled o%Ve.ts6 Types o( In e"ri y *ntit4 $ntegrit4 9e5erential $ntegrit4 'omain $ntegrit4 Entit+ Integrit+ $s a state :(ere no .olumn t(at is 3art o5 a 3rimar4 -e4 .an (a+e a null +alues6 Re2erential Integrit+ $s a state :(ere e+er4 5oreign -e4 in t(e 5irst ta%le must eit(er mat.( a 3rimar4 -e4 +alue in t(e se.ond ta%le or must %e :(oll4 null6 !omain Integrit+ $ntegrating o5 in5ormation allo:ed in .olumn6 En i y Re$# ions*ip Mode$ *)9 model is a logi.al re3resentation o5 data 5or a %usiness area6 9e3resented as entities relations(i3 %et:een entities and attri%utes o5 %ot( relations(i3s and entities6 *)9 models are out3uts o5 anal4sis 3(ase6 *Cam3le o5 relational Stru.ture CUSTO7*9 3la.es O9'*9S O9'*9 (as /9O'UCTS *a.( order relates to onl4 one .ustomer Gone)to)oneH 7an4 orders .an .ontain man4 3rodu.ts Gman4)to)man4H .ustomer .an 3la.e an4 num%er o5 orders G one)to)man4H $n last eCam3le .ustomer<order R 3rodu.t are .alled entities

121

n entities ma4 trans5orm into ta%les6 T(e uni;ue identit4 5or in5ormation stored in an entit4 is .alled a 3rimar4 -e4 ttri%utes :(i.( de5ine t(e .(ara.teristi.s o5 t(e ta%le6 D,; O-@ECTS Stogrou3GStorage grou3H 'ata%ase Ta%le S3a.e Ta%le =ie: $ndeC Stogrou5 : Storage ,rou5; $t is a .olle.tion o5 dire.t a..ess +olume< all o5 t(e same de+i.e t43e T(e o3tion is de5ined as a 3art o5 ta%le s3a.e de5initions @(en a gi+en s3a.e needs to %e eCtended< storage is a.;uired 5rom t(e a33ro3riate stogrou36 !ata1ase .olle.tion o5 logi.all4 related o%Ve.ts , li-e ta%le s3a.es< indeC s3a.es< ta%les et.6 2ot a 3(4si.al -ind o5 o%Ve.t< ma4 o..u34 more t(an one dis- s3a.e6 STO89OU/ R BUFF*9 /OOL must %e de5ined 5or ea.( data%ase6 $n a gi+en data%ase< all t(e s3a.es need not (a+e t(e same STO89OU/6 T#-LE SP#CES Logi.al address s3a.e on se.ondar4 storage to (old one or more ta%les6 $t is t(e storage unit 5or re.o+er4 and reorganiDing 3ur3ose T(ree t43es o5 ta%le s3a.es are B

122

Sim3le /artitioned Segmented Sim5le Ta1le S5aces Can .ontain more t(an one stored ta%les 'e3ending on a33li.ation< storing more t(an one ta%les mig(t ena%le 5aster retrie+al 5or Voins using t(ese ta%les6 Usuall4 onl4 one ta%le is 3re5erred6 T(is is %e.ause a single 3age .an .ontain ro:s 5rom all ta%les de5ined in t(e data%ase6 Segmented ta1le s5aces Can .ontain more t(an one stored ta%les< %ut in a segmented s3a.e6 \segment" .onsists o5 a logi.all4 .ontiguous set o5 \n" 3ages6 2o segment is allo:ed to .ontain re.ords 5or more t(an one ta%le6 Se;uential a..ess to a 3arti.ular ta%le is more e55i.ient6 Lo.- Ta%le on ta%le lo.-s onl4 t(e ta%le< not t(e entire ta%le s3a.e6 $5 a ta%le is dro33ed< t(e s3a.e 5or t(at ta%le .an %e re.laimed :it(in minimum reorganiDation6 Partitioned Ta1le S5ace /rimaril4 used 5or +er4 large ta%les Onl4 one ta%le in a 3artitioned ta%le s3a.e $ndi+idual 3artitions .an %e inde3endentl4 re.o+ered and reorganiDed6 'i55erent 3artitions .an %e stored on di55erent storage grou3s 5or e55i.ient a..ess6 T#-LES ta%le is a .olle.tion o5 ro:s and .olumns6 T(e data is stored on magneti. dis-s in a series o5 T BL*S6

123

*a.( COLU72 .ontains some s3e.i5i. in5ormation a%out su33liers and ea.( 9O@ .ontains all t(e in5ormation a%out a 3arti.ular su33lier6 For eCam3le SU//L$*9 ta%le loo-s li-e B

SP &&1 &&2 &&3 IE*S

S2 7* ST TUS C$T? /9 S ' 2& CE*22 $ = SU 3& '*LE$ S$= 1& BO7B ?

=ie:s .an %e +er4 3ra.ti.al :a4s o5 sim3li54ing ;ueries %4 redu.ing t(e num%er o5 di55erent ta%les6 =ie:s .an also (ide sensiti+e data 5rom users :(o don"t need a..ess to it6 C9* T* =$*@ *7/[=$*@ S S*L*CT *7/2O<2 7*<'*/T<JOB F9O7 *7/ S'NON'MS S4non4m is li-e a ni.- name to a ta%le name and :(en no longer needed it .an %e dro33ed6 S4non4m a..ess is s3e.i5i. to t(e user :(o (as .reated it6 STRUCTURED BUER4 +AN0UA0E(SB+) 3o:er5ul data%ase management language t(at 3er5orms t(e 5un.tion o5 data mani3ulation< data de5inition and data .ontrol6 non)3ro.edural language6 T(e .a3a%ilit4 to a.t on a set o5 data and t(e la.- o5 need to -no: (o: to retrie+e it6 $t allo:s to s3e.i54 @E T t(e result s(ould %e< 2OT EO@ t(e result o%tained6 S%L T'PES:-ased on 2unctionalit+; ''L ) C9* T*< LT*9 and '9O/ '7L ) S*L*CT<$2S*9T< U/' T* R '*L*T* 'CL ) 89 2T and 9*=O>*

124

S%L T'PES:Others; Stati. or '4nami. S!L *m%edded or Stand)alone S!L )O* !O 'O& &TILIGE S%L? $t is usuall4 a..essed on)line6 $t .an %e used intera.ti+el4< su.( as S/UF$<!7F or it .an %e em%edded in COBOL</L0$< SS*7BL*9 or FO9T9 2 3rogram6 *)#T MI,)T 'O& !O *IT) S%L? s an end)user 4ou :ill %e using S!L on)line to a..ess data and 3rodu.e 5ormatted re3orts6 s an a33li.ation 3rogrammer< 4ou :ill use S!L to eCtra.t data 5rom one or more ta%les and 3ass t(ese data to anot(er 3rogram 5or additional 3ro.essing6 S!L tas- is .enter a%out 5our %asi. 5un.tions R t(ese 5un.tions .orres3ond to t(e 5our %asi. S!L .ommand GS*L*CT< U/' T*< $2S*9T< '*L*T*H )O* TO CRE#TE # SIMPLE S%L %&ER'? Sear.( t(e ta%le o5 4our .(oi.e Sele.t s3e.i5i. .olumns to %e dis3la4ed 5rom a ta%le Sele.t s3e.i5i. ro:s to %e dis3la4ed 5rom a ta%le S3e.i54 t(e order in :(i.( to dis3la4 data )ow do +ou s5eci2+ which ta1les +ou want to select 2rom? @(i.( ta%les .ontain data] @(i.( .olumns to dis3la4 5rom t(e ta%le] @(i.( ro:s to dis3la4] $n :(i.( order to dis3la4 t(e .olumns and0or ro:s6 n4 S*L*CT statement must s3e.i54 a ta%le $5 t(e ta%le %elongs to anot(er user< 4ou ma4 (a+e to 3re5iC t(e ta%le name :it( t(e ot(er user"s $'6

125

)ow do +ou s5eci2+ which COL&MNS +ou want to dis5la+? Listing t(e name o5 t(e .olumns on a S*L*CT statement< se3arated %4 .ommas6 S*L*CT S2 7*< ST TUS F9O7 SU//L$*9S *h+ not use the REN in all +our ?ueries? Using t(e \J" to indi.ate all .olumns s(ould %e dis3la4ed is ine55i.ient i5 4ou don"t need to see all t(e .olumns6 ?ou .an 3ut t(e .olumns in t(e order 4ou :ant t(em6 $t is %etter to s3e.i54 Vust t(ose .olumn 4ou :ant6 )ow do +ou s5eci2+ which rows +ou want to dis5la+? Using @E*9* -e4:ord6 T(e 5ormat is @E*9* 5ollo:ed %4 a .ondition or list o5 .onditions6 S*L*CT S2 7* F9O7 SU//L$*9 @E*9* ST TUS13& Can +ou 5ut the data in Order? Using O9'*9 B? -e4:ord to 4our ;uer4 S!L automati.all4 orders data in as.ending order i5 4ou (a+e an4 O9'*9 B? statement in 4our ;uer46 $5 4ou :ant 4our data in des.ending order< use t(e '*SC -e4:ord6 SE+ECT STATUS .ROM SUPPLIERS ORDER ,4 STATUS DESC Can +ou order 1+ more than one column? ?ou .an order %4 as man4 .olumns as 4ou :ant6 Sim3le add t(e .olumns 4ou :ant to sort to t(e O9'*9 B? .lause< se3arated %4 .omma6 *Cam3leB SE+ECT SNAME ,STATUS, CITY .ROM SUPPLIERS ORDER ,4 STATUS,SNAME &se o2 R#N!N and RORN to ma3e a ?uer+ more s5eci2ic.

126

Sometimes a single sear.( .ondition is not 3re.ise enoug( to sele.t onl4 t(e ro:s 4ou need6 So 4ou need to use t(e logi.al o3erator 2' and O96 ?ou .an lin- as man4 sear.( eC3ression as 4ou :ant using 2' and O96 Using %ot( o3erator toget(er< sear.(ed eC3ression lin-ed %4 2' are 3aired u3 5irst6 /arent(eses .an %e used to 5or.e eC3ression to %e 3aired toget(er6 )ow do +ou a/oid du5licate data in +our out5ut? B4 adding t(e -e4:ord '$ST$2CT immediatel4 5ollo:ing S*L*CT < 4ou su33ress an4 du3li.ates6 SE+ECT DISTINCT STATUS .ROM SUPPLIERS *hat are the relational o5erators? Eere is t(e 5ull list o5 o3eratorsB S?7BOL CO2'$T$O2 1 e;ual to N greater t(an O less t(an N1 greater t(an or e;ual to O1 lesser t(an or e;ual to ON less t(an or greater t(an L$>* .ontaining .ertain .(ara.ters B*T@**2 :it(in a range o5 +alues $2 one o5 a set o5 +alues *a.( .ondition also (as a negati+e +ersion6 IN Lets 4ou retrie+e data 5rom ea.( ro: :(ose .olumns (as a +alue e;ual to one o5 t(e se+eral listed +alues6 *Cam3leB *)ERE ST TUS IN G2&<1&<3&H n4 ro: :it( ST TUS .olumn +alue o5 2&<1&< 3& is sele.ted6 *a.( .(ara.ter +alue must %e in ;uotes6 =alues are se3arated %4 .omma R +alues list is en.losed in 3arent(esis6 ,ET9EEN

Lets 4ou retrie+e data 5rom ea.( ro: :(ose .olumns (as a +alue :it( t:o limits6 *Cam3leB *)ERE ST TUS -ET*EEN 1& 2' 3& n4 ro: :it( ST TUS .olumn +alue o5 1& t(ru 3& is sele.ted6

127

$t .an %e used 5or %ot( numeri. and .(ara.ter +alues6 T(e t:o +alues must %e se3arated %4 2'< t(e lo:er +alue must %e t(e 5irst +alue6

+I1E

Lets 4ou retrie+e data 5rom ea.( ro: :(ose .olumns (as a +alue similar to t(e +alue s3e.i5ied in t(e @E*9* CL US*6 *Cam3leB *)ERE S2 7* LI(E \BcC" n4 ro: :it( name .olumn %eginning :it( \B" 5ollo:ed %4 2? = LU* o5 2? L*28TE< and ending :it( \C" is sele.ted6 \c" re3resents an4 +alue o5 an4 lengt(< :(ere as an unders.ore \[" re3resents an4 single .(ara.ter L$>* .an"t use 5or an4 numeri. .olumn6

9*# is NU++E

2ULL is a .olumn +alue t(at does not eCists6 $t is not a %lan-< not is it Dero , it is a \non)+alue"6 T(e .olumns must 3rede5ined to t(e 'B7S as a .olumn t(at ma4 .ontain 2ULL +alues6

)O* !OES S%L TRE#T N&LL #L&ES?


8enerall4< 2ULL +alues are ignored6 $5 4ou 3er5orm a .al.ulation using a .olumn :it( 2ULL +alues< t(ose ro:s .ontaining 2ULLQs are ignored and a das( :ill out3ut as t(e result6 2ULL means ^= LU* U2>2O@2_< so it .annot meet an4 o5 t(e standard sear.( .onditions6

EFam5le o2 N&LL /alues


To sele.t all ro:s :it( a 2ULL +alue in t(e CO77 .olumn< 4ou must use @E*9* CO77 $S 2ULL as 4our sear.( .ondition To sele.t all ro:s t(at do 2OT (a+e a 2ULL +alue< 4ou must use @E*9* CO77 $S 2OT 2ULL as 4our sear.( .ondition 2oteB @E*9* CO77 1 & ` @(o (as earned no .ommission] @E*9* CO77 $S 2ULL @(o is ineligi%le 5or .ommission]

ARIT'METRIC EX!RESSIONS

n arit(meti. eC3ression is a .al.ulation using numeri. +alues and one or more o5 t(e arit(meti. o3erators Baddition GKH< su%tra.tion G)H< multi3li.ation GJH< and di+ision G0H6 *Cam3leB SE+ECT SALARY + COMM,NAME,DEPT rit(meti. eC3ressions .an also %e used in a @E*9* .lauseB 9'ERE SALARY + COMM >5000.00

12#

R&LES FOR CO!IN, #RIT)METIC E"PRESSIONS


S3a.es on eit(er side o5 t(e arit(meti. s4m%ols are o3tional6 SALARY/12 O9 SALARY / 12 ?ou .an .om%ine .olumn names and .onstants in arit(meti. eC3ressions6 1998 - JOIN_YR, 1.0*SALARY

)O* !OES S%L E #L&#TE #RIT)METIC E"PRESSIONS?


S!L :or-s 5rom le5t to rig(t< e+aluating multi3li.ation and di+ision %e5ore addition and su%tra.tion GJ< 0 < K< )H6 Eo:e+er an4 eC3ressions in 3arent(eses are e+aluated 5irst6

-&ILT IN F&NCTION

SU7 7 F 7$2 =8 COU2TGJH COU2TG'$ST$2CT .ol nameH

S&M

Cal.ulate t(e total +alue 5or a gi+en .olumn or arit(meti. eC3ression SE+ECT SUM SALARY! .ROM EMP

M#" and MIN

'is3la4 eit(er t(e (ig(est or lo:est +alue 5ound in t(e ro:s sele.ted %4 t(e ;uer46 SE+ECT MAX SALARY!,MIN SALARY! .ROM EMP

# ,

'is3la4 t(e a+erage o5 all non)2ULL .olumns SE+ECT AV0 SALARY! .ROM EMP =8 disregards an4 ro:s :it( 2ULLs in an4 .olumn in+ol+ed in t(e a+eraging eC3ression $nteger .olumns are not rounded< so result ma4 %e ina..urate6 To .on+ert an integer .olumn to a de.imal .olumn multi3l4 %4 16& as 3art o5 t(e =8 eC3ression6 AV0 1.0 * STATUS!

CO&NT:E;

$t .ounts all t(e ro:s sele.ted %4 a ;uer4 SE+ECT COUNT(F) .ROM SUPPLIERS

129

CO&NT:!ISTINCT col name;


$t .ounts onl4 t(ose ro:s t(at (a+e a uni;ue +alue in t(e s3e.i5ied .olumn SE+ECT COUNT(DISTINCT STATUS) .ROM SUPPLIERS COU2T GJH .ounts all t(e ro:s sele.ted COU2TG'$ST$2CT .ol nameH does not .ount ro:s :it( a du3li.ate +alue in t(e s3e.i5ied .olumn6 COU2TG'$ST$2CT .ol[nameH does not .ount ro:s t(at (a+e 2ULLS in t(e s3e.i5ied .olumn6

)O* !OES S%L CRE#TES S&MM#R' !#T#


@(en 4ou re;uest a %uilt)in summar4 5un.tions< S!L goes t(roug( se+eral ste3s to rea.( a result6 First< all t(e ro:s and .olumns are sele.ted6 T(is intermediate result is -e3t in a tem3orar4 ta%le6 2eCt< t(e s4stem 3ro.ess 4our 89OU/ B? re;uest< .reating a tem3orar4 ta%le 5or ea.( 89OU/ and 3utting t(e a33ro3riate ro:s in ea.( ta%le6 T(en t(e %uilt)in 5un.tions are .al.ulated6 $5< 5or eCam3le 4ou re;uested an =8< t(en t(e a+erage 5or ea.( tem3orar4 su% grou3 is .al.ulated6

,RO&P -'

89OU/ B? out3uts a summar4 ta%le , one line 5or ea.( grou36 89OU/ B? .an onl4 %e used in .onVun.tion :it( %uilt)in 5un.tions6 89OU/ B? 5ollo:s F9O7 and @E*9* and 3re.edes O9'*9 B? *Cam3leB SE+ECT DEPT, MAX SALARY! .ROM EMP 0OU! ,4 DEPT $t :ill 3rodu.e a ta%le listing t(e maCimum salar4 +alue 5or ea.( de3artment6

)# IN,

$t is similar in 5un.tion to t(e @E*9* .lause $ts 3ur3ose is to 5urt(er de5ine a \grou3" s3e.i5ied in t(e 89OU/ B? statement SE+ECT DEPT, AV0 SALARY! .ROM EMP 0ROU! ,4 DEPT 'AVIN0 COUNT *!>" E =$28 .an onl4 %e used in .onVun.tion :it( 89OU/ B? E =$28 must immediatel4 5ollo: t(e 89OU/ B? .lause E =$28 .an onl4 .om3are %uilt)in 5un.tions not indi+idual .olumns

/OININ0

Joining ta%les in+ol+es mat.(ing t(e ro:s o5 one ta%le :it( related ro:s o5 anot(er ta%le to 3rodu.e a ta%le .onsisting o5 ro:s :it( .olumns 5rom %ot( t(e original ta%les6

-#SIC PRINCIPLES OF @OININ, T#-LES

$t :ill .om%ine related in5ormation 5rom t:o ta%les into a single ro:6

13&

$5 a +alue a33ears on.e in t(e ^Voining .olumn_ o5 one ta%le< %ut se+eral times in t(e ot(er< t(e (ig(er num%er o5 o..urren.es :ill a33ear in t(e out3ut ta%le6 $5 a +alue eCists in t(e ^Voining .olumn_ o5 one ta%le< %ut not in t(e ot(er< no ro: a33ears in t(e out3ut ta%le :it( t(at +alue6

/OININ0 CO+UMN

$t is a .olumn t(at is .ommon to all t(e ta%les %eing Voined and .ontains t(e ro: +alues t(at tie one ta%le to neCt6

)O* !O 'O& #CT&#LL' TIE T)E T#-LES TO,ET)ER?


@it( a s3e.ial t43e o5 @E*9* .lause .alled t(e Voining .ondition *)ERE *7/6'*/T2O 1 '*/T6'*/T2O *Cam3leB SE+ECT ITEM,PRICE,COLOR .ROM T#$%&1,T#$%&2 9'ERE T#$%&1.ITEM ' T#$%&2.ITEM

MER0IN0

7erging ta%les also in+ol+es .om%ining data 5rom t:o ta%les< %ut t(e ro:s are not Voined toget(er6 *Cam3leBSE+ECT *.ROM EMP UNION SE+ECT * .ROM SUPPLIER

MER,IN, %&ER' CO!IN,


Sele.t data 5rom one ta%le S3e.i54 U2$O2 or U2$O2 LL to indi.ate 7*98* Sele.t data 5rom se.ond ta%le *Cam3leB SE+ECT * .ROM T#$%&_1 UNION SE+ECT * .ROM T#$%&_2 T(e U2$O2 or U2$O2 LL -e4:ord must %e entered a5ter t(e 5irst S*L*CT statement

&NION /s &NION #LL

U2$O2 sorts t(e result ta%les< U2$O2 LL does not6 $n ot(er :ords< U2$O2 miCes ro:s toget(er in t(e out3ut6 U2$O2 LL out3uts all t(e ro:s 5rom t(e 5irst ta%le t(at meet t(e sear.( .ondition6 U2$O2 remo+es du3li.ate ro:s< U2$O2 LL does not6

*)EN TO MER,E T*O T#-LES


*a.( .olumn sele.ted 5rom 5irst ta%le must %e .om3ati%le :it( t(e .orres3onding .olumns 5rom t(e se.ond ta%le6 numeri. .olumn are .om3ati%le :it( numeri. .olumn< a .(ara.ter .olumn to a .(ara.ter .olumn< and so on6 2umeri. data t43es need not %e t(e same .olumn lengt( ?ou must sele.t t(e same num%er o5 .olumns 5rom ea.( ta%les6

131

CRE#TIN, #N! &P!#TIN, T#-LES

To .reate a ne: ta%le 4ou must use t(e S!L statement C9* T* T BL*6 ?ou must s3e.i54 t(e ta%le name and t(e names and attri%utes o5 ea.( .olumn6

RU+ES .OR TA,+E NAME


7aCimum 1# .(ara.ters /ermissi%le .(ara.ters o letters o5 t(e al3(a%et o Z< P< and L o num%ers o unders.ore G[H T(e 5irst .(ara.ter must %e al3(a%eti. or Z<P< or L

DATA T4!ES 'ata t43e de3ends on t(e nature o5 t(e data itsel5 and :ill al:a4s %e one o5 t:o t43es , 2U7*9$C or CE 9 CT*9 T43es o5 CE 9 CT*9 .olumn CE 9 , llo:s an4 +alues to %e entered in t(e .olumn6 ll entries are t(e same lengt( = 9CE 9 , llo:s an4 +alues to %e entered in t(e .olumn6 ll entries are t(e +ar4ing lengt( T43es o5 2U7*9$C .olumns $2T*8*9 ) For +er4 large integers u3 to 2<147<4#3<647 S7 LL$2T ) For small integer u3 to 99999 Ta%le S3a.e '*C$7 L ) For num%ers :it( a 5iCed num%er o5 de.imal 3la.es a5ter t(e de.imal 3oint6 T(e num%er .an (a+e a total o5 15 digits FLO T )For +er4 large num%ers :it( an undetermined num%er o5 de.imal 3la.es a5ter t(e de.imal 3oint T43es o5 ' T*0T$7* .olumns ' T* ) 'ates are stored in ????77'' 5ormat T$7* ) Times are stored on a 24)(our .lo.- in EE77SS 5ormat

132

T$7*ST 7/ , T$7*ST 7/ .olumns .ontain %ot( date and time in5ormation< :it( t(e time +alue a..urate to t(e millise.ond6 0RANT 5 REVO1E

/ri+ileges in 'B2 to .ontrol a..essing data To grant a..ess to a ta%le or +ie: 4ou must run a ;uer4 t(at s3e.i5ies t(ree t(ings in t(e 5ollo:ing order o T(e 3ri+ileges 4ou are granting GS*L*CT<$2S*9T<'*L*T*<U/' T* or LLH o T(e name o5 t(e ta%le or +ie: o T(e user or users to :(om 4ou are granting a..ess STO89OU/GStorage grou3H To grant e+er4t(ing< use 89 2T LL To grant a 3ri+ilege to *=*9?BO'? < 4ou grant TO /UBL$C

PRI ILE,ES

(RANT ALL ON TA)LE EMP TO PU)LIC RE*O+E ALL ON EMP TO PU)LIC

C#N 'O& C)#N,E # T#-LE OR IE* #FTER 'O& CRE#TE IT?


T(e onl4 .(ange 4ou .an ma-e to a ta%le or +ie: a5ter it (as %een .reated is to add an additional .olumn6 T(is is done :it( t(e S!L .ommand LT*9 o ALTER TA)LE EMP ADD COMM DECIMAL , ,2!

!ROP

@(en 4ou no longer need a T BL*< =$*@< or S?2O2?7 4ou .an '9O/ t(em6 o '9O/ T BL* SU//L$*9 o '9O/ =$*@ *7/[=$*@ o '9O/ S?2O2?7 S

INSERTIN, # T#-LE

T(ere must %e one +alue 5or ea.( .olumn Se3arate +alues :it( .ommas /ut .(ara.ter +alues in single ;uotes 2umeri. +alues do not re;uire ;uotes $5 4ou :ant enter t(e +alues in a di55erent order< t(ere is an alternati+e :a4 o5 inserting a ro:< %4 listing t(e .olumns along :it( t(eir assigned +alues o INSERT INTO SUPPLIER S-,STATUS,SNAME! VA+UES .S1/,"0,/*AST/!

&P!#TE

S!L 3ro+ides t:o .ommands 5or u3dating ro: +alues , U/' T* and S*T6

133

U/' T* tells S!L :(i.( ta%le 4ou :ant to u3date and S*T 3ro+ides t(e name o5 t(e .olumn to u3date and t(e ne: +alue 5or t(e .olumn6 ?ou tell S!L :(i.( ro: to u3date :it( a @E*9* .lause .an %e +er4 s3e.i5i.< so t(at a single ro: gets .(anged< or it .an %e +er4 general< so t(at man4 ro:s get u3dated6 o O)>UPDATE SUPPLIER SET STATUS ' 00 9'ERE S- ' .S1/ o U!DATE EMP SET SALARY ' SALARY + SALARY *.01

!ELETE

Using t(e '*L*T* .ommand 4ou .an delete ro:s and using @E*9* .lause 4ou .an s3e.i54 :(i.( ro:s 4ou :ant to delete6 o DE+ETE .ROM SUPPLIER 9'ERE S- ' .S1/

Com5leF S%LNs

One terms a S!L to %e .om3leC :(en data t(at is to %e retrie+ed .omes 5rom more t(an one ta%le6 S!L 3ro+ides t:o :a4s o5 .oding a .om3leC S!L o Su%;ueries and Join

S&- %&ERIES

2ested sele.t statements6 S3e.i5ied using t(e $2 or 2OT $2 3redi.ate< e;ualit4 or non)e;ualit4 3redi.ate and .om3arati+e o3erator6 @(en using t(e e;ualit4< non)e;ualit4 or .om3arati+e o3erators t(e inner ;uer4 s(ould return onl4 a single +alue6 2ested loo3 statements gi+es t(e user 5leCi%ilit4 5or ;uer4ing multi3le ta%les6 s3e.ialiDed 5orm is a .orrelated su% ;uer46 $t :or-s on to3)%ottom)to3 5as(ion6 2on .orrelated su% ;uer4 :or-s in %ottom to to3 5as(ion6

@OINS

OUT*9 JO$2 $22*9 JO$2

O&TER @OIN

For one or more ta%les %eing Voined %ot( mat.(ing and t(e non)mat.(ing ro:s are returned6 'u3li.ate .olumns ma4 %e eliminated6 2on)mat.(ing .olumns :ill (a+e nulls6

INNER @OIN

Eere t(ere is a 3ossi%ilit4 one or more o5 t(e ro:s 5rom eit(er or %ot( ta%les %eing Voined :ill not %e in.luded in t(e ta%le t(at results 5rom t(e Voin o3eration

134

BM.8 Buery M#n#"emen .#%i$i y


$t is an 7=S and =7)%ased ;uer4 tools llo:s end users to enter S!L ;ueries to 3rodu.e a +erit4 o5 re3orts and gra3(s as a result o5 t(is ;uer46 !7F ;ueries .an %e 5ormulated in se+eral :a4sB %4 dire.t S!L statements< %4 means o5 relational 3rom3ted ;uer4 inter5a.e

SP&FI :S%L Processing &sing File In5ut;


Su33orts t(e on)line eCe.ution o5 S!L statements 5rom a TSO terminal6 Used 5or de+elo3ers to .(e.- S!L statements or +ie: ta%le details6 S/UF$ menu .ontains t(e in3ut 5ile in :(i.( t(e S!L statements are .oded< o3tion 5or de5ault settings and editing and out3ut 5ile6 !ro"r#m !rep#r# ion

/re.om3ile Com3ile R LinBind o /a.-age o /lan

Precom5ile

Sear.(es all t(e S!L statements and 'B2 related $2CLU'* mem%ers and .omments out e+er4 S!L statement in t(e 3rogram6 T(e S!L statements are re3la.ed %4 a C LL to t(e 'B2 runtime inter5a.e module along :it( 3arameter6 ll S!L statements are eCtra.ted and 3ut in a 'B976 /la.es a time stam3 in t(e modi5ied sour.e and t(e 'B97 so t(at t(ese are tied6 ll 'B2 related $2CLU'* statements must %e 3la.ed %et:een *F*C S!L R *2') *F*C -e4 :ords 5or t(e 3re.om3iler to re.ogniDe t(em6

Com5ile M Lin3

7odi5ied 3re.om3iler COBOL out3ut is .om3lied6 Com3lied sour.e is lin- edited to an eCe.uta%le load module6

-ind

t43e o5 .om3iler 5or S!L statement6 $t reads t(e S!L statements 5rom t(e 'B97 and 3rodu.es a me.(anism to a..ess data as dire.ted %4 t(e S!L statements %eing %ound6 C(e.-s s4ntaC< .(e.- 5or .orre.tness o5 ta%le R .olumn de5initions against t(e .atalog in5ormation R 3er5orms aut(oriDation +alidation6

135

Pac3age

$t is a single %ound 'B97 :it( o3timiDed a..ess 3at(s6 $t also .ontains a lo.ation identi5ier a .olle.tion identi5ier and a 3a.-age identi5ier6 3a.-age .an (a+e multi3le +ersions< ea.( :it( it"s o:n +ersion identi5ier6

#d/antages o2 Pac3age

9edu.ed %ind time6 =ersioning6 /ro+ides remote data a..ess6 Can s3e.i54 %ind o3tions at t(e 3rogrammer le+el6

Plan

n a33li.ation 3lan .ontains one or %ot( o5 t(e 5ollo:ing elements o list o5 3a.-age names6 o T(e %ound 5orm o5 S!L statements ta-en 5rom one or more 'B976 *+er4 'B2 a33li.ation re;uires an a33li.ation 3lan6 /lans are .reated using t(e 'B2 su% .ommands B$2' /L 26

D,; Op imiGer

nal4Des t(e S!L statements and determines t(e most e55i.ient :a4 to a..ess data< gi+es 3(4si.al data inde3enden.e6 $t e+aluates t(e 5ollo:ing 5a.torsB C/U .ost< $0O .ost< 'B2 .atalogue statisti.s R t(e S!L statements6 $t estimate C/U time< .ost in+ol+ed in a33l4ing 3redi.ates tra+ersing 3ages R sorting6 $t estimates t(e .ost o5 3(4si.all4 retrie+ing and :riting data6

Ste5s in/ol/ed in creating a !-7 #55lication


Using *m%edded S!L Using Eost =aria%les G'CL8*2H Using S!LC /re.om3ile Com3ile R Lin-edit t(e 3rogram Bind

Em1edding S%L Statements


$t is li-e t(e 5ile $0O 2ormall4 t(e em%edded S!L statements .ontain t(e (ost +aria%les .oded :it( t(e $2TO .lause o5 t(e S*L*CT statement6 T(e4 are delimited :it( EXEC SB+ 1 END8EXEC *Cam3leB *F*C S!L S*L*CT eno< ename $2TO B()eno<B()ename

136

F9O7 em3lo4ee @E*9* eno11&&1 *2')*F*C6 )ost aria1les


T(ese are +aria%les de5ined in t(e (ost language to use t(e 3redi.ates o5 a 'B2 ta%le6 T(ese are re5eren.ed in t(e S!L statement6 means o5 mo+ing data 5rom and to 'B2 ta%les6 'CL8*2 3rodu.es (ost +aria%les t(e same as t(e .olumns o5 t(e ta%les6

!CL,EN

$ssued 5or a single ta%le6 /re3ares t(e stru.tures o5 t(e ta%le in a COBOL .o34 %oo-6 T(e .o34 %oo- .ontains a S!L '*CL 9* T BL* statement along :it( a :or-ing storage (ost +aria%le de5inition 5or t(e ta%le6

S%LC#

n S!LC is a stru.ture or .olle.tion o5 +aria%les t(at is u3dated a5ter ea.( S!L statement eCe.utes6 n a33li.ation 3rogram t(at .ontains eCe.uta%le S!L statements must 3ro+ide eCa.tl4 one S!LC 6

C&RSOR

Used :(en more t(an one ro: are to %e sele.ted6 Can %e used 5or modi54ing data using \FOR &P!#TE OF" .lause6

T*e .our Cursor %on ro$ S # emen s


'*CL 9* B name assigned 5or a 3arti.ular S!L statement6 O/*2B Builds t(e result ta%le6 F*TCE B 9eturns data 5rom t(e results ta%le one ro: at a time and assign t(e +alue to t(e s3e.i5ied (ost +aria%les6 CLOS*B 9eleases all resour.es used %4 t(e .ursor6

!ECL#RE4 *F*C S!L '*CL 9* em3.ur CU9SO9 FO9 S*L*CT em3no< ename< de3t< Vo% F9O7 em3 @E*9* de3t1\'11" FO9 U/' T* OF Vo% *2')*F*C6 OPEN4 5or t(e O/*2 statement *F*C S!L

137

O/*2 em3.ur *2')*F*C6 FETC)4 5or t(e F*TCE statement *F*C S!L F*TCE em3.ur $2TO Bem3no< Bename< Bde3t< BVo% *2')*F*C6 *)ENE ER4 5or t(e @E*2*=*9 .lause *F*C S!L @E*2*=*9 2OT FOU2' 8O TO .lose)em3.ur *2')*F*C6 &P!#TE4 5or t(e u3date statement using .ursors *F*C S!L U/' T* em3 S*T Vo%1Bne:)Vo% @E*9* CU99*2T OF em3.ur *2')*F*C6 !ELETE4 5or t(e delete statement using .ursor6 *F*C S!L '*L*T* F9O7 *7/ @E*9* CU99*2T OF em3.ur *2')*F*C6

D,; +OC1IN0

Lo.-ing is used to 3ro+ide multi3le user a..ess to t(e same s4stem6 'B2 uses lo.-ing ser+i.es 3ro+ided %4 an 7=S su%s4stem .alled $7S 9esour.e Lo.-ing 7anagerG$9L7H6

EF5licit Loc3ing Facilities


T(e S!L statement LOC> T BL* T(e $SOL T$O2 3arameter on t(e B$2' / C> 8* .ommand , t(e t:o 3ossi%le +alues are 99G9e3eata%le 9eadH R CS GCursor Sta%ilit4H6 CS is t(e +alue s3e.i5ied i5 t(e a33li.ation 3rogram is used in an on)line en+ironment6 T(e LOC>S$I* 3arameter , 3(4si.all4 'B2 lo.-s data in terms o5 3ages or ta%les or ta%le s3a.es6 T(is 3arameter is s3e.i5ied in C9* T* or LT*9 ta%le s3a.e o3tion \LOC>S$I*"6 T(e o3tions are Ta%les3a.e< Ta%le< /age or n46 T(e C!U$9* 0 9*L* S* 3arameters on t(e B$2' /L 2 .ommand s3e.i5ies :(en ta%le lo.-s to %e a.;uired and release6

13#

o o

C!U$9* US* 0 LLOC T* 9*L*S* CO77$T 0 '* LLOC T*

C# #$o"ue T#)$es

9e3ositor4 5or all 'B2 o%Ve.ts , .ontains 43 ta%les *a.( ta%le maintains data a%out an as3e.ts o5 t(e 'B2 en+ironment T(e data re5ers to in5ormation a%out ta%le s3a.e< ta%les< indeCes et.` S?S$B76S?ST BL*S< S?S$B76S?S$2'*FS< S?S$B76S?SCOLU72S et.`

!-7 &tilities4UTI+ITIES

CE*C> CO/? 7*98*CO/? 9*CO=*9 LO ' 9*O98 9U2ST TS *F/L $2

C)EC(

C(e.-s t(e integrit4 o5 'B2 data stru.tures C(e.-s t(e re5erential integrit4 %et:een t:o ta%les and also .(e.-s 'B2 indeCes 5or .onsisten.46 Can delete in+alid ro:s and .o3ies t(em to a eC.e3tion ta%le6

COP'

Used to .reate an image .o34 5or t(e .om3lete ta%le s3a.e or a 3ortion o5 t(e ta%le s3a.e) 5ull image .o34 or in.remental image .o346 *+er4 su..ess5ul eC.e3tion o5 CO/? utilit4 3la.es in t(e ta%le< S?S$B76S?SCO/?< at least one ro: t(at indi.ates t(e status o5 t(e image .o346

MER,ECOP'

T(e 7*98*CO/? utilit4 .om%ines multi3le in.remented image .o34 data sets into a ne: 5ull or in.remental image .o34 dataset6

RECO ER

9estore '%2 ta%le s3a.es and indeCes to a s3e.i5i. instan.e6 'ata .an %e re.o+ered 5or a single 3age< 3ages t(at .ontain $0O errors< a single 3artition or an entire ta%les3a.e6

139

Standard unit o5 re.o+er4 is ta%le s3a.e6

LO#!

To a..om3lis( %ul- inserts into 'B2 ta%le Can re3la.e t(e .urrent data a33end to it $5 a Vo% terminates in an4 3(ase o5 LO ' 9*/L C*< t(e utilit4 (as to %e terminated and rerun

REOR,

To reorganiDe 'B2 ta%les and indeCes and t(ere %4 im3ro+ing t(eir e55i.ien.4 o5 a..ess re).lusters data< resets 5ree s3a.e to t(e amount s3e.i5ied in t(e \.reate ''L" <statement and deletes and rede5ines underl4ing =S 7 datasets 5or stogrou3 de5ined o%Ve.ts6

E"PL#IN

*C3lain .an %e used to o%tain t(e details a%out t(e a..ess 3at(s .(osen %4 t(e 'B2 o3timiDer 5or S!L statements6 Used s3e.i5i.all4 5or 3er5orman.e monitoring6 @(en *F/L $2 is re;uested t(e a..ess 3at(s t(at t(e 'B2 .(ooses are 3ut in .oded 5ormat into t(e ta%le /L 2[T BL*< :(i.( is .reated in t(e de5ault data%ase %4 t(e user6 T(e ot(er met(od is s3e.i54ing *F/L $2 ?*S :it( B$2' .ommand T(e /L 2[T BL* is to %e ;ueried to get t(e re;uired in5ormation Sin.e t(e *F/L $2 results are de3endent on t(e 'B2 .atalogue< it is %etter to run 9U2ST T %e5ore running *F/L $26

!17 F#%Os 2rame4!-7 F#%S 16 Eo: :ould 4ou 5ind out t(e total num%er o5 ro:s in a ta%le] o Use S*L*CT COU2TGJH 666 26 Eo: do 4ou eliminate du3li.ate +alues in S*L*CT] o Use S*L*CT '$ST$2CT 666 36 Eo: do 4ou sele.t a ro: using indeCes] o S3e.i54 t(e indeCed .olumns in t(e @E*9* .lause6 46 @(at are aggregate 5un.tions] o Built)in mat(emati.al 5un.tions 5or use in S*L*CT .lause6 56 Eo: do 4ou 5ind t(e maCimum +alue in a .olumn] o Use S*L*CT 7 FG666H 66 Can 4ou use 7 F on a CE 9 .olumn] o ?es6 76 74 S!L statement S*L*CT =8GS L 9?H F9O7 *7/ 4ields ina..urate results6 @(4] o Be.ause S L 9? is not de.lared to (a+e 2ULLs and t(e em3lo4ees 5or :(om t(e salar4 is not -no:n are also .ounted6

14&

#6 Eo: do 4ou retrie+e t(e 5irst 5 .(ara.ters o5 F$9ST2 7* .olumn o5 *7/ ta%le] o S*L*CT SUBST9GF$9ST2 7*<1<5H F9O7 *7/M 96 Eo: do 4ou .on.atenate t(e F$9ST2 7* and L ST2 7* 5rom *7/ ta%le to gi+e a .om3lete name] o S*L*CT F$9ST2 7* dd Q Q dd L ST2 7* F9O7 *7/M 1&6 @(at is t(e use o5 = LU* 5un.tion] o +oid )+e S!LCO'*s %4 (andling nulls and Deroes in .om3utations o Su%stitute a numeri. +alue 5or an4 nulls used in .om3utation 116 @(at is U2$O2<U2$O2 LL] o U2$O2 B eliminates du3li.ates U2$O2 LLB retains du3li.ates Bot( t(ese are used to .om%ine t(e results o5 di55erent S*L*CT statements6 126 Su33ose $ (a+e 5i+e S!L S*L*CT statements .onne.ted %4 U2$O20U2$O2 LL< (o: man4 times s(ould $ s3e.i54 U2$O2 to eliminate t(e du3li.ate ro:s] o On.e6 136 @(at is t(e restri.tion on using U2$O2 in em%edded S!L] o $t (as to %e in a CU9SO96 146 $n t(e @E*9* .lause :(at is B*T@**2 and $2] o B*T@**2 su33lies a range o5 +alues :(ile $2 su33lies a list o5 +alues6 156 $s B*T@**2 in.lusi+e o5 t(e range +alues s3e.i5ied] o ?es6 166 @(at is QL$>*Q used 5or in @E*9* .lause] @(at are t(e :ild.ard .(ara.ters] o L$>* is used 5or 3artial string mat.(es6 QcQ G 5or a string o5 an4 .(ara.ter H and Q[Q G5or an4 single .(ara.ter H are t(e t:o :ild .ard .(ara.ters6 176 @(en do 4ou use a L$>* statement] o To do 3artial sear.( e6g6 to sear.( em3lo4ee %4 name< 4ou need not s3e.i54 t(e .om3lete nameM using L$>*< 4ou .an sear.( 5or 3artial string mat.(es6 1#6 @(at is t(e meaning o5 unders.ore G Q[Q H in t(e L$>* statement] o 7at.( 5or an4 single .(ara.ter6 196 @(at do 4ou a..om3lis( %4 89OU/ B? 666 E =$28 .lause] o 89OU/ B? 3artitions t(e sele.ted ro:s on t(e distin.t +alues o5 t(e .olumn on :(i.( 4ou grou3 %46 o E =$28 sele.ts 89OU/s :(i.( mat.( t(e .riteria s3e.i5ied 2&6 Consider t(e em3lo4ee ta%le :it( .olumn /9OJ*CT nulla%le6 Eo: .an 4ou get a list o5 em3lo4ees :(o are not assigned to an4 3roVe.t] o S*L*CT *7/2O F9O7 *7/ @E*9* /9OJ*CT $S 2ULLM 216 @(at is t(e result o5 t(is ;uer4 i5 no ro:s are sele.tedB o S*L*CT SU7GS L 9?H F9O7 *7/ @E*9* !U L1Q7SCQM 2ULL 226 @(4 S*L*CT J is not 3re5erred in em%edded S!L 3rograms] o For t(ree reasonsB 16 $5 t(e ta%le stru.ture is .(anged G a 5ield is added H< t(e 3rogram :ill (a+e to %e modi5ied6

141

236

246

256 266

276

2#6

296 3&6 316 326

336

26 /rogram mig(t retrie+e t(e .olumns :(i.( it mig(t not use< leading on $0O o+er (ead6 36 T(e .(an.e o5 an indeC onl4 s.an is lost6 @(at are .orrelated su% ;ueries] o su% ;uer4 in :(i.( t(e inner G nested H ;uer4 re5ers %a.- to t(e ta%le in t(e outer ;uer46 Correlated su% ;ueries must %e e+aluated 5or ea.( ;uali5ied ro: o5 t(e outer ;uer4 t(at is re5erred to6 @(at is a .ursor] :(4 s(ould it %e used] o Cursor is a 3rogramming de+i.e t(at allo:s t(e S*L*CT to 5ind a set o5 ro:s %ut return t(em one at a time6 o Cursor s(ould %e used %e.ause t(e (ost language .an deal :it( onl4 one ro: at a time6 Eo: :ould 4ou retrie+e ro:s 5rom a 'B2 ta%le in em%edded S!L] o *it(er %4 using t(e single ro: S*L*CT statements< or %4 using t(e CU9SO96 3art 5rom .ursor< :(at ot(er :a4s are a+aila%le to 4ou to retrie+e a ro: 5rom a ta%le in em%edded S!L] o Single ro: S*L*CTs6 Eo: do 4ou s3e.i54 and use a .ursor in a COBOL 3rogram] o Use '*CL 9* CU9SO9 statement eit(er in :or-ing storage or in 3ro.edure di+ision G%e5ore o3en .ursorH< to s3e.i54 t(e S*L*CT statement6 T(en use O/*2< F*TCE ro:s in a loo3 and 5inall4 CLOS*6 @(at (a33ens :(en 4ou sa4 O/*2 CU9SO9] o $5 t(ere is an O9'*9 B? .lause< ro:s are 5et.(ed< sorted and made a+aila%le 5or t(e F*TCE statement6 Ot(er :ise sim3l4 t(e .ursor is 3la.ed on t(e 5irst ro:6 $s '*CL 9* CU9SO9 eCe.uta%le] o 2o6 Can 4ou (a+e more t(an one .ursor o3en at an4 one time in a 3rogram] o ?es6 @(en 4ou CO77$T< is t(e .ursor .losed] o ?es6 Eo: do 4ou lea+e t(e .ursor o3en a5ter issuing a CO77$T] G5or 'B2 263 or a%o+e onl4 H o Use @$TE EOL' o3tion in '*CL 9* CU9SO9 statement6 But< it (as not e55e.t in 3suedo).on+ersational C$CS 3rograms6 8i+e t(e COBOL de5inition o5 a = 9CE 9 5ield6 o = 9CE 9 .olumn 9*7 9>S :ould %e de5ined as 5ollo:sB 1& 9*7 9>S6 49 9*7 9>S)L*2 /$C S9G4H US 8* CO7/6 49 9*7 9>S)T*FT /$C FG192&H6

346 @(at is t(e 3(4si.al storage lengt( o5 ea.( o5 t(e 5ollo:ing 'B2 data t43esB ' T*< T$7*< T$7*ST 7/] ' T*B 4%4tes T$7*B 3%4tes

142

T$7*ST 7/B 1&%4tes 356 @(at is t(e COBOL 3i.ture .lause o5 t(e 5ollo:ing 'B2 data t43esB ' T*< T$7*< T$7*ST 7/] ' T*B /$C FG1&H T$7* B /$C FG&#H T$7*ST 7/B /$C FG26H 366 @(at is t(e COBOL 3i.ture .lause 5or a 'B2 .olumn de5ined as '*C$7 LG11<2H] o /$C S9G9H=99 CO7/)36 2oteB $n '*C$7 LG11<2H< 11 indi.ates t(e siDe o5 t(e data t43e and 2 indi.ates t(e 3re.ision6 376 @(at is 'CL8*2] o 'eCLarations 8*2eratorB used to .reate t(e (ost language .o34%oo-s 5or t(e ta%le de5initions6 lso .reates t(e '*CL 9* ta%le6 3#6 @(at is JO$2 and di55erent t43es o5 JO$26 o T(e a%ilit4 to Voin ro:s and .om%ine data 5rom t:o or more ta%les is one o5 t(e most 3o:er5ul 5eatures o5 relational s4stem6 T(ree t43es o5 VoinsB 16 *;ui)Voin 26 2on)e;uiVoin 36 sel5)Voin 396 Can $ alter a ta%le Ge6g6 adding a .olumnH :(en ot(er user is sele.ting some Columns or u3dating some .olumns 5rom t(e same ta%le] o 4es 3ossi%le6 until t(e u3dation or sele.tion is .ommitted d%2 ta%le :ill not %e restru.tured6 ne: .olumn de5inition :ill %e t(ere %ut it :ill not %e in.luded until all t(e tas-s on t(e ta%le are .ommitted6 4&6 @(at are t(e di55erent met(ods o5 a..essing d%2 5rom tso] o T(ere are t(ree :a4s in esta%lis(ing tso0d%2 .onne.tion 16 S/UF$ 26 !7F 36 C T LO8 =$S$B$L$T? 416 Eo: is t(e .onne.tion esta%lis(ed %et:een TSO R 'B2] o t(read %et:een TSO R 'B2 is esta%lis(ed :(ile attem3ting to ma-e Conne.tion %et:een tso R d%26 426 @(at is s;l.ode )922] o ut(oriDation 5ailure 436 Eo: do 4ou do t(e *F/L $2 o5 a d4nami. S!L statement] o Use S/UF$ or !7F to *F/L $2 t(e d4nami. S!L statement o $n.lude *F/L $2 .ommand in t(e em%edded d4nami. S!L statements 446 Eo: is a t43i.al 'B2 %at.( 3gm eCe.uted] o Use 'S2 utilit4 to run a 'B2 %at.( 3rogram 5rom nati+e TSO6 n eCam3le is s(o:nB 'S2 S?ST*7G'S/3H 9U2 /9O89 7G*''47&B'H /L 2G*''47&B'H L$B GQ*'8S&1T6OBJ6LO 'L$BQH *2' o Use $>J*FT&1 utilit4 3rogram to run t(e a%o+e 'S2 .ommand in a JCL6 456 $s it mandator4 to use 'CL8*2] $5 not< :(4 :ould 4ou use it at all]

143

466 476

4#6

496 5&6

$t is not mandator4 to use 'CL8*26 Using 'CL8*2< (el3s dete.t :rongl4 s3elt .olumn names et.6 during t(e 3re).om3ile stage itsel5 G%e.ause o5 t(e '*CL 9* T BL* H6 'CL8*2 %eing a tool< :ould generate a..urate (ost +aria%le de5initions 5or t(e ta%le redu.ing .(an.es o5 error6 2ame some 5ields 5rom S!LC 6 o S!LCO'*< S!L*997< S!L*99' Eo: does 'B2 determine :(at lo.-)siDe to use] o Based on t(e lo.-)siDe gi+en :(ile .reating t(e ta%le s3a.e o /rogrammer .an dire.t t(e 'B2 :(at lo.-)siDe to use o $5 lo.-)siDe 2? is s3e.i5ied< 'B2 usuall4 .(oses a lo.-)siDe o5 / 8* @(at is t(e di55eren.e %et:een CS and 99 isolation le+els] o CSB 9eleases t(e lo.- on a 3age a5ter use o 99B 9etains all lo.-s a.;uired till end o5 transa.tion @(ere do 4ou s3e.i54 t(em] o $SOL T$O2 L*=*L is a 3arameter 5or t(e %ind 3ro.ess6 Eo: do 4ou simulate t(e *F/L $2 o5 an em%edded S!L statement in S/UF$0!7F] 8i+e an eCam3le :it( a (ost +aria%le in @E*9* .lause6 o Use ;uestion mar- in 3la.e o5 a (ost +aria%le Gor an un-no:n +alueH6 e6g6
o

516

526

536 546

556 566 576

5#6 596

S*L*CT *7/[2 7* F9O7 *7/ @E*9* *7/[S L 9? N ] @(at is C!U$9*09*L* S* in B$2'] o 'etermine t(e 3oint at :(i.( 'B2 a.;uires or releases lo.-s against ta%le and Ta%le s3a.es< in.luding intent lo.-s6 $n S/UF$ su33ose 4ou :ant to sele.t maC6 o5 1&&& ro:s< %ut t(e sele.t returns onl4 2&& ro:s6 @(at are t(e 2 s;l.odes t(at are returned] o 1&& G5or su..ess5ul .om3letion o5 t(e ;uer4H< & G5or su..ess5ul CO77$T i5 UTOCO77$T is set to ?esH6 Eo: :ould 4ou 3rint t(e out3ut o5 an S!L statement 5rom S/UF$] o /rint t(e out3ut data set6 @(at does it mean i5 t(e null indi.ator (as )1< &< )2] o )1 B t(e 5ield is null o & B t(e 5ield is not null o )2 B t(e 5ield +alue is trun.ated Eo: do 4ou retrie+e t(e data 5rom a nulla%le .olumn] o Use null indi.ators6 S4ntaC 666 $2TO BEOST= 9B2ULL$2' @(at else is t(ere in t(e /L 2 a3art 5rom t(e a..ess 3at(] o /L 2 (as t(e eCe.uta%le .ode 5or t(e S!L statements in t(e (ost 3rogram @(at is lo.- es.alation] o /romoting a / 8* lo.-)siDe to ta%le or ta%le s3a.e lo.-)siDe :(en a transa.tion (as a;uired more lo.-s t(an s3e.i5ied in 2U7L>TS6 Lo.-s s(ould %e ta-en on o%Ve.ts in single ta%le s3a.e 5or es.alation to o..ur6 @(en is t(e a..ess 3at( determined 5or d4nami. S!L] o t run time< :(en t(e /9*/ 9* statement is issued6 @(at are t(e +arious lo.-s a+aila%le] o SE 9*< *FCLUS$=*< U/' T*

144

6&6 @(at is s;l.ode )#11] o S*L*CT statement (as resulted in retrie+al o5 more t(an one ro:6 616 @(at are t(e ad+antages o5 using a / C> 8*] o +oid (a+ing to %ind a large num%er o5 'B97 mem%ers into a 3lan o +oid .ost o5 a large %ind o +oid t(e entire transa.tion %eing una+aila%le during %ind and automati. re%ind o5 a 3lan o 7inmiDe 5all%a.- .om3leCities i5 .(anges result in an error6 626 @(at is 9*O98] @(en is it used] o 9*O98 reorganiDes data on 3(4si.al storage to re).luster ro:s< 3ositioning o+e5lo:ed ro:s in t(eir 3ro3er se;uen.e< to re.laim s3a.e< to restore 5ree s3a.e6 $t is used a5ter (uge u3dates< inserts and delete a.ti+it4 and a5ter segments o5 a segmented ta%le s3a.e (a+e %e.ome 5ragmented6 636 Eo: does 'B2 store 2ULL 3(4si.all4] o as an eCtra)%4te 3re5iC to t(e .olumn +alue6 3(4si.all4< t(e nul 3re5iC is EeC Q&&Q i5 t(e +alue is 3resent and EeC QFFQ i5 it is not 646 @(at is CE*C> /*2'$28] o @(en a ta%le is LO 'ed :it( *2FO9C* 2O o3tion< t(en t(e ta%le is le5t in CE*C>/*2'$28 status6 $t means t(at t(e LO ' utilit4 did not 3er5orm .onstraint .(e.-ing6 656 @(en do 4ou s3e.i54 t(e isolation le+el] Eo:] o 'uring t(e B$2' 3ro.ess6 $SOL T$O2 GCS099H666 666 @(at is a 'B97< /L 2] o 'B97B 'ataBase 9e;uest 7odule< (as t(e S!L statements eCtra.ted 5rom t(e (ost language 3rogram %4 t(e 3re).om3iler6 o /L 2B result o5 t(e B$2' 3ro.ess6 $t (as t(e eCe.uta%le .ode 5or t(e S!L statements in t(e 'B976 676 $s '*CL 9* T BL* in 'CL8*2 ne.essar4] @(4 it used] o $t not ne.essar4 to (a+e '*CL 9* T BL* statement in 'CL8*26 T(is is used %4 t(e 3re).om3iler to +alidate t(e ta%le)name< +ie:)name< .olumn name et.6< during 3re).om3ile6 6#6 @(at do 4ou need to do %e5ore 4ou do *F/L $2] o 7a-e sure t(at t(e /L 2[T BL* is .reated under t(e UTE$'6 696 @(at is a .olle.tion] o a user de5ined name t(at is t(e an.(or 5or 3a.-ages6 $t (as not 3(4si.al eCisten.e6 7ain usage is to grou3 3a.-ages6 7&6 Eo: .an 4ou ;ui.-l4 5ind out t(e P o5 ro:s u3dated a5ter an u3date statement] o C(e.- t(e +alue stored in S!L*99'G3H6 716 @(at is *F/L $2] o *F/L $2 is used to dis3la4 t(e a..ess 3at( as determined %4 t(e o3timiDer 5or a S!L statement6 $t .an %e used in S/UF$ G5or single S!L statement H or in B$2' ste3 G5or em%edded S!L H6 726 @(ere is t(e out3ut o5 *F/L $2 stored] o $n userid6/L 2[T BL* 736 Su33ose $ (a+e a 3rogram :(i.( uses a d4nami. S!L and it (as %een 3er5orming :ell till no:6 O55 late< $ 5ind t(at t(e 3er5orman.e (as deteriorated6 @(at (a33ened]

145

746

756 766

776 7#6 796 #&6 #16 #26 #36 #46 #56

#66 #76 ##6

#96

9&6 916

/ro%a%l4 9U2 ST TS is not done and t(e 3rogram is using a :rong indeC due to in.orre.t stats6 /ro%a%l4 9U2ST TS is done and o3timiDer (as .(osen a :rong a..ess 3at( %ased on t(e latest statisti.s6 @(at are t(e .ontents o5 a 'CL8*2] ) 8S o *F*C S!L '*CL 9* T BL* statement :(i.( gi+es t(e la4out o5 t(e ta%le0+ie: in terms o5 'B2 data t43es6 o (ost language .o34 %oo- t(at gi+es t(e (ost +aria%le de5initions 5or t(e .olumn names6 @ill 3re).om3ile o5 an 'B2)COBOL 3rogram %om%< i5 'B2 is do:n] o 2o6 Be.ause t(e 3re).om3iler does not re5er to t(e 'B2 .atalogue ta%les6 @(at are t(e isolation Galso .alled isolation 3arametersH le+els 3ossi%le] o CSB Cursor Sta%ilit4 o 99B 9e3eata%le 9ead @(at is t(e 3i.ture .lause o5 t(e null indi.ator +aria%le] o S9G4H CO7/6 *F/L $2 (as out3ut :it( 7 TCECOLS 1 &6 @(at does it mean] o non)mat.(ing indeC s.an i5 CC*SST?/* 1 $6 $ use CS and u3date a 3age6 @ill t(e lo.- %e released a5ter $Q+e done :it( t(at 3age] o 2o6 @(at are t(e +arious lo.-ing le+els a+aila%le] o / 8*< T BL*< T BL*S/ C* @(at is LT*9] o S!L .ommand used to .(ange t(e de5inition o5 'B2 o%Ve.ts6 Can $ use LOC> T BL* on a +ie:] o 2o6 To lo.- a +ie:< ta-e lo.- on t(e underl4ing ta%les6 @(at are t(e disad+antages o5 / 8* le+el lo.-] o Eig( resour.e utiliDation i5 large u3dates are to %e done @(at are / C> 8*S ] o T(e4 .ontain eCe.uta%le .ode 5or S!L statements 5or one 'B976 Lot o5 u3dates (a+e %een done on a ta%le due to :(i.( indeCes (a+e gone (a4:ire6 @(at do 4ou do] o Loo-s li-e indeC 3age s3lit (as o..ured6 'O a 9*O98 o5 t(e indeCes6 @(at is d4nami. S!L] o '4nami. S!L is a S!L statement .reated at 3rogram eCe.ution time6 @(at is $7 8*CO/? ] o $t is 5ull %a.-u3 o5 a 'B2 ta%le :(i.( .an %e used in re.o+er46 @(at is !U$*SC*] o !U$*SC* 5lus(es all 'B2 %u55ers on to t(e dis-6 T(is gi+es a .orre.t sna3s(ot o5 t(e data%ase and s(ould %e used %e5ore and a5ter an4 $7 8*CO/? to maintain .onsisten.46 @(at does t(e s;l.ode o5 )#1# 3ertain to] ) 8S o T(is is generated :(en t(e .onsisten.4 to-ens in t(e 'B97 and t(e load module are di55erent6 @(at (a33ens to t(e /L 2 i5 indeC used %4 it is dro33ed] o /lan is mar-ed as in+alid6 T(e neCt time t(e 3lan is a..essed< it is re%ound6
o o

926 @(at is F9**/ 8* and /CTF9** in T BL*S/ C* .reation]

146

/CTF9**B 3er.entage o5 ea.( 3age to %e le5t 5ree F9**/ 8*B 2um%er o5 3ages to %e loaded :it( data %et:een ea.( 5ree 3age 936 re +ie:s u3data%le] o 2ot all o5 t(em6 Some +ie:s are u3data%le e6g6 single ta%le +ie: :it( all t(e 5ields or mandator4 5ields6 *Cam3les o5 non)u3data%le +ie:s are +ie:s :(i.( are Voins< +ie:s t(at .ontain aggregate 5un.tions Gsu.( as 7$2H< and +ie:s t(at (a+e 89OU/ B? .lause6 946 @(at is CO/? /*2'$28 status] o state in :(i.(< an image .o34 on a ta%le needs to %e ta-en< in t(is state< t(e ta%le is a+aila%le onl4 5or ;ueries6 ?ou .annot u3date t(is ta%le6 To remo+e t(e CO/? /*2'$28 status< 4ou ta-e an image .o34 or use 9*/ $9 utilit46 956 @(at is an inner Voin< and an outer Voin] o $nner JoinB .om%ine in5ormation 5rom t:o or more ta%les %4 .om3aring all +alues t(at meet t(e sear.( .riteria in t(e designated .olumn or .olumns o5 one ta%le :it( all t(e +alues in .orres3onding .olumns o5 t(e ot(er ta%le or ta%les6 T(is -ind o5 Voin :(i.( in+ol+e a mat.( in %ot( .olumns are .alled inner Voins6 o Outer Voin is one in :(i.( 4ou :ant %ot( mat.(ing and non mat.(ing ro:s to %e returned6 'B2 (as no s3e.i5i. o3erator 5or outer Voins< it .an %e simulated %4 .om%ining a Voin and a .orrelated su% ;uer4 :it( a U2$O26 966
o o o

976 @(at is t(e di55eren.e %et:een 3rimar4 -e4 R uni;ue indeC] o /rimar4B a relational data%ase .onstraint6 /rimar4 -e4 .onsists o5 one or more .olumns t(at uni;uel4 identi54 a ro: in t(e ta%le6 For a normaliDed relation< t(ere is one designated 3rimar4 -e46 o Uni;ue indeCB a 3(4si.al o%Ve.t t(at stores onl4 uni;ue +alues6 T(ere .an %e one or more uni;ue indeCes on a ta%le6 9#6 @(en do 4ou use t(e $7 8*CO/?] o To ta-e routine %a.-u3 o5 ta%les6 o 5ter a LO ' :it( LO8 2O6 5ter 9*O98 :it( LO8 O26 996 @(at is 9U2ST TS] o 'B2 utilit4 used to .olle.t statisti.s a%out t(e data +alues in ta%les :(i.( .an %e used %4 t(e o3timiDer to de.ide t(e a..ess 3at(6 $t also .olle.ts statisti.s used 5or s3a.e management6 T(ese statisti.s are stored in 'B2 .atalog ta%les6 1&&6Eo: do 4ou insert a re.ord :it( a nulla%le .olumn] o To insert a 2ULL< mo+e )1 to t(e null indi.ator o To insert a +alid +alue< mo+e & to t(e null indi.ator Fileaid 4FILE #I! 8*2*9 L $2FO97 T$O2 'esigned 5or a33li.ations and s4stems 3rogrammers< File) $' is an intera.ti+e< 5ull)s.reen s4stem 5or editing< %ro:sing< de5ining< .o34ing< re5ormatting< .om3aring< and 3rinting =S 7< $ 7< $S 7< /'S< B' 7< and se;uential 5iles under TSO0$S/F6

147

>*? F* TU9*S File) $'Qs 5un.tions ena%le 4ou to signi5i.antl4 redu.e t(e time re;uired to 3er5orm da4)to)da4 data 5ile mani3ulation tas-s su.( as .reating and modi54ing test data< resol+ing 3rodu.tion data 3ro%lems< and 3er5orming ad)(o. 5ile .on+ersions and .om3arisons6

>*? F* TU9*SB o *liminates $S/F editing restri.tions ) 3ro+ides on)line editing o5 se;uential< B' 7< /'S< $S 7< $ 7< and =S 7 5iles using 5ormatted< 5ull)s.reen dis3la4s ) eliminates re.ord lengt( restri.tion eliminates 5ile siDe restri.tion %4 using sele.tion .riteria to limit t(e num%er o5 re.ords to %e edited ) ) su33orts 5iles in .om3ressed0en.r43ted 5ormat G:it( $0O eCitsH 3ro+ides o3tional audit trail o5 all re.ords u3dated< inserted< and deleted :(ile editing a data 5ile

o Uses eCisting COBOL or /L0$ re.ord la4outs dire.tl4 ) t(e re.ord la4out is t(e sole de5inition o5 5iles t(us eliminating t(e need to rede5ine t(e 5ile0data in anot(er language ) data ) 5iles ma4 %e 3rinted in a 5ormatted manner using t(e re.ord la4out su3erim3osing t(e re.ord la4out o+er ra: data %rings meaning to t(at

o Eas 3o:er5ul< eas4 to use< .o34ing and re5ormatting .a3a%ilities ) t(ese .a3a%ilities eCist in %ot( %at.( and on)line modes ) no language to learn and no 3rogramming re;uired ) re.ords ma4 %e sele.ted 5or .o34ing using sele.tion .riteria %ased on re.ord .ounts and0or s3e.i5i. +alues in indi+idual 5ields 6 ) sele.tion .riteria .an %e used in t(e Bro:se< *dit< Co34< /rint< or Com3are 5un.tions 6

14#

o 9uns as a single dialog under $S/F ) uses menu)dri+en< 5ull)s.reen< intera.ti+e $S/F)li-e dis3la4s ) (as user de5ined /F G3rogram 5un.tionH -e4 su33ort ) .an o3erate As3lit)s.reenA :it( $S/F0/'F ) eas4 to learn and use ) a 5ull4 intera.ti+e 3rodu.t :it( %at.( .a3a%ilities ) eCe.utes in storage a+aila%le a%o+e t(e 16 mega%4te line on s4stems running 7=S0F 7=S0*S 8*2*9 L $2FO97 T$O2 $2=O>$28 File) $' File) $' eCe.utes as a dialog under $B7Qs $S/F dialog manager 5a.ilit46 ?ou .an in+o-e it %4 sele.ting t(e File) $' o3tion 5rom a .ustomiDed +ersion o5 t(e $S/F 3rimar4 o3tion menu< or 5rom a su%)menu 3anel 4our installation (as set u36 $5 t(e File) $' eCe.ution CL$STS (a+e %een installed< 4ou ma4 in+o-e File) $' 5rom an4 $S/F s.reen6 For eCam3le< t(e .ommand TSO F ST 9T sus3ends 4our .urrent s.reen and dis3la4s t(e File) $' 3rimar4 o3tion menu6 U3on eCit 5rom File) $' 4our sus3ended s.reen is restored6 T(e 5ollo:ing :ill %e 3resented onl4 i5 sele.ted %4 num%erB 1 ) File) $' eCe.ution CL$STS 8*2*9 L $2FO97 T$O2 SU77 9? OF O/T$O2S &)C T(e File) $' 3rimar4 o3tions areB O/T$O2 & ) S/*C$F? $S/F 2' File) $' / 9 7*T*9S T(is o3tion .onsists o5 t(e $S/F)3ro+ided 3arameter o3tion s.reens and se+eral s.reens to s3e.i54 File) $' de5ault 3arameters6 O/T$O2 1 ) B9O@S* F$L* T(is o3tion is used to dis3la4 %ut not .(ange t(e .ontents o5 5iles using an4 o5 t(ree dis3la4 modes ) 5ormatted< +erti.al< and .(ara.ter6 O/T$O2 2 ) *'$T F$L* or

149

T(is o3tion is used to .reate< dis3la4 and .(ange t(e .ontents o5 5iles using t(e 5ormatted< +erti.al< and .(ara.ter dis3la4 modes6 O/T$O2 3 ) UT$L$T$*S0* T(is o3tion a..esses a menu o5 dataset management utilities6 $n.luded areB 361 Li%rar4 G/'S dire.tor4 management and CS*CT in5oH< 362 'ataset G2on)=S 7 dataset allo.ation< in5ormationH< 363 Co34 GSele.ti+e re.ord .o34ing 5or all 5ile t43es in.luding /'S mem%ersH< 364 Catalog Gsear.( .atalog using 3attern .(ara.tersH 365 =S 7 G'e5ine =S 7 .lusters< indeCes< and 3at(s online or in %at.(H< 366 Sear.(0U3date GS.an or 3er5orm glo%al .(anges 5or an4 datasetH< 367 =TOC GSear.( +olumes 5or datasets using 3attern .(ara.ters< anal4De s3a.eH< 36# $ntera.ti+e Grun File) $'0Bat.( onlineH< 369 Su%mit G.reate %at.( JCLH6 O/T$O2 5 ) /9$2T F$L* T(is o3tion is used to 3rint data 5ile .ontents< t(e sele.tion .riteria and r.d0la4out F9*Fs .reated in o3tions 6 and 7 o5 File) $'< 5ormatted re.ord la4outs< and audit trail datasets .reated :(ile editing a data 5ile in o3tion 2 G*ditH or 366 GU3dateH o5 File) $'6 O/T$O2 6 ) *'$T S*L*CT$O2 C9$T*9$ T(is o3tion is used to .reate and maintain sele.tion .riteria 5or use in t(e Bro:se< *dit< Co34< /rint< and Com3are 5un.tions6 O/T$O2 7 ) *'$T 9C'0L ?OUT F9*F T(is o3tion is used to .reate and maintain r.d0la4out F9*Fs 5or use in ot(er File) $' 5un.tions6 O/T$O2 # ) =$*@ 9*CO9' L ?OUT T(is o3tion is used to dis3la4 t(e .ontents o5 COBOL or /L0$ la4outs as inter3reted %4 File) $'6 O/T$O2 9 ) 9*FO97 T F$L*

15&

T(is o3tion allo:s t(e re.ords o5 an in3ut 5ile to %e re5ormatted and :ritten to an out3ut 5ile %ased on re.ord la4outs de5ining t(e in3ut and out3ut 5iles6 O/T$O2 1& ) CO7/ 9* T(is o3tion is used to .om3are t:o 5iles and re3ort t(e di55eren.es %et:een t(em6 O/T$O2 C ) File) $' CE 28*S T(is o3tion do.uments .(anges made in t(e +arious releases o5 File) $'6 8*2*9 L $2FO97 T$O2 SC9**2 FO97 TS File) $' uses t(e 5ull s.reen 5or dis3la4 and entr4 o5 data6 T(e 5irst t(ree lines o5 ea.( dis3la4< .alled t(e (eading lines< (a+e a .ommon 5ormat 5or all File) $' dis3la4s6 T(e remainder o5 t(e s.reen ma4 .ontain a list o5 o3tions< in3ut 5ields and 3rom3ts< or s.rolla%le data6 T(e 5irst t(ree lines o5 ea.( dis3la4 are 5ormatted as 5ollo:sB U))))))))))))))))))))))))))))))))))))))))U)))))))))))))))))))))))) ))U line 1B U T$TL* U SEO9T 7*SS 8* U )))U

U))))))))))))))))))))))))))))))))))))))) U))))))U)))))))))) line 2B U CO77 2'0O/T$O2

U SC9OLL U

U)))))))))))))))))))))))))))))))))))))))))))))) ))U)))))))))))))))) )))U line 3B U LO28 7*SS 8* U

U)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))U T(e T$TL* area Gline 1H identi5ies t(e 5un.tion %eing 3er5ormed and< :(ere a33ro3riate< li%rar4 or dataset in5ormation6 T(e SEO9T 7*SS 8* area Gline 1H is used to indi.ateB ) Current line or .olumn 3ositions ) Su..ess5ul .om3letion o5 a 3ro.essing 5un.tion ) *rror .onditions Ga..om3anied %4 audi%le alarmH

151

T(e CO77 2'0O/T$O2 area Gline 2H is used to enter a .ommand6 On an o3tion sele.tion menu< it ma4 %e used to enter eit(er a .ommand or an o3tion6 T(e SC9OLL area Gline 2H .ontains t(e .urrent s.roll amount :(ene+er s.rolling is a33li.a%le6 ?ou ma4 .(ange it %4 o+ert43ing6 T(e LO28 7*SS 8* area Gline 3H is used to dis3la4 an eC3lanation o5 error .onditions u3on re;uest Gsee E*L/ .ommandH6 T(is line :ill normall4 %e %lan- or :ill .ontain (eading Gnon data entr4H in5ormation6 'ataset s3e.i5i.ation s.reens allo: 4ou to enter in5ormation su.( as dataset names< mem%er names< and ot(er 3arameters6 T(e 5ields in :(i.( 4ou ma4 enter in5ormation are la%eled and 3re.eded :it( an arro:6 $5 4ou 5ail to enter a re;uired +alue or i5 4ou enter in.onsistent +alues< 4ou are 3rom3ted :it( a message6

UJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ T(e eCam3le at t(e rig(t s(o:s t(e edit dataset s3e.i5i.ation s.reen6 U File) $' ))))))))))))) *dit ) 'ataset S3e.i5i U CO77 2' 111N U U *dit 7ode U U S3e.i54 *dit $n5ormationB U U *dit 'ataset name 7em%er name 111N F S 7/6J 111N 111N GBlan- or G$5 datas 111N C GF1Format

U =olume serial U U 'is3osition Create audit trail

111N OL' GSE9 or O 111N 2 G? 1 ?esM

Se+eral 5ields on dataset s3e.i5i.ation s.reens are 3re)entered :it( +alues t(at 4ou entered t(e last time on t(at s.reen or on a similar s.reen6 $5 t(e +alues are .orre.t< sim3l4 3ress *2T*96 $5 t(e +alues are not .orre.t< o+ert43e t(e 5ields t(at need to %e .(anged %e5ore 3ressing *2T*96 T(e 3re)entered in5ormation .omes 5rom 4our user 3ro5ile< :(i.( File) $' automati.all4 %uilds and maintains a.ross sessions6 $n5ormation t(at is maintained in 4our user 3ro5ile in.ludesB

152

) 'ataset names and mem%er names ) Jo% statement in5ormation ) S?SOUT .lass 5or 3rinted out3ut ) /arameters entered +ia O3tion & G/arametersH ) /F)>e4 de5aults 8*2*9 L $2FO97 T$O2 7*7B*9 S*L*CT$O2 SC9**2S mem%er sele.tion s.reen is an al3(a%eti. list o5 t(e mem%ers o5 a 3artitioned dataset6 $t is dis3la4ed :(en re;uested 5rom an4 o5 t(e File) $' 5un.tions 1)1&6 $n most 5un.tions it is 3ossi%le to o%tain multi3le mem%er lists 3rior to entering t(e 5un.tion6

UJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ T(e eCam3le at t(e rig(t s(o:s t(e sele.tion o5 mem%er T*STF$L3 5rom t(e 3artitioned dataset /9OJ*CT6T*ST6' T U File) $' )))) *'$T ) /9OJ*CT6T*ST6' T )))))))) U CO77 2' 111N U 2 7* =*967O' C9* T*' &16&4 &16&2 &#017093 &90230 &6012093 &90130 &7029093 &902&0 &#0&1093 &#0290 &70&1093 &90&10 L ST 7

U T*ST1 U T*ST2 U S T*STF$L3 U T*STF$L4 U T*STF$L5

&1613 &16&7 &1611

S.rolla%le data dis3la4 s.reens s(o: 5ile .ontents or re.ord la4outs and allo: u30do:n s.rolling< and in some .ases le5t0rig(t s.rolling6 On man4 s.rolla%le data dis3la4 s.reens< 4ou .an also u3date 5ile .ontents %4 t43ing o+er 5ields on t(e s.reen6 T(e eCam3le %elo: s(o:s t(e edit 5ormatted s.reen6 ?ou .an s.roll using t(e U/ and 'O@2 .ommands< and .an u3date 5ile .ontents %4 t43ing o+er t(e F$*L' = LU* .olumn6 File) $' )))) *'$T ) /9OJ*CT6T*ST6' T GT*STFL3H )))))))))))))))))))) L$2* &&&&1

153

CO77 2' 111N 9C' S*! 2O 1

SC9OLL 111N / 8*

))))))))L*=*L 2U7B*90' T )2 7*))))))))) )OFFS*T) )))))))))F$*L' = LU*)))))))))) &1 O9'*9)L$2* &5 $T*7)2O &5 !T?)O9'*9*' &5 L$ST)/9$C* 1 /S02 7O'5& 11 1&& 14 24&&6&&

8*2*9 L $2FO97 T$O2 U2SC9OLL BL* ' T '$S/L ? SC9**2S Uns.rolla%le data dis3la4 s.reens s(o: Anonre3eatingA in5ormation :(i.( 5its on a single s.reen6 T(e Sele.tion Criteria O3tions s.reen s(o:n %elo: is an eCam3le o5 t(is t43e o5 s.reen6 JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ JJ File) $' )))) Sele.tion Criteria ) O3tions )))))))))))))))))))))))))))))))))))) CO77 2' 111N

Sele.tion .riteria o3tions First< start at t(e 5ollo:ing re.ord >*? Starting re.ord -e4 ) O9 ) Starting 9B 111N 111N O9 at t(e 5ollo:ing 9B G%ot( %lan- 5or start o5 5ile

$nitial re.ords to s-i3

111N &

t(en s-i3 t(is man4 re.ords

8*2*9 L $2FO97 T$O2 CO77 2' *2T9?

154

File) $' 3ro+ides .ommands 5or .ommonl4 used 5un.tions6 ?ou ma4 enter .ommands in one o5 t:o :a4sB 1H B4 t43ing t(e .ommand in t(e .ommand0o3tion 5ield Gline 2 o5 t(e s.reenH and t(en 3ressing t(e *2T*9 -e4< or 2H B4 3ressing a 3rogram 5un.tion G/FH -e4 to :(i.( 4ou (a+e assigned t(e desired .ommand6 ?ou .an assign .ommands to /F -e4s using o3tion &6&63 or t(e >*?S .ommand6 @(en 4ou 3ress t(e /F -e4< t(e 3ro.essing is t(e same as i5 4ou t43ed t(e .ommand in t(e .ommand 5ield and 3ressed *2T*96 Be5ore 4ou 3ress a /F -e4< 4ou .an enter in5ormation in t(e .ommand 5ield6 T(e /F -e4 de5inition is .on.atenated a(ead o5 t(e .ontents o5 t(e .ommand 5ield6 For eCam3le< su33ose 4ou assign t(e 'O@2 .ommand to t(e /F# -e46 $5 4ou t43e A6A in t(e .ommand 5ield and 3ress /F#< t(e results are t(e same as i5 4ou (ad t43ed A'O@2 6A in t(e .ommand 5ield and 3ressed *2T*96 ?ou .an sta.- multi3le .ommands 5or eCe.ution in one intera.tion %4 entering a s3e.ial delimiter %et:een t(e .ommands6 T(e de5ault delimiter is a semi.olon GMH6 ?ou .an .(ange t(e delimiter using o3tion &6&616 For eCam3leB CO77 2' 111N 'O@2 1&ML*FT $n t(is eCam3le t(e 'O@2 and L*FT .ommands (a+e %een sta.-ed6 8*2*9 L $2FO97 T$O2 CO77 2' SU77 9? File) $' 3rimar4 .ommands are di+ided into 5our .ategories listed %elo:6 Commands designated :it( an asteris- GJH (a+e t(e same s4ntaC and 5un.tion as in $S/F6 $n man4 File) $' 5un.tions< t(e in5ormation to %e dis3la4ed eC.eeds t(e s.reen siDe6 S.roll .ommands allo: 4ou to mo+e t(e s.reen A:indo:A in as man4 as t(ree dimensions a.ross t(e in5ormationB u30do:n< le5t0rig(t< and 5or:ard0%a.-6 For a more detailed des.ri3tion o5 s.rolling< see t(e SC9OLL$28 se.tion :it(in 8*2*9 L $2FO97 T$O26 T(e s.roll .ommands areB U/ J Causes s.rolling to:ard t(e to3 o5 a re.ord< 5ile< re.ord la4out< or mem%er list6

'O@2 J Causes s.rolling to:ard t(e end o5 a re.ord< 5ile< re.ord la4out< or mem%er list6 L*FT J Causes s.rolling to:ard t(e le5t margin o5 t(e data or .auses %a.-:ard s.rolling to:ards t(e %eginning o5 a 5ile6 9$8ET J Causes s.rolling to:ard t(e rig(t margin o5 t(e data or .auses 5or:ard s.rolling to:ards t(e end o5 a 5ile6

155

FO9@ 9' B C> LOC T* name6

Causes re.ord s.rolling to:ard t(e %ottom o5 t(e 5ile6 Causes s.rolling to:ard t(e to3 o5 t(e 5ile6 Causes u3 or do:n s.rolling to t(e s3e.i5ied line num%er< la%el< or mem%er

LOC T* Causes u3 or do:n s.rolling to t(e re.ord :it( a la%el GdatanameH or eC.lude .lassi5i.ation6 lso .auses s.rolling to a data)name t(at .ontains< in 3art or 5ull< t(e data nameGo..H string6 L9 Causes 5or:ard or %a.-:ard s.rolling to a s3e.i5ied re.ord num%er< la%el< or an4 re.ord :it( a la%el .lassi5i.ation6 9*CO9' 7 2$/UL T$O2 CO77 2'S 9e.ord mani3ulation .ommands allo: 4ou to u3date 5ile .ontents and to 5ind and .(ange o..urren.es o5 a string in a 5ile6 T(e re.ord mani3ulation .ommands areB $2S*9T 5ilesH Causes AnA re.ords to %e inserted a5ter t(e .urrent re.ord Gnot su33orted 5or B' 7

'*L*T* Causes AnA re.ords to %e deleted %eginning :it( .urrent re.ord Gnot su33orted 5or B' 7 5ilesH 9*/* T 5ilesH F$2' Causes a re.ord to %e re3eated AnA times Gnot su33orted 5or B' 7

Causes one or all o..urren.es o5 a string to %e 5ound

9F$2' J $n *dit or Bro:se< .auses t(e 3re+ious F$2' .ommand to %e re3eated CE 28* Causes one or all o..urren.es o5 a string to %e .(anged 9CE 28* J $n *dit< .auses t(e 3re+ious CE 28* .ommand to %e re3eated S =* J Causes t(e data to %e stored %a.- into t(e edit dataset U2'O Causes t(e last a33lied .(ange to data to %e re+ersed

@(en using an F9*F to :or- :it( AsegmentedA re.ords t(e 5ollo:ing are +alidB '' 2*FT $nsert a segment at a 3oint in t(e re.ord6 'is3la4 2*FT segment o5 re.ord using .orre.t la4out

156

9*7O=* 9emo+e a segment at a 3oint in t(e re.ord6 TO/ US* 9eturn to start o5 re.ord and dis3la4 %ase 'is3la4 la4outs and allo: manual sele.tion and relo.ation

S*SS$O2 CO2T9OL CO77 2'S Session .ontrol .ommands (a+e to do :it( terminating t(e .urrent 5un.tion or s:it.(ing 5rom one 5un.tion to anot(er6 T(e session .ontrol .ommands areB C 2C*L J Causes editing to %e terminated :it(out sa+ing t(e data *2' J Terminates t(e .urrent o3eration and returns to t(e neCt (ig(er le+el s.reen Galso used to indi.ate end o5 ta%le in3utH 9*TU92 J Causes an immediate return to t(e 3rimar4 o3tion menu or to a s3e.i5ied o3tion 9e.ursi+e .ommandsB File) $' (as s3e.ial .ommands li-e F1 GBro:seH< F2 G*ditH< F33 GCo34H t(at let 4ou sus3end 4our .urrent dis3la4 and start anot(er 5un.tion6 U3on end 5rom t(e ne: 5un.tion< t(e sus3ended dis3la4 is resumed6 T(e 5ollo:ing :ill %e 3resented onl4 i5 sele.ted %4 num%erB 1 ) 9e.ursi+e Commands

7$SC*LL 2*OUS CO77 2'S 7is.ellaneous .ommands .o+er a +ariet4 o5 5un.tions6 T(e4 are listed and %rie5l4 des.ri%ed %elo:6 >*? Causes a s3e.i5ied -e4 to %e retrie+ed or t(e -e4 s3e.i5i.ation s.reen to %e dis3la4ed Ga33lies to B' 7< $S 7< =S 7)>S'S< =S 7)99'S< and $ 7 5iles onl4H E*F J Causes data to %e dis3la4ed in eit(er (eCade.imal or .(ara.ter 5ormat C /S J Causes al3(a%eti. data entered 5rom t(e terminal to %e eit(er translated to u33er .ase or le5t as) is 9*S*T J Causes a general resetting o5 intensi5ied messages and in.om3lete line .ommands

157

CE 9 mode

Causes a s:it.( 5rom Formatted or =erti.al editing modes to C(ara.ter editing

FO97 T Causes a s:it.( 5rom =erti.al or C(ara.ter editing modes to Formatted editing mode G liasesB F7T< 7 /H =F7T mode S/L$T line Causes a s:it.( 5rom Formatted or C(ara.ter editing modes to =erti.al editing

J Causes s3lit s.reen mode to %e entered or .(anges t(e lo.ation o5 t(e s3lit

S@ / J 7o+es t(e .ursor to :(ere+er it :as 3re+iousl4 3ositioned on t(e ot(er logi.al s.reen o5 a s3lit s.reen 3air TSO J llo:s a TSO .ommand or CL$ST to %e entered 5rom an4 s.reen

>*?S J Causes an immediate dis3la4 o5 a s.reen on :(i.( .urrent /F -e4 de5initions are dis3la4ed and modi5ia%le / 2*L$' J Causes all su%se;uent s.reens to %e dis3la4ed0not dis3la4ed :it( t(e 3anel identi5ier s(o:n in t(e u33er le5t .orner o5 t(e s.reen E*L/ tutorial J 'is3la4s additional in5ormation a%out an error or s:it.(es to t(e on)line

CU9SO9 J 7o+es t(e .ursor to t(e 5irst in3ut 5ield on line 2 /9$2T J Causes a sna3s(ot o5 t(e .urrent s.reen to %e re.orded in t(e $S/F list 5ile 5or su%se;uent 3rinting /9$2T)E$J Same as /9$2T eC.e3t t(at (ig()intensit4 .(ara.ters on t(e s.reen are 3rinted :it( o+erstri-es to simulate t(e (ig()intensit4 dis3la4 JCL Causes t(e generated JCL to %e dis3la4ed

8*2*9 L $2FO97 T$O2 / >*?S T(e t:o 3rogram a..ess G/ H -e4s (a+e s3e.ial meaning in $S/F and File) $'6 T(e4 are not e;uated to $S/F or File) $' .ommands< and t(e4 ma4 not %e reassigned6 2ormall4< 4ou s(ould not use / 1 :(ile o3erating in File) $' 5ull s.reen mode6 Eo:e+er< t(ere are t:o eC.e3tions6

15#

$5 4ou 3ress / 1 a5ter t(e -e4%oard (as %een unlo.-ed %4 File) $'< it is treated li-e / 2 G9*SEO@H6 $t does not .ause eCit 5rom File) $'6 Eo:e+er< i5 4ou 3ress / 1 a se.ond time :it(out an4 inter+ening intera.tion< it .auses t(e .urrent 3ro.essing to %e terminated and t(e $S/F /9$7 9? O/T$O2 7*2U is redis3la4ed6 $5 4ou 3ress / 1 a5ter t(e -e4%oard (as %een manuall4 unlo.-ed G%4 3ressing t(e 9*S*T -e4H< it usuall4 .auses t(e .urrent 3ro.essing to %e terminated6 T(e $S/F /9$7 9? O/T$O2 7*2U is redis3la4ed6 ?ou .an $'6 use / 2 to res(o: t(e last 5ull s.reen image dis3la4ed %4 File)

?ou ma4 need to res(o: t(e s.reen i5 4ou a..identall4 3ress t(e *9 S* $2/UT or CL* 9 -e4< or i5 4ou (a+e t43ed data on t(e s.reen t(at 4ou :ant ignored and (a+e not 4et 3ressed *2T*9 or a /F -e46 '*F ULT SS$827*2T

/9O89 7 FU2CT$O2 >*?S @(en 4ou %egin using File) $'< .ommonl4 used .ommands are assigned to t(e /F -e4s as s(o:n on t(e rig(t6 U)))))))))))))U)))) ))))))))U)))))))))))) )))))U U /F1013 U /F2014 U /F3015 U E*L/ U S/L$T U *2' U ?ou .an .(ange t(ese de5ault assignments in o3tion &6&63 or +ia t(e >*?S .ommand6 U U U U U

U))))))))))))))U)))))))))))))U)))))))))))))))))U U /F4016 U /F5017 U /F601# U

U 9*TU92 U 9F$2' U 9CE 28* U U U U U

U)))))))))))))))U))))))))))))U))))))))))))))))))U U /F7019 U U/ U U /F#02& U /F9021 U 'O@2 U S@ / U U U U U

U)))))))))))))))U)))))))))))))U)))))))))))))))))U

159

U /F1&022 U /F11023 U /F12024 U L*FT U

U 9$8ET U 9*T9$*=* U U U U

U))))))))))))))))U))))))))))))U)))))))))))))))))U 8*2*9 L $2FO97 T$O2 SC9OLL$28 $n man4 File) $' 5un.tions< t(e in5ormation to %e dis3la4ed eC.eeds t(e s.reen siDe6 S.rolling allo:s 4ou to mo+e t(e s.reen A:indo:A in as man4 as t(ree dimensions a.ross t(e in5ormationB u30do:n< le5t0rig(t< and 5or:ard0%a.-6 ?ou a..om3lis( t(is using t:o %asi. t43es o5 s.rollingB / 8* SC9OLL$28 T(e 3age s.rolling .ommands and de5ault /F -e4 assignments areB U/ G/F7019H ) to s.roll to:ard t(e to3 o5 t(e data

'O@2 G/F#02&H ) to s.roll to:ard t(e %ottom o5 t(e data L*FT G/F1&022H ) to s.roll to:ard t(e 5irst .olumn o5 t(e data 9$8ET G/F11023H ) to s.roll to:ard t(e last .olumn o5 t(e data T(ese .ommands 5un.tion eCa.tl4 as t(e4 do in $S/F0/'F6 On all s.reens in+ol+ing s.rolling< a s.roll amount is dis3la4ed on line 2 o5 t(e s.reen6 T(is +alue indi.ates t(e num%er o5 lines or .olumns to s.roll :(en 4ou enter one o5 t(e 5our 3age s.rolling .ommands6 ?ou .an .(ange t(e s.roll amount %4 sim3l4 t43ing o+er t(e s.roll amount 5ield6 =alid s.roll amounts areB ) a num%er 5rom 1 to 9999 ) s3e.i5ies t(e num%er o5 lines0.olumns to s.roll ) / 8* ) s3e.i5ies s.rolling %4 one logi.al 3age ) ' T ) s3e.i5ies s.rolling %4 one logi.al 3age less one line ) E LF ) s3e.i5ies s.rolling %4 one)(al5 logi.al 3age ) 7 F ) s3e.i5ies s.rolling to t(e to3< %ottom< le5t margin< or rig(t margin< de3ending on :(i.( s.rolling .ommand is used6

16&

) CS9 ) s3e.i5ies s.rolling %ased on t(e .urrent 3osition o5 t(e .ursor6 T(e line or .olumn :(ere t(e .ursor is 3ositioned is mo+ed to t(e to3< %ottom< le5t< or rig(t o5 t(e s.reen de3ending on :(i.( s.rolling .ommand is used6 $5 t(e .ursor is not in t(e %od4 o5 t(e data< or i5 it is alread4 3ositioned at t(e to3< %ottom< le5t< or rig(t< a 5ull 3age s.roll o..urs6 For s.rolling 3ur3oses a A3ageA is de5ined as t(e amount o5 in5ormation .urrentl4 +isi%le on t(e logi.al s.reen6 $n s3lit s.reen mode< 5or eCam3le< t(e edit .(ara.ter dis3la4 mig(t (a+e 12 lines %4 #& .olumns o5 s.rolla%le data6 $n t(is .ase< a s.roll amount o5 E LF :ould mo+e t(e :indo: u3 or do:n %4 6 lines< or rig(t or le5t %4 4& .olumns6 T(e .urrent s.roll amount is sa+ed in t(e user 3ro5ile6 @(en 4ou t43e o+er t(e s.roll amount< t(e ne: +alue remains in e55e.t until 4ou .(ange it again6 ?ou .an o+erride t(e .urrent s.roll amount on a gi+en intera.tion %4 entering a s.roll amount in t(e .ommand 5ield and using a s.roll .ommand or /F -e46 For eCam3le< 4ou .an enterB CO77 2' 111N 'O@2 5 and 3ress *2T*9 or

CO77 2' 111N 5

and 3ress t(e 'O@2 /F -e4

*it(er 5orm results in a tem3orar4< one)time o+erride o5 t(e s.roll amount6 To redu.e -e4stro-es< 4ou .an .(ange t(e s.roll amount 5ield %4 t43ing o+er t(e 5irst .(ara.terGsH onl4B ) To .(ange t(e s.roll amount to / 8*< ' T < E LF< 7 F< or CS9< t43e o+er t(e 5irst .(ara.ter :it( /< '< E< 7< or C res3e.ti+el46 ) To .(ange t(e s.roll amount to a num%er o5 lines or .olumns< t43e o+er t(e 5irst .(ara.terGsH :it( t(e desired num%er6 9*CO9' SC9OLL$28 T(e re.ord s.rolling .ommands are not dire.tl4 assigned to a /F -e4B FO9@ 9' Gor F@' H ) to s.roll to:ard t(e end o5 t(e 5ile B C> ) to s.roll to:ard t(e %eginning o5 t(e 5ile

T(e L*FT G/F1&0/F22H and 9$8ET G/F110/F23H .ommands .an %e used in 3la.e o5 B C> and FO9@ 9'< res3e.ti+el46

161

T(ese .ommands a33l4 to t(e s.reens :(ere one Are.ordA 3er s.reen is dis3la4ed 5ormatted :it( a re.ord la4out Gedit0%ro:se Formatted< edit 5ormatted 5ield sele.tion .riteria< de5ine 5ormatted F9*FH and are used to mo+e 5or:ard or %a.-:ard AnA re.ords Gor .riteria setsH in a 5ile6 ?ou enter t(e s.roll amount 5or re.ord s.rolling in t(e CO77 2' in3ut area Gunless 4ou (a+e assigned %ot( t(e .ommand and t(e s.roll amount to a /F -e4H6 =alid s.roll amounts areB ) a num%er 5rom 1 to 2<147<4#3<647 ) s3e.i5ies t(e num%er o5 re.ords to s.roll FO9@ 9' or B C> ) 7 F or 7 ) s3e.i5ies s.rolling to t(e last re.ord GFO9@ 9'H or t(e 5irst re.ord GB C>H in t(e 5ile 8*2*9 L $2FO97 T$O2 S/L$T SC9**2 T(ere ma4 %e times :(en 4ou :ant to 3er5orm anot(er File) $' 5un.tion or $S/F0/'F 5un.tion :it(out ending t(e .urrent 5un.tion6 File) $' 3ro+ides t(e a%ilit4 to Qs3litQ t(e 3(4si.al s.reen image into t:o logi.al s.reens t(at o3erate inde3endentl4 o5 one anot(er< as t(oug( 4ou (ad t:o terminals6 $n s3lit s.reen mode< onl4 one o5 t(e logi.al s.reens is .onsidered a.ti+e at a time6 n4 intera.tions< su.( as 3ressing *2T*9 or a /F -e4< are inter3reted as (a+ing meaning 5or t(e a.ti+e s.reen6 T(e .urrent lo.ation o5 t(e .ursor identi5ies :(i.( o5 t(e t:o s.reens is a.ti+e6 To s:it.( 5rom one s.reen to t(e ot(er< sim3l4 mo+e t(e .ursor to t(e desired s.reen or enter t(e S@ / .ommand6 8*2*9 L $2FO97 T$O2 T*97$2 T$28 File) $' ?ou .an terminate File) $' in an4 o5 t(ree :a4sB 1H %4 entering t(e *2' .ommand on t(e 3rimar4 o3tion menu 2H %4 entering o3tion F on t(e 3rimar4 o3tion menu 3H %4 entering t(e 1F Vum3 .ommand 5rom an4 s.reen @(en 4ou in+o-e File) $' 5rom t(e $S/F 3rimar4 o3tion menu< e+entuall4 terminate $S/F0/'F using t(e *2' .ommand< and used eit(er t(e log or list 5iles< a termination s.reen is dis3la4ed6 8*2*9 L $2FO97 T$O2 File) $' ' T S*TS 8eneral in5ormation a%out t(e use o5 datasets %4 File) $' 5ollo:s6 *a.( to3i. is 3resented in se;uen.e< or ma4 %e sele.ted %4 num%erB 1 ) Con+entions 5or S3e.i54ing 'atasets

162

2 ) 'ata File 'ataset 3 ) 9e.ord La4out 'ataset and sour.e language su33ort 4 ) La4out F9*F 'ataset 5 ) Sele.tion Criteria 'ataset 6 ) 9e5ormat 'e5inition 'ataset 7 ) 7em%er List /ro.essing

ll datasets 3ro.essed on)line must reside on a dire.t a..ess storage de+i.e or on a mass storage de+i.e6 Un.ataloged dis- data 5ile datasets are allo:ed in all 5un.tions and .an %e a..essed %4 s3e.i54ing a =OLS*96 Tem3orar4 data 5iles and ta3e datasets are allo:ed as in3ut to inde3endent File) $'0Bat.( Vo%s 5or :(i.( 4ou de+elo3 t(e JCL6 File) $'0Bat.( JCL .an %e o3tionall4 generated :it( Co34 G363H< Sear.(0U3date G366H< /rint G56CH< 9e5ormat G9H< and Com3are G1&H CO2=*2T$O2S FO9 S/*C$F?$28 ' T S*TS @(en a 'ataset 2ame is re;uired in File) $'< 4ou ma4 enter a 5ull4 ;uali5ied G;uotedH< un;uali5ied Gno ;uotes< userid 3re5iC im3liedH< or 3attern G.atalog sear.( re;uestH6 File) $' sa+es t(e name o5 t(e most re.entl4 re5eren.ed dataset o5 ea.( t43e G'ata 5ile< 9e.ord La4out< F9*F< Sele.tion CriteriaH in 4our session 3ro5ile and redis3la4s t(ese names on all a33ro3riate s.reens6 FULL? !U L$F$*' 2 7*S ?ou ma4 enter an4 5ull4 ;uali5ied data set name %4 en.losing t(e name in a3ostro3(es GQH6 Trailing ;uotes are ne+er re;uired6 *Cam3leB 'ataset name 111N QS?S167 CL$BQ U2!U L$F$*' 2 7*S

$5 4ou omit t(e a3ostro3(eGsH< 4our TSO 3re5iC is le5t)a33ended to t(e entered data set name Gunless t(e TSO 3ro5ile o3tion A2O/9*F$FA (as %een s3e.i5iedH6

163

$5 4ou s3e.i54 a de5ault =S 7 $2T*97*'$ T* 2 7* :it( t(e &61 S4stem /arameters 5un.tion< and0or 4our installation uses t(e o3tional File) $' =S 7 (ig( le+el indeC< and no dataset .an %e Found :it( t(e .om%ination o5 ATSO)/9*F$F6' T S*TA< a ne: A=S 7 3re5iCA is .onstru.ted as 5ollo:sB =S 7 (ig( le+el indeC6=S 7 $2T*97*'$ T* 2 7*6 T(e .onstru.ted A=S 7 3re5iCA is t(en le5t)a33ended to t(e entered dataset name G=S 7 3re5iC6datasetH and t(e .atalog is again sear.(ed 5or t(e dataset6 $5 allo.ating a =S 7 .luster< :it( t(e 365 =S 7 utilit4< t(e =S 7 3re5iC is al:a4s .onstru.ted :(en an un;uali5ied name is s3e.i5ied6 U2C T LO8*' ' T S*TS $5 t(e dataset is not .ataloged< 4ou must s3e.i54 a =olume serial num%er6 US$28 / TT*92 CE 9 CT*9S ) C T LO8 S* 9CE ?ou .an use 3attern .(ara.ters in t(e dataset 5ield to d4nami.all4 in+o-e File) $'Qs .atalog sear.( G364H to loo- 5or mat.(ing dataset names6 =alid 3attern .(ara.ters areB ] and c Gsingle .(ara.terH J Gmulti3le .(ara.ters in one nodeH< K G& or more nodesH6 /attern .(ara.ters are used to re3resent an4 or all .(ara.ters :(i.( are not 3art o5 t(e (ig()le+el node o5 a dataset name6 T(e (ig()le+el node must %e 5ull4 s3e.i5ied6 Follo:ing are some eCam3les o5 using t(e asteris- GJH to retrie+e a list o5 datasetsB CO7/ 9* ' T S*T 111N F$L*6J or CO7/ 9* ' T S*T 111N Quserid6F$L*6JQ or CO7/ 9* ' T S*T 111N F$L*6 BCJ US$28 / TT*92 CE 9 CT*9S ) C T LO8 S* 9CE G.ont6H 5ter s3e.i54ing t(e 3attern< 3ress *2T*96 T(e File) $' 364 Catalog Utilit4 is in+o-ed< and a list o5 datasets .orres3onding to t(e 3attern t(at 4ou s3e.i5ied is dis3la4ed6 T43e S in t(e CO77 2' .olumn to t(e le5t o5 t(e name o5 t(e dataset 4ou :ant to sele.t and 3ress *2T*96 T(e sele.ted dataset :ill %e used and :ill re3la.e t(e 3attern 4ou s3e.i5ied on t(e 3anel 5or t(e 5un.tion 4ou are 3er5orming6

164

$5 4ou are not li.ensed 5or File) $'0S/F< 4ou :ill re.ei+e an error i5 4ou use a 3attern .(ara.ter in t(e dataset 5ield6 For 5urt(er in5ormation on 3attern .(ara.ters< eC3lore t(e tutorial 5or t(e 364 Catalog utilit4 or see t(e File) $' Online 9e5eren.e 7anual< C T LO8 UT$L$T?6 /'S ' T S*TG7*7B*9H mem%er name en.losed in 3arent(eses ma4 5ollo: t(e data set name G:it(in t(e a3ostro3(es< i5 t(e4 are 3resentH 5or 3artitioned data sets6 For sele.tion 3ur3oses< s3e.i54ing a mem%er name 5or a 3artitioned dataset :ill .ause t(e mem%er to %e 3ro.essed as a se;uential dataset6 $n most instan.es a 7em%er 2ame 3rom3t is 3ro+ided under t(e 'ataset 2ame 3rom3t6 $5 a mem%er name is s3e.i5ied in 3arent(eses along :it( t(e dataset name< t(e mem%er in5ormation is .onsidered as i5 it (ad %een entered in t(e 7em%er 2ame 5ield6 /'S 7*7B*9 2 7* 7 S>S @(en re5eren.ing a /'S dataset< 4ou ma4 s3e.i54 a 7em%er 2ame o5 %lan-< or use a 3attern to generate a list o5 mem%ers 5or sele.tion6 /'S 7*7B*9 2 7* 7 S>S G.ont6H ?ou .an use a ;uestion mar- G]H or 3er.ent GcH to re3resent a single .(ara.ter o5 t(e mem%er name or an asteris- GJH to re3resent multi3le .(ara.ters in a mem%er name6 Eo:e+er< 4ou must enter at least t(e 5irst .(ara.ter o5 t(e mem%er name %e5ore 4ou .an use t(e asteris-6 G*C.e3tionB in 363 Co34 or 366 Sear.( U3date< a mem%er name o5 asteris- GJH means to 3ro.ess all mem%ers and to %43ass all /'S /ro.essing O3tions s.reens and mem%er lists6H Using %lan- or a mem%er name 3attern :ill eit(er .ause a File) $' mem%er list to %e dis3la4ed or a /'S /ro.essing O3tion s.reen to a33ear to 3ro+ide additional mem%er sele.tion o3tions6 On.e a list o5 mem%ers is 3resented< 4ou .an sele.t a mem%er 5rom t(is list %4 using t(e S line .ommand6 ?ou .an also enter t(e 5ull mem%er name< in 3arent(eses< on t(e same line as t(e dataset name6 $5 4ou do so< 4ou .an ignore t(e 7em%er 2ame 5ield6 8*2*9 T$O2 ' T S*TS 8eneration data sets ma4 %e re5eren.ed %4 using a signed or unsigned num%er en.losed in 3arents6 *Cam3leB 111N Q8'S6T*STG&HQ

165

T(is eCam3le re5eren.es t(e most re.entl4 allo.ated data set in t(e generation data grou36 7inus num%ers re5eren.e 3re+iousl4 allo.ated data sets and 3ositi+e num%ers re5eren.e unallo.ated data sets o5 t(e grou36

C T LO8 ' T S*T On some 3anels a .atalog dataset name ma4 %e entered6 $n t(is .ase :(et(er t(e .atalog dataset name is en.losed in ;uotes or not< t(e name is al:a4s .onsidered to %e a 5ull4 ;uali5ied name and no 3re5iC is a33ended to it6 Catalog dataset name 111N QC T LO86' T S*TQ Catalog dataset name 111N C T LO86' T S*T $n t(e a%o+e eCam3le< %ot( entries are .orre.t and treated e;uall46 ' T F$L* ' T S*T T(e data 5ile dataset .ontains t(e data to %e %ro:sed< edited< re5ormatted 5rom0into< .o3ied 5rom0into< sear.(ed< u3dated< 3rinted or .om3ared6 $t .an also %e a dataset 4ou are de5ining or managing :it( t(e eCtended utilities6 File) $' su33orts user :ritten $0O eCit 3rograms 5or data 5ile datasets6 $0O eCits .an (andle .om3ression0de.om3ression< en.r43tion0de.r43tion< or .an 3er5orm all 3(4si.al $0O to 4our data 5ile6 See t(e File) $' $nstallation 8uide 5or details and sam3les6 T(e neCt t:o tutorial 3ages dis3la4 ta%les s(o:ing t(e .om%inations o5 dataset organiDations and re.ord 5ormats allo:ed 5or data 5iles6 For se;uential G/SH< 3artitioned G/OH< B' 7 G' H< and $S 7 G$SH 5iles< t(e L9*CL and BL>S$I* .an range 5rom 1 to 32<76& 5or ea.( 9*CF76 For =S 7 5iles< t(e L9*CL .an range 5rom 1 to 32<7676 T(e ta%le %elo: s(o:s t(e .om%inations o5 dataset organiDations and re.ord 5ormats allo:ed 5or data 5iles6 RECFM =B F F F

'SO98 F /S F GSe;uentialH /O F G/artitionedH $S G$ndeCed F

FB F F F

= F F F

U F F n0a

S/ 22*' F F n0a

166

Se;uentialH ' GB' 7H F

T(e ta%le %elo: s(o:s t(e .om%inations o5 dataset organiDations and re.ord 5ormats allo:ed 5or =S 7 data 5iles6 RECFM =B n0a n0a n0a

'SO98 7 G=S 7) >S'S<*S'SH 7 G=S 7) 99'SH 7 G$ 7H 7 G=S 7) L'SH

F n0a F F

FB n0a n0a n0a

= F n0a F

U n0a n0a n0a

S/ 22*' F n0a F

Gallo.ate< delete< in5o onl4H lso< t(e .on.e3t o5

1H =S 7)>S'S and *S'S 5iles are treated as +aria%le lengt( 5iles6 %lo.-ing< as a33lied to /S< /O< and $S 5iles< does not a33l4 to =S 76

2H File) $' does not su33ort $S 7 5iles :it( O/TC'1L in t(e 'CB in5ormation :(en t(e -e4 starts in t(e 5irst 3osition G9>/1& 5or 5iCed lengt( 5iles< 9>/14 5or +aria%le lengt( 5ilesH 3H File) $' does not su33ort 5iCed lengt( un%lo.-ed $S 7 5iles :it( a relati+e -e4 3osition o5 & G9>/1&H< or +aria%le lengt( un%lo.-ed $S 7 5iles :it( a relati+e -e4 3osition o5 4 G9>/14H6 4H File) $' su33orts reading a =S 7)>S'S in an alternate -e4 se;uen.e +ia a =S 7 / TE6 / TE name ma4 %e s3e.i5ied 5or t(e in3ut data 5ile name in t(e %ro:se< edit< .o34< 3rint< and .om3are o3tions6 5H File) $' treats 9*CF71FB B' 7 5iles as 9*CF71F Gi6e6< re.ords are not de)%lo.-ed6H >e4ed B' 7 5iles are 3ro.essed %4 File) $' as i5 t(e -e4 :ere .on.atenated in 5ront o5 ea.( data %lo.-6 6H $ 7 5iles eCist as 5iCed or +aria%le lengt( 5iles6 'ue to a .onstraint in t(e in5ormation a+aila%le to File) $' 5rom t(e $ 7 a..ess met(od< all 5iles are .urrentl4 (andled as +aria%le lengt( 5iles6 $5 t(e lengt( is .(anged on an $ 7 5ile :(i.( is trul4 5iCed< File) $' :ill dis3la4 an error message6 $ 7 5iles are 3ro.essed as =S 7)>S'S 5iles in all 5un.tions6 OS / SS@O9' /9OT*CT*' F$L*S File) $' allo:s 4ou to a..ess data 5ile datasets :it( OS 3ass:ord 3rote.tion6 n4 dataset ma4 %e 3rote.ted to 3ermit read)onl4 or read0:rite a..ess6 7ore t(an one 3ass:ord ma4 %e assigned to t(e same dataset6 dataset t(at is read0:rite 3rote.ted< 5or eCam3le< mig(t allo: se+eral aut(oriDed users to read it< %ut onl4 one user to :rite6

167

$5 4ou attem3t to a..ess a dataset 3rote.ted %4 an OS 3ass:ord< File) $' :ill 3resent t(e OS) /ass:ord)/rote.ted s.reen .ontaining a 5ield :(ere 4ou .an s3e.i54 a dataset 3ass:ord as 5ollo:sB 'ataset 3ass:ord 111N nondis3la4 in3ut 5ield is used so t(at t(e 3ass:ord does not a33ear on t(e s.reen :(ile 4ou are t43ing it6 2ote t(at t(e File) $' 365 =S 7 utilit4 su33orts s3e.i5i.ation and modi5i.ation o5 3ass:ords 5or =S 7 .lusters6 9*CO9' L ?OUT ' T S*T T(is dataset .ontains t(e re.ord la4outs :(i.( are used in man4 File) $' 5un.tions6 T(e re.ord la4out dataset .an %e one o5 5our t43esB T?/* /artitioned 'ataset / 2= L*T 5ile L$B9 9$ 2 5ile Standard se;uential dataset 'SO98 /O J J /S 9*CF7 F< FB< =< =B J J F< FB< =< =B L9*CL #& J J #&

7ust .on5orm to t(e re;uirements 5or a +alid C )/ 2= L*T0L$B9 9$ 2 5ile6 C ) / 2= L*T and C )L$B9 9$ 2 are 3rodu.ts o5 Com3uter sso.iates $nternational< $n.6 re.ord la4out ma4 %e a se3arate CO/?L$B mem%er or ma4 %e (ard).oded :it(in t(e sour.e statements o5 a 3rogram6 $5 t(e la4out is in a 3rogram or i5 a CO/?L$B mem%er .ontains multi3le re.ord la4outs< 4ou .an isolate t(e s3e.i5i. la4out< or 3ortion o5 a la4out< t(at File) $' s(ould use %4 s3e.i54ing a starting data)name6 $5 4ou do not s3e.i54 a starting data)name< File) $' uses e+er4 la4out 5ound in t(e 3rogram< or CO/?L$B mem%er< to 5ormat t(e data< treating t(e se.ond t(roug( last la4outs as additional la4outs t(at ma4 %e manuall4 sele.ted and o+erlaid at an4 o55set +ia t(e US* .ommand6 2oteB File) $' 9elease 6 A7 /A li%raries .ontaining .om3iled re.ord la4outs are a..e3ta%le as a re.ord la4out li%rar46 L 28U 8* SU//O9T File) $' su33orts sour.e re.ord la4outs .oded in COBOL or /L0$6 La4outs ma4 %e used :(en %ro:sing< editing< 3rinting< re5ormatting and .om3aring data 5iles6

16#

La4outs .an also %e used to de5ine sele.tion .riteria and to s3e.i54 tests 5or multi3le re.ord t43e la4out usage6 File) $' automati.all4 re.ogniDes t(e sour.e language :(ene+er a la4out is re5eren.ed6 File) $' su33orts Format 1 o5 t(e COBOL data de5inition statement and ignores Formats 2 and 36 @(en a 66 or ## le+el item is en.ountered File) $' s-i3s to t(e end o5 t(e senten.e and 3er5orms no s4ntaC .(e.-ing6 FO97 T 1 FO97 T 2

le+el num%er data)name

66 data)name)1 9*2 7*S .lause6

9*'*F$2*S .lause BL 2> @E*2 I*9O JUST$F$*' .lause OCCU9S .lause /$CTU9* .lause S$82 .lause S?2CE9O2$I*' .lause US 8* .lause = LU* .lause6 T(e 5ollo:ing rules a33l4 to Format 1B 1H T(e 5irst data des.ri3tion entr4 in t(e COBOL la4out need not (a+e le+el num%er &16 2H $5 multi3le data des.ri3tion entries (a+e le+el num%er &1< t(e se.ond t(roug( AnA &1 le+el entries are treated as t(oug( t(e4 rede5ine t(e 5irst &1 le+el entr46 *a.( &1 le+el entr4 need not %e su..essi+el4 longer t(an t(e 3re+ious &1 le+el entr46 3H T(e .lauses ma4 %e :ritten in an4 order6 4H T(e /$CTU9* .lause must %e s3e.i5ied 5or e+er4 elementar4 item :it( t(e eC.e3tion o5 $2'*F< CO7/)1< and CO7/)2 data items6 ## .ondition)name = LU* .lause6 FO97 T 3

169

5H

*a.( data des.ri3tion entr4 must %e terminated %4 a 3eriod6

6H Semi.olons or .ommas ma4 %e used as se3arators %et:een .lauses6 7H T(e *J*CT< S>$/1< S>$/2< and S>$/3 reser+ed :ords ma4 %e im%edded %et:een data de5inition statements :it(in a COBOL la4out6 File) $' s-i3s o+er t(ese :ords6 #H File) $' also s-i3s o+er t(e T$TL* statement< :(i.( is +alid in =S COBOL $$6 9H Sort 5ile des.ri3tion entr4 statements GS'H and 5ile des.ri3tion entr4 statements GF'H ma4 %e im%edded :it(in t(e COBOL la4out6 File) $' s-i3s t(ese statements and 3er5orms no s4ntaC .(e.-ing6 1&H File) $' also s-i3s de%ugging lines GA'A in .olumn 7H and senten.es :(i.( do not %egin :it( a +alid le+el num%er6 11H File) $' ignores t(e 9*'*F$2*S .lause i5 it is on t(e 5irst data des.ri3tion entr4 in t(e COBOL la4out6 T(e le+el num%er and data)name are re;uired in t(e COBOL data des.ri3tion entr46 T(e 5ormat isB Le+el num%er data)name T(e le+el num%er ma4 %e an4 num%er 5rom 1 t(roug( 496 ?ou ma4 not use le+el num%er 776 'ata)names must %e 3& .(ara.ters or less %ut are not ot(er:ise +alidated6 For eCam3le< 4ou are not restri.ted to using .(ara.ters t(roug( I< & t(roug( 9< and (43(en to 5orm data)names< and 4ou need not ma-e data)names uni;ue6 T(e -e4:ord F$LL*9 is treated t(e same as ot(er data) names6 T(e 5ormat o5 t(e 9*'*F$2*S .lause isB le+el num%er data)name)1 9*'*F$2*S data)name)2 T(e le+el num%ers o5 data)name)1 and data)name)2 must %e identi.al and .an %e an4 le+el num%er 5rom 1 to 496 Bet:een t(e data des.ri3tions o5 data)name)2 and data)name)1< t(ere ma4 %e no entries (a+ing numeri.all4 lo:er le+el num%ers t(an t(e le+el num%er o5 data)name)2 and data)name)16 T(e data des.ri3tion entr4 5or data)name)2 ma4 not .ontain an OCCU9S .lause6 Eo:e+er< data) name)2 ma4 %e su%ordinate to an item .ontaining an OCCU9S .lause :it( or :it(out t(e '*/*2'$28 O2 o3tion6 $tems su%ordinate to data)name)2 ma4 .ontain an OCCU9S .lause :it(out t(e '*/*2'$28 O2 o3tion6

17&

'ata)name)1 and an4 items su%ordinate to data)name)1 ma4 .ontain an OCCU9S .lause :it( or :it(out t(e '*/*2'$28 O2 o3tion6 $5 data)name)1 .ontains an OCCU9S .lause< its lengt( is .om3uted to %e t(e lengt( o5 one o..urren.e multi3lied %4 t(e num%er o5 o..urren.es6 T(e siDe o5 t(e rede5ining area must %e less t(an or e;ual to t(e siDe o5 t(e rede5ined area6 7ulti3le rede5initions o5 t(e same rede5ined area ma4 re5eren.e t(e data)name o5 t(e rede5ined area or t(e data)name o5 an4 o5 t(e 3re.eding rede5ining areas6 9*'*F$2*S .lauses ma4 also %e s3e.i5ied 5or items su%ordinate to items .ontaining 9*'*F$2*S .lauses6 File) $' ignores t(e 9*'*F$2*S .lause i5 it is on t(e 5irst data des.ri3tion entr4 in t(e COBOL la4out6 T(e 5ormat o5 t(e BL 2> @E*2 I*9O .lause isB BL 2> G@E*2H I*9O T(e :ord A@E*2A is o3tional6 T(is .lause is .(e.-ed 5or +alid s4ntaC %ut it does not a55e.t 3ro.essing in an4 :a46 T(e 5ormat o5 t(e JUST$F$*' .lause isB JUST$F$*' G9$8ETH JUST T(e JUST$F$*' .lause is used to o+erride normal 3ositioning o5 data :it(in a re.ei+ing al3(anumeri. data item6 T(is .lause a55e.ts 3ro.essing in t(e re5ormatting 5un.tion Go3tion 9H onl46 2ormall4 data is le5t Vusti5ied in t(e re.ei+ing 5ield and eit(er trun.ation or %lan- 3adding o..urs on t(e rig(t6 @(en t(e JUST$F$*' .lause is s3e.i5ied< data is rig(t Vusti5ied in t(e re.ei+ing 5ield and eit(er trun.ation or %lan- 3adding o..urs on t(e le5t6 T(e OCCU9S .lause (as t:o %asi. 5ormatsB FORM#T 6 OCCU9S integer)2 T$7*S G'*/*2'$28 O2 data)name)1H G SC*2'$28 >*? $S data)name)2 Gdata)name)3H666H666 '*SC*2'$28 G$2'*F*' B? indeC)name)1 GindeC)name)2H666H

171

FORM#T 7 OCCU9S integer)1 TO integer)2 T$7*S G'*/*2'$28 O2 data)name)1H G SC*2'$28 >*? $S data)name)2 Gdata)name)3H666H666 '*SC*2'$28 G$2'*F*' B? indeC)name)1 GindeC)name)2H666H T(e :ords AT$7*SA< A>*? $SA< and AB?A are o3tional in %ot( 5ormats6 $n FO97 T 1< integer)2 re3resents t(e eCa.t num%er o5 o..urren.es i5 t(e '*/*2'$28 O2 o3tion is not 3resent< or t(e maCimum num%er o5 o..urren.es i5 t(e '*/*2'$28 O2 o3tion is 3resent6 $nteger)2 must %e greater t(an & and less t(an 32<76#6 $n FO97 T 2< integer)1 re3resents t(e minimum num%er o5 o..urren.es and integer)2 re3resents t(e maCimum num%er o5 o..urren.es6 $nteger)1 must %e greater t(an or e;ual to &< and integer)2 must %e greater t(an integer)1 and less t(an 32<76#6 T(ree nested le+els o5 OCCU9S .lauses are allo:ed6 T(e OCCU9S .lause ma4 not %e s3e.i5ied on &1 le+el items6 T(e SC*2'$28 >*?< '*SC*2'$28 >*?< and $2'*F*' B? o3tions are .(e.-ed 5or +alid s4ntaC< %ut do not a55e.t 3ro.essing in an4 :a46 'ata)name)1< t(e o%Ve.t o5 t(e '*/*2'$28 O2 o3tionB ) must %e de5ined as an integer ) must not .ontain or %e su%ordinate to an OCCU9S .lause T(ere .an %e multi3le OCCU9S '*/*2'$28 O2 .lauses 3er COBOL la4out6 T(e 5ormat o5 t(e /$CTU9* .lause isB /$CTU9* G$SH .(ara.ter)string /$C File) $' inter3rets all o3tions o5 t(e /$CTU9* .lause6 T(e al3(a%eti.< al3(anumeri.< al3(anumeri. edited< and numeri. edited .ategories o5 data are all treated as al3(anumeri. data Gi6e6 treated as i5 t(e .(ara.ter string .ontained all FQsH6 /i.ture .(ara.ters F B & I < 6 J ) C9 'B L *

172

are all treated as t(e 3i.ture .(ara.ter F GFF 5or C9 and 'BH6 For al3(anumeri. edited and numeri. edited data items< File) $' does not +alidate t(e .(ara.ter string a..ording to t(e A3re.eden.e o5 s4m%olsA as COBOL does6 *Cternal 5loating 3oint items are 5ull4 s4ntaC .(e.-ed and treated as 3i.ture F items6 s.aling 3osition .(ara.ter< /< is su33orted T(e 5ormat o5 t(e S$82 .lause isB S$82 G$SH L* '$28 GS*/ 9 T* CE 9 CT*9H T9 $L$28 T(e :ord ACE 9 CT*9A is o3tional in t(e S*/ 9 T* o3tion6 File) $' treats t(e S$82 .lause eCa.tl4 as COBOL treats it6 T(e 5ormat o5 t(e S?2CE9O2$I*' .lause isB S?2CE9O2$I*' GL*FTH S?2C G9$8ETH lso< t(e

T(e S?2CE9O2$I*' .lause ma4 %e s3e.i5ied at t(e &1 or elementar4 item le+el6 @(en s3e.i5ied at t(e &1 le+el< e+er4 elementar4 item :it(in t(e &1 le+el is s4n.(roniDed6 File) $' treats all ot(er as3e.ts o5 t(e S?2CE9O2$I*' .lause eCa.tl4 as COBOL treats t(em< in.luding .om3utation o5 sla.- %4tes 5or grou3s< de5ined :it( t(e OCCU9S .lause< .ontaining s4n.(roniDed items6 T(e 5ormat o5 t(e US 8* .lause isB '$S/L ? '$S/L ?)1 CO7/UT T$O2 L CO7/ CO7/UT T$O2 L)1 US 8* G$SH CO7/)1

CO7/UT T$O2 L)2 CO7/)2

173

CO7/UT T$O2 L)3 CO7/)3 CO7/UT T$O2 L)4 CO7/)4 $2'*F /O$2T*9 G=S COBOL $$ onl4H / C>*')'*C$7 L G=S COBOL $$ onl4H B$2 9? G=S COBOL $$ onl4H T(e US 8* .lause .an %e s3e.i5ied at an4 le+el o5 data des.ri3tion6 Eo:e+er< i5 t(e US 8* .lause is :ritten at a grou3 le+el< it a33lies to ea.( elementar4 item in t(e grou36 T(e usage o5 an elementar4 item ma4 not .ontradi.t t(e usage o5 a grou3 to :(i.( an elementar4 item %elongs6 $5 t(e US 8* .lause is not s3e.i5ied 5or an elementar4 item< or 5or an4 grou3 to :(i.( t(e item %elongs< usage '$S/L ? is assumed6 CO7/UT T$O2 L)4 and CO7/)4 items are treated as CO7/UT T$O2 L items6 T(e 5ormat o5 t(e = LU* .lause isB = LU* G$SH literal T(e = LU* .lause is .(e.-ed 5or +alid s4ntaC %ut does not a55e.t 3ro.essing in an4 :a46 COBOL L ?OUT *99O9S @(en File) $' en.ounters an error during its on)line 3ro.essing o5 a COBOL la4out< an error messages is :ritten to 4our $S/F log 5ile6 T(ese messages .ontain an image o5 t(e last line File) $' read 5rom t(e COBOL la4out< 3lus t(e internal la4out re3resentation File) $' %uilt %e5ore t(e error o..urred6 B4 using t(ese messages in .onVun.tion :it( t(e error message File) $' dis3la4s at 4our terminal< 4ou :ill %e a%le to resol+e most COBOL la4out errors6 L ?OUT 7*7B*9 S*L*CT$O2 @(ene+er 4ou lea+e t(e la4out mem%er name %lan- or use a 3attern< File) $' 3resents a mem%er list6 3artitioned 3ro.essing o3tions G//OH s.reen usuall4 a33ears 5irst to let 4ou 5ilter t(e mem%er list to im3ro+e 3er5orman.e6 3attern .onsisting onl4 o5 an asteris- GJH tells File) $' to list all mem%ers and to %43ass t(e //O s.reen6

174

2OT*B Using a single asteris- GJH 3attern to list all mem%ers o5 a large la4out li%rar4 Gsu.( as a /an+alet or Li%rarian li%rar4H ma4 %e time .onsuming6 7em%er list 3resentation o..urs automati.all4 in t(e F9*F 5un.tion :(en 4ou use line .ommands< or enter a 3attern in t(e mem%er name 5ield G:it( or :it(out using t(e S or SU line .ommandH6 SOU9C* ST T*7*2T S*L*CT$O2 SOU9C* O/T$O2S @(en File) $' .annot .om3ile 4our re.ord la4out :it( t(e de5ault sour.e o3tions< t(e Sour.e Statement Sele.tion 3anel is dis3la4ed6 T(is 3anel .ontains a Sour.e Statement sele.tion area and a .om3iler o3tion se.tion6 9e.ord la4out eCtra.tion .an %e done %4 AC(ara.ter stringA or AStatement num%erA6 C(ara.ter string sele.tion is 3er5ormed %4 entering t(e 5ull or 3artial dataname o5 t(e 5irst grou3 item :anted6 T(e ending string is onl4 needed 5or /L0$ or :(en a 3artial grou3 is :anted6 Sele.tion %4 num%er is 3er5ormed %4 entering t(e %eginning and ending statement num%ers6 T(e num%ers .an %e standard G.ols 73)#&H< relati+e< or COBOL G.ols 1)6H6 9elati+e is /lease enter t(e %eginning and term Sour.e statement line num%ers or %l 9e.ord la4out sele.tion %4 C(ara.ter St Beginning string 111N *nding string 111N 9e.ord la4out sele.tion %4 Sour.e State Beginning num%er 111N *nding num%er 111N 2um%er t43e 111N

T(e Sour.e O3tions 3anel is also used to enter .om3iler o3tions6 T(e .om3iler o3tions are Language< Starting le+el num%er< Literal delineator GCOBOL onl4H and Use 4# .(ara.ter set G/L0$ onl4H6 Language is s3e.i5ied %4 entering COBOL or /L0$ in t(e language 5ield6 Starting le+el num%er indi.ates t(e le+el num%er to %e used to indi.ate t(e start o5 a ne: .o34%oo- to %e .om3iled6 Literal delineator indi.ates to t(e Com3iler o3tionsB Language 111N COBOL Starting le+el num% 111N &1 Literal delineator 111N !UOT* Use 4# .(ara.ter set 111N ?*S )))))))))))))))))))))))))))))))))))))))))))))))))

COBOL .om3iler t(at eit(er t(e ;uote GAH or t(e a3ostro3(e GQH is t(e .(ara.ter used to delineate literals6 Use 4# .(ara.ter set indi.ates to t(e /L0$ .om3iler t(at t(e sour.e is :ritten in t(e 4#).(ara.ter set6

175

$5 File) $' .annot determine t(e language< or i5 .om3ilation 5ails< it :ill dis3la4 t(is 3anel to allo: 4ou to .(ange sour.e or .om3ile o3tions6 F9*F ' T S*T T(is dataset .ontains F9*F mem%ers .reated using o3tion 7 o5 File) $'6 F9*F mem%ers .ontain in5ormation relating re.ord data to a re.ord la4out6 T(e F9*F dataset must (a+e t(e 5ollo:ing attri%utesB T?/* /artitioned 'ataset 'SO98 /O 9*CF7 =B L9*CL 3&&

L ?OUT F9*F ' T S*T ?ou .reate F9*F mem%ers to .ommuni.ate in5ormation a%out t(e re.ord la4out dataset to File) $' in t(e 5ollo:ing situationsB 1H t(e data 5ile 4ou :ant to :or- :it( .ontains re.ords :it( di55ering 5ormats< re;uiring di55erent re.ord la4outs to de5ine t(e +arious 5ormats 2H t(e re.ord la4out t(at de5ines t(e data 5ile is (ard).oded in a 3rogram 3H t(e re.ord la4out t(at de5ines t(e data 5ile is stored in a CO/?L$B mem%er t(at .ontains multi3le re.ord la4outs 4H ea.( re.ord in t(e data 5ile re;uires t:o or more re.ord la4outs< 3resented in se;uen.e< to de5ine it For t(e 5irst situation< t(e F9*F .ontains t:o 3ie.es o5 in5ormationB 1H t(e name or t(e lengt( and starting 3osition o5 t(e 5ieldGsH :it(in ea.( data re.ord t(at File) $' s(ould use to identi54 t(e data re.ordQs t43e Gre5erred to as t(e Are.ord t43e 5ieldGsHAH 2H a list o5 all t(e 3ossi%le re.ord t43e +alues and t(e .orres3onding la4out li%rar4 mem%er :(i.( de5ines t(e data re.ords :it( t(ose +alues For t(e se.ond and t(ird situations< t(e F9*F .ontains t(e data)name t(at starts t(e data stru.ture 4ou :ant Gre5erred to as t(e Astarting data)nameAH6 File) $' reads t(e la4out 5rom t(e sour.e li%rar4 mem%er G.ontaining eit(er multi3le la4outs or a 3rogramH starting :it( t(e data)name 4ou s3e.i546 File) $' sto3s reading :(en it 5inds a ne: data stru.ture Ge;ual or lo:er le+el num%erH or :(en t(e end o5 t(e re.ord la4out< li%rar4 mem%er< or 3rogram is rea.(ed6 For t(e 5ourt( situation< t(e F9*F .ontains t(e names o5 t(e la4out li%rar4 mem%ers 5or ea.( segment o5 a data re.ord6 $t also .ontains t(e rules 5or identi54ing ea.( segment o5 t(e re.ord

176

%4 lo.ating t(e Asegment t43e 5ieldA and 5ield +alues to use 5or sele.ting a segment la4out G+ia 2*FT .ommand o5 Formatted Bro:se0*ditH6 $n an4 o5 t(e File) $' 3rimar4 o3tions :(i.( use la4outs to de5ine t(e data< t(e re.ord la4out dataset and F9*F dataset in5ormation are s3e.i5ied as s(o:n in t(e eCam3le %elo:6 S3e.i54 9e.ord la4out and F9*F $n5ormationB 9e.ord la4out usage 9e.ord la4out dataset 7em%er name F9*F dataset name 7em%er name 111N 111N 111N 111N 111N F GS 1 SingleM F 1 F9*FM 2 1 2oneH Q/9O'6CO/?L$BQ GBlan- or 3attern 5or mem%er listH F S 7/6F9*F O9'9F$L* GBlan- or 3attern 5or mem%er listH

9*CO9' L ?OUT US 8* indi.ates :(et(er 4ou :ill use a single re.ord la4out Gusage ASAH< a la4out F9*F Gusage AFAH< or no sour.e la4outs Gusage A2AH to de5ine t(e 5ile6 T(e ta%le %elo: s(o:s t(e +alid dataset and mem%er entries 5or t(e re.ord la4out and la4out F9*F datasets< 5or ea.( la4out usage6 L ?OUT US 8* S F 2 9*CO9' L ?OUT ' T S*T se;uential 5ile< or mem%er o5 3artitioned0/ 20L$B 5ile se;uential 5ile< or 3artitioned0/ 20L$B 5ileM Gre;uiredH mem%er must %e %lanignored F9*F ' T S*T ignored mem%er o5 3artitioned 5ile ignored

S*L*CT$O2 C9$T*9$ ' T S*T T(is dataset .ontains eCisting Asele.tion .riteria in5ormationA .reated using o3tion 6 o5 File) $'6 ?ou .an use sa+ed sele.tion .riteria in t(e %ro:se< edit< .o34< sear.(0u3date< 3rint< and .om3are 5un.tions6 T(e sele.tion .riteria dataset must (a+e t(e 5ollo:ing attri%utesB T?/* /artitioned 'ataset 'SO98 /O 9*CF7 =< =B L9*CL 3&&

9*FO97 T '*F$2$T$O2 ' T S*T T(is dataset .ontains sa+ed 9e5ormat 'e5initions .reated using o3tion 9 o5 File) $'6 ?ou .an use a sa+ed 9e5ormat 'e5inition online or in %at.( G9*FO97 T 5un.tionH6 T(e 9e5ormat 'e5inition dataset must (a+e t(e 5ollo:ing attri%utesB

177

T?/* /artitioned 'ataset

'SO98 /O

9*CF7 =< =B

L9*CL 157&

7*7B*9 L$ST /9OC*SS$28 @(en 3artitioned datasets are s3e.i5ied on t(e dataset s3e.i5i.ation s.reens< 4ou ma4 dis3la4 a mem%er list %4B ) Lea+ing t(e mem%er name 5ield %lanFile) $' dis3la4s a list o5 t(e mem%ers in t(e 3artitioned dataset ) *ntering a 3attern as t(e mem%er name 3attern is a 3artial mem%er name .ontaining one or more o5 t(e single .(ara.ter A:ild .ardsA J Gasteris-H ] G;uestionH or c G3.tH6 $5 an4 3attern .(ara.ter is 3resent< t(e name %e.omes a mas-

mat.(ing an4 mem%er name starting :it( t(e 3attern entered Gas i5 t(e 3attern .ontained all A:ild .ardsA at t(e endH6 T(ere5ore< one trailing 3attern .(ara.ter is used onl4 i5 it is t(e onl4 A:ild .ardA in t(e mas-< ot(er:ise it is assumed6 G*C6 /9]8 is t(e same as /9]8]]]] and /9]8J6 Eo:e+er /9O and /9OJ are di55erent %e.ause /9O is a mem%er name not a 3attern li-e /9OJ is6H For eCam3le< t(e 3atternsB ]9OJ< ]9O< /J< /9]8c< /]O]8< /9O89 7J all mat.( and 3rodu.e t(e 5ollo:ing listB /9O89 71 /9O89 72 /9O89 73 Use t(e S GSele.tH line .ommand to sele.t t(e mem%er 4ou :ant6 ?ou ma4 also s.roll t(roug( t(e mem%er list using t(e U/ and 'O@2 .ommands6 $n addition< 4ou .an enter a LOC T* 3rimar4 .ommand and s.roll dire.tl4 to Gor nearH a s3e.i5ied mem%er name6 7ULT$/L* /'S ' T S*T 7*7B*9 L$ST CO2=*2T$O2SB On .ertain dataset s3e.i5i.ation s.reens< 4ou .an s3e.i54 multi3le 3artitioned datasets6 T(ere5ore< it is 3ossi%le 5or 4ou to re.ei+e multi3le mem%er list s.reens Gone 5or ea.( 3artitioned dataset s3e.i5ied :it(out a mem%er or :it( a 3atternH %e5ore 3ro.eeding to t(e neCt s.reen in t(e 5un.tion6 T(e mem%er lists are dis3la4ed in t(e se;uen.e t(at t(e datasets a33ear on t(e dataset s3e.i5i.ation s.reen6 /'S /9OC*SS$28 O/T$O2S FO9 /9OC*SS$28 / 9T$T$O2*' ' T S*TSB

17#

$5 t(e main dataset in Bro:se G1H< *dit G2H< Co34 G363H< Sear.(0U3date G366H< and /rint data G561H< is a /'S and an eC3li.it mem%er is not s3e.i5ied< File) $' 3ro+ides a /'S /ro.essing O3tions G//OH s.reen6 T(e //O s.reen lets 4ou s3e.i54 additional mem%er ;uali5i.ation 5ilters su.( asB mem%er name range< last modi5ied userid range< .reate date range< and modi5ied date range6 $5 4ou :is( to %43ass t(e //O s.reen and 3ro.ess all mem%ers< use a mem%er name o5 J on t(e main entr4 s.reen G*C6 *dit 'S217?6/'SGJH H6 2ote t(at :(en multi3le /'Ss are s3e.i5ied on t(e entr4 s.reen t(e list o5 mem%ers mat.(ing 4our //O o3tions ma4 not a33ear until FT*9 all ot(er /'S mem%er lists (a+e %een 3resented and a mem%er sele.ted6 B2O97 L T*97$2 T$O2 File) $' .an a%normall4 terminate in one o5 t:o situationsB 1H :(en File) $' dete.ts an unre.o+era%le error 2H :(en File) $' itsel5 terminates a%normall4 $n %ot( situations< File) $' inter.e3ts t(e a%end and dis3la4s an error s.reen6 $n t(e 5irst .ase< a message is dis3la4ed des.ri%ing t(e unre.o+era%le error en.ountered6 $n t(e se.ond .ase< t(e s4stem and user a%end .odes are dis3la4ed6 T(e 5irst -e4%oard intera.tion on t(e error dis3la4 s.reen .auses t(e $S/F a%normal termination s.reen to %e dis3la4ed6 File) $' attem3ts to .lose all o3en 5iles 3rior to returning .ontrol to $S/F6 ' T S*T S*CU9$T? File) $' is .om3letel4 .om3ati%le :it( an4 data se.urit4 so5t:are 4our installation ma4 (a+e G*C6 9 CF< C ) CF20TO/ Se.ret< et.H6 File) $' 3ro.essing does not .ir.um+ent 4our se.urit4 so5t:are in an4 :a46 File) $' 3ro+ides 4our installation :it( t(e .a3a%ilit4 o5 .reating its o:n se.urit4 eCit routine t(at File) $' :ill .all during its 3ro.essing6 T(is ena%les 4our installation to limit a..ess to .ertain datasets6 Follo:ing are some eCam3les o5 t(e o3tional se.urit4 eCit routine usesB ) To allo: onl4 aut(oriDed users to %ro:se and0or edit sele.ted data 5iles

$5 4ou re;uire in5ormation on 4our installationQs se.urit4 eCit routine< .onta.t t(e 3erson res3onsi%le 5or File) $' at 4our installation6 $n addition to t(e se.urit4 eCit< an audit eCit is 3ro+ided t(at .an %e .ustomiDed 5or +arious uses in.ludingB

179

) To 5or.e t(e .reation o5 an audit trail :(en o3tion 2 o5 File) $' is used to edit sele.ted data 5iles< and0or to 5or.e t(e 3rinting o5 an audit trail re3ort u3on .om3letion o5 t(e data 5ile u3dates ) To log all or sele.ted dataset u3dates to t(e S7F log6 U'$T T9 $L F* TU9* @(en 4ou use o3tion 2 o5 File) $' to edit a data 5ile< 4ou ma4 s3e.i54 t(at File) $' .a3ture all o5 4our u3date a.ti+it4 in an audit trail dataset6 *+er4 insert< re3eat< delete< .o34< t43eo+er< and CE 28* .ommand 4ou 3er5orm .auses a %e5ore and0or a5ter image o5 t(e re.ordGsH a55e.ted to %e :ritten to t(e audit trail dataset6 @(en 4ou .om3lete 4our edit session< a s.reen is dis3la4ed gi+ing 4ou t(e o3tion to 3rint< delete< or -ee3 t(e audit trail6 $5 4ou s3e.i54 t(at t(e audit trail %e 3rinted< a %at.( Vo% is su%mitted :(i.( 3rodu.es a 5ormatted audit trail re3ort6 File) $' also 3ro+ides 4our installation :it( t(e a%ilit4 to 5or.e t(e .reation o5 an audit trail during an4 userQs edit session t(roug( an audit eCit routine6 T(is is es3e.iall4 use5ul< 5or eCam3le< i5 4our installation :ants to ensure t(at an audit trail is .reated :(ene+er File) $' is used to edit .ertain sensiti+e data 5iles6 @(en t(e edit session is .om3lete< t(e audit eCit routine .an also %e used to 5or.e t(e automati. su%mittal o5 a %at.( Vo% to 3rodu.e t(e audit trail re3ort< t(ere%4 ensuring t(at a re.ord o5 t(e edit session is 3rinted6 $n addition to t(e audit trail 5a.ilit4< File) $' 3ro+ides t(e o3tion to log all dataset u3dates to t(e s4stem S7F datasets6 $5 4ou re;uire in5ormation on (o: 4our installation ma4 %e using an4 o5 t(ese audit trail 5a.ilities< .onta.t t(e 3erson res3onsi%le 5or File) $' at 4our installation6 CO7/9*SS$O20*2C9?/T$O2 *F$T File) $' 3ro+ides 4our installation :it( t(e .a3a%ilit4 o5 .reating its o:n .om3ression0en.r43tion eCit routine t(at :ill a.t as an inter5a.e %et:een File) $' and an4 .om3ression0en.r43tion so5t:are 4ou ma4 (a+e Ge6g6< SE9$2> or ' T / C>*9H6 T(is allo:s 4ou to :or- :it( data 5iles t(at are stored on dis- or ta3e in a .om3ressed or en.r43ted 5ormat in all File) $' o3tions6 File) $' in+o-es t(e .om3ression0en.r43tion eCit 5or data 5iles onl4< not 5or re.ord la4out datasets< re.ord0la4out .ross re5eren.es< or sele.tion .riteria6 $5 4ou re;uire in5ormation on 4our installationQs .om3ression0 en.r43tion eCit< .onta.t t(e 3erson res3onsi%le 5or File) $' at 4our installation6 'OUBL*)B?T* CE 9 CT*9 SU//O9T File) $' :ill automati.all4 dete.t and 3resent 'BCS data .(ara.ters i5 4our terminal t43e is set to 3277>2 or 327#>2 5rom o3tion &6&61 o5 File) $'< or o3tion &61 o5 $S/F G$S/F terminal .(ara.teristi.sH6

1#&

T(ere are t:o :a4s File) $' 3resents data6 T(e t:o :a4s are 3resented in se;uen.e< or ma4 %e sele.ted %4 num%erB 1 ) Formatted data 3resentation GFormatted and =erti.al modesH 2 ) Full)s.reen data 3resentation GC(ara.ter modeH File) $' assumes t(at all .(ara.ter 5ields .ontain a miCture o5 *BC'$C data and 'ou%le)B4te C(ara.ter Set G'BCSH data6 T(e 'BCS .(ara.ters are en.losed :it( s(i5t)out GFQ&*QH and s(i5t)in GFQ&FQH .(ara.ters6 For /$C 8GnnH 5ields in COBOL or 89 /E$CGnnH 5ields in /L0$ File) $' assumes t(at t(e 5ield .ontains onl4 'ou%le)B4te C(ara.ter Set G'BCSH data6 'BCS data does not in.lude s(i5t)out GFQ&*QH and s(i5t)in GFQ&FQH .(ara.ters and s(ould %e an e+en num%er o5 %4tes in lengt(6 2oteB FQ&*Q and FQ&FQ are 5or $B7 sites6 Ot(er 3lat5orms su.( as FS/ and Eita.(i ma4 use ot(er re3resentations 5or s(i5t)in and s(i5t)out6 FULL)SC9**2 ' T /9*S*2T T$O2 @(en data is 3resented :it(out COBOL or /L0$ re.ord la4outs Gt(ree)line (eCade.imal or .(ara.ter 5ormatH< ea.( .(ara.ter line dis3la4ed is .onsidered a .(ara.ter 5ield6 File) $' assumes t(at all .(ara.ter 5ields .ontain a miCture o5 *BC'$C data and 'ou%le)B4te C(ara.ter Set G'BCSH data6 T(e 'BCS .(ara.ters are en.losed :it( s(i5t)out GFQ&*QH and s(i5t) in GFQ&FQH .(ara.ters6 Use .aution :(en entering 'BCS .(ara.ters to ensure t(at t(e s(i5t)out and s(i5t)in .(ara.ters are a..ounted 5or and :ill not o+erla4 ot(er data +alues uneC3e.te.tl46 T(e .ommand E*F O2 is use5ul to +ie: t(e lo.ation o5 t(e s(i5t %4tes6 'ou%le)%4te .(ara.ter su33ort File) $' :ill automati.all4 dete.t and 3resent 'BCS data .(ara.ters i5 4our terminal t43e is set to 3277>2 or 327#>2 5rom o3tion &6&61 o5 File) $'< or o3tion &61 o5 $S/F G$S/F terminal .(ara.teristi.sH6 T(ere are t:o :a4s File) $' 3resents data6 T(e t:o :a4s are 3resented in se;uen.e< or ma4 %e sele.ted %4 num%erB 1 ) Formatted data 3resentation GFormatted and =erti.al modesH 2 ) Full)s.reen data 3resentation GC(ara.ter modeH

1#1

FO97 TT*' ' T /9*S*2T T$O2 File) $' assumes t(at all .(ara.ter 5ields .ontain a miCture o5 *BC'$C data and 'ou%le)B4te C(ara.ter Set G'BCSH data6 T(e 'BCS .(ara.ters are en.losed :it( s(i5t)out GFQ&*QH and s(i5t)in GFQ&FQH .(ara.ters6 For /$C 8GnnH 5ields in COBOL or 89 /E$CGnnH 5ields in /L0$ File) $' assumes t(at t(e 5ield .ontains onl4 'ou%le)B4te C(ara.ter Set G'BCSH data6 'BCS data does not in.lude s(i5t)out GFQ&*QH and s(i5t)in GFQ&FQH .(ara.ters and s(ould %e an e+en num%er o5 %4tes in lengt(6 2oteB FQ&*Q and FQ&FQ are 5or $B7 sites6 Ot(er 3lat5orms su.( as FS/ and Eita.(i ma4 use ot(er re3resentations 5or s(i5t)in and s(i5t)out6 FULL)SC9**2 ' T /9*S*2T T$O2 @(en data is 3resented :it(out COBOL or /L0$ re.ord la4outs Gt(ree)line (eCade.imal or .(ara.ter 5ormatH< ea.( .(ara.ter line dis3la4ed is .onsidered a .(ara.ter 5ield6 File) $' assumes t(at all .(ara.ter 5ields .ontain a miCture o5 *BC'$C data and 'ou%le)B4te C(ara.ter Set G'BCSH data6 T(e 'BCS .(ara.ters are en.losed :it( s(i5t)out GFQ&*QH and s(i5t)in GFQ&FQH .(ara.ters6 Use .aution :(en entering 'BCS .(ara.ters to ensure t(at t(e s(i5t)out and s(i5t)in .(ara.ters are a..ounted 5or and :ill not o+erla4 ot(er data +alues uneC3e.te.tl46 T(e .ommand E*F O2 is use5ul to +ie: t(e lo.ation o5 t(e s(i5t %4tes

6 means lengt( o5 t(e re.ord in %4tes means lengt( o5 t(e %lo.- in BL>S$I* %4tes BUFF*9S means num%er o5 %u55ers 9*CS$I* T(e re.ord (as 1&& .(ara.ters and %lo.- (as 5&& .(ara.ters< (en.e t(ere are 5 re.ords 3er %lo.-6 *n+ironment attri%ute des.ri%es t(e 3(4si.al 3ro3erties o5 a data set6 .onse.uti+e means t(at re.ords are stored se;uentiall46

LOC#TE mode $n t(is mode t(e logi.al re.ords are dire.tl4 3ro.essed in %u55er6 (ere a %ased +aria%le or a 3ointer +aria%le is needed Ga stru.ture :it( t(e lengt( o5 a logi.al re.ordH is li-e a mas- :(i.( is laid o+er t(e %u55er6 record in5ut in locate mode 4- Files to %e 3ro.essed using lo.ate mode must< li-e ot(er 5iles %e

1#2

de.lared and o3ened6 t(e 5irst 3(4si.al re.ord (as alread4 %een read into t(e %u55er and o3ened6 using 4- read 5ileG5ilenameH setG3ointerHM T(e address o5 t(e 5irst re.ord logi.al 3ointer is 3ut in t(e +aria%le 3ointer6 POINTER aria1le 3ointer +aria%le is a +aria%le G5ull :ord< 4 %4tesH :(i.( .ontains a storage address6 t(is address .an %e assigned to 3ointer +aria%le in +arious :a4s6

e6g6 B) d.l C4D 3ointerM read 5ileGin3utH setGC4DHM 3ointer is used to 3oint to t(e 3osition o5 t(e neCt re.ord in a %u55er or to anot(er +aria%le6

-#SE! aria1le $n t(e e6g6 gi+en %elo:< read 3la.es t(e address o5 neCt logi.al re.ord in t(e 3ointer 3tr6 e6g6 B) d.l 1 e5ile %asedG3trH< 2 name .(arG3&H< 2 5irst[name .(arG2&H< 2 3ersno 5iCed de.G5HM 9ead 5ileG3ersH setG3trHM T(e %ased +aria%le e5ile is o+erlaid on t(e logi.al re.ord< as it (as t(e attri%ute %ased and .ontains address as t(e 3ointer6 EFam5le o2 Record read in locate mode F d.l one 5ile in3ut se;uential %u55ered en+G5% re.siDeG2&&H %l-siDeG1&&&H %u55ersG1HHM d.l ; 3ointerM d.l re.ord[a .(arG2&&H %asedG;HM 66666 read 5ileGoneH setG;HM On 6t( read< t(e 2nd 3(4si.al re.ord is retrie+ed 5rom t(e data set and 3ut in %u55er6 4ou re.ogniDe 7O=* mode %4 t(e o3tion F9O7 and LOC T* mode %4 t(e o3tion S*T6

Record Out5ut in Locate mode Records read in are written out

1#3

2orm 4- LOC T* %ased[+aria%le F$L*G5ilenameHM e6g6 B) d.l in 5ile re.ord %u55ered in3ut en+G5% re.siDeG1&&H %l-siDeG1&&&H %u55ersG2HHM d.l out 5ile re.ord %u55ered out3ut en+G5% re.siDeG1&&H %l-siDeG1&&&H %u55ersG2HHM d.l inre. .(arG1&&H %asedG;HM d.l outre. .(arG1&&H %asedG3HM loo3 B read 5ileGinH setG;HM lo.ate outre. 5ileGoutHM outre. 1 inre.M goto loo3M

Rewriting o2 a 2ile in MO E and LOC#TE mode @it( 9*@9$T* statement< re.ords read in .an %e .(anged and :ritten %a.- to t(e same 3la.e t(e4 .ame 5rom in t(e data set6

e6g6 B) d.l 3ersonnel 5ile se;uential %u55ered u3dateM d.l re.ord .(arG5&&H %asedG3HM d.l 3 3ointerM read 5ileG3ersonnelH setG3HM 6666666 .(ange re.ord read in 66666 6666666 re:rite 5ileG3ersonnelHM aria1le length record $5 ;uantit4 o5 data 3er logi.al re.ord +aries a great deal Gas 5or e6g6 :it( addressesH it is a good idea to store t(e data in +aria%le lengt( re.ord6 note B) T(ere is 4 %4te re.ord lengt( 5ield G9LH%e5ore e+er4 +aria%le re.ord6 T(ere is a 4 %4te %lo.- lengt( 5ield %e5ore e+er4 %lo.-6 e6g6 B) su33ose t(e %iggest logi.al re.ord .an %e 1&&& %4tes long and t(at t(e re.ords are to %e %lo.-ed in su.( a :a4 t(at a %lo.- is li-e:ise to (a+e t(e maCimum lengt( o5 1&&& %4tes< t(en en+ironment attri%ute o5 5ile de.laration :ould loo- li-e en+G+% re.siDeG1&&4H %l-siDeG1&&#HHM SiHe statements are calculated as 4-

1#4

re.siDe 1 1&&& %4tes K 4 %4tes re.ord lengt( %l-siDe 1 re.siDe K 4 %4tes %lo.- lengt( $n 5iCed 5ormat< t(e re.ord lengt( and t(e %lo.- lengt( are 5iCed %ut in +aria%le 5ormat< t(e re.ord lengt( and t(e %lo.- lengt( +ar4 %lo.- lengt( is siDe o5 t(e 3(4si.al re.ord re.ord lengt( is siDe o5 t(e logi.al re.ord $5 data lengt( o5 t(e re.ord is 75&< t(e re.ord siDe :ill %e 754 and t(e %lo.- siDe :ill %e 75#6 SC#L#R #R'IN, o5tion $5 4ou are using re.ord i0o :it( +aria%le lengt( strings and lo.ate mode< t(en s.alar +ar4ing o3tion must %e stated in en+ attri%ute 5or i0o< so t(at t(e 2 %4te lengt( area :(i.( goes %e5ore ea.( +aria%le lengt( string are ta-en into .onsideration6

e6g6 B) d.l 3ers)5ile 5ile re.ord out3ut %u55ered en+G+% re.siDeG1&6H %l-siDeG11&H s.alar+ar4ing %u55ersG1HHM d.l outre. .(arG1&&H +ar4ingM

'#nd$in" VSAM .i$es S#M data sets 3 T43es o5 =S 7 data sets are t(ere B) 16 >e4 Se;uen.ed 'ata Set G>S'SH 26 *ntr4 Se;uen.ed 'ata Set G*S'SH 36 9elati+e 9e.ord 'ata Set G99'SH Note 4- Se;uential is t(e de5ault 5ile organiDation< (en.e +sam s(ould %e s3e.i5ied in t(e *2= o3tion6 =sam 5iles are al:a4s re.ord 5iles6 9e.ords on a +sam 5ile are not (eld in %lo.-s< (en.e t(e %l-siDe o3tion e+en i5 s3e.i5ied is ignored6 re.siDe o3tion :ill %e .(e.-ed against t(e details stored :it( t(e 5ile6 T(e utilit4 $'C 7S Ga..ess met(od ser+i.esH is used to set u3 a +sam 5ile initiall46

arious !CL 2or S#M datasets e6g6 B) d.l +5ile re.ord dire.t -e4ed in3ut en+G+samHM

1#5

=sam 5iles are all dire.t a..ess 5iles6 asso.iated :it( e+er4 re.ord is a -e4< :(i.( (el3s in a..essing t(e re.ord in an4 order6 e6g6 B) d.l +5ile 5ile re.ord se;uential in3ut en+G+samHM $5 4ou :ant to start at t(e %eginning and 3ro.ess e+er4 re.ord< Vust as :it( a .onse.uti+e 5ile< s3e.i54 t(e 5ile as se;uential6 e6g6 B) d.l +5ile 5ile re.ord se;uential -e4ed in3ut en+G+samHM T(e 5irst read o5 t(e 3rogram s3e.i5ies t(e -e4 o5 t(e re.ord 4ou :ant to start at su%se;uent se;uential read statements are issued :it(out a -e46 e6g6 B) d.l in5ile 5ile re.ord dire.t -e4ed in3ut en+G+samHM to read a +sam 5ile dire.tl46 e6g6 B) d.l in5ile 5ile re.ord dire.t u3date en+G+sam 3ass:ordGQmasterQHHM @(en a 5ile is originall4 set< it .an %e gi+en one or more 3ass:ords6 i5 attri%ute re.ord is gi+en< it means t(at it must %e a 5ile< (en.e t(e attri%ute 5ile is im3lied and t(ere5ore o3tional6

(e+ Se?uenced !ata Set :(S!S; >S'S is used to (old master 5ile data6 identi5i.ation is %4 means o5 -e4 so t(e attri%ute '$9*CT im3lies >*?*'6 e6g6B) d.l amast 5ile re.ord dire.t in3ut en+G+samHM Se;uential a..ess is 3ossi%le :it( -sds6 -sds (as a -e4 :(i.( is 3art o5 a data re.ord< t(is is -no:n as an em%edded -e46 >e4s are also stored in anot(er 3art o5 data set .alled as 3rime indeC6 T(e -e4s are uni;ue sin.e du3li.ation is not allo:ed6 (S!S Features Reading a 3sds directl+ 4- 9e.ords are a..essed %4 s3e.i54ing a +alue using t(e -e4 o3tion6

e6g6B) d.l almost 5ile re.ord dire.t in3ut en+G+samHM d.l 1 area< 2 -s-e4 .(arG5H< 2 -sname .(arG15HM read 5ileGamastH intoGareaH -e4GQ&&&1&QHM

&5dating a 3sds directl+ 4- T(e 5ile s(ould %e o3ened as u3date6 4ou .annot amend t(e -e46 e6g6B d.l -mast 5ile re.ord dire.t u3date en+G+samHM d.l 1 area<

1#6

2 -s-e4 .(arG5H initGQ&&&#1QH< 2 -sname .(arG15HM read 5ileG-mastH intoGareaH -e4G-s-e4HM 0J amend J0 re:rite 5ileG-mastH 5romGareaH -e4G-s-e4HM !elete a record in 3sds 4- 4- 4- Use delete statement6 e6g6 B) -s-e4 1 Q&&&56QM delete 5ileG-sdsH -e4G-s-e4HM #dd a record in 3sds 4- 4- 4- Use :rite statement6 e6g6 B) -s-e4 1 Q&&&24QM -sname 1 Q 33letsQM :rite 5ileG-sdsH 5romGareaH -e45romG-s-e4HM First direct access M then se?uential access 4e6g6B d.l ram3 5ile re.ord se;uential -e4ed en+G+samHM read 5ileGram3H intoGareaH -e4GQ12309990%QHM read 5ileGram3H intoGareaHM 0EN1E4 op ion e6g6 B) d.l +sam 5ile re.ord se;uential -e4ed en+G+sam gen-e4HM read 5ileG+mastH intoGareaH -e4GQ123QHM read 5ileG+mastH intoGareaHM ssume t(at t(e -e4 is de5ined as nine .(ars long6 $5 gen-e4 o3tion is not s3e.i5ied in t(e en+ironment statement< +sam sear.(es 5or a re.ord :it( a -e4 o5 \123\6 $5 gen-e4 o3tion is s3e.i5ied t(e 5irst read reads t(e 5irst re.ord o5 data set %eginning :it( 1236 Se.ond read .ontinues :it( t(e re.ord immediatel4 5ollo:ing it6

ENTR4 Se6uen%ed D# # Se (ESDS) $t is t(e most li-el4 .onse.uti+e non)+sam 5ile6 i6e6 data is not in a 3arti.ular order< (en.e t(e 5ile is se;uential6 n esds 5ile :(i.( alread4 (as data on it< ma4 onl4 %e o3ened :it( eit(er in3ut or u3date attri%utes6 e6g6 B) d.l esds 5ile re.ord se;uential u3date en+G+samHM &5dating an esds 2ile 4-

1#7

$t is 3ossi%le to .(ange re.ords on.e t(e4 (a+e %een :ritten to esds 5ile6

e6g6 B) read 5ileGesdsH intoGareaHM 666666 re:rite 5ileGesdsH 5romGareaHM

@rite .an also %e used and t(e ne: re.ords added are al:a4s added at t(e end6 'elete is not allo:ed6

1eyed #%%ess o #n ESDS (i$e n esds is a se;uential 5ile and (as no de5ined -e46 T(e in5ormation t(at .an %e used 5or -e4ed a..ess is .alled relati+e %4te address Gr%aH6

re.ord)1 B re.ord)2 B re.ord)3 B re.ord)4 B B B 5& %4tes B 4& %4tes B 6& %4tes B 3& %4tes B B B r%a1& r%a15& r%a19& r%a115& ?ou (a+e to get (old o5 r%a %4 using >*?TO o3tion on read and :rite6

e6g6 B) d.l esds 5ile re.ord se;uential -e4ed u3date en+G+samHM d.l r%a .(arG4HM 666666 :rite 5ileGesdsH 5romGareaH -e4toGr%aHM 9%a must %e a 4 %4te .(ara.ter string6 t(is :ill add a ne: re.ord to t(e end o5 t(e 5ile and 3la.e t(e relati+e %4te address o5 t(e re.ord in t(e 5ield r%a6 t(is is t(en used as a -e4 on a read or re:rite6 5ile s(ould %e de.lared as -e4ed6

e6g6 B) read 5ileGesdsH intoGareaH -e4Gr%aHM e6g6 B) 0J eCam3le o5 esds read and re:rite J0 d.l esds 5ile re.ord se;uential -e4ed u3date en+G+samHM d.l r%a .(arG4HM read 5ileGesdsH intoGareaH -e4toGr%aHM 666666

1##

re:rite 5ileGesdsH 5romGareaH -e4Gr%aHM RE+ATIVE Re%ord D# # Se (RRDS) 9e.ords are read and .an %e a..essed se;uentiall4 or dire.tl4 :it( or :it(out -e4s6 T(e data set ma4 %e t(oug(t o5 as a set o5 num%ered slots ea.( o5 :(i.( ma4 (old re.ord6 t(e num%ering starts at 1 and goes to t(e maCimum s3e.i5ied6 9e.ord num%er is t(e relati+e re.ord num%er6 t(is is t(e -e4 to t(e 5ile6 T(e -e4 must %e de.lared as a .(ara.ter string o5 lengt( #6

e6g6 B) d.l relre.no .(arG#H initGQ&&&&&145QHM e6g6 B) d.l relre.no .(arG#H initGQ 145QHM

(e+ed access to an RR!S File ma4 %e de.lared as se;uential or dire.t6 $5 t(e 5ile is de.lared as -e4ed se;uential all -e4 o3tions .an %e used6 i5 4ou lea+e -e4 re5eren.e< 3ro.essing :ould %e Vust 5or a se;uential 5ile6 e6gB) d.l rrds 5ile re.ord se;uential -e4ed u3date en+G+samHM d.l rr-e4 .(arG#HM rr-e4 1 GQ&&&&&&25QHM read 5ileGrrdsH intoGareaH -e4Grr-e4HM 0J read rel6re.6no 25 J0 666666 re:rite 5ileGrrdsH 5romGareaHM 0J re.6no 25 is re:ritten J0 666666 read 5ileGrrdsH intoGareaH -e4toGrr-e4HM 0J re;uests a J0 0J re.ord num%er6 J0 0J t(e neCt re.ord :ill J0 0J %e 3resented and t(e J0 0J -e4 +alue :ill %e J0 0J 3la.ed in rr-e4 J0 *RITE in an RR!S e6g6 B) 0J assume re.ord 5 eCists on 5ile rrds6 J0 d.l rrds 5ile re.ord se;uential -e4ed u3date en+G+samHM d.l relre.no .(arG#HM d.l 1 area< 2 666666 M relre.no 1 Q&&&&&&&5QM

1#9

read 5ileGrrdsH intoGareaH -e4Grelre.noHM 666666 delete 5ileGrrdsH -e4Grelre.noHM 666666 :rite 5ileGrrdsH 5romGareaH -e45romGrelre.noHM !ro%essin" o( S rin" D# # S&-STR :-uilt-in Function; Su%str is used to a..ess a 3art o5 a string6 2orm 4- Gstring)+ar6< start)3os6< lengt()o5)eCtra.tH

e6g6 B) d.l data .(arG5&HM d.l 5ield .(arG1&HM 666666 data1Q$2T*92 T$O2 L BUS$2*SS 7 CE$2*SQM 5ield1su%strGdata<6<#HM Field :ill %e Q2 T$O2 LQ $n SUBST9 3arameter 2 and 3 .an %e eC3ression< resulting to %e an integer6 note 4- i5 t(e 3arameters re3resent a +alue :(i.( lies outside t(e string t(e result is un3redi.ta%le6

IN!E" :-uilt-in Function; $ndeC 5un.tion is used to loo- 5or a .ertain .(ara.ter or a string o5 .(ars in a gi+en string6 2orm 4- 3os6 1 indeCGstring< sear.( stringHM $ndeC 5un.tion returns a %inar4 num%er G15<&H6 $5 string to %e loo-ed 5or is not 5ound< t(e return +alue is Dero6 onl4 5irst o..uren.e is s(o:n6

e6g6 B) d.l to:n[.ountr4 .(arG25HM 666666 to:n[.ountr4 1 Q@*?B9$'8*<SU9=*?QM i.omma1indeCGto:n[.ountr4<Q<QHM i.omma :ill %e 1&6 e6g6 B) d.l Gstring<3art1H .(arG3&HM 666666 i3os 1 indeCGstring<Q0QHM 3art1 1 su%strGstring<1<i3os)1HM

19&

ERIF' :-uilt-in Function; ERIF' 2unction 4- =eri54 :ill see t(at a string :ill (a+e onl4 .ertain .(ara.ters 3resent6 2orm 4- +eri54GC< 4HM QFQ is t(e string o5 .(ars to %e .(e.-ed in ?6 Q?Q is t(e string .ontaining t(e list o5 .(ara.ters :(i.( are to %e loo-ed 5or6 # 1inar+ 2iFed 5oint num1er is returned 4) Dero< i5 all .(ara.ters in QFQ a33ear also in Q?Q6 ) +alue< :(i.( gi+es t(e 3osition o5 t(e 5irst .(ara.ter in QFQ :(i.( does not a33ear in Q?Q6 e6g6 B) d.l test .(arG3HM test1QB$TQM $F1+eri54Gtest<Q BC'*'F8E$QHM 3 :ould %e returned< %e.ause t(e t(ird .(ara.ter is not in t(e se.ond 3arameter o5 +eri546

TR#NSL#TE :-uilt-in Function; 2orm 4- translateGC< 4< DH QFQ 1 .(ara.ter string to %e .(e.-ed Q?Q 1 string o5 re3la.ement .(ara.ter QIQ 1 .(ars in QFQ :(i.( are to %e re3la.ed i5 5ound result is modi5ied .(ara.ter string QFQ6 e6g6 B) d.l Gold< ne:H .(arG1&HM d.l i.(ara.ter .(arG1&H initGQF$9TUFQHM d.l t.(ara.ter .(arG1&H initGQ 2U$!TQHM 666666 old 1 QF$FTU9*SQM ne: 1 translateGold<t.(ara.ter<i.(ara.terHM ne: 1 translateGQF$FTU9*SQ<Q 2U$!TQ<QF$9TUFQHM 1 2T$!U*S LEN,T) :-uilt-in Function; T(is determines t(e lengt( o5 t(e string6 +alue returned is %inar4 5iCed 3oint num%er G15<&H6 2orm 4- lengt(GCHM

e6g6 B) d.l 5ield .(arG9&H +ar4ingM 5ield 1 Q8OO' LUC> WQM ilengt( 1 lengt(G5ieldHM

191

ilengt( re.ei+es t(e +alue 116 !seudo&#ri#)$es $5 a 5un.tion is on t(e le5t in an assignment< 4ou (a+e a 3seudo+aria%le6 3seudo+aria%les are 5un.tions :(i.( ma4 not onl4 mani3ulate +alues< %ut ma4 also re.ei+e t(em6

e6g6 B) su%strGt5ield<2<5H 1 g5ieldM e6g6 B) d.l C .(arG1&HM C 1 Q BC'*F8E$JQM su%strGC<6<5H 1 su%strGC<1<5HM 0J soln is Q BC'* BC'*Q J0 note 4- s;rtGsumH 1 2M is not a 3seudo+aria%le6 !ro"r#m Or"#niG# ion T+5es o2 -loc3s PL$6 3nows two t+5es o2 1loc3s 416 /ro.edures 26 Begin)%lo.-s Procedures are o2 two t+5es 416 *Cternal /ro.edures 26 $nternal /ro.edures n *FT*92 L 3ro.edure is a %lo.- :(i.( is not .ontained in anot(er %lo.-6 T(e4 are .om3iled se3aratel4 %ut t(e4 .an Voined to ma-e one 3rogram %4 lin-age editor< so t(at 2 3rogrammers .an :or- on it simultaneousl46 O3tion main identi5ies t(e main 3ro.edure6 i6e6< la%elB3ro. o3tionsGmainHM n $2T*92 L 3ro.edure is in+o-ed %4 a .all 5rom a surrounding %lo.- and .ontrol returns to statement a5ter t(e .all6 @it(in an eCternal 3ro.edure 4ou .an (a+e u3to 5& internal 3ro.edures6

e6g6 B) outerB3ro. o3tionsGmainHM statement1 .all innerM )))))))) ))))))))))N statement2 B

192

B e innerB3ro.M O))))))) B B statement3 B B statement4 = ))))))) end innerM ))))))))))N statement5 statement6 end outerM -E,IN-1loc3 4- T(e4 al:a4s lie :it(in a 3ro.edure and are eCe.uted :(ere t(e4 are6 T(e4 5inis( :it( an end statement6

2orm 4- B3ro.M 666666 %eginM 666666 666666 endM 666666 end M Sco5e o2 !eclaration aria1les which are declared ha/e two sco5e attri1utes 416 $nternal 26 *Cternal $5 a +aria%le (as an $2T*92 L s.o3e< t(en it is -no:n in t(e %lo.- in :(i.( it :as de.lared and in all t(e %lo.-s :(i.( 3(4si.all4 lie in t(at %lo.- until it is not de.lared in one o5 t(ese su%ordinate %lo.-s6

e6g6 B) outerB3ro. o3tionsGmainHM d.l rate 5iCed de.G7<3HM d.l minus .(arG5HM d.l C .(arG1&&HM 666666 innerB3ro.M d.l minus 5iCed de.G7<2HM d.l C .(arG1&&HM end innerM end outerM rate 5ield is addressed in %ot( %lo.-s6 .(ara.ter 5ield minus is not -no:n in %lo.- inner6 T(e +aria%le QFQ (as attri%ute internal and (en.e 4ou are dealing :it( 2 +aria%les t(at are -no:n

193

:it(in t(eir %lo.-s6 $5 a +aria%le is to %e same in t:o eCternal 3ro.edures< t(en it must %e de.lared :it( same attri%utes *FT*92 L6

m3roB3ro. o3tionsGmainHM d.l 1 re. eCternal< 2 a .(arG3&H< 2 % 5iCed %inG31HM

su%3roB3ro.M d.l 1 re. eCternal< 2 a .(arG3&H< 2 % 5iCed %inG31HM

Stru.ture re. :(i.( is de.lared in %ot( eCternal 3ro.edures< o..u3ies t(e same data area6

Storage Class in a aria1le Using storage .lass attri%utes< t(e 3rogrammer de5ines< :(en storage s3a.e is to %e allo.ated to a +aria%le and :(en t(is storage s3a.e is 5reed6 There are 9 di22erent storage class 416 utomati. Gde5aultH 26 Stati. 36 Based 46 Controlled #&TOM#TIC Storage Class n automati. +aria%le (as internal attri%ute6 Storage is allo.ated :(en %lo.- .ontaining storage de.laration is a.ti+ated and is 5reed again :(en t(e %lo.- is terminated6

e6g6 B) CB3ro. o3tionsGmainHM 666666 %eginM O))))))))))))))))))))))))) 666666 B d.l ta%G1&&<1&&<1&<2H .(arG25HM B a.ti+ated 666666 B endM O))))))))))))))))))))))))) 5reed 666666 end CM ST#TIC Storage Class Stati. +aria%le (as eCternal attri%ute6 Storage is allo.ated %e5ore t(e eCe.ution o5 t(e 3rogram and remains allo.ated until end o5 t(e

194

3rogram6 T(is storage .lass .annot %e in5luen.ed %4 t(e 3rogrammer during 3rogram eCe.ution6

e6g6 B) d.l ta%G1&<1&H 5iCed de.imalG7<2H stati.M d.l CG1&<1&H 5iCed de.imalG5<2H %asedG3HM d.l C .(arG12&H stati. eCternalM -#SE! Storage Class Based storage .lass is used in .onne.tion :it( re.ord i0o6 Based +aria%le s(ould al:a4s (a+e attri%ute internal6 $n lo.ate mode< it :as ne.essar4 to de.lare t(e storage .lass %ased 5or re.ord to %e read in 0 :ritten out6

e6g6 B)d.l in 5ile re.ord %u55ered in3ut en+G5% re.siDeG1&&H %l-siDeG1&&&H %u55ersG2HHM d.l out 5ile re.ord %u55ered out3ut en+G5% re.siDeG1&&H %l-siDeG1&&&H %u55ersG2HHM d.l iarea .(arG1&&H %asedG;HM d.l oarea .(arG1&&H %asedG3HM d.l G;<3H 3ointerM 666666 read 5ileGinH setG;HM 666666 lo.ate oarea 5ileGoutHM CONTROLLE! Storage Class @it( .ontrolled +aria%le t(e 3rogrammer (as .om3lete .ontrol o+er storage s3a.e6 Using LLOC T* s3a.e is assigned and :it( F9** t(e storage s3a.e is 5reed again6 t(e4 .an (a+e t(e attri%utes internal or eCternal6

e6g6 B)d.l 5ieldC .(arG12H .ontrolledM allo.ate 5ieldCM 0J storage s3a.e is assigned J0 5ieldC 1 Qall .lear ]QM 3ut 5ileG3rinterH editG5ieldCH GCG5H< HM 5ree 5ieldCM 0J storage s3a.e is 5reed J0 Su)rou ines 5 .un% ions Su)rou ines $t is al:a4s an internal or eCternal 3ro.edure6 su%routine is not re3la.ed %4 a result +alue a5ter its eCe.ution6 su%routine is al:a4s in+o-ed :it( a .all statement6 Su%routines are o5ten added as eCternal 3ro.edures6 e6g6 B) mrouB3ro. o3tionsGmainHM

195

d.l 666666M .all srou1M 666666 .all srou2M end mrouM srou1B3ro.M d.l 666666M 666` end srou1M #rguments @(en a 3ro.edure is in+o-ed using a .all< it is 3ossi%le to 3ass +aria%les :(i.( are .alled as arguments6 e6g6 B) d.l re.1 .(arG45HM d.l 1 inre.< 2 3art1 .(arG1&H< 2 amount 5iCed de.G7<2HM .all srouGre.1<inre.HM Parameters 3rogram to :(i.( arguments are 3assed :(en it is in+o-ed< are .alled as 3arameters6 e6g6B) srouB3ro.Ga<%HM d.l a .(arG1&&HM d.l 1 %< 2 %1 .(arG1&H< 2 %2 5iCed de.G7<2HM Eere a R % are t(e 3arameters :(ere a 1 re.1 and % 1 inre.6 T(e se;uen.e and t(e attri%utes o5 t(e arguments and 3arameters must %e identi.al6 names ma4 %e di55erent< %ut t(e4 use same area6 Note 4- null arguments ma4 %e indi.ated %4 t:o .ommas and unne.essar4 arguments o5 t(e end o5 t(e list ma4 %e omitted6 Multi5le Entr+ Points Su%routine ma4 (a+e se+eral entr4 3oints6 ) 3rimar4 entr4 3oints .an %e identi5ied %4 /9OC6 ) se.ondar4 entr4 3oints .an %e identi5ied %4 *2T9? statements6 *a.( entr4 3oints ma4 (a+e di55erent 3arameter list6 0J arguments J0 srou2B3ro. d.l 666666M 666666 end srou2M

196

e6g6 B) 3rog1B3ro. o3tionsGmainHM .all 3rog5Ga<%HM .all ent2Ga<%<.HM .all ent1G.HM end 3rog1M 3ro.5B3ro.GC<4HM 666666 ent1Bentr4GmHM 666666 ent2Bentr4GC<4<mHM 666666 end 3rog5M EFit 2rom Procedures 2ormal eCit 5or a 3ro.edure is *2'6 Furt(ur eCit .an %e 3ro+ided using 9*TU926 e6g6 B) srouB3ro.GC<4HM 666666 ent2Bentr4Gm<n<oHM 666666 i5 C 1 & t(en returnM 666666 end srouM Functions Fun.tions are al:a4s a 3art o5 an eC3ression6 e6g6 B) 0J %uilt)in 5un.tions J0 C 1 sumGta%3HM 0J :it( an argument J0

5un.tion is re3la.ed %4 its result a5ter eCe.ution6

adds u3 all elements o5 arra4 ta%6 + 1 dateGHM 0J :it( em3t4 arguments J0 5un.tion .all is re3la.ed %4 +alue returned6 e6g6 B) .al.B3ro.Ga<%<.HM 666666 i5 C N 4 t(en returnGCJ4HM else returnGDHM 666666 end .al.M

197

:ON-&NIT; On *2'/ 8* and on *2'F$L* are some im3ortant .onditions :(i.( .an %e 5orseen6 e6g6 B) on end3ageGs4s3rintH %eginM n 1 n K 1M 3ut editGQ3ageQ< nH G3age< CG7&H< a< 3QD9QHM 3ut s-i3G3HM endM T(is :rites t(e .urrent 3age num%er :(en t(e 3re.eding 3age is 5ull6 SI,N#L M RE ERT SI,N#L o5tion 4-@it( signal statement< a .ondition .an %e .aused arti5i.all46 T(e 3rogram .ontinues :it( t(e statement :(i.( .omes immediatel4 a5ter signal statement6 2orm 4- S$82 L .onditionM Signal is used to raise .onditions deli%eratel46 e6g6 B) on end3ageG3rint3H .all o+ersM 666666 signal end3ageG3rint3HM RE ERT o5tion 4- Can.els on)unit 5or t(e .ondition s3e.i5ied6 e6g6 B) on error .all error1M 0J error1 :ill %e .alled J0 on error .all error2M 0J error2 :ill %e .alled J0 re+ert errorM 0J .an.els error2< error1 :ill %e .alled J0

19#

You might also like