TITLE 'Driver program for CSCI 464 Assignment 3, Spring 2006' *********0*****6*******************6**********************************1 * * Driver program for CSCI 464 Assignment 3, Spring Semester 2006 * * This program reads a file of transactions on DD SYSIN and * calls the appropriate queue processing routine to handle each * transaction type. This program should be COPYed at the front * of the program providing the functions, and it will be * assembled separately. * * Logic: * [1] Perform standard initialization * [2] Read the initial transaction * [3] Do While ( Not End-of-File ) * [4] Select ( InCode ) * [5] When ( C'I' ) add an entry to the rear of the queue * [6] When ( C'D' ) remove an entry from the front of the queue * [7] When ( C'E' ) test for an empty queue * [8] When ( C'F' ) test for a full queue * [9] When ( C'1' ) extract contents of front entry, no removal * [10] Otherwise bad transaction, print error message * [11] End Select * [12] Read the next transaction * [13] End Do * [14] Return to caller * *********0*****6*******************6**********************************1 * * [1] Perform standard initialization * Print NoGen Suppress macro expansions Copy ASMMSP Get IBM structured macros XSet XSave=OFF,XReturn=OFF Turn off tracing QDriver XSave OPT=CSECT Standard entry linkage * * Set up to trap program interrupts. * PgmDump <---------- See p. 65 in course notes * * [2] Read the initial transaction * XRead Input,80 Get first transaction * * [3] Do While ( Not End-of-File ) * Do While=(E) Continue until EOF * *********0*****6*******************6**********************************1 * * [4] Select ( InCode ) * Select CLI,InCode,EQ Check transaction code * *********0*****6*******************6**********************************1 * * [5] When ( C'I' ) add an entry to the rear of the queue * When (C'I') Insert entry into queue XDecI 6,InItem Get input item ST 6,Input# Set binary value in parameter XCall QInsert,(Input#,RetValue) If (ICM,0,15,RetValue,NZ) Check return code XPrnt NoRoom,L'NoRoom Print err message if no room Else XDecO 6,InsVal Convert inserted value XPrnt InsMsg,InsMsgLN Print inserted value EndIf * *********0*****6*******************6**********************************1 * * [6] When ( C'D' ) remove an entry from the front of the queue * When (C'D') Delete entry from queue XCall QDelete,(Input#,RetValue) IF (ICM,0,15,RetValue,NZ) Check return code XPrnt NoItem,L'NoItem Print err msg if empty Else L 6,Input# Get deleted value XDecO 6,DelOut Convert deleted value XPrnt DelMsg,DelMsgLn Print deleted value EndIf * *********0*****6*******************6**********************************1 * * [7] When ( C'E' ) test for an empty queue * When (C'E') Check for queue empty XCall QEmpty,(0,RetValue) Call QEmpty routine IF (ICM,0,15,RetValue,NZ) Check return code XPrnt NotEmpty,L'NotEmpty Print 'not empty' message Else XPrnt EmptyMsg,L'EmptyMsg Print 'empty' message EndIf * *********0*****6*******************6**********************************1 * * [8] When ( C'F' ) test for a full queue * When (C'F') Check for queue full XCall QFull,(0,RetValue) Call QFull routine IF (ICM,0,15,RetValue,NZ) Check return code XPrnt NotFull,L'NotFull Print 'not full' message Else XPrnt FullMsg,L'FullMsg Print 'full' message EndIf * *********0*****6*******************6**********************************1 * * [9] When ( C'1' ) extract contents of front entry, no removal * When (C'1') Get front entry in queue XCall QFront,(Input#,RetValue) IF (ICM,0,15,RetValue,NZ) Check return code XPrnt NoItem2,L'NoItem2 Print err msg if empty Else L 6,Input# Get front value XDecO 6,FrOut Convert front value XPrnt FrMsg,FrMsgLn Print front value EndIf * *********0*****6*******************6**********************************1 * * [10] Otherwise bad transaction, print error message * OthrWise , Bad transaction code XPrnt BadTrans,L'BadTrans * * [11] End Select * EndSel * * [12] Read the next transaction * XRead Input,80 Get next transaction * * [13] End Do * EndDo * * [14] Return to caller * XReturn RC=0,SA=* * LtOrg , Accumulate literals here * *********0*****6*******************6**********************************1 * * Parameters for queue routines * Input# DC F'-1' Binary value of key to process RetValue DC F'-1' Processing return code * * Input record definition * Input DS CL80 Input buffer ORG Input InCode DS C Transaction code InItem DS CL6 Transaction value ORG , * * Informational and error messages * EmptyMsg DC C'0*** Queue Empty function returns TRUE ***' * NotEmpty DC C'0*** Queue Empty function returns FALSE ***' * FullMsg DC C'0*** Queue Full function returns TRUE ***' * NotFull DC C'0*** Queue Full function returns FALSE ***' * NoRoom DC C'0*** Queue is full - cannot INSERT ***' * InsMsg DC C'0*** INSERTed Entry ' InsVal DS CL12 InsMsgLN EQU *-InsMsg * NoItem DC C'0*** Queue is empty - cannot DELETE ***' * NoItem2 DC C'0*** Queue is empty - cannot get FRONT ***' * DelMsg DC C'0*** DELETEd Entry is ' DelOut DS CL12 DelMsgLN EQU *-DelMsg * FrMsg DC C'0*** FRONT Entry is ' FrOut DS CL12 FrMsgLN EQU *-FrMsg * BadTrans DC C'0*** Bad Transaction Code ***' * End QDriver