Viewing contents of file '../idllib/ghrs/pro/aipsname.pro'
function aipsname,userno,seqno,directory
;+
; NAME
;   AIPSNAME
; PURPOSE:
;   Returns the VAX filename of a specified AIPS sequence number, for
;   a given user number.  Needed because AIPS tries to hide the VAX
;   file name, which is what the IDL procedure AIPSRD needs to read an image.
; CALLING SEQUENCE:
;   filename = aipsname(userno,[seqno,directory])
; INPUTS:
;   userno - AIPS user number, integer scalar
;   seqno -  sequence or slot number of image in the user's catalog.
;            If not supplied, AIPSNAME will display all images in the
;            users catalog, and prompt for a choice.
;   directory - string giving disk and directory name to search for the
;           image.   If not supplied, AIPSNAME uses the default
;           AIPS directory (currently CHAMP$USER5:[AIPS.DATA])
; OUTPUT:
;   STRING giving full VAX file name of the catalog header ('CB' file)
;   of the desired image.
; EXAMPLE:
;   User number 11 wants the VAX filename of the image with a slot
;   number of 1 in his catalog.
;   FILENAME= AIPSNAME(11,1)
; NOTES:
;   AIPSNAME currently assumes an AIPS format version of 'B', i.e.
;   for images written in the 15-JAN-1987 AIPS version.  Users
;   may need to change the first line of this program for other
;   AIPS data formats.  The default AIPS directory also needs to be
;   changed on other systems.
;
;   AIPSNAME does not check that the filename really exists;  it merely
;   creates a VAX filename from a user number and slot number, as per
;   GOING AIPS (15-APR-1987), p. 5-3.
; REVISION HISTORY:
;   Written    W. Landsman          March 6, 1989
;-
format_version = 'B'       ;Data format of 15-JAN-1987 AIPS version
defdir = 'CHAMP$USER5:[AIPS.DATA]'
if n_params(0) lt 3 then directory = defdir
if n_params(0) lt 2 then begin
     aipsdir,userno,directory
     seqno=0
     read,'Enter sequence (slot) number of desired AIPS image: ',seqno
endif
filename=directory+'CB' + format_version + to_hex(seqno,3)  + $
       '01.' + to_hex(userno,3)
return,filename
end