.op .he COBOL 85 - The new standard Page #  Th Commo Busines Oriente Language COBOL wil celebrat it 30t anniversar i Apri o nex year Th ne standar fo COBO compilers hereafte calle COBO 85 wa announce i Septembe o 198 afte seve year o deliberation Thi ne versio o th world' mos popula languag present man ne improvement whic wil serv t furthe promot th efficienc o COBOL' dat processin capabilities However nothin ca b gaine withou sacrifice B improvin th programmin efficienc thi ne standar ha t giv u complet upwar compatibility I 1959 mos programmin task wer writte i machin codes Thi prove t b ver tim consumin an costly als fe peopl coul understan i enoug t b productive Whe th assembler cam out i marke th beginnin o highl productiv programming However ther stil existe anothe majo problem a assembl languag progra i machin specific Programmer ha t lear almos completel differen language t wor wit differen computers Fo thi purpose an coupl o othe reasons conferenc wa organized Th goa o thi conference hel o th campu o th Universit o Pennsylvania wa t recommen t th Departmen o Defens t hav serie o meeting t com u wit a "commo busines language. Th followin year th Conferenc o Dat System Languages CODASYL wa held Th resul wa COBO 60 th firs publishe standar o COBOL Th goa wa t creat standar fo COBO compiler tha woul satisf thre mai problems Th firs wa th proble o complicate programming COBO provide eas o programming readability an understandin t peopl i th compute fiel b usin ope ende Englis-typ statements Th secon proble wa tha o upwar compatibility I othe words th COBO languag provide fo eas modifications an program writte fo a earlie compile woul b abl t b compile o th ne compiler Th thir an fina proble t b solve wa transferability B publishin COBO standard th author wante t b abl t tak progra compile o on bran o compute an b abl t compil an execut th sam sourc cod o differen computer Thus COBO wa officiall born Th Unite State o Americ Standard Institute USASI whic becam ANSI merge wit CODASY t com u wit COBO 68 Sinc the th tw group hav publishe COBO 7 an COBO 85 Th Internationa Standard Organization ISO ha accepte AN COBO version a internationa standards Th rapi acceptanc an continue growt i th us o COBO ha its root i changin programmin environment A th tim o th introductio o COBOL CP tim wa relativel expensive mors tha programme time A resul o this programmer mad painstakin effort t mak thei program mor efficient wit littl concer fo th tim i too t accomplis th codin task Sinc tha time th role hav switched Now CP tim i considere cheap an progra efficienc ha give wa t bette documentatio an eas o modification COBO standard hav continuall adjuste t thi chang wit mor descriptiv reserve word an easie t incorporat modularity Th difference betwee COBO 8 an COBO 74 th curren accepte standard ar to broa fo complet coverage Thi ne versio bring wit i ne features change i ol features an deletio o obsolet features Th scop o thi pape cover onl th majo difference tha wil mak programmin i COBO mor efficien an productive Th topic covere b thi pape cu acros two circle o interest bette readabilit o sourc code an easie implementatio o structure logic. Simpl thing tha mak readin COBO progra littl easie mak u on advantag thi standar ha t offer Wit th fort-nin ne reserve words tw o the serv onl t improv sourc cod readability Whe programmin unde COBO 7 an describin dat item a packe decima o binary th USAG claus mus b use wit COMPUTATIONA o COMPUTATIONA-3 However wit COBO 8 ther ar bette way t sho th mor efficien us o dat item Th ne reserve word ar PACKE-DECIMA an BINARY Now dat item ca b declare a follows 0 FIELDS. 0 DISPLA-ITE PI S9(5 USAG I DISPLAY. 0 PACKE-ITE PI S9(5 USAG I PACKE-DECIMAL. 0 BINAR-ITEM PI S9(5 USAG I BINARY. However eve thoug writin ou BINAR o PACKE-DECIMA create bette readabilit fo debugging th ne compiler wil stil accep COM an COM-3 Eventuall th latte tw reserve word wil b eliminate fro th publishe COBO standard Anothe ne advantag i th numbe o level tabl ca have Pas COBO standard hav ha limi o thre level o subscripting whil COBO 8 ha th capacit fo a additiona fou levels tabl ma b describe a follows 0 NEW-TABLE-TYPE. 0 LEVEL-1 OCCUR TIMES. 0 LEVEL-2 OCCUR TIMES. 0 LEVEL-3 OCCUR TIMES. 0 LEVEL-4 OCCUR TIMES. 0 LEVEL- OCCUR TIMES. 0 LEVEL- OCCUR TIMES. 0 LEVEL- OCCUR TIMES. 0 DATA-ITE PI 9(5). Whe progra i designe t produc repor tha wil b see b uppe leve management whic ma b easil impresse b smal details littl thing suc a th dat becom important Wit COBO 7 th compile ca retur th dat, an wit som mino codin th dat ca b writte i a for managemen wil like Unde COBO 74 th dat ca b obtaine b wa o th MOV statemen an coul b printe i th for 09/15/88 I mont tabl i included th dat coul b pu i th for o Septembe 15 1988 Thi for look goo t management bu COBO 8 add ne leve t th aesthetic o th date th DA- O-WEE reserve word Whe DA-O-WEE i use wit th ACCEP statement th compile return on digi characte tha stand for Monday Tuesday Wednesday Thursday Friday Saturday Sunday Thi digi coul b use a subscrip t acces da table WORKING-STORAG SECTION. 0 DAYS-TABLE 02 DAYS-DEFINED. 03 PI X(9 VALU I "MONDA ". 03 PI X(9) VALU I "TUESDA ". 03 PI X(9) VALU I "WEDNESDAY". 03 PI X(9 VALU I "THURSDA ". 03 PI X(9 VALU I "FRIDA ". 03 PI X(9 VALU I "SATURDA ". 03 PI X(9 VALU I "SUNDA ". 0 DAY-NAM-TABLE REDEFINE DAYS-DEFINED. 0 DAY-NAM PI X(9 OCCUR TIMES. 77 DAY-CODE. . . ACCEP DAY-COD FRO DAY-OF-WEEK. DISPLA "GOO MORNING TODA I " DA-NAME(DA-CODE). A experience COBO 7 programme woul immediatel notic th absenc o th FILLE reserve word Anothe on o COBO 85' improvement ove COBO 7 i it mor versatil us o th FILLE ke word I previou version FILLE coul no b use a th grou level Als include i FILLER' ne rol i optionability FILLE i a optiona word an i i i omitte th compile assume it presence Compar th followin examples COBO 7 : COBO 8 : 0 HEADER-LINE 0 HEADER-LINE. 0 FILLE PI XXXX. 0 FILLER. 0 FILLE PI XXXX 0 PI XXXX. 0 TOTALS PI 9999. 0 PI XXXX. 0 FILLE PI XXXX 0 TOTAL PI 9999. 0 PI XXXX. Thi ne featur add bette readabilit fo th programmer, an i eliminate th nee t typ FILLE ove an ove agai fo progra wit man header an detai lines Sinc th wor FILLE wil b absen fro th fiel definitio, th referenceabl element wil b easie t recognize A ever programme knows whe dealin wit progra tha make us o table o accumulators i i necessar t us a ou-o-flo loo jus t initializ th field t zero COBO 8 ha manage t overcom thi inconvenience Wit thi ne standard th VALU claus ca b place o element unde a OCCUR clause Thi provide simpl metho t initializ tabl o value t an numbe, a show here .pa 0. 0 EMPLOYEE-WAGE-TOTALS OCCUR 10 TIMES. 0 EMPLOYEE-WAGES-TO-DATE PI S9(8)V99 VALU I 0. Th feature describe s fa hav al reside withi th circl o bette readability Thes smal change wil mak progra maintenanc a easie task an i th lon run thi wil sav valuabl programmin time Ther i stil anothe are t cover: bette implementatio o structure logic COBO 8 bring wit i tw ne powerfu feature neve befor offere b COBOL Thes feature ar neste program an instrea loops Th firs feature neste programs i ver eas t implemen an provide wonderfu wa t us differen module create b member o programmin team Th forma i conceptually an actually rathe simple Th ide o nested program i illustrate here   Mai Progra       Inne Progra           Inne Progra I                 Inne Progra I                 Inne Progra I       Thi conceptua figur ca easil b transforme int COBO skeleto a follows: IDENTIFICATIO DIVISION.  PROGRA ID MAI-PROGRAM.   .  .  .   IDENTIFICATIO DIVISION.   PROGRA ID INNE-PROGRAM-I.     .   .   .     IDENTIFICATIO DIVISION    PROGRA ID INNER-PROGRAM-IA                   EN PROGRA INNER-PROGRAM-IA        IDENTIFICATIO DIVISION    PROGRA ID INNER-PROGRAM-IB                   EN PROGRA INNER-PROGRAM-IB        EN PROGRA INNER-PROGRAM-I     IDENTIFICATIO DIVISION   PROGRA ID INNE-PROGRA-II     .   .   .     EN PROGRA INNER-PROGRAM-II.     EN PROGRA MAIN-PROGRAM.  Th nex ne featur o COBO 8 i probabl th singl greates improvemen ove th previou standards Thi additio i th ne an improve function o th PERFOR verb I pas COBO standards ther wa n wa t proces loop instream Th flo o contro ca b illustrate a follows:  Mai Segment              Nex Segment              Stmt i Loop      However wit COBO 8 th flo o contro ca be instream:  Mai Segment    Stmt. i Loop    Nex Segment  Thi differenc ca b see clearl i th illustrations Al o th detail o th ne PERFOR statemen d no nee t b discusse a thi time Th majo aspect o th ne PERFOR ver ca b see wit th followin tw examples PERFOR TIMES DISPLA ITEM(SUBSCRIPT) SUBSCRIP SUBSCRIP 1 END-PERFORM. PERFOR UNTI EO-HA-OCCURRE AD NUMBE T SUB-TOTAL REA IN-FIL A EN MOV 'Y T EOF END-PERFORM. Th las tw feature fil u th empt spac i th real o implementin structure logic Fo smal routine thi wil improv efficiency an readability an i wil confor t structure logic Branchin t anothe paragrap ca b eliminated s visuall th COBO sourc code' flo o executio wil b easie t follo, resultin i quicke progra maintenance COBO 8 bring wit i th alread mentione feature an man others bu i als ha eliminate som o th ol features Th lis o th "obsolete feature i to lon t lis i its entirety ye ther i goo exampl o th theor behin this I th IDENTIFICATIO DIVISIO ther ar man paragraph tha serv onl a documentation Th reserve words AUTHOR INSTALLATION DAT-WRITTEN DAT-COMPILED an SECURIT wil n longe b accepte b COBO compilers Th COBO 8 authors theor behin thi come fro compile tim efficiency Th compile coul sav tim b onl havin t proces th necessar paragraphs I programmer wan th previousl mentione documentatio i thei progra, the ca ad commen card Othe streamlinin o th compile ha take plac i th ne COBO standard Wit al o th ne features change i ol features an th cancelin o obsolet features convertin program writte fo COBO 7 t COBO 8 i no a eas tas, i i ca b don a all On o th forementione purpose o COBO wa upwar compatibility Thi basi fundamenta o th COBO languag ha bee pu o th roa t oblivion Th convertin o presen program t COBO 8 woul tak man expensiv programmer lon labo hours Mos firm wil no tak th tim t conver thei ol programs thu the ar face wit toug decision Th choice fo eac compan ar (1 kee programmin wit COBO 7 compile an ignor th ne standard (2 kee COBO 7 an als star ne program unde COBO 85 o (3 conver COBO 7 t COBO 8 an cod al ne program fo COBO 85 Thi decisio i on tha wil b comin u ver shortl i al COBO programmin environments Th problem o convertin sourc cod t COBO 8 fro COBO 7 appears t hav th sam difficult a convertin PL/ t an versio o COBOL Thi similarit throws ne ligh o th codin decision Firm ma wis t trea COBO 8 a completel separat languag fro COBO 7 an le eac peacefull coexis i th programmin environment A th presen time thi decisio appear t b th mos reasonabl one Unlik previou version o COBOL COBO 8 wil no b rapidl implemente int mainstrea programming I ma tak wel int th 1990' befor th upgrad i finall mad t b a efficien alternativ t programmin unde COBO 74 Th slo chang ma caus COBO t los som o it popularit t newer faster an mor powerfu languages Onl tim wil tell. Fo now programmin i COBO wil remai almos entirel unde th 197 standard Th futur hold promisin new fo COBO programmer i th wa o ne feature an improvement o ol features Th ne standar o COBO programmin exists ye i wil b som tim befor th accepte standar become COBO 85 Eve thoug COBO 8 bring wit i instrea logic bette define verbs an bette documentation COBO 7 stil stand alon a th to o th programmin hill. .pa .op .he .ul Work Consulted Brown P R an Gwilli V. User' Guid t COBO 85 Halste Press Ne York Ne York 436p 1985. Garfunkel Jerome Th COBO 8 Exampl Book Joh Wile Sons: Ne York Ne York 322p 1987. I.B.M IB V COBO fo OS/VS releas 2 Internationa Busines Machines Sa Jose California 544p 1986. Nirmal Barr K. Programmin Standard an Guidelines COBO Edition. Prentice-Hall 226p 1987.