-- $Source: /commtar/monoBANK/CICS_INTF/io_c_2.ada,v $ -- $Revision: 1.7 $ $Date: 88/03/27 18:06:58 $ $Author: chris $ with CICS_test_reporter; use CICS_test_reporter; with CICS_exceptions; use CICS_exceptions; with Sequential_io; ---------------- procedure io_c_2 ---------------- is K : integer; Fail : Boolean := FALSE; subtype Seq_range is Integer range 1..20; package SEQ is new Sequential_io(Element_type=>integer); use SEQ; Q1, Q2 : File_type; begin Start_module("io_c_2", "Sequential_io / CICS Transient Storage Queues"); Start_test("io_c_2_a", "create transient queue"); Create(File=>Q1, Name=>"TDI1"); Pass_test; Start_test("io_c_2_b", "write to transient queue "); for i in 1..4 loop K := i*i; Write(File=>Q1, Item=>K); end loop; Pass_test; Start_test("io_c_2_d", "read sequentially from transient queue"); Reset(File=>Q1, Mode=>IN_FILE); for i in 1..4 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_2_e", "at end of file"); if not End_of_file(File=>Q1) then Fail_test; else Pass_test; end if; Start_test("io_c_2_f", "reset to beginning of file and read 1 record - will raise end_error"); Reset(File=>Q1, Mode=>IN_FILE); begin Read(File=>Q1, Item=>K); fail_test; exception when End_Error => Pass_test; end; Start_test("io_c_2_ca", "close transient queue so we can open it"); Close(File=>Q1); Pass_Test; Start_test("io_c_2_cb", "open transient queue for output"); Open(File=>Q1, Name=>"TDI1", Mode=>OUT_FILE); Pass_test; Start_test("io_c_2_g", "create another transient queue and write to it"); Create(File=>Q2, Name=>"TDI2"); for i in 1..6 loop if (i rem 2) = 0 then Write(File=>Q2, Item=>i); end if; end loop; Pass_test; Start_test("io_c_2_h", "delete both transient queues"); Delete(File=>Q2); Delete(File=>Q1); Pass_test; End_module; exception when Name_error => unexpected_exception("Name_Error"); End_Module; when Status_error => unexpected_exception("Status_error"); End_Module; when Use_Error => unexpected_exception("use_error"); End_Module; when Others => unexpected_exception("undocumented exception"); End_module; end;