You are on page 1of 43

SECTION-I

/*EDTING CHARACTERS*/
IDENTIFICATION DIVISION. PROGRAM-ID. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 77 A PIC 99. 77 B PIC 99V99. 77 C PIC S9999. 77 D PIC XXXXX. 77 F PIC 9B9B9B. 77 G PIC ZZZ99. 77 H PIC ***99. PROCEDURE DIVISION. PARA. DISPLAY THE EXAMPLE FOR THE 99 . MOVE !9" TO A. DISPLAY A. DISPLAY THE EXAMPLE FOR THE 99V99 . MOVE !9" TO B. DISPLAY B. DISPLAY THE EXAMPLE FOR THE XXXX . MOVE !9" TO D. DISPLAY D. DISPLAY THE EXAMPLE FOR THE 9B9BB . MOVE !9" TO F. DISPLAY F. DISPLAY THE EXAMPLE FOR THE ZZZZ99 . MOVE !9" TO G.

DISPLAY G. DISPLAY THE EXAMPLE FOR THE ***99 . MOVE !9" TO H. DISPLAY H. STOP RUN.

OUTPUT#
THE EXAMPLE FOR THE 99 9" THE EXAMPLE FOR THE 99V99 9""" THE EXAMPLE FOR THE XXXX !9" THE EXAMPLE FOR THE 9B9BB !9" THE EXAMPLE FOR THE ZZZZ99 !9" THE EXAMPLE FOR THE ***99 **!9"

/*ARITHMETIC $ COMPUTE VERBS*/ /*PROGRAM FOR ALL ARIHAMATIC VERBS*/


IDENTIFICATION DIVISION. PROGRAM-ID. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 77 A PIC 99. 77 B PIC 99. 77 C PIC 99. 77 R PIC 99. PROCEDURE DIVISION. MAIN. DISPLAY ENTER A $ B . ACCEPT A. ACCEPT B. ADD A B GIVING C. DISPLAY ADDTION OF A%B # C.

SUBTRACT A FROM B GIVING C. DISPLAY SUBTRACT OF A-B# MULTIPLY A BY B GIVING C. DISPLAY MULTIPLICATION A*B # DIVIDE A BY B GIVING C. DISPLAY DIVISION A/B # C. C. C.

DIVIDE A BY B GIVING C REMAINDER R. DISPLAY REMAINDER A&B IS# STOP RUN. R.

OUTPUT#
ENTER A $ B ' ( ADDTION OF A%B # "9 SUBTRACT OF A-B# ") MULTIPLICATION A*B # *" DIVISION A/B # ") REMAINDER A&B IS# "(

/*PROGRAM CALCULATING GIVEN E+UATIONS USING COMPUTE VERB*/


// C , - ' / 9 . * F IDENTIFICATION DIVISION. PROGRAM-ID. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 77 C PIC 99. 77 F PIC 99. 77 TEMP PIC 99. PROCEDURE DIVISION. PARA. DISPLAY ENTER FOREGIN HEAT . ACCEPT F. COMPUTE F , F - /*. COMPUTE C , - ' / 9 . * F. DISPLAY CELSEOUS C , C.

OUTPUT#
ENTER FOREGIN HEAT# 9!.( CELSEOUS C# /0.'*

/* AREA OF CIRCLE*/
IDENTIFICATION DIVISION. PROGRAM-ID. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 77 A PIC 99V99. 77 R PIC 99.9. 77 PI PIC 9.99 VALUE IS /.)(. PROCEDURE DIVISION. PARA. DISPLAY ENTER RADIUS TO CLALCULATE AREA . ACCEPT R. COMPUTE A , R * PI. DISPLAY AREA A. STOP RUN.

OUTPUT#
ENTER RADIUS TO CLALCULATE AREA# ' AREA# 7!.'"

SECTION-II
/*PROGRAM TO FIND FACTORIAL */
IDENTIFICATION DIVISION. PROGRAM-ID. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 77 F PIC 999. 77 N PIC 99. 77 I PIC 99. PROCEDURE DIVISION. PARA. DISPLAY ENTER NUMBER TO FIND FACTORIAL . ACCEPT N. MOVE ) TO F. PERFORM PARA-) I VARYING FROM ) BY ) UNTIL I 1 N. DISPLAY FACTORIAL OF GIVEN NUMBER IS F. STOP RUN. PARA-). COMPUTE F , F * I.

