**this program checks for room availability in hotels and search guests by their name**
IDENTIFICATION DIVISION.
PROGRAM-ID."hotel room".
AUTHOR."KUNAL"
DATE-WRITTEN."15/02/12".
DATE-COMPILED."15/02/12".
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. M8.
OBJECT-COMPUTER. M8.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT HOTEL ASSIGN TO DISK
ORGANIZATION IS SEQUENTIAL
ACCESS MODE IS SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD HOTEL
LABEL RECORDS ARE STANDARD
VALUE OF FILE-ID IS "HOTEL.DAT".
01 HOTEL-REC.
02 ENAME PIC X(20).
02 EROOM PIC 9(2).
02 EDATE PIC X(10).
WORKING-STORAGE SECTION.
77 CH1 PIC 9.
77 ROOM1 PIC 99.
77 NAME1 PIC X(20).
77 ROW1 PIC 99.
SCREEN SECTION.
01 CLEAR-SCREEN.
02 BLANK SCREEN.
PROCEDURE DIVISION.
MENU-PARA.
DISPLAY " ".
DISPLAY "PRESS..1.INSERT 2.CHECK AVAILABILITY 3.SEARCH 4.EXIT".
ACCEPT CH1.
IF CH1 = 1 GO TO INSERT-PARA ELSE
IF CH1 = 2 GO TO CHECK-PARA ELSE
IF CH1 = 3 GO TO SEARCH-PARA ELSE
IF CH1 = 4 GO TO EXIT-PARA.
END-PARA.
INSERT-PARA.
OPEN EXTEND HOTEL.
DISPLAY "Enter NAME of guest:".
ACCEPT ENAME.
DISPLAY "Enter room no :".
ACCEPT EROOM.
DISPLAY "Enter date of entry:".
ACCEPT EDATE.
WRITE HOTEL-REC.
CLOSE HOTEL.
GO TO MENU-PARA.
CHECK-PARA.
DISPLAY "Enter room no for availability".
ACCEPT ROOM1.
OPEN I-O HOTEL.
PARA-3.
READ HOTEL AT END GO TO PARA-4.
IF ROOM1 = EROOM
DISPLAY "NOT AVAILABLE"
GO TO LAST-PARA.
GO TO PARA-3.
PARA-4.
DISPLAY "ROOM AVAILABLE".
LAST-PARA.
CLOSE HOTEL.
GO TO MENU-PARA.
SEARCH-PARA.
DISPLAY CLEAR-SCREEN.
DISPLAY "ENTER GUEST NAME".
ACCEPT NAME1.
OPEN INPUT HOTEL.
DISPLAY(1,1) "---------------------------------------------------------".
DISPLAY(2,2) "NAME".
DISPLAY(2,23) "R.NO".
DISPLAY(2,28) "ENTRY DATE".
DISPLAY(3,1) "---------------------------------------------------------".
MOVE 4 TO ROW1.
READ-PARA.
READ HOTEL AT END GO TO L-PARA.
IF NAME1 = ENAME
DISPLAY(ROW1,2) ENAME
DISPLAY(ROW1,23) EROOM.
DISPLAY(ROW1,28) EDATE.
GO TO READ-PARA.
L-PARA.
CLOSE HOTEL.
GO TO MENU-PARA.
EXIT-PARA.
STOP RUN.
PROGRAM-ID."hotel room".
AUTHOR."KUNAL"
DATE-WRITTEN."15/02/12".
DATE-COMPILED."15/02/12".
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. M8.
OBJECT-COMPUTER. M8.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT HOTEL ASSIGN TO DISK
ORGANIZATION IS SEQUENTIAL
ACCESS MODE IS SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD HOTEL
LABEL RECORDS ARE STANDARD
VALUE OF FILE-ID IS "HOTEL.DAT".
01 HOTEL-REC.
02 ENAME PIC X(20).
02 EROOM PIC 9(2).
02 EDATE PIC X(10).
WORKING-STORAGE SECTION.
77 CH1 PIC 9.
77 ROOM1 PIC 99.
77 NAME1 PIC X(20).
77 ROW1 PIC 99.
SCREEN SECTION.
01 CLEAR-SCREEN.
02 BLANK SCREEN.
PROCEDURE DIVISION.
MENU-PARA.
DISPLAY " ".
DISPLAY "PRESS..1.INSERT 2.CHECK AVAILABILITY 3.SEARCH 4.EXIT".
ACCEPT CH1.
IF CH1 = 1 GO TO INSERT-PARA ELSE
IF CH1 = 2 GO TO CHECK-PARA ELSE
IF CH1 = 3 GO TO SEARCH-PARA ELSE
IF CH1 = 4 GO TO EXIT-PARA.
END-PARA.
INSERT-PARA.
OPEN EXTEND HOTEL.
DISPLAY "Enter NAME of guest:".
ACCEPT ENAME.
DISPLAY "Enter room no :".
ACCEPT EROOM.
DISPLAY "Enter date of entry:".
ACCEPT EDATE.
WRITE HOTEL-REC.
CLOSE HOTEL.
GO TO MENU-PARA.
CHECK-PARA.
DISPLAY "Enter room no for availability".
ACCEPT ROOM1.
OPEN I-O HOTEL.
PARA-3.
READ HOTEL AT END GO TO PARA-4.
IF ROOM1 = EROOM
DISPLAY "NOT AVAILABLE"
GO TO LAST-PARA.
GO TO PARA-3.
PARA-4.
DISPLAY "ROOM AVAILABLE".
LAST-PARA.
CLOSE HOTEL.
GO TO MENU-PARA.
SEARCH-PARA.
DISPLAY CLEAR-SCREEN.
DISPLAY "ENTER GUEST NAME".
ACCEPT NAME1.
OPEN INPUT HOTEL.
DISPLAY(1,1) "---------------------------------------------------------".
DISPLAY(2,2) "NAME".
DISPLAY(2,23) "R.NO".
DISPLAY(2,28) "ENTRY DATE".
DISPLAY(3,1) "---------------------------------------------------------".
MOVE 4 TO ROW1.
READ-PARA.
READ HOTEL AT END GO TO L-PARA.
IF NAME1 = ENAME
DISPLAY(ROW1,2) ENAME
DISPLAY(ROW1,23) EROOM.
DISPLAY(ROW1,28) EDATE.
GO TO READ-PARA.
L-PARA.
CLOSE HOTEL.
GO TO MENU-PARA.
EXIT-PARA.
STOP RUN.
Sign up here with your email
ConversionConversion EmoticonEmoticon