-- $Source: /commtar/monoBANK/CICS_INTF/io_c_1.ada,v $ -- $Revision: 1.6 $ $Date: 88/03/29 16:22:54 $ $Author: chris $ with CICS_test_reporter; use CICS_test_reporter; with CICS_exceptions; use CICS_exceptions; with Direct_io; ---------------- procedure io_c_1 ---------------- is K : integer; Fail : Boolean := FALSE; subtype dio_index_range is Integer range 1..4; package DIO is new Direct_io(Element_type=>integer); use DIO; Q1, Q2 : File_type; begin Start_module("io_c_1", "Direct_io / CICS Temporary Storage Queues"); Start_test("io_c_1_a", "create temp queue"); Create(File=>Q1, Name=>"Q1"); Pass_test; Start_test("io_c_1_b", "write to temp queue using index"); for i in dio_index_range loop Write(File=>Q1, Item=>i, To=>Count(i)); end loop; Pass_test; Start_test("io_c_1_c", "set index and then write to temp queue " & "sequentially"); set_index(File=>Q1, To=>Count(dio_index_range'first)); for i in dio_index_range loop K := i*i; Write(File=>Q1, Item=>K); end loop; Pass_test; Start_test("io_c_1_d", "read from temp queue specifying index"); for i in dio_index_range loop Read(File=>Q1, Item=>K, From=>Count(i)); if K /= i*i then Fail_test; FAIL := TRUE; exit; end if; end loop; if not Fail then Pass_test; end if; Fail := FALSE; Start_test("io_c_1_e", "set_index and then read from temp queue " & "sequentially"); set_index(File=>Q1, To=>Count(dio_index_range'first)); for i in dio_index_range loop Read(File=>Q1, Item=>K); if K /= i*i then Fail_test; FAIL := TRUE; exit; end if; end loop; if not Fail then Pass_test; end if; Fail := FALSE; Start_test("io_c_1_f", "get the current index"); Read(File=>Q1, Item=>K, From=>Count(3)); if Index(File=>Q1) /= 4 then Write_Log("Index is: " & Integer'Image(Integer(Index(File=>Q1)))); Fail_test; else Pass_test; end if; Start_test("io_c_1_g", "at end of file"); Set_index(File=>Q1, To=>Count(Dio_index_range'last+1)); if not End_of_file(File=>Q1) then Fail_test; else Pass_test; end if; Start_test("io_c_1_h", "create another temp queue and write to it"); Create(File=>Q2, Name=>"Q2"); for i in dio_index_range loop if (i rem 2) = 0 then Write(File=>Q2, Item=>i, To=>Count(i)); end if; end loop; Pass_test; Start_test("io_c_1_i", "delete both temp queues"); Delete(File=>Q2); Delete(File=>Q1); Pass_test; End_module; exception when NAME_ERROR => unexpected_exception("Name_Error"); End_Module; when USE_ERROR => unexpected_exception("Use_Error"); End_Module; when STATUS_ERROR => unexpected_exception("Status_Error"); End_Module; when Constraint_Error => unexpected_exception("Constraint_Error"); End_Module; when Others => unexpected_exception("undocumented exception"); End_module; end;