OUTPUT#
ENTER N VALUE# ' FACTORIAL OF GIVEN NUMBER IS# )*"

/*PROGRAM TO PRINT CLOCK ON SCREEN*/


IDENTIFICATION DIVISION. PROGRAM-ID. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 77 HOW PIC 99. 77 MIN PIC 99. 77 SEC PIC 99. PROCEDURE DIVISION. PARA. DISPLAY ENTER HOURS . ACCEPT HOW. DISPLAY ENTER MINS . ACCEPT MIN. DISPLAY ENTER SEC . ACCEPT SEC. DISPLAY -*" 2 *". HOW. DISPLAY -*" 2 **. # . DISPLAY -*" 2 */. MIN. DISPLAY -*" 2 *'. # . DISPLAY -*" 2 *0. SEC.

OUTPUT#
ENTER HOURS )* ENTER MINS )* ENTER SEC )*

)*#)*#)*

SECTION-III /*MATRIX MULTIPLICATION*/


IDENTIFICATION DIVISION. PROGRAM-ID. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. ") ARRAY. "* X OCCURS ' TIMES. "/ Y OCCURS ' TIMES. "( A PIC 9-*.. "( B PIC 9-*.. "( C PIC 9-/.. 77 K PIC 9. 77 M PIC 9. 77 N PIC 9. 77 L PIC 9. 77 H PIC 9. 77 I PIC 9. 77 3 PIC 9. 77 W PIC 9. 77 E PIC 9. 77 P PIC ZZ9. PROCEDURE DIVISION. MAIN-PARA. DISPLAY ENTER ORDER OF FIRST MATRIX . ACCEPT M. ACCEPT N.

DISPLAY ENTER ORDER OF SECOND MATRIX . ACCEPT L. ACCEPT H. IF-N NOT , L. DISPLAY NOT POSSIBLE STOP RUN. DISPLAY -) 2 ). ERASE. DISPLAY ENTER FIRST MAT ELEMENTS . PERFORM RD) VARYING I FROM ) BY ) UNTIL I 1 * AFTER 3 FROM ) BY ) UNTIL 3 1 *. DISPLAY - ) 2 ). ERASE. PERFORM RD) VARYING I FROM ) BY ) UNTIL I 1 * AFTER 3 FROM ) BY ) UNTIL 3 1 * . PERFORM PARA-K VARYING K FROM ) BY ) UNTIL K 1 *. DISPLAY -) 2 ). ERASE. DISPLAY TWO MATRIX ARE . MOVE * TO LIN. MOVE " TO COL. PERFORM M) VARYING I FROM ) BY ) UNTIL I 1 * AFTER 3 FROM ) BY ) UNTIL 3 1 *. MOVE * TO LIN. MOVE )' TO COL PERFORM M* VARYING I FROM ) BY ) UNTIL I 1 * AFTER 3 FROM ) BY ) UNTIL 3 1 *. DISPLAY -)( 2 ). PRODUCT OF * MATRIX IS . MOVE )' TO LIN. MOVE " TO COL PERFORM D-PARA VARYING I FROM ) BY ) UNTIL I 1 * AFTER 3 FROM ) BY ) UNTIL 3 1*. STOP RUN. RD). ACCEPT A-I 2 3.. RD*. ACCEPT B-I 2 3.. K-PARA.

