APPENDIX D : BANK TYPES


       D.1  EXTENDED BANK HEADER FOR BANK TYPE DESCRIPTION

            The extended Bank Header associated with  the  Bank  Type
       Descriptor has the following format:-

        Word (Integer)   Contents   Description

             IND-3         NAME     Bank Name (4 ASCII Characters)
             IND-2           NR     Bank Number
             IND-1                  Index to next bank with same name
             IND             ND     Length of Bank
             IND+1                  Bank Type 
             IND+2                  Group 1 Type (if appropriate)
             .....
             INDDAT-1               Group n Type (if appropriate)
             INDDAT                 First Data Word
             .....                  ...
             IND+ND                 Last Data Word
        
       Where:-

           (a)  IND is the Bank Index returned by the  relevant  YBOS
                subprograms (BLOCAT, MLINK and NLINK).

           (b)  INDDAT is the Bank Data Index returned,  in  addition
                to IND, by BLOCAT etc.

           (c)  The Bank Name, Number, Pointer and Length  words  are
                unchanged.

           (d)  The Bank Type word describes the internal data format
                of  the Bank, whether it contains Integer, Integer*2,
                Real*4 quantities or a mixture of them  etc.   It  is
                always  present,  and  is  described in detail in the
                next section.  Banks may be split into two categories
                -   Mono-Type   and  Mixed-Type.   A  Mono-Type  Bank
                contains data of only one datatype  (Integer,  Real*4
                etc.).   A Mixed-Type Bank contains data of differing
                datatypes.

           (e)  Bank Group Type words will only exist for  Mixed-Type
                Banks   (see  above).   They  describe  the  detailed
                sub-structure of the Group of datawords.

           (f)  Data words are  segregated  into  Groups  having  the
                identical   datatype   (Integer,   Real  etc.).   For
                Mono-Type Banks there is only one Group and the  data
                format is completely described by the Bank Type word;
                the Group Type word is  redundant  and  is  therefore
                omitted.   The  first  dataword is at Index IND+2 and
                INDDAT is set to this value.   For  Multi-Type  banks
                with mixed datatypes, the Index to the first dataword
                (INDDAT) depends on the number of  Group  Type  words
                present (i.e. the number of Group Types).




       D.2  FORMAT OF THE BANK TYPE AND GROUP TYPE WORDS

            The Bank Type Word has the following Bit assignments:-

            Bits  0-7      Bank/Group Type ID
                  8-15     All zero
                 16-31     No. of Group Type Words following

       Note that for a Mono-Type Bank (all datawords having the  same
       datatype),  no  Group  Type words are necessary since the Data
       Type word completely specifies the Bank format.

            The Group Type Word has the following Bit assignments:-

            Bits  0-7      Bank/Group Type ID
                  8-15     Zero or Groups per Entry
                 16-31     No. of Datawords (or No. of Entries)

       where the unit of a "word" is always Integer  (assumed  to  be
       Integer*4).   For  a  Group  of  10 Integer*2 items the No. of
       Datawords will be set to 5.

            The Following Bank/Group Type IDs have been defined:-

          Bank/Group Type ID       Descriptor          Description

                 0                                     Mixed Mode

                 1                 I2                  16 Bit Integer (Integer*2)
                 2                 AS                  8 Bit ASCII Characters
                 3                 I4                  32 Bit Integer (Integer)
                 4                 R4                  32 Bit VAX F Reals (Real*4)
                 5                 VD                  64 Bit VAX D Reals (Real*8)
                 6                 VG                  64 Bit VAX G Reals (Real*8)
                 7                 VH                  128 Bit VAX H Reals (Real*16)
                 8                 BY                  8 Bit Bytes
                64               Entry Count ID (Group Type only)

       These are also declared in a Parameter Definition File  to  be
       "Included"  into  each program module that needs to access the
       Bank Type information (see later section of this Appendix).

            For a Bank containing only Integer data,  the  Bank  Type
       word  is  set  to  3,  no Group Type words are present and the
       first dataword commences at Index IND+2.  Similarly, for other
       Mono-Type  Banks,  the  first  dataword  is at Index IND+2 and
       INDDAT is set to this value.

            For a Mixed-Type Bank (mixed datatypes), bits 0-15 of the
       Bank  Type  word are set to zero, while bits 16-31 specify how
       many Group Type words follow.  As many Group Types  follow  as
       are  necessary  to describe the detailed data structure of the
       Bank.

            A frequent situation is where the Bank is most  logically
       organised  as containing several different Entries, each Entry
       having both Integer and Real  datawords.   This  situation  is
       dealt  with  by  the  "Entry  Count" Group Type (Type 64).  An
       example detailing the use of this Bank Type follows.



       D.2.1  Mono-Type Bank Example

            Consider the situation of a  Bank  containing  10  Real*4
       quantities.  The Bank has the following format:-

                                Bits
               Word      16-31  8-15  0-7     Description

               IND-3                          Bank Name 
               IND-2                          Bank Number
               IND-1                          Bank Pointer
               IND                     11     Bank Length
               IND+1         0     0    4     Bank Type (R*4)
       INDDAT  IND+2                          First R*4 Dataword
               ........
               IND+11                         Last R*4 Dataword


               The STRING argument in BTYBLD for this example would be:

               R4 or 1R4  .


       D.2.2  Simple Mixed-Type Bank Example

            Consider a Bank having 20 Integer words  followed  by  15
       Real*4 words.  The Bank Format is as follows:-

                                Bits
               Word      16-31  8-15  0-7     Description

               IND-3                          Bank Name 
               IND-2                          Bank Number
               IND-1                          Bank Pointer
               IND                     38     Bank Length
               IND+1         2     0    0     Bank Type (Mixed)
               IND+2        20     0    3     Group Type (I*4)
               IND+3        15     0    4     Group Type (R*4)
       INDDAT  IND+4                          First I*4 Dataword
               .........
               IND+23                         Last I*4 Dataword
               IND+24                         First R*4 Dataword
               .........
               IND+38                         Last R*4 Dataword


               The STRING argument in BTYBLD for this example would be:

               20I4,15R4  .

       Note that there are 2 Group Type words corresponding to the  2
       datatypes,  the  first Group Type word corresponding to the 20
       Integer quantities etc.


       D.2.3  More Complex Mixed-Type Bank Example

            Consider the example of a  Bank  having  4  Entries,  the
       first 2 Entries each having 1 Integer words and 1 Real*4 words
       (in that sequence), the next 2 Entries each having  1  Integer
       word and 2 nested Entries; each of these nested Entries having
       1 Integer words and 1 Real*4 words (in  that  sequence).   The
       format of the Bank Type and Group Type words would be:-

                             Bits
               Word  16-31 8-15 0-7  Description

               IND-3                 Bank Name
               IND-2                 Bank Number
               IND-1                 Bank Pointer
               IND               23  Bank Length
               IND+1     8    0   0  Bank Type (Mixed)
               IND+2     2    2  64  Group Type (Entry Loop)
               IND+3     1    0   3  Group Type (I*4)
               IND+4     1    0   4  Group Type (R*4)
               IND+5     2    4  64  Group Type (Entry Loop)
               IND+6     1    0   3  Group Type (I*4)
               IND+7     2    2  64  Group Type (Entry Loop)
               IND+8     1    0   3  Group Type (I*4)
               IND+9     1    0   4  Group Type (R*4)
       INDDAT  IND+10                I*4 Data of 1st Entry
               IND+11                R*4 Data of 1st Entry
               IND+12                I*4 Data of 2nd Entry
               IND+13                R*4 Data of 2nd Entry
               IND+14                I*4 Data of 3rd Entry
               IND+15                I*4 Data of 3rd Entry/1st Nest
               IND+16                R*4 Data of 3rd Entry/1st Nest
               IND+17                I*4 Data of 3rd Entry/2nd Nest
               IND+18                R*4 Data of 3rd Entry/2nd Nest
               IND+19                I*4 Data of 4th Entry
               IND+20                I*4 Data of 4th Entry/1st Nest
               IND+21                R*4 Data of 4th Entry/1st Nest
               IND+22                I*4 Data of 4th Entry/2nd Nest
               IND+23                R*4 Data of 4th Entry/2nd Nest


               The STRING argument in BTYBLD for this example would be:

               2(I4,R4),2(I4,2(I4,R4))  .



       D.3  BANK TYPE PARAMETER DEFINITION FILE

            A Parameter Definition File is  available  for  the  Bank
       Type  definitions.   It  can  be  "Included" into each program
       module that requires access to the Bank Type descriptor words.
       For VAX installations this file is in

            YBOS$Library:BnkTyp.Inc

       For non-VAX installations, the location of this file should be
       determined by consulting the local YBOS expert.

            The following Parameters are defined:-

                Name  Value    Description             Data Type Descriptor

               BNKTMX   0      Mixed Bank Type           --

               BNKTI2   1      Integer*2 Bank Type       I2

               BNKTAS   2      ASCII Character Bank Type  AS

               BNKTI4   3      Integer*4 Bank Type       I4

               BNKTR4   4      Real*4 Bank Type          R4

               BNKTVD   5      VAX D Real*8 Bank Type    VD

               BNKTVG   6      VAX G Real*6 Bank Type    VG

               BNKTVH   7      VAX H Real*16 Bank Type   VH

               BNKTBY   8      Byte Bank Type            BY

               BNKTEC  64      Entry Count Bank/Group Type  --
next page