From: cflatter@nrao.edu (Chris Flatters)
Subject: Serious bug in MK3IN (15OCT92) with fix
Followup-To: alt.sci.astro.aips
Reply-To: cflatter@nrao.edu
Organization: NRAO
Date: Mon, 25 Jan 93 23:19:18 GMT


The version of MK3IN distributed in the 15OCT92 release of AIPS has a
serious bug that can cause scans not to be read from Mk3 correlator
archive tapes.  This is due to the AIPS I/O control structures not
being reset when skipping over unwanted files in the archive and is the
cause of strange output like the following.

MK3IN1:    1 X DIR -7:     Restored TDRSS data
MK3IN1:    2 X FILE: 
MK3IN1: Reading data from tape AFILE
MK3IN1:    3 X FILE: #AFILE   EXTENT:    0    TYPE:    3
MK3IN1:    4 X FILE: <0094A   EXTENT:    1    TYPE:   51
MK3IN1:    5   FILE: <0175A   EXTENT:    0    TYPE:   50
MK3IN1:    6 X FILE: <00905   EXTENT:    2    TYPE:   52
MK3IN1:    7 X FILE: 
MK3IN1:    8 X FILE: 
MK3IN1:    9 X FILE: h
MK3IN1:   10 X FILE: 
MK3IN1:   11 X FILE: 0
MK3IN1:   12 X FILE: 

If you have users who wish to reduce Mk3 VLBI data in AIPS or who are
expecting to reduce Mk3 VLBI data before you install the next release
of AIPS (15APR93) you should do the following (assuming that you
run some flavour of UNIX).

1) Save this message in a file in $APGNOT.  The following instructions
   assume that the file is named MK3IN.patch.

2) Change directory to $APGNOT and apply the patch at the end of this
   message as follows.

	patch < MK3IN.patch

   You should see the following messages

	Hmm...  Looks like a new-style context diff to me...
	The text leading up to this was:
	--------------------------
	|*** MK3IN.FOR.old      Mon Jan 25 15:35:07 1993
	|--- MK3IN.FOR  Mon Jan 25 15:32:21 1993
	--------------------------
	Patching file MK3IN.FOR using Plan A...
	Hunk #1 succeeded at 3091.
	done

   Don't worry if the number on the "Hunk #1" line is different.

   If the patch program is not installed on your system, you may obtain
   it from prep.ai.mit.edu by anonymous ftp.

3) Recompile MK3IN.
	
	COMLNK $APGNOT/MK3IN

If you can not obtain the patch program or if you are using VMS then
you will have to manually edit MK3IN to remove the uncomment the
two TAPIO calls in SUBROUTINE ATSKIP and the error tests that follow
them before recompiling (use the patch below as a guide).

	Chris Flatters
	cflatter@nrao.edu




*** MK3IN.FOR.old	Mon Jan 25 15:35:07 1993
--- MK3IN.FOR	Mon Jan 25 15:32:21 1993
***************
*** 3091,3103 ****
  C
        INCLUDE 'INCS:DMSG.INC'
  C-----------------------------------------------------------------------
! C                                       Don't need to close and reopen
  C                                       Close tape
! C      CALL TAPIO ('CLOS', FDVEC, TBUFF, TBIND, TERR)
! C      IF (TERR.NE.0) GO TO 990
  C                                       Reopen tape for read
! C      CALL TAPIO ('OPRD', FDVEC, TBUFF, TBIND, TERR)
! C      IF (TERR.NE.0) GO TO 990
  C                                       Go to next file
        IFIL = 1
        CALL ZTAPE ('ADVF', FDVEC(1), FDVEC(40), IFIL, TERR)
--- 3091,3105 ----
  C
        INCLUDE 'INCS:DMSG.INC'
  C-----------------------------------------------------------------------
! C                                       Close the tape device and reopen
! C                                       it to reset the AIPS I/O control
! C                                       structures.
  C                                       Close tape
!       CALL TAPIO ('CLOS', FDVEC, TBUFF, TBIND, TERR)
!       IF (TERR.NE.0) GO TO 990
  C                                       Reopen tape for read
!       CALL TAPIO ('OPRD', FDVEC, TBUFF, TBIND, TERR)
!       IF (TERR.NE.0) GO TO 990
  C                                       Go to next file
        IFIL = 1
        CALL ZTAPE ('ADVF', FDVEC(1), FDVEC(40), IFIL, TERR)