MOVE " TO C-I 2 3.. PERFORM PARA-C VARYING I FROM ) BY ) UNTIL I 1 * AFTER 3 FROM ) BY ) UNTIL 3 1 *. PARA-C. COMPUTE C-I 2 3.,C-I 2 3. % A-I 2 K. * B-K 2 3.. M). COMPUTE COL , COL % /. MOVE A-I 2 3. TO P. DISPLAY -LIN 2 COL. P. IF-3 , N. COMPUTE LIN , LIN % ) MOVE " TO COL. M*. COMPUTE COL , COL % /. MOVE B-I 2 3. TO P. DISPLAY -LIN 2 COL. P. IF-3 , H. COMPUTE LIN , LIN % ) MOVE )' TO COL. D-PARA. COMPUTE COL , COL % /. MOVE C-I 2 3. TO P. DISPLAY -LIN 2 COL. P. IF-3,H. COMPUTE LIN , LIN % ) MOVE " TO COL. STOP RUN.

OUTPUT#
ENTER ORDER )ST MATRIX * * ENTER ( ELEMENTS OF )ST MATRIX * / ( ' ENTER ORDER *ND MATRIX * * ENTER ( ELEMENTS OF *ND MATRIX ' 0 7 !

GIVEN MATRICS ARE# * ( / ' ' 7 0 !

RESULT MARTICS IS /) '' /0 0(

/*LINEAR-SEARCH*/
IDENTIFICATION DIVISION. PROGRAM-ID. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. ") TT. "* A PIC 99 OCCURS ' TIMES. 77 I PIC 99. 77 N PIC 999. PROCEDURE DIVISION. PARA. DISPLAY ENTER ELEMENTS IN TO THE ARRAY/TABLE . PERFORM PARA) VARYING I FROM ) BY ) UNTIL I 1 '. DISPLAY ENTER ELEMENT TO FIND . ACCEPT N. PERFORM PARA/ VARYING I FROM ) BY ) UNTIL I 1 '. DISPLAY ELEMENT NOT FOUND . STOP RUN. PARA). ACCEPT A-I.. PARA/. IF-A-I.,N. DISPLAY ELEMENT FOUND STOP RUN.

OUTPUT#
ENTER ELEMENTS IN TO THE ARRAY/TABLE */ )* )' )/ )! ENTER ELEMENT TO FIND )/ ELEMENT FOUND.

/*BINARY-SEARCH*/
IDENTIFICATION DIVISION. PROGRAM-ID. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. ") TT. "* A PIC 99 OCCURS ' TIMES. 77 I PIC 99. 77 M PIC 99. 77 L PIC 99 VALUE ). 77 H PIC 99 VALUE '. 77 N PIC 99. PROCEDURE DIVISION. PARA. DISPLAY ENTER ARRAY/TABLE ELEMENTS . PERFORM PARA) VARYING I FROM ) BY ) UNTIL I 1 '. DISPLAY ENTER ELEMENT TO FIND . ACCEPT N. PERFORM PARA/ VARYING I FROM ) BY ) UNTIL I 1 '. DISPLAY ELEMENT NOT FOUND . STOP RUN. PARA). ACCEPT A-I.. PARA/. COMPUTE M,-L % H. / *. IF A-M. , N DISPLAY ELEMENT FOUND STOP RUN ELSE IF A-M. 4 N

COMPUTE L , M % ). ELSE IF-A-M. 1 N. COMPUTE H , M - ).

OUTPUT#
ENTER ELEMENTS IN TO THE ARRAY/TABLE */ *' *9 /' (/ ENTER ELEMENT TO FIND /' ELEMENT FOUND.

SECTION-IV /*PROGRAM USING STRING2UNSTRIN2INSPECT*/


IDENTIFICATION DIVISION. PROGRAM-ID. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 77 ST PIC X-9". VALUE MR. KUMAR MRS.KUMARI . 77 ST) PIC X-)". VALUE ABCDBBB . 77 ST* PIC X-)". VALUE ABC BT* .

