

c---
c  variable declarations

      integer*2 FirstFld, LastFld
      integer*2 Row, Col, CurField, TermKeys(30)
      integer*2 NumberOfFields
      integer*2 LastKey, FieldNumber
      logical*1 Next, Previous, Exit, Refresh, Valid

      character*  6 SpecimenID
      character* 12 Orientation

c---
c Normal termination on F1 key
c immediate termination on F2 key
      data TermKeys/ 1, 141, 1, 142, 26*0 /

c---
c Default variable initialization
      data SpecimenID /' '/
      data Orientation /' '/

c---
c Screen origin
      data Row, Col / 1, 1 /

c---
c TTY initialization
      call TTYinit
      call EchoOff
      call KpdOn

c---
c Starting edit field
      CurField = 1

c---
c Total number of screen parameters

      NumberOfFields =   2

c---
c Default limits

      FirstFld = 1
      LastFld = NumberOfFields


c---
c Clear the screen region

 10     call SpecClear( Row, Col )

c---
c Display the Text fields

      call SpecTextDsp( Row, Col )

c---
c Display the Data fields

      call SpecDataDsp( Row, Col, FirstFld, LastFld
     1, SpecimenID, Orientation
     1 )


c---
c Edit the Data fields

 20     call SpecEdit( Row, Col, FirstFld, LastFld, CurField, TermKeys
     1, SpecimenID, Orientation
     1, Next, Previous, Exit, Refresh, LastKey )



      if( Refresh ) then
          goto 10
      else if( Next ) then
          CurField = 1
          goto 20
      else if( Previous ) then
          CurField = NumberOfFields
          goto 20
      else if( .not. Exit ) then
          goto 20
      end if


c---
c Validate the Data fields

      call SpecValidate( FirstFld, LastFld
     1, SpecimenID, Orientation
     1, Valid, FieldNumber )

      if( .not. Valid ) then
          CurField = FieldNumber
          goto 20
      end if

      call TTYinit
      call EchoOn
      call KpdOff

      End
