SUBROUTINE GETEAR
*-- Author :    Girish D. Patel
      SUBROUTINE GETEAR(IRUN,IDATE,ITIME,IBFLD,IPRESS,IFR,IFP,IRET)
      COMMON /CHEAR/ JDATE,JTIME,JBFLD,JPRES,JBBL3                      
C     ------BOSMDL                                                                                            
      LOGICAL       BEGJOB,ENDRUN,BEGRUN,REVENT,ENDJOB,OTHDAT           
      COMMON/BOSMDL/BEGJOB,ENDRUN,BEGRUN,REVENT,ENDJOB,OTHDAT,          
     +              LCCRUN,NCCRUN,NEVENT,                               
     +              IHA,IBS,IDB,IDATEL,LUP,ISN,JSN                      
      SAVE  /BOSMDL/                                                    
C     ------                                                                                                  
      INTEGER      NHROW,NHCOL,NHLEN                                    
      PARAMETER   (NHROW = 2, NHCOL = 1, NHLEN=2)                       
      INTEGER      NBOSIW                                               
      PARAMETER   (NBOSIW=1000000)                                      
      INTEGER      IW(NBOSIW)                                           
      REAL         RW(NBOSIW)                                           
      COMMON /BCS/ IW                                                   
      EQUIVALENCE (RW(1),IW(1))                                         
      SAVE   /BCS/                                                      
      LOGICAL FIRST /.TRUE./                                            
      IF(FIRST) THEN                                                    
        FIRST = .FALSE.                                                 
        CALL H1ENVI(IFLAG,IPROC,NPROC)                                                                 
      ENDIF                                                             
      IL4L5 = IFLAG                                                     
      IF(IL4L5.EQ.2) THEN                                               
        IROLD  = NCCRUN                                                 
        NCCRUN = IRUN                                                   
        IRET=1                                                          
        IND=IABS(MDB('ZEAR'))                                           
        NCCRUN = IROLD                                                  
        IF(IND.GT.0) THEN                                               
           IDATE = IW(IND+3)                                            
           ITIME = IW(IND+4)                                            
           IBFLD = IW(IND+8)                                            
           IPRESS = IW(IND+10)                                          
           IBBL3  = IW(IND+11)                                          
           IFR = JBIT(IBBL3,19)                                         
           IFP = JBIT(IBBL3,20)                                         
           IRET = 0                                                     
        ENDIF                                                           
      ELSE IF(IL4L5.EQ.1) THEN                                          
                                                                        
        WRITE(*,*) 'GETEAR is called for Run =',IRUN                    
                                                                        
        IRET=1                                                          
        IF(JDATE.GT.0) THEN                                             
           IDATE = JDATE                                                
           ITIME = JTIME                                                
           IBFLD = JBFLD                                                
           IPRESS = JPRES                                               
           IFR = JBIT(JBBL3,19)                                         
           IFP = JBIT(JBBL3,20)                                         
           IRET = 0                                                     
        END IF                                                          
      ELSE                                                              
                                                                        
        WRITE(*,*) ' WARNING GETEAR is called for Run =',IRUN,          
     & ' with illegal IL4L5 flag',IL4L5                                 
                                                                        
      ENDIF                                                             
      RETURN                                                            
      END                                                               
*