77 ST/ PIC X-)". VALUE ABCDGBBBB . 77 ST( PIC X-)". VALUE ABCDDD . 77 ST' PIC X-)". VALUE ABCDBBAAA . 77 A PIC X-)". VALUE "(/"0/*")/ . 77 F PIC X-)".. 77 B) PIC X-)".. 77 B* PIC X-)".. 77 B/ PIC X-)".. 77 B( PIC X-)".. 77 FST-NAME PIC X-0. VALUE SUSAN . 77 LST-NAME PIC X-!. VALUE SONY . 77 WNAME PIC X-)'.. PROCEDURE DIVISION. PARA. DISPLAY GIVEN VALUE A. UNSTRING A DELIMITED BY / INTO B) B* B/. DISPLAY -)' 2 *". DAY B). DISPLAY -)02*". MONTH B*. DISPLAY -)7 2 *". YEAR B/.

STRING FST-NAME DELIMITED BY LST-NAME INTO WNAME. DISPLAY BEFOR STRING# . DISPLAY FST-NAME. DISPLAY LST-NAME. DISPLAY AFTER STRING# . DISPLAY WNAME. INSPECT ST ) REPLACING FIRST B BY G. DISPLAY ST). INSPECT ST RELACING ALL MR. BY SRI . DISPLAY ST. INSPECT ST* REPLACING LEADING DISPALY ST*. INSPECT ST/ REPLACING CHARACTERS BY G AFTER D . DISPLAY ST/. INSPECT ST( REPLACING ALL B BY G 2 D BY H . DISPLAY ST(. INSPECT ST' TALLYING COUNT FOR ALL A . DISPLAY COUNT OF A IN ST' COUNT. STOP RUN. BY 567.

OUTPUT#
GIVEN VALUE# "(/"0/*")/

DAY#"( MONTH#"0 YEAR#*")/

BEFOR STRING SUSAN SONY AFTER STRING# SUSANSONY AGCDBBB SRI KUMAR MRS.KUMARI 6 ABC BT* ABCDGGGGG AGCHHH COUNT OF A IN ST'# (

/*PROGRAM FOR MR BY SRI AND MRS BY SMT*/


IDENTIFICATION DIVISION. PROGRAM-ID. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 77 ST PIC X-(".. PROCEDURE DIVISION. PARA. DISPLAY ENTER STRING THAT CONTAIN MR $ MRS . ACCEPT ST. INSPECT ST REPLACING ALL MR. BY SRI 2 M8. BY SRI . INSPECT ST REPLACING ALL MRS BY SMT 2 M89 BY SMT . DISPLAY AFTER REPLACING . DISPLAY ST.

OUTPUT#
ENTER STRING THAT CONTAIN MR $ MRS MR. KUMAR MRS KUMARI

M8. SREEDHAR M89 MOUNIKA AFTER REPLACING SRI KUMAR SMT KUMARI

SRI SREEDHAR SMT MOUNIKA

SECTION-V /*GENARATING ELECTRICAL*/


IDENTIFICATION DIVISION. PROGRAM-ID. ENVIRONMENT DIVISION. FILE-CONTROL. SELECT APSEB ASSIGN TO DISK ORGANIZATION IS SE+UENTIAL. DATA DIVISION. FILE SECTION. FD APSEB LABEL RECORDS ARE STANDARD VALUE OF FILE-ID IS CBILL.DAT . ") EBILL-REC. "* HNO PIC 9-0.. "* OP PIC X-)".. "* OW-NAME PIC X-)".. "* ZONE PIC 9-*.. "* CAT PIC 9-*.. "* PMR PIC 9-/.. "* CMR PIC 9-/.. WORKING-STORAGE SECTION. 77 UR PIC 9 VALUE '. 77 TOT PIC 9999 VALUE ". 77 CH PIC X VALUE Y . PROCEDURE DIVISION. PARA-). OPEN OUTPUT APSEB. PARA-A. DISPLAY ENTER HNO2OPNAME2OW-NAME2ZONE2CAT2PMR $ CMR .

PARA-*. ACCEPT HNO. ACCEPT OP. ACCEPT OW-NAME. ACCEPT ZONE. ACCEPT CAT. ACCEPT PMR. ACCEPT CMR. COMPUTE TOT , UR * -CMR - PMR.. WRITE EBILL-REC. DISPLAY FOR ANOTHER RECORD PRESS Y . ACCEPT CH. IF CH , Y GO TO PARA-*. CLOSE APSEB. PARA-(. DISPLAY -)2 ). ERASE. MOVE ( TO LIN.

PARA-/. DISPLAY -------------------------------------------------------------------------------------- . DISPLAY HNO OP-NAME OW-NAME ZONE CAT PMR CMR TOTAL .

DISPLAY -------------------------------------------------------------------------------------- . OPEN INPUT APSEB. PARA-R. READ APSEB AT END GO TO EXIT-PARA.

DISPLAY -LIN2 ). HNO. DISPLAY -LIN2 9. OP. DISPLAY -LIN2 *". OW-NAME.

