      subroutine LablPackage


      integer*2 NF, NI, NR, NC, NT, NdimT, NdimC
      integer*2 NdimH, IEle, L, I

      parameter ( NF=  4,NI=  1,NR=  1,NC=  4,NT= 18 )
      parameter ( NdimT=  126,NdimC=   69,NdimH=  216 )

      integer*2 Row, Col, StartField, TermKeys(30), LastKey
      integer*2 First, Last
      logical*1 Next, Previous, Exit, Refresh
      character*80 ScrHelpLine
      integer*2 FieldNumber
      logical*1 Valid

      character*   32 C1  
      character*    6 C2  
      character*    6 C3  
      character*   25 C4  

      character*1 Text(NdimT)
      character*1 Char(NdimC)
      character*1 Help(NdimH)

      character*7 Formats(NF)

      integer*2 TextTable(5,NT), FldTable(7,NF), IntArray(5,NI)
      integer*2 CharTable(2,NC), HelpTable(4,NF)
      real RealArray(5,NR) 

      data ScrHelpLine(1:40) /
     1   'Up-Previous Field    Down-Next Field    '/
      data ScrHelpLine(41:80) /
     1   'Ctrl Z-End    F1-Abort Definition       '/

 
      data (TextTable(I,  1),I=1,5) /    1,13, 1, 1,10/
      data (Text(I),I=    1,   13) /
     1   'l','q','q','q','q','q','q','q','q','q','q','q',
     1   'q' /
 
      data (TextTable(I,  2),I=1,5) /   14,13, 1,14, 2/
      data (Text(I),I=   14,   26) /
     1   ' ','L','a','b','e','l',' ','F','i','e','l','d',
     1   ' ' /
 
      data (TextTable(I,  3),I=1,5) /   27,15, 1,27,10/
      data (Text(I),I=   27,   41) /
     1   'q','q','q','q','q','q','q','q','q','q','q','q','q','q',
     1   'k' /
 
      data (TextTable(I,  4),I=1,5) /   42, 1, 2, 1,10/
      data (Text(I),I=   42,   42) /
     1   'x' /
 
      data (TextTable(I,  5),I=1,5) /   43, 5, 2, 3, 0/
      data (Text(I),I=   43,   47) /
     1   'N','a','m','e',
     1   ' ' /
 
      data (TextTable(I,  6),I=1,5) /   48, 1, 2,41,10/
      data (Text(I),I=   48,   48) /
     1   'x' /
 
      data (TextTable(I,  7),I=1,5) /   49, 1, 3, 1,10/
      data (Text(I),I=   49,   49) /
     1   'x' /
 
      data (TextTable(I,  8),I=1,5) /   50, 1, 3,41,10/
      data (Text(I),I=   50,   50) /
     1   'x' /
 
      data (TextTable(I,  9),I=1,5) /   51, 1, 4, 1,10/
      data (Text(I),I=   51,   51) /
     1   'x' /
 
      data (TextTable(I, 10),I=1,5) /   52, 7, 4, 4, 0/
      data (Text(I),I=   52,   58) /
     1   'L','e','n','g','t','h',
     1   ' ' /
 
      data (TextTable(I, 11),I=1,5) /   59,13, 4,19, 0/
      data (Text(I),I=   59,   71) /
     1   'J','u','s','t','i','f','i','c','a','t','i','o',
     1   'n' /
 
      data (TextTable(I, 12),I=1,5) /   72, 1, 4,41,10/
      data (Text(I),I=   72,   72) /
     1   'x' /
 
      data (TextTable(I, 13),I=1,5) /   73, 1, 5, 1,10/
      data (Text(I),I=   73,   73) /
     1   'x' /
 
      data (TextTable(I, 14),I=1,5) /   74, 1, 5,41,10/
      data (Text(I),I=   74,   74) /
     1   'x' /
 
      data (TextTable(I, 15),I=1,5) /   75, 1, 6, 1,10/
      data (Text(I),I=   75,   75) /
     1   'x' /
 
      data (TextTable(I, 16),I=1,5) /   76, 9, 6, 4, 0/
      data (Text(I),I=   76,   84) /
     1   'A','t','t','r','i','b','u','t',
     1   'e' /
 
      data (TextTable(I, 17),I=1,5) /   85, 1, 6,41,10/
      data (Text(I),I=   85,   85) /
     1   'x' /
 
      data (TextTable(I, 18),I=1,5) /   86,41, 7, 1,10/
      data (Text(I),I=   86,  126) /
     1   'm','q','q','q','q','q','q','q','q','q','q','q','q','q','q',
     1   'q','q','q','q','q','q','q','q','q','q','q','q','q','q','q',
     1   'q','q','q','q','q','q','q','q','q','q',
     1   'j' /
 
      data (FldTable(I,    1),I=1,7) / 3,    1,1,32, 2, 8,1 /
      data (CharTable(I,    1),I=1,2) /     1,0 /
      data (HelpTable(I,    1),I=1,4) /     1,   59,    0,    0 /
      data (Help(I),I=    1,   59) /
     1   'E','n','t','e','r',' ','t','h','e',' ','F','o','r','T','r',
     1   'a','n',' ','v','a','r','i','a','b','l','e',' ','n','a','m',
     1   'e',' ','c','o','r','r','e','s','p','o','n','d','i','n','g',
     1   ' ','t','o',' ','t','h','i','s',' ','f','i','e','l',
     1   'd' /
      data Formats(    1) / 'A32    '/
 
      data (FldTable(I,    2),I=1,7) / 3,    2,1, 6, 4,11,1 /
      data (CharTable(I,    2),I=1,2) /    33,0 /
      data (HelpTable(I,    2),I=1,4) /    60,   41,    0,    0 /
      data (Help(I),I=   60,  100) /
     1   'E','n','t','e','r',' ','t','h','e',' ','n','u','m','b','e',
     1   'r',' ','o','f',' ','c','h','a','r','a','c','t','e','r','s',
     1   ' ','t','o',' ','d','i','s','p','l','a',
     1   'y' /
      data Formats(    2) / 'A 6    '/
 
      data (FldTable(I,    3),I=1,7) / 3,    3,1, 6, 4,33,1 /
      data (CharTable(I,    3),I=1,2) /    39,0 /
      data (HelpTable(I,    3),I=1,4) /   101,   34,    0,    0 /
      data (Help(I),I=  101,  134) /
     1   'E','n','t','e','r',' ','N','O','N','E',',',' ','L','E','F',
     1   'T',',',' ','R','I','G','H','T',',',' ','o','r',' ','C','E',
     1   'N','T','E',
     1   'R' /
      data Formats(    3) / 'A 6    '/
 
      data (FldTable(I,    4),I=1,7) / 3,    4,1,25, 6,14,1 /
      data (CharTable(I,    4),I=1,2) /    45,1 /
      data (HelpTable(I,    4),I=1,4) /   135,   60,  195,   22 /
      data (Help(I),I=  135,  194) /
     1   'E','n','t','e','r',' ','e','i','t','h','e','r',' ','N','O',
     1   'R','M','A','L',' ','o','r',' ','R','E','V','E','R','S','E',
     1   ',',' ','a','n','d','/','o','r',' ','I','N','T','E','N','S',
     1   'E',',',' ','a','n','d','/','o','r',' ','B','L','I','N',
     1   'K' /
      data (Help(I),I=  195,  216) /
     1   '(',' ','e','.','g','.',' ','I','N','T','E','N','S','E',',',
     1   'B','L','I','N','K',' ',
     1   ')' /
      data Formats(    4) / 'A25    '/


      entry LablClear( Row, Col )


      call ClearScrn( Row, Col, 41,  7 )

      return



      entry LablTextDsp( Row, Col )

      call DsplyText( Row, Col,
     1   NT, TextTable, NdimT, Text )

      return


      entry LablDataDsp( Row, Col, First, Last,
     1   C1  ,C2  ,C3  ,C4
     1   )
 
      IEle = FldTable(2,  1)
      L = FldTable(4,  1)
      call ANtoA1( C1  , NdimC, Char, CharTable(1,IEle), L )
 
      IEle = FldTable(2,  2)
      L = FldTable(4,  2)
      call ANtoA1( C2  , NdimC, Char, CharTable(1,IEle), L )
 
      IEle = FldTable(2,  3)
      L = FldTable(4,  3)
      call ANtoA1( C3  , NdimC, Char, CharTable(1,IEle), L )
 
      IEle = FldTable(2,  4)
      L = FldTable(4,  4)
      call ANtoA1( C4  , NdimC, Char, CharTable(1,IEle), L )

      call DsplyData( Row, Col, First, Last,
     1   NF, FldTable,
     1   NI, IntArray, NR, RealArray, NC, CharTable, NdimC, Char,
     1   Formats )

      return


      entry LablValidate( First, Last,
     1   C1  ,C2  ,C3  ,C4
     1  , Valid, FieldNumber )
 
      IEle = FldTable(2,  1)
      L = FldTable(4,  1)
      call ANtoA1( C1  , NdimC, Char, CharTable(1,IEle), L )
 
      IEle = FldTable(2,  2)
      L = FldTable(4,  2)
      call ANtoA1( C2  , NdimC, Char, CharTable(1,IEle), L )
 
      IEle = FldTable(2,  3)
      L = FldTable(4,  3)
      call ANtoA1( C3  , NdimC, Char, CharTable(1,IEle), L )
 
      IEle = FldTable(2,  4)
      L = FldTable(4,  4)
      call ANtoA1( C4  , NdimC, Char, CharTable(1,IEle), L )

      call VldWholeScreen( First, Last, NF, FldTable,
     1   NI, IntArray, NR, RealArray, NC, CharTable, NdimC, Char,
     1   'LABL ', Valid, FieldNumber )

      return


      entry LablEdit( Row, Col, First, Last, StartField, TermKeys,
     1   C1  ,C2  ,C3  ,C4  ,
     1   Next, Previous, Exit, Refresh, LastKey )
 
      IEle = FldTable(2,  1)
      L = FldTable(4,  1)
      call ANtoA1( C1  , NdimC, Char, CharTable(1,IEle), L )
 
      IEle = FldTable(2,  2)
      L = FldTable(4,  2)
      call ANtoA1( C2  , NdimC, Char, CharTable(1,IEle), L )
 
      IEle = FldTable(2,  3)
      L = FldTable(4,  3)
      call ANtoA1( C3  , NdimC, Char, CharTable(1,IEle), L )
 
      IEle = FldTable(2,  4)
      L = FldTable(4,  4)
      call ANtoA1( C4  , NdimC, Char, CharTable(1,IEle), L )

      call EditScrn( 'LABL ', Row, Col, First, Last, StartField,
     1   ScrHelpLine, TermKeys, NF, FldTable,
     1   NI, IntArray, NR, RealArray, NC, CharTable, NdimC, Char,
     1   Formats, HelpTable, NdimH, Help, Next, Previous, Exit,
     1   Refresh, LastKey )
 
      IEle = FldTable(2,  1)
      L = FldTable(4,  1)
      call A1toAN( NdimC, Char, CharTable(1,IEle), L, C1   )
 
      IEle = FldTable(2,  2)
      L = FldTable(4,  2)
      call A1toAN( NdimC, Char, CharTable(1,IEle), L, C2   )
 
      IEle = FldTable(2,  3)
      L = FldTable(4,  3)
      call A1toAN( NdimC, Char, CharTable(1,IEle), L, C3   )
 
      IEle = FldTable(2,  4)
      L = FldTable(4,  4)
      call A1toAN( NdimC, Char, CharTable(1,IEle), L, C4   )

      return
      end


      integer*2 function LablIndex( Name )

      integer*2 I
      character*(*) Name
      character*32 LocName
      character*32 FldName(  4)
      data FldName(  1) /'OLDVERSION'/
      data FldName(  2) /'OLDVERSION'/
      data FldName(  3) /'OLDVERSION'/
      data FldName(  4) /'OLDVERSION'/

      LocName = Name
      call CvtToUpCase( LocName )
      do 100 I = 1 ,   4
        if( FldName(I) .eq. LocName ) then
          LablIndex = I
          return
        end if
100   continue

      LablIndex = 0

      end
