Steps associated with the logic flow for the practice program

 

These steps are associated with the logic flow for the practice problem.

  1. Retrieve the user name that is passed in as a parameter. This is used to write to the TRNP file and also used to retrieve the last transaction entered by each operator. This application assumes unique user names for operators.

  2. Prompt for the basic display using the format name PROMPT.

  3. If F3 is pressed, start an end of program function.

  4. If F4 is pressed, start a routine to access the last transaction entered by the operator.

  5. Read the item record using the field ITEM. Because the file is an update file, this request locks the record.

  6. Check for a not found condition in the file ITMP.

  7. If no ITMP record exists, set on indicator 62 to cause the error message and return to step 2.

  8. Subtract the quantity requested (QTY) from the on hand balance (ONHAND) into a work area.

  9. Check to see if sufficient quantity exists to meet the request.

  10. If insufficient quantity exists, release the lock on the record in the ITMP file. This step is needed because of insufficient quantity.

  11. Set on indicator 61 to signal an insufficient quantity display error message and return to step 2.

  12. Change the ONHAND field for the new balance and update the ITMR record.

  13. Check for special entry in the ITEM field that can be used to simulate conditions where ROLLBACK is required.

  14. Check for QTY=100. Issue a ROLLBACK operation. This simulates a condition where the program senses a need for rollback.

  15. Check for QTY=101. Cause an exception in the program that will produce an inquiry message. Use divide by zero for this function. The operator should enter C to cancel the program unless the job description INQMSGRPH option provides an automatic reply. This simulates a condition where an unexpected error has occurred and the operator cancels the program.

  16. Check for QTY=102. Issue a display with inquiry operation. This stops the program at this step and allows the use of the System Request key to get to a different job. Cancel the updating job. This simulates a condition where an abnormal job or system end has occurred in the middle of a commit boundary.

  17. Write the transaction record to TRNP.

  18. Commit the records for the transaction and return to step 2.

  19. Read the first record on the access path for file TRNL, using USER as the key. Because this file is in LIFO sequence, this will be the last transaction record entered by this user.

  20. Check for a record not found condition in the TRNL file that is caused if the file does not contain entries for this user.

  21. If there is no record for this user, set on indicator 64 to cause an error message and return to step 2.

  22. Display the last transaction entered for this user. This information can be used if the operator forgets what was previously entered or when the transaction is restarted. When the operator responds, return to step 2.

  23. Perform any of the program functions.

 

Parent topic:

Practice problem for commitment control