DISPLAY -LIN2 *9. ZONE. DISPLAY -LIN2 /'. CAT. DISPLAY -LIN2 (". PMR. DISPLAY -LIN2 ('. CMR. DISPLAY -LIN2 '". TOT. COMPUTE LIN , LIN % ). GO TO PARA-R. EXIT-PARA. COMPUTE LIN , LIN % ). CLOSE APSEB. STOP RUN.

OUTPUT#
ENTER HNO2OPNAME2OW-NAME2ZONE2CAT2PMR $ CMR )*) RAMU SAI "* "/ /'' ('' FOR ANOTHER RECORD PRESS Y Y **) SITA SAI ") "* 0/' 7!' FOR ANOTHER RECORD PRESS Y N

------------------------------------------------------------------------------------------------------------------HNO OP-NAME OW-NAME ZONE CAT PMR CMR TOTAL

-------------------------------------------------------------------------------------------------------------------

121 121

RAMU SITA

SAI SAI

02 01

03 02

355 635

455 785

500 750

/*STUDENT DETAILS*/
IDENTIFICATION DIVISION. PROGRAM-ID. ENVIRONMENT DIVISION. FILE-CONTROL. SELECT STU ASSIGN TO DISK ORGANIZATION IS SE+UENTIAL. DATA DIVISION. FILE SECTION. FD STU LABEL RECORDS ARE STANDARD VALUE OF FILE-ID IS STU.DAT . ") STU-REC. "* NA PIC X-)".. "* NUM PIC 999. "* M PIC 99. "* P PIC 99. "* C PIC 99. WORKING-STORAGE SECTION. 77 TOT PIC 999 VALUE ". 77 GRA PIC X. 77 CH PIC X VALUE Y . PROCEDURE DIVISION. PARA-). OPEN OUTPUT STU. PARA-A. DISPLAY ENTER STU NAME2 NUM2 MATHS2 PHYSICS2 COMPUTER . PARA-*. ACCEPT NA. ACCEPT NUM.

ACCEPT M. ACCEPT P. ACCEPT C. COMPUTE TOT , M % P % C. IF TOT 1 *'" MOVE A TO GRA ELSE IF TOT 1 )'/ MOVE B TO GRA ELSE MOVE C TO GRA. WRITE STU-REC. DISPLAY FOR ANOTHER RECORD PRESS Y . ACCEPT CH. IF CH , Y GO TO PARA-*. CLOSE STU. PARA-(.

DISPLAY -)2 ). ERASE. MOVE ( TO LIN.

PARA-/. DISPLAY --------------------------------------------------------------------------------------------------- . DISPLAY NAME ROLLNO MATHS PHYSICS COMPUTERS TOT GRADE . DISPLAY -------------------------------------------------------------------------------------------------- . OPEN INPUT STU. PARA-R. READ STU AT END GO TO EXIT-PARA.

DISPLAY -LIN2 ). NA. DISPLAY -LIN2 9. NUM. DISPLAY -LIN2 *". M. DISPLAY -LIN2 *9. P.

