代写 graph Donna Graves COMP 35 In class Exercise Phase I Compute Room Cost Program Specifications

Donna Graves COMP 35 In class Exercise Phase I Compute Room Cost Program Specifications
PROGRAM: OVERVIEW: INPUT/OUTPUT:
PROCESSING:
ROOMCOST
Allows a user to enter a room number, the program then computes the room cost. COSTFILE Room Cost Master File
COSTMAP Room Cost Map
1. The program is invoked when the user enters the trans-id COST. It should respond by displaying the room cost map.
2. The user instructions should initially read, “Type a room number and number of days. Then press Enter.” When the user enters a valid room number and number of days, read the appropriate record from the COSTFILE file and display the guest’s name, daily room cost and total room cost. Compute the total room cost by multiplying the number of days by the daily room cost. Protect the user input fields, change the user instructions to “Press Enter to update the file. Or press F4 to enter corrections.” Then, if the user presses the Enter key, update the cost record by adding the number of days. Then, redisplay the room cost map for a new transaction. Inform the user that the record was updated.
3. If the data entered by the user is invalid, redisplay the map with an appropriate error message and change the user instructions to “Type corrections. Then press Enter.”
4. If the user presses F4 to make corrections, redisplay the initial screen changing the user instructions to “Type corrections. Then press Enter.”
5. If the user presses F3 or F12, the program should display the message “Have a nice day” and terminate by issuing a RETURN command without a trans-id..
Room Cost Master File Record Description:
01 ROOMCOST-MASTER-RECORD.
05 RM-ROOM-NUMBER
05 RM-GUEST-NAME
05 RM-DAILY-COST
05 RM-NUMBER-OF-DAYS
Screen Layout for the Compute Room Cost Program:
(member name: ROOMMAST) PIC X(3).
(Index field)
PIC X(20).
PIC 999V99.
PIC 99.
1 |
2|
3 |
4|
5 | Room Number . . . . XXX Guest Name . . . . . . . : XXXXXXXXXXXXXXXXXXXX 6|
COSTMAP Compute Room Cost Program XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXX
7 | 8| 9 | 10| 11|
: 23| 24|
Number of days . . . . 99
Daily Room Cost . .: $ZZ9.99
Total Room Cost . . : $ZZ,ZZ9.99
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X
35roomcostpgm COMP 35
Page 1

Partial BMS Code:
COSTMAP DFHMSD ….. COSTMAP DFHMDI…….
MSG FKEYS DUMMY
DFHMDF ……. DFHMDF
DFHMDF …….
DFHMDF …….
DFHMDF ………
DFHMDF ………. Unprotected, turquoise DFHMDF …….
DFHMDF ….. unprotected, turquoise
TRANID
INSTR
ROOMNO
NAME
NODAYS
DAYCOST DFHMDF …… TOTCOST DFHMDF ……….
1. Complete the chart below:
– –
Event
fill in each of the events that can trigger the execution of this program and its response Add the context and next context fields last
Context Response next context
Trans-id
None
Display the map
Get room data
Clear
any
Redisplay the map
Get room data
Enter
Get Room data
Receive map, edit room # and # days If valid
Read file If valid
Lock fields and display rec Else
Display err msg
Confirm data Get room data
Enter
Confirm update
Read/update file
Update fields
Rewrite file
For any errors send an error msg Else
Inform user of update
Get room data
F4
Confirm update
Redisplay the map
Reset fields and instructions
Get room data
PA key
all
ignore
unchanged
F3/F12
all
End pgm
none
Any other PFkey
all
Display an appropriate error message
unchanged
35roomcostpgm COMP 35 Page 2

2.
Add the context flag and user input to the communication area.
*
b)
Handle ENTER with context flag to call 1000-PROCESS-ROOMCOST-MAP and 2000-UPDATE_ROOM-COST paragraphs to handle when enter is pressed.
PROCEDURE DIVISION.
*
0000-COMPUTE-ROOMCOST.
*
MOVE DFHCOMMAREA TO COMMUNICATION-AREAA END-IF
*
EVALUATE TRUE
*
WHEN EIBCALEN = ZERO OR EIBAID = DFHCLEAR
SET SEND-ERASE TO TRUE
MOVE LOW-VALUE TO COSTMAPO
PERFORM 1400-SEND-ROOMCOST-MAP
*
…..
WHEN EIBAID = DFHENTER
01 COMMUNICATION-AREA.
05 CONTEXT-FLAGS 88 GET-DATA
88 CONFIRM-DATA 05 CA-ROOMNO
05 CA-NODAYS
PIC X.
VALUE ‘1’.
VALUE ‘2’.
PIC X(3).
PIC 99.
3. Add the necessary COPY library that holds values for setting field attributes.
COPY ATTR.
LINKAGE SECTION.
01 DFHCOMMAREA PIC X(_6__).(6).
4. Add a constant literal to save an ending message when PF3 or PF12 are entered.
01 END-MSG PIC(15) VALUE ‘HAVE A NICE DAY’.
5. a) Copy saved data into working storage
END-EVALUTE.
IF GET-DATA OR EVALUATE TRUE WHEN… PERFORM 1000-PROCESS-ROOMCOST-MAP
ELSE OR WHEN OTHERDON’T CODE A CONDITION PERFORM 2000-UPDATE-ROOM-COST
END-IF OR END-EVALUATE
NOTE: WE’LL HANDLE F4 NEXT WEEK
35roomcostpgm COMP 35 Page 3

