-- $Source: /commtar/monoBANK/CICS_INTF/demo_utl.ada,v $ -- $Revision: 1.4 $ $Date: 88/04/03 18:44:40 $ $Author: chris $ with CICS_Terminal_Control; with CICS_File_Control; with CICS_Task_Control; with Host_Character_Pkg; package Demo_Utilities is package TC renames CICS_Terminal_Control; package TSK renames CICS_Task_Control; package HC renames Host_Character_Pkg; type Entry_Map_Field is (Action, Name, Msg); type Map_Field_Lens is array(Entry_Map_Field) of Integer; package Emap is new TC.Terminal_Data_Pkg(Entry_Map_Field, Map_Field_Lens, (Action=>1, Name=>15, Msg=>60)); type Data_Field is (LName, FName, Company, Street, City, State, Zip, Phone, Comments, Error); type Data_Lens is array(Data_Field) of Integer; package Dmap is new TC.Terminal_Data_Pkg(Data_Field, Data_Lens, (LName=>15, FName=>15, Company=>30, Street=>40, City=>15, State=>2, Zip=>5, Phone=>13, Comments=>65, Error=>60)); type Data_Record is record lname: HC.Host_String(1..15); fname: HC.Host_String(1..15); company : HC.Host_String(1..30); street : HC.Host_String(1..40); city : HC.Host_String(1..15); state : HC.Host_String(1..2); zip : HC.Host_String(1..5); Phone : HC.Host_String(1..13); Comments : HC.Host_String(1..65); end record; for Data_record use record lname at 0 range 0..119; -- 15 bytes fname at 15 range 0..119; company at 30 range 0..239; street at 60 range 0..319; city at 100 range 0..119; state at 115 range 0..15; zip at 117 range 0..39; phone at 122 range 0..103; comments at 135 range 0..519; end record; package DFile is new CICS_File_Control(Data_Record, HC.Host_String); type State_Enum is (Read_Choice, Add_Data, Update_Data); type Comm_Record is record state : State_Enum; Action : Character; end record; package Comm is new TSK.Communication_Area_Pkg(Comm_Record); procedure Read_Data( Data : Dmap.Terminal_Data; Output_Rec : in out Data_Record ); end Demo_Utilities; package body Demo_Utilities is procedure Read_Data( Data : Dmap.Terminal_Data; Output_Rec : in out Data_Record ) is begin for F in Data_Field loop declare Input : String(1..Dmap.Current_Length(F)); begin case F is when Lname => Output_Rec.Lname := HC.To_Padded_Host_String( Dmap.Field(Data,F), Dmap.Length(F)); when Fname => Output_Rec.Fname := HC.To_Padded_Host_String( Dmap.Field(Data,F), Dmap.Length(F)); when Company => Output_Rec.Company := HC.To_Padded_Host_String( Dmap.Field(Data,F), Dmap.Length(F)); when Street => Output_Rec.Street := HC.To_Padded_Host_String( Dmap.Field(Data,F), Dmap.Length(F)); when City => Output_Rec.City := HC.To_Padded_Host_String( Dmap.Field(Data,F), Dmap.Length(F)); when State => Output_Rec.state := HC.To_Padded_Host_String( Dmap.Field(Data,F), Dmap.Length(F)); when Zip => Output_Rec.zip := HC.To_Padded_Host_String( Dmap.Field(Data,F), Dmap.Length(F)); when Phone => Output_Rec.phone := HC.To_Padded_Host_String( Dmap.Field(Data,F), Dmap.Length(F)); when Comments => Output_Rec.Comments := HC.To_Padded_Host_String( Dmap.Field(Data,F), Dmap.Length(F)); when others=> -- don't save the message field null; end case; end; -- declare end loop; end; end Demo_Utilities; -- $Cprt start$ -- -- Copyright (C) 1988 by Intermetrics, Inc. -- -- This material may be used duplicated or disclosed by or for the -- U.S. Government pursuant to the copyright license under DAR clause -- 7-104.9(a) (May 1981). -- -- This project was spnsored by the STARS Foundation -- Naval Research Laboratory, Washington DC -- -- $Cprt end$