DISPLAY -LIN2 /7. C. DISPLAY -LIN2 (7. TOT. DISPLAY -LIN2 '*. GRA. COMPUTE LIN , LIN % ). GO TO PARA-R. EXIT-PARA. CLOSE STU . STOP RUN.

OUTPUT#
ENTER STU NAME2 NUM2 MATHS2 PHYSICS2 COMPUTER RAVI ")" 9' 9' 9" FOR ANOTHER RECORD PRESS Y Y RAMU ""9 9" 9" 9" FOR ANOTHER RECORD PRESS Y N -------------------------------------------------------------------------------------------------------------------NAME ROLLNO MATHS PHYSICS COMPUTERS TOT GRADE

---------------------------------------------------------------------------------------------- --------------------RAVI RAMU ")" ""9 9' 9" 9' 9" 9" 9" *!" *7" A A

SECTION-VI
/*PROGRAM FOR MERGE FILES*/
IDENTIFICATION DIVISION. PROGRAM-ID MRG. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT STU) ASSIGN TO DISK ORGANIZATION IS LINE SE+UENTIAL. SELECT STU* ASSIGN TO DISK ORGANIZATION IS LINE SE+UENTIAL. SELECT MERGE-FILE ASSIGN TO DISK ORGANIZATION IS LINE SE+UENTIAL. SELECT TEMP-FILE ASSIGN TO DISK. DATA-DIVISION. FILE-SECTION. FD STU) LABEL RECORDS ARE STANDARD VALUE OF FILE-ID IS STU.DAT . ") S)-REC. "* SNO) PIC 9-'.. "* SNAME) PIC X-)".. "* SMARKS) PIC 9-/.. FD STU* LABEL RECORDS ARE STANDARD VALUE OF FILE-ID ID ST*.DAT . ") S*-REC. "* SNO* PIC 9-'.. "* SNAME* PIC X-)".. "* SMARKS* PIC 9-/.. FD MERGE-FILE LABEL RECORDS ARE STANDARD VALUE OF FILE-ID ID ST*.DAT . ") M*-REC. "* MNO PIC 9-'.. "* MNAME PIC X-)".. "* MMARKS PIC 9-/.. SD TEMP-FILE. ") TEMP-REC.

"* TNO PIC 9-'.. "* TNAME PIC X-)".. "* TMARKS PIC 9-/.. WORKING-STORAGE SECTION. ") CH PIC A VALUE IS Y . PROCEDURE DIVISION. P). OPEN OUTPUT STU). P*. DISPLAY ENTER SNO)2NAME)2MARKS) OF STUDENT) . ACCEPT SNO). ACCEPT SNAME). ACCEPT SMARKS). WRITE S)-REC. DISPLAY FOR CONTINUTION PRESS Y ACCEPT CH. IF CH, Y GO TO P*. CLOSE STU). OPEN OUTPUT STU*. P/. DISPLAY ENTER SNO*2NAME*2MARKS* OF STUDENT* . ACCEPT SNO*. ACCEPT SNAME*. ACCEPT SMARKS*. WRITE S*-REC. DISPLAY FOR CONTINUTION PRESS Y ACCEPT CH. IF CH, Y GO TO P/. CLOSE STU*.

P(. MERGE TEMP-FILE ON ASCENDING KEY TNO USING STU) STU* GIVING MERGE-FILE. STOP RUN.

OUTPUT#
ENTER SNO)2NAME)2MARKS) OF STUDENT) ")" RAMU /*" FOR CONTINUTION PRESS Y Y ""9 RAVI /7' FOR CONTINUTION PRESS Y N ENTER SNO*2NAME*2MARKS* OF STUDENT* ""! ARUN /'" FOR CONTINUTION PRESS Y N

CMD# C#:COBOL:MERGE-FILE TYPE


""! ""9 ")" ARUN RAVI RAMU /'" /7' /*'

/*PROGRAM FOR SORT VERBS*/