6. Position the cursor at the room number field
WHEN OTHER ENDS WHEN EIBCALEN=0
MOVE LOW-VALUE TO COSTMAPO
MOVE -1 TO ROOMNOL -1-1 TO ROOMNOL
MOVE ‘Invalid key pressed.’ TO MSGO
SET SEND-DATAONLY-ALARM TO TRUE
PERFORM 1400-SEND-ROOMCOST-MAP
*
END-EVALUATE.
*
EXEC CICS
RETURN TRANSID(‘COST’)
COMMAREA(COMMUNICATION-AREA)
END-EXEC.
7. Add the code to change to the 2nd context. 1000-PROCESS-ROOMCOST-MAP. ENTER AT FIRST CONTEXT *
*

PERFORM 1100-RECEIVE-ROOMCOST-MAP. PERFORM 1200-EDIT-ROOMCOST-DATA. IF VALID-DATA
PERFORM 1300-READ-COST-RECORD
END-IF
IF VALID-DATA THEREFORE DATA INPUT IS VALID, REC FOUND
MOVE ‘Press Enter to update the file. Or press F4 ‘to enter corrections.’ TO INSTRO
MOVE SPACE TO MSGO
SET CONFIRM-UPDATE TO TRUEULTIPLY RM-DAILY-COST SET SEND-DATAONLY TO TRUE
ELSE
MOVE ‘Correct the highlighted errors. Then press Enter.’
TO INSTRO
SET SEND-DATAONLY-ALARM TO TRUE
END-IF
BY
….
8. Add the code to edit the number of days and room number (bottom up). If field is invalid, set VALID-DATA-SW, error message, position the cursor, change the colour to yellow and make the field bright.
Note: Initially reset the colour and intensity to BMS settings, clear the name and total cost and daily cost fields.
PERFORM 1400-SEND-ROOMCOST-MAP.
*
*
EDIT REGARDLESS, SO SET BACK TO BMS
35roomcostpgm
COMP 35
Page 4
1200-EDIT-ROOMCOST-DATA.
MOVE ATTR-TURQUOISE TO ROOMNOC NODAYSC MOVE ATTR-UNPROT TO ROOMNOA
MOVE ATTR-UNPROT-NUM TO NODAYSA
MOVE SPACE TO NAMEO
MOVE ZERO TO TOTCOSTO DAYCOSTO
IF NODAYSL>0 //user entered data
MOVE NODAYSI TO CA-NODAYS //COPY TO CA
END-IF  DON’T CODE ELSE
IF CA-NODAYS = SPACES OR LOW-VALUES (USE CA THE REMAINDER OF PGM)
MOVE ‘N’ TO VALID-DATA-SW
MOVE ‘WRONG #DAYS’ TO MSGO
MOVE -1 TO NODAYSL
MOVE ATTR-YELLOW TO NODAYSC
MOVE ATTR-UNPROT-NUM-BRT TO NODAYSA
END-IF

TRUE
MOVE
35roomcostpgm
COMP 35
Page 5
TO
MOVE LOW-VALUES TO COMMUNICATION-AREA DO BEFORE SET CONTEXT MOVE -1 TO ROOMNOL
MOVE ‘COST’ TO TRANIDO
MOVE ‘ENTER ROOM# & # DAYS’ TO INSTRO
SET GET-DATA TO TRUE
IF ROOMNOL>0 //user entered data
MOVE ROOMNOI TO CA-ROOMNO //COPY TO CA
END-IF  DON’T CODE ELSE
IF CA-ROOMNO=SPACES OR LOW-VALUES MOVE ‘N’ TO VALID-DATA-SW
(USE CA THE REMAINDER OF PGM)
MOVE ‘WRONG ROOM #’ TO MSGO MOVE -1 TO ROOMNOL
MOVE ATTR-YELLOW TO ROOMNOC MOVE ATTR-UNPROT-BRT TO ROOMNOA
END-IF
9. Add the missing key field. If the record is found, display the name, daily cost and compute the room cost. If record is not found, set VALID- DATA-SW, error message, position the cursor, change the colour to yellow and make the field bright.
1300-READ-COST-RECORD.
*
EXEC CICS
READ FILE(‘COSTFILE’)
INTO(ROOMCOST-MASTER-RECORD) RIDFLD(_____________) ROOMNOI (WILL CHANGE SOON)
EXT WEEK =CA-ROOM-NO
RESP(RESPONSE-CODE)
END-EXEC.
EVALUATE RESPONSE-CODE
WHEN DFHRESP(NORMAL)
MOVE RM-GUEST-NAME TO NAMEO
MOVE RM-DAILY-COST TO DAYCOSTO
MULTIPLY RM-DAILY-COST BY NODAYSI GIVING TOTCOSTO
MOVE RM-DAILY-COST TO DAYCOST0
WHEN DFHRESP(NOTFND)
MOVE ‘N’ TO VALID-DATA-SW
MOVE ‘RECORD NOT FOUND’ TO MSGO MOVE -1 TO ROOMNOL
MOVE ATTR-YELLOW TO ROOMNOC MOVE ATTR-UNPROT-BRT TO ROOMNOA
WHEN OTHER
EXEC CICS
ABEND
NODUMP
END-EXEC
END-EVALUATE.
10. When refreshing the screen, display the transid, initial instructions, function keys, position the cursor and set the first context. Ensure the cursor will be at the key field.
*
1400-SEND-ROOMCOST-MAP.
*
EVALUATE TRUE
WHEN SEND-ERASE

35roomcostpgm
COMP 35
Page 6
EXEC CICS
SEND MAP(‘COSTMAP’)
MAPSET(‘COSTMAP’)
FROM(COSTMAPO)
ERASE CURSOR ON EVERY SEND
CURSOR
END-EXEC …
To be continued next week