IDENTIFICATION DIVISION. PROGRAM-ID SORT. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT STU ASSIGN TO DISK ORGANIZATION IS LINE SE+UENTIAL. SELECT SORT-FILE ASSIGN TO DISK ORGANIZATION IS LINE SE+UENTIAL. SELECT TEMP-FILE ASSIGN TO DISK. DATA-DIVISION. FILE-SECTION. FD STU LABEL RECORDS ARE STANDARD VALUE OF FILE-ID IS ST.DAT DATA RECORDS IS STUREC. ") STU-REC. "* RNO PIC 9-'.. "* NAME PIC X-)".. "* ADDRESS PIC X-'.. "* MARKS PIC 9-/.. FD SORT-FILE LABEL RECORDS ARE STANDARD VALUE OF FILE-ID ID RECORDS IS SORT-REC. ") SORT-REC. "* SRNO PIC 9-'.. "* SNAME PIC X-)".. "* SADDRESS PIC X-'.. "* SMARKS PIC 9-/.. SD TEMP-FILE. ") TEMP-REC. "* TRNO PIC 9-'.. "* TNAME PIC X-)".. "* TADDRESS PIC X-)".. SORT.DAT DATA

"* TMARKS PIC 9-/.. WORKING-STORAGE SECTION. ") CH PIC A VALUE IS Y . PROCEDURE DIVISION. P). OPEN OUTPUT STU. P*. DISPLAY ENTER RNO2NAME2ADDRESS2MARKS OF STUDENT . ACCEPT RNO. ACCEPT NAME. ACCEPT ADDRESS. ACCEPT MARKS. WRITE STU-REC. DISPLAY FOR CONTINUTION PRESS Y ACCEPT CH. IF CH, Y GO TO P*. CLOSE STU. MAIN-PARA. SORT TEMP-FILE ON ASCENDING KEY TMARKS OF TEMP-REC USING STU GIVING SORT-FILE. DISPLAY SORTED RECORDS ARE IN SORT.DAT . DISP-PARA. OPEN INPUT SORT-FILE. READ PARA. READ SORT-FILE AT END GO TO EXIT-PARA. DISPLAY SORT-REC. GO TO READ-PARA. EXIT-PARA. CLOSE SORT-FILE. STOP-RUN.

OUTPUT#
ENTER RNO2NAME2ADDRESS2MARKS OF STUDENT ""9 SAI KAKINADA '(" FOR CONTINUTION PRESS Y Y ")" BALU HYDRABAD '/" FOR CONTINUTION PRESS Y Y ")) GANESH VI3AYAWADA '*' FOR CONTINUTION PRESS Y N

SORTED RECORDS ARE IN SORT.DAT ")) ")" ""9 GANESH BALU SAI VI3AYAWADA HYDRABAD KAKINADA '*' '/" '("

SECTION-7
/*CONVERSION OF SE+UEANTAL TO RELATIVE*/
IDENTIFICATION DIVISION. PROGRAM-ID. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT RE ASSIGN TO DISK ORGANIZATION IS RELATIVE ACCESS MODE IS SE+UENTIAL RELATIVE IS REL-POS. DATA DIVISION. FILE SECTION. FD RE LABEL RECORDS ARE STANDARD VALUE OF FILE-ID IS C.DAT . ") RE-REC. "* NOM PIC X-)".. "* NAME PIC X-)".. WORKING-STORAGE SECTION. 77 CH PIC X. 77 REL-POS PIC 99. PROCEDURE DIVISION. PARA. OPEN OUTPUT RE. RD-PARA. DISPLAY ENTER NUMBER 2 NAME . ACCEPT NOM. ACCEPT NAME. WRITE RE-REC. DISPLAY CHOICE . ACCEPT CH.

IF CH , Y GO TO RD-PARA. CLOSE RE. PA-). MOVE * TO REL-POS. OPEN INPUT RE. START RE KEY IS E+UAL TO REL-POS. WR-PARA. READ RE AT END GO TO E-PARA. DISPLAY RE-REC. GO TO WR-PARA. E-PARA. CLOSE RE. STOP RUN.

OUTPUT#
ENTER NUMBER 2 NAME ")* UDAY CHOICE Y ""/ SAI CHOICE Y NAG ")"

SAI NAG

""/ ")"

/*SUPER MARKET*/
IDENTIFICATION DIVISION. PROGRAM-ID. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT SUP ASSIGN TO DISK ORGANIZATION IS RELATIVE ACCESS MODE IS SE+UENTIAL RELATIVE IS REL-POS. DATA DIVISION. FILE SECTION. FD SUP LABEL RECORDS ARE STANDARD VALUE OF FILE-ID IS C.DAT . ") SUP-REC. "* COD PIC X-)".. "* DES PIC X-)".. "* UNI PIC X-)".. "* RPRI PIC *9-'.. "* R+TY PIC *9-/.. "* RTOT PIC *9-0.. WORKING-STORAGE SECTION. 77 CH PIC X VALUE Y . 77 GTOT PIC 9-7.. 77 REL-POS PIC 99. 77 PRI PIC 9-)".. 77 +TY PIC 999. 77 TOT PIC 9999999. PROCEDURE DIVISION. PARA. MOVE " TO GTOT. OPEN OUTPUT SUP.

RD-PARA.

DISPLAY ENTER CODE2DESCRIPTION2UNIT2PRICE2+TY . ACCEPT COD. ACCEPT DES. ACCEPT UNI. ACCEPT PRI. MOVE PRI TO RPRI. ACCEPT +TY. MOVE +TY TO R+TY. COMPUTE TOT , PRI * +TY. MOVE TOT TO RTOT. WRITE SUP-REC. DISPLAY CONTINUE . ACCEPT CH. IF CH , Y GO TO RD-PARA. COMPUTE GTOT , GTOT % TOT. CLOSE SUP.

PA-). MOVE ' TO LIN. MOVE ) TO COL. DISPLAY -)2 ). ERASE. DISPLAY -LIN 2 COL. CODE DISPLAY +TY TOTAL . DESCRIPTION UNIT PRICE .

MOVE ) TO REL-POS. OPEN INPUT SUP. START SUP KEY IS E+UAL TO REL-POS. WR-PARA.

READ SUP AT END GO TO E-PARA. COMPUTE LIN , LIN % *. DISPLAY -LIN 2 ). COD. DISPLAY -LIN 2 )". DES. DISPLAY -LIN 2 *'. UNI. DISPLAY -LIN 2 /*. RPRI. DISPLAY -LIN 2 (*. R+TY. DISPLAY -LIN 2 (9. RTOT. GO TO WR-PARA. E-PARA. CLOSE SUP. COMPUTE LIN , LIN % /. DISPLAY -LIN 2 /". GRAND TOTAL , . DISPLAY -LIN 2 (9. GTOT. STOP RUN.

OUTPUT#
ENTER CODE2DESCRIPTION2UNIT2PRICE2+TY AAA T.V ) )*'"" * CONTINUE Y ENTER CODE2DESCRIPTION2UNIT2PRICE2+TY BBB D.V.D ) *'"" / CONTINUE N

CODE AAA AAA

DESCRIPTION T.V D.V.D

UNIT ) )

PRICE )*'"" *'""

+YT * /

TOTAL *'""" 7'""

GRAND TOTAL# /*'""

SECTION-!
/*LINKAGE SECTION*/
SUBPROGRAMIDENTIFICATION DIVISION. PROGRAM-ID. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 77 TOT PIC 999 VALUE 0" . LINKAGE SECTION. 77 VAL PIC 99. PROCEDURE DIVISION USING VAL. PARA. COMPUTE TOT , TOT % VAL. DISPLAY 5TOTOL,7 TOT. EXIT PROGRM.

MAIN PROGRAMIDENTIFICATION DIVISION. PROGRAM-ID. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 77 VAL PIC 99. PROCEDURE DIVISION. PARA. MOVE )" TO VAL. CALL LINK.COB USING VAL. MOVE *" TO VAL. CALL LINK.COB USING VAL.

OUTPUT#
TOTAL# 7" TOTAL# 9"