1 Misc_GRADS_Routines

  There are basicly two types: 

	    	1) Command procedures & utilities
	  (This includes DCL procedures and FORTRAN utility programs)

			and 

		2) FORTRAN callable routines.


2 Command_Files_&_Utilities

3 AAAREADME

       ALLMOUNT: Tape allocation and mounting routine.

        DELTREE: Deletes a complete directory tree.
                                         
         EDTINI: This is an EDIT/EDT initialization file.  It contains
			helpful editor MACROS.

          ERROR: A command file that returns the error message for a 
			specified error code (decimal or hex).

      FILESPECS: A procedure to parse a file specification.

       GETDRIVE: Allocates a tape drive.

   GET_TERMTYPE: A procedure to identify the type of terminal.

  GRADS_LIBRARY: A procedure to perform various DCL library
			functions.  To use type GLIB.

         GO_GET: A command file used in conjunction with TRANSFER.
			It is used to retrieve the file in the intermediate
			   directory.

         LIBEX: A command file that extracts a module from a library. 	

          MOVE: Moves a tape by block or EOF. invoked by
			@DISK$SYSTEM:[GRAVLIB]MOVE

          PAGE: Erases the screen of a video terminal or move to a new
			page on a hardcopy device.

        REWIND: A command file that will rewind a tape drive.  To
			use type REW*IND.

        SETACL: A command file that performs the SET/FILE/ACL/LIKE command.

         TITLE: A fortran utility to display a title and version in 
			a box (VT220).

      TRANSFER: A command file to transfer files from one group to another.
              
     UNMESSAGE: A utility to decompile a message file.

          VERB: A utility to extract verb definitions.

!*** IO ***

3 IO

	Command files to control I/O functions.
          

4 ALLMOUNT

     This procedure will allocate and mount a magnetic tape.
 It mounts the tape as "foreign".                   

	@SYS$UTILITIES:ALLMOUNT P1 P2

   P1 is the logical name assigned to the drive.
   
   If P2 is specified then an attempt is made to 
 allocate that drive only.

   The physical name of the drive is returned in
 the global symbol "DRIVE".

   The status of ALLMOUNT is returned in $STATUS.
 Normal if allocation and mounting worked.  If
 there was an error $STATUS contains the value of 3.

   This procedure uses GETDRIVE to do the allocation.


4 GETDRIVE

     This procedure will allocate a magnetic tape.

	@SYS$UTILITIES:GETDRIVE P1 P2

   P1 is the logical name assigned to the drive.
   
   If P2 is specified then an attempt is made to 
 allocate that drive only.

   The physical name of the drive is returned in
 the global symbol "DRIVE".

   The status of GETDRIVE is returned in the global 
 symbol STATUS.  

    STATUS = 1: Drive allocated
           = 2: Drive already mounted
           = 3: No drives available
           = 4: Unknown error


4 GET_TERMTYPE

     This procedure tests to see if SYS$INPUT is 
 a terminal.  It sets the following four global
 symbols:

     terminal_code: Numeric value of the terminal
                     as defined in $TTDEF.  (INTEGER)
			(returns 120 for VT240)

     terminal_unit: Physical device name of the
                     terminal.  (STRING)

     terminal_type: Type of terminal.  (STRING)
                     (VT220, TEK_4014, VT240, LA120)

    terminal_type2: First three characters of 
                     TERMINAL_TYPE.    (STRING)


4 MOVE               

  This routine moves a specified tape                
    a specified number of blocks or eofs             

  It is invoked using the COM file: DISK$SYSTEM:[GRAVLIB]MOVE.COM         
							   
  To move a tape forward by blocks:                  
            MOVE BLOCK unit# number                  
               number is positive                    
							   
  To move a tape backward by blocks:                 
               number is negative                    
							   
  example:  MOVE BLOCK 10 3  ...moves tape 10        
                                3 blocks             
            MOVE BLOCK 20 -2 ...moves tape 20        
                                back 3 blocks        
							   
  To move a tape by files use the word FILE instead  
        of BLOCK. (Only the first character of 
	FILE or BLOCK is required)
 

4 REWIND

	This command file will rewind a 
		specified tape drive.

 example:  $rew  MSB0     This will rewind MSB0.

 You will be prompted for the tape drive 
	name if it is missing.


4 TAPEXFER
     The tape transfer procedure is designed 
 to provide the user with a nearly effortless 
 method of transferring files from the VAX
 to the IBM.  Only ASCII source or print files 
 can be transfered.
     The procedure uses AVATU for creating 
 IBM readable tapes.  As part of the process 
 a JCL file containing all the infomation the 
 IBM needs to get the files off the tape is 
 created and is placed as the first file on 
 each tape.  This enables the IBM to read the 
 tape without the operator having to write 
 special JCL to get the files off.

     Using the procedure is simple.  Select 
 whether you want to write or read a tape 
 (reading is somewhat primative right now).
 If you want to write a tape, you have three 
 additional options.  The files to be transfered 
 to the IBM can be transfered for printing
 (in which case they are not saved after printing),
 they can be transfered as individually named 
 IBM files, or they can be included as part of 
 an IBM Partitioned Data Set (PDS).  If you chose 
 the partitioned data set option, you will have 
 to enter an IBM PDS name.  Consult the IBM 
 system manager if you are not sure what the 
 PDS name should be.

     The procedure will ask you next for file 
 names to transfer.  At this prompt a simple 
 carriage return will terminate further prompts
 and the tape will get made.  You can also enter 
 any existing VMS file name including wildcards.  
     For example, you could enter *.LIS at the
 prompt to place all listing files on the tape.  
 As each file is processed for inclusion on the 
 tape, a message will appear on the VT100 terminal 
 specifying the file being processed.  In the event
 that a file name is entered which does not 
 exist, a warning message will appear and the 
 procedure will prompt again for another name.
 When you finally type just a return at this 
 prompt, the specified files will be written to 
 the tape and the tape will be dismounted.
     Physically remove the tape from the tape 
 drive, give the tape to the IBM operator and 
 the tape will be transfered to your IBM account.



!*** Screen_Oriented ***

3 Screen_Oriented

   These procedures are for doing screen oriented functions.

4 PAGE

 DESCRIPTION:

      Erases the screen of a video terminal or 
 moves to a new page on a hardcopy device.  

	   DCL use: PAGE

     The symbol PAGE already points to the command file.  
	You do not need to set up a symbol.  
                  

3 TERMINAL_SET_&_RESET
     These command procedures allow you to set 
 and/or reset your terminal to either the
 system supplied characteristics or ones that
 you prefer.  

     To SET:  @SYS$UTILITIES:TERMINAL_SET

   To RESET:  @SYS$UTILITIES:TERMINAL_RESET

     These procedures check the logical name
 USER$GPWFILES for a command file called
 TERMINAL_SET.COM or TERMINAL_RESET.COM depending 
 on the function.  By default USER$GPWFILES points
 to SYS$LOGIN (your default login directory).

     If the file does not exist in your SYS$LOGIN 
 then the one in SYS$GPWFILES is used.  For example 
 uses of these files please see:

	SYS$GPWFILES:TERMINAL_RESET.COM
		      &
	SYS$GPWFILES:TERMINAL_SET.COM


4 TITLE
     This routine will display the title for 
 Grads Professional workstation tasks.  Input 
 is the title (passed as a literal string).  
 The terminal type must be previously defined by
 the global symbol "TERMINAL_TYPE".

     The nice graphics only work on a VT220 
 type terminal.

 EXAMPLE:
 $ title:=="$SYS$UTILITIES:TITLE" ! Foreign command
 $ @SYS$UTILITIES:GET_TERMTYPE	  ! Get terminal type
   .
   .
 $ title GRADS TEST,V0886	  ! This will display
   .				  ! GRADS TEST in a 
   .				  ! box and V0886 on
   .				  ! the last line of
   . 				  ! the box.

!*** Job_Info ***

3 Job_Info



!*** Other_Stuff ***

3 Other_Stuff

		Miscellaneous command files.


4 CMD

     We have a number of system wide 
 command files of general utility.  An 
 easy way to activate them is with the 
 CMD command.

     In general, to activate any command 
 file or process type:

     $ CMD cmdname optional-command-string

 CMD activates only command files on SYS$UTILITIES


4 EDTINI 

 	This is a startup command file used 
 by the EDT editor.  This file contains some 
 helpful macro definitions.  To use this file 
 create a symbol in the user login file as follows: 

 ED=="edit/edt/command=GRAVLIB$GENERAL:edtini.edt"

 To invoke a macro, simply type the macro name 
	as you would any editor command.

 MACROS CONTAINED IN THIS FILE AND THEIR USES 
 --------------------------------------------
 EX: exits the editor and places numbers in the output for printing.

 LCASE: changes everything in the current line 
	to lower case.
 LCASEFULL: changes everything the current buffer 
	to lower case.
 RBLANK: removes all the blanks in the current line.
 TABS: changes every occurence of 6 blanks to 
	the <tab> character.
 UCASE: changes everything in the current line 
	to upper case.


4 ERROR

     This command file will print the error message 
 associated with the specified error code.  The 
 error code may be decimal or hex.  If hex then 
 an X must precede the error code.

	   example:  $ERROR  x840

 This returns the following message:

 %SYSTEM-W-DEVALLOC, device already allocated to another user

 You will be prompted for the error code if it is missing.


4 FILESPECS

      This procedure parses a file specification into its basic parts.

	example:  @SYS$UTILITIES:FILESPECS filespec default_filespec

	Where:
		filespec: File specification to parse.
		default_filespec: Default file specification.  Any 
			fields missing from FILESPEC are filled from
			this parameter.

    The parts of the file specification are returned in the following 
 global symbols:

	NODE, DEVICE, DIRECTORY, FILENAME, EXTENTION, VERSION 


4 LIBEX

     This command file will extract a module from 
 a library.  The output is placed in the current 
 default directory.  The library name must include 
 the appropriate extention. 

    example:  $LIBEX  general.tlb  wait
  
 This will extract the module WAIT out of GENERAL.TLB. 

 You will be prompted for the library and module 
	names if they are missing.


4 MAILMSG

     MAILMSG sets the global symbol MAIL_MSG_NUMBER.
 This can be used to examine the number of unread
 mail messages for the specified user.

     MAILMSG is designed to be run as a foreign
 command.  The EXE resides in SYS$UTILITIES.


4 TESTFILE

     Determines if a named file exists, 
 without cluttering up SYS$OUTPUT with 
 diagnostic messages, leaving $STATUS 
 and $SEVERITY in a small set of known 
 states. 

      TESTFILE file-spec

Result:
 o If file-spec exists, $STATUS = $SEVERITY = 1.
 o If file-spec does not exist, but the command 
    was well formatted, then $STATUS = 3 (informational).

5 EXIT_STATUS
     For successful completion of TESTFILE, 
 $STATUS may take the following (hexidecimal) 
 values:

	 1 -    normal (file found)
	 3 -    File not found via F$SEARCH

5 USES

     To delete a file, without messages if 
 it doesn't exist:

  $TESTFILE FILE.BAD
  $IF '$STATUS .EQ. 1 THEN DELETE FILE.BAD;*

     To run a command procedure which makes 
 a file, but only if the file does not already exist:

  $TESTFILE NEEDED.DAT
  $IF '$STATUS .NE. 1 THEN @MAKEFIL


4 TRANSFER

     The TRANSFER and GO_GET functions allow the 
 user to transfer files from one group to another 
 with very little effort on the users part.

     The sender specifies a file to be transferred.  
 The file will then be copied into an open directory 
 and made available for transfer.  The sender should 
 notify the intended receiver(s) that the file is 
 available.  

     To retrieve a file that is in the open directory, 
 the user specifies which file to GO_GET.

     Files in the open directory will be available 
 for two working days only.  The sender's quota will 
 be charged until the transferred files have expired.  
 Deletion is automatic and does not require any user 
 action.


4 TYPE_PAGE

     TYPE_PAGE is a foreign command which will 
 type out a section of an ASCII sequential file.  

 The format of the command is:
	
     TYPE_PAGE <filename>/Start=xxx/End=zzz

      Starting with line 'xxx' in the file, the 
 file contents up to and including line 'zzz' 
 will be displayed.


4 VERB
	VERB Verb[,verb...]

      Extract verb definitions, to create command 
 definition files from command tables (or from the 
 current process tables).  Optionally just create 
 a listing of the specified verbs.   Wildcarding 
 is allowed.

 i.e.
	VERB C*,D*,*ING
	VERB/LIST/ALL/OUT=VERBS.LIST

 /ALL: Same as entering "*" as the verb.
 /PROCESS: Default if /TABLE isn't specified. 
      Causes verbs to be looked up and extracted 
      from the current in-memory process tables.
 /TABLE: /TABLE[=table-file-spec]
      Specifies that verbs are to be looked up 
      and extracted from command table files. 
      If no file is specified it defaults to 
      SYS$SHARE:DCLTABLES.EXE
 /OUTPUT: /OUTPUT=out-file-spec
      Send output to 'out-file-spec'
 /WIDTH: /WIDTH=width
      Specifies width of output lines. Default 
      to current screen width.
 /LIST: Create a listing of the specified verbs, 
      rather than extracting the verb definitions.


4 UNMESSAGE
	UNMESSAGE [message-file]
	Default = SYS$SHARE:SYSMSG.EXE
     Decompiles message files. Note, the decompiled 
 message file will not be exactly the same as the 
 original, as certain information is not stored in 
 these files. However, the message text files created 
 can be rerun through the message compiler (MESSAGE)
 and the resulting file will produce exactly the same 
 results as the original (We hope).

 /OUTPUT: /OUTPUT=file-spec
     Specifies an output file to store the decompiled 
     message text.


!*** FORTRAN_Callable ***

2 FORTRAN_Callable

3 AAAREADME

         ALLMOUNT:  	Tape allocation and mounting routine.
     
           ARGCNT: 	Returns the number of arguments passed 
			   to a subroutine.

           BORDER: 	Draws chart boundaries, axes, and labels for 
			   CALCOMP plotting routines.

          BOXPAGE: 	Outputs three lines of text in large letters.

          BTEST_Q:	Tests the bits of a quadword.

           CALCIA: 	Plots WDBII coastlines for VERSATEC and 
			   CALCOMP graphics packages.

            CHBND: 	Returns latitude and longitude of a 
			   9 character chart number.

         CHECK_ID:	Checks the current user has the specified
			   identifier.

 CLEAR2, CLEAR4, CLEAR4_REST: Fills an array with zeros.

   CREATE_LOGNAME:	Creates a logical name in the specified 
			   logical name table.

           CRVPLT: 	Used by CALCIA (not for general use).

    DELETE_BLANKS: 	Deletes all the blanks from a specified string.

   DELETE_LOGNAME:	Deletes a logical name from the specified 
			   logical name table.

         DEVOWNER:  	Returns the PID for a specific device.
      
           DSTCHK: 	Used by CALCIA (not for general use).
  
           EZTRAN:	High speed disk and tape I/O.

     ENABLE_CTRLY: 	Enables control Y interrupts to DCL.  
			   This cancels the action of ENABLE_CTRLY_AST.

 ENABLE_CTRLY_AST: 	Disables control Y interrupts to DCL and sets 
			   up an AST to be executed on a control_Y
			    interrupt.

        FILESPECS:	This routine parses a file specification.

             FLIP:	This routine flips the bytes in an 
			   integer*2 word.

          GEOBATH: 	Returns the bathymetry and geoid height 
			   for a specified latitude and longitude.

         GETDESCR:	Returns the actual address of the byte string
			   of characters.

           GETPID:  	Returns the calling process's PID.

      GET_ELEMENT:	Returns one element at a time of a 
			   delimited string.

     GET_TERMTYPE: 	Returns the type of terminal the process 
			   is using.

     GET_USERINFO: 	Returns process information of the 
			   current process.

     GET_USERNAME: 	Returns USERNAME of the current process.

          JOBMODE: 	Returns the mode of the job (BATCH,NETWORK,INTERACTIVE).
                                   
          JOBTYPE: 	Checks for whether the job is either demand or batch.

           JULMIN:  	Converts julian day,hours,minutes to 
			   julian minutes.

           JULSEC:  	Converts julian day,hours,minutes to
		     	   julian seconds.  This routine
			   also converts julian seconds to
			   day,hours,minutes using the entry
   		           point SECJUL.

         LANDMASK: 	Checks to see if a specified latitude and 
			   longitude is land or water.

    LSHIFT_STRING: 	Left justifies a specified string.
          
           MAPDEX:	Computes a PS-16 BNC chart number.

           MINJUL:	Converts julian minutes to julian day,
 			   hours and minutes.

           MVBITS:	Description of FORTRAN function to move bits.

            NTRAN:	Simulates UNIVAC NTRAN for tape I/O.

          PREVIEW: 	Used to preview CALCOMP plots on Evans 
			   and Sutherland MPS terminals.

             PAGE: 	Erases the screen of a video terminal or move 
			   to a new page on a hardcopy device.

     TRAN_LOGNAME:	Translates a specified logical name.


           SCREEN:	Sets VT220 type terminal attributes and places 
			   text on the screen in specified positions.

              YMP: 	Converts latitude degrees to meridional parts.
				(MERCATOR PROJECTION) 

!*** IO ***

3 IO

		These are FORTRAN callable I/O routines.

4 ALLMOUNT
      
 DESCRIPTION: This routine will allocate and mount a 
	magnetic tape.  It mounts the tape as "foreign" 
	and inserts a user supplied logical name in 
	the Process Logical Name Table.
      
 example call: call ALLMOUNT2(*100,512,512,'10',physnam)

 	The integer parameters may be integer*2 or *4.

 PARAMETERS:  

          return1: Error in routine, control is 
		returned to the calling program.  
          
          recordsize: Size of the logical records 
		in bytes or characters.
                      (passed,integer*2)
      
          blocksize: Size of the logical blocks in bytes.
                      (passed,integer*2)
      
          lognam: Logical name to be associated with 
		the allocated tape drive.       
                      (passed,character*6)

          physnam: Physical name the allocated device.
                      (returned, character*6)

      
 SUBROUTINES REQUIRED: VAX System Services, GETPID, DEVOWNER
      

 
4 BOXPAGE
     This routine outputs to logical name FOR006 
 (Fortran unit 6) three lines of large text.  Each 
 line may be up to ten characters in length.  

   FORTRAN call:  call BOXPAGE(line1,line2,line3)         

 Where: line1, line2, line3 are the three lines 
		of text to be output in large letters.
		(passed,character*10)

 The text is centered on each line.

 SUBROUTINES REQUIRED: CENTER_STRING, BIGCHARS



4 EZTRAN

     This routine provides faster access to disc 
 (or tape) than FORTRAN I/O.  See the referenced 
 notes (NOTE#) for specific details on a function.

	To call from FORTRAN:

 call EZTRAN(unit#,func,blockparm,# of bytes,array,status)


 The following is a summary of the functions available.

	     FUNCTION
           NUMBER               DESCRIPTION
           
		1		Sequential Read
		2		Sequential Write
		3		Random Read
		4		Random Write
		5		Open & Assign
		6		Close &DEassign
		7		Skip Record
		8		Skip File
		9		Write EOF
	       10		Rewind
	       11		Create File
	       12		Sequential Read (record)
	       13 		Sequential Write (record)
	       14		Random Read (record)
	       15		Random Write (record)



	All arguments are integer with the exception of ARRAY,
	which can be integer or character.

5   NOTE1
			NOTE 1
			------
     Functions 1-4 perform block I/O.  For the random
 block I/O the actual block number in the file must
 be addressed, (not the logical block number).  If,
 for example, the first block of the file contains 
 1024 bytes, then the second block would be 
 requested as block 3.  Any type of file may be
 accessed with block I/O, provided it has been
 opened for block I/O.


5   NOTE2
			NOTE 2
			------
     Function 5.  Opens files and assigns a logical 
 unit to them.  The file name or tape drive device
 name must be passed as character strings.  The 
 user should specify if he wants to do record or
 block I/O.


5   NOTE3
			NOTE 3
			------
      Function 11.  Creates, (opens and assigns), files
 for block and record I/O.  
 The larger allocation/extension quantity pro-
 vides faster I/O, in particular for large data
 files on which block I/O is being performed.
 All  files are created on a contiguous-best-try
 basis,(CBT option).
     The number of blocks must be passed by reference
 rather than by value.  If number of blocks equals 0,
 then the block count is set to 64 blocks.
     Files may be created in any of the three
 modes,(thus left open for block or record I/O).
     However, if a file is created in one mode, it may
 be closed, and reopened in another mode.  The only
 limitation in this respect is that a file opened
 with variables length records may not be accessed
 with random record I/O,(variable records are 
 opened for block I/O, random or sequenced).
 
5   NOTE4
			NOTE 4
			------
     Functions 12-15.  These functions perform record
 I/O.  Any type of file may be accessed with record
 I/O,(except the random record I/O to variable 
 length records).

5   ERRORS
		ERRORS
		------
     Error handling.  Eztran has a built-in error hand-
 ling routine for most common errors.  However, if 
 an eror is undiagnosed then, the contents of 
 registor 0 are converted to a hexadecimal number
 which is printed out and may be looked up in the
 appendix of the Record Management Services,
 (RMS), manual.

5   READ_SEQUENTIAL

  For additional information see NOTE 1.

  FUNCTION    FUNCTION     BLOCK/RECORD    NUMBER      ARRAY        STATUS  
  NUMBER    DESCRIPTION    PARAMETER      OF BYTES   INT/CHAR    (RETURNED)
__________  ___________   ____________    ___________  _______   __________     

    1          by Block        n/a        no. bytes    integer   no. bytes
                                           to read                 read 
                                                                 -3 is EOF

   12         by Record         n/a            "           "        "

5   WRITE_SEQUENTIAL

  For additional information see NOTE 1.

  FUNCTION    FUNCTION     BLOCK/RECORD    NUMBER      ARRAY        STATUS  
  NUMBER    DESCRIPTION    PARAMETER      OF BYTES   INT/CHAR    (RETURNED)
__________  ___________   ____________    ___________  _______   __________     
    2          by Block        n/a        no. bytes    integer   no. bytes
                                           to write              written

   13         by Record         n/a            "           "         "

5   READ_RANDOM

  For additional information see NOTE 1.

  FUNCTION    FUNCTION     BLOCK/RECORD    NUMBER      ARRAY        STATUS  
  NUMBER    DESCRIPTION    PARAMETER      OF BYTES   INT/CHAR    (RETURNED)
__________  ___________   ____________    ___________  _______   __________     
    3         by Block    Block number    no. bytes    integer   no. bytes
                           to read         to read                 read 

   14        by Record    Record number       "           "          "
                            to read                           

5   WRITE_RANDOM

  For additional information see NOTE 1.

  FUNCTION    FUNCTION     BLOCK/RECORD    NUMBER      ARRAY        STATUS  
  NUMBER    DESCRIPTION    PARAMETER      OF BYTES   INT/CHAR    (RETURNED)
__________  ___________   ____________    ___________  _______   __________     
    4         by Block    Block number    no. bytes    integer   no. bytes
                           to write        to write                write

   15        by Record    Record number       "            "        "
                           to write    

5   OPEN_FILE      

  For additional information see NOTE 2.

  This function opens and assigns a file or device

  FUNCTION    FUNCTION     BLOCK/RECORD                ARRAY        STATUS  
  NUMBER    DESCRIPTION    PARAMETER       ACCESS    INT/CHAR    (RETURNED)
__________  ___________   ____________    ___________  _______   __________     

    5       block access       0          0= read/write  character 512: disk

            record access      1          1= read only  filename   1: tape 

                                                                   -1: file not found

5   CLOSE_FILE          

       This function closes and deassigns a file or device


  FUNCTION    FUNCTION     BLOCK/RECORD    NUMBER      ARRAY        STATUS  
  NUMBER    DESCRIPTION    PARAMETER      OF BYTES   INT/CHAR    (RETURNED)
__________  ___________   ____________    ___________  _______   __________     

    6           n/a              n/a         n/a          n/a         n/a


5   RECORD_SKIP

  FUNCTION    FUNCTION     BLOCK/RECORD    NUMBER      ARRAY        STATUS  
  NUMBER    DESCRIPTION    PARAMETER      OF BYTES   INT/CHAR    (RETURNED)
__________  ___________   ____________    ___________  _______   __________     

    7         no. blocks         n/a         n/a          n/a        n/a
               to skip

5   FILE_SKIP

  FUNCTION    FUNCTION     BLOCK/RECORD    NUMBER      ARRAY        STATUS  
  NUMBER    DESCRIPTION    PARAMETER      OF BYTES   INT/CHAR    (RETURNED)
__________  ___________   ____________    ___________  _______   __________     

    8         pos. no.=          n/a         n/a          n/a        n/a
            files forward

              neg. no. =
            files backward

5   WRITE_EOF

  FUNCTION    FUNCTION     BLOCK/RECORD    NUMBER      ARRAY        STATUS  
  NUMBER    DESCRIPTION    PARAMETER      OF BYTES   INT/CHAR    (RETURNED)
__________  ___________   ____________    ___________  _______   __________     

    9           n/a              n/a         n/a          n/a         n/a

5   REWIND

  FUNCTION    FUNCTION     BLOCK/RECORD    NUMBER      ARRAY        STATUS  
  NUMBER    DESCRIPTION    PARAMETER      OF BYTES   INT/CHAR    (RETURNED)
__________  ___________   ____________    ___________  _______   __________     

   10           n/a              n/a         n/a          n/a         n/a

5   CREATE_FILE   

  This function creates, opens and assigns a file to a process

  For additional information see NOTE 3.

  FUNCTION    FUNCTION     BLOCK/RECORD    NUMBER      ARRAY        BLOCK  
  NUMBER    DESCRIPTION    PARAMETER      OF BYTES   INT/CHAR    ALLOCATION
__________  ___________   ____________    ___________  _______   __________     

   11      variable length        0          n/a       character  Must be  
           records, max. no.                           filename   passed
           bytes/rec=48000                                        as a                                                             
                                                                  variable    
   11      fixed length           1        no. bytes       "      name. 
           records, open for               per record             Default is      
            for block I/O                                         64 blocks.

           fixed length           2            "           "          n/a
           records, open for                                         
            for record I/O

 
4 NTRAN   
      THIS ROUTINE SIMULATES THE UNIVAC NTRAN ROUTINE.
 THE ROUTINE ALLOWS YOU TO PERFORM CERTAIN OPERATIONS 
 ON TAPE VOLUMES.

 THE ROUTINE IS CALLED AS FOLLOWS:

     	CALL NTRAN(UNIT,OPER,NUW,ARRAY,STATUS)

5 UNIT

 UNIT: THE LOGICAL UNIT NUMBER WHICH CAN BE ASSIGNED
             
	$MOUNT MSA0:     LABEL      10
	_____     _____      ___
	  |         |         |
        
 	DEVICE     LABEL     LOGICAL
				UNIT

			OR
        
	$ASSIGN   MSA0:  10

             VALID UNIT NUMBERS RANGE FROM 01 TO 30

5 OPER

        OPER: OPERATION TO BE PERFORMED
              
       	      1-WRITE
              2-READ
              7-POSITION TAPE BY BLOCK
              8-POSITION TAPE BY FILE
              9-WRITE AN EOF
              10-REWIND
              17-REWIND AND DISMOUNT TAPE
              22-WAIT AN UNSTACK

5 NUW

        NUW: NUMBER OF WORDS TO BE WRITTEN OR READ
             MIN=3, MAX=16383 WARNING:AN ERROR WILL 
             NOT OCCUR IF THE MAX IS EXCEEDED
            
             ON AN POSITION TAPE BY BLOCK OR FILE
             NUW IS THE NUMBER OF BLOCKS OR FILES
             TO BE MOVED.  A POSITIVE NUMBER WILL POSITION  
             THE TAPE FOWARD, AND NEGATIVE BACKWARD.

5 ARRAY

        ARRAY: ARRAY TO BE WRITTEN OUT OR TO RECEIVE DATA

5 STATUS

        STATUS: STATUS UNDER NORMAL COMPLETION L WILL 
		EQUAL THE NUMBER OF WORDS TRANSFERED.
           -1 ERROR CONDITION
           -2 END OF FILE


4 READ_LINE

 DESCRIPTION:

     This is an input routine that checks for escape 
 sequences from a VT type keyboard.  The keys listed 
 below are the ones currently checked for.  This 
 routine assigns a channel to SYS$INPUT for the I/O.  
 If the terminal is a VT type the I/O is done using 
 $QIOW, else if SYS$INPUT is an unknown terminal or 
 a batch job the I/O is done using FORTRAN I/O.  


 FORTRAN call:	call READ_LINE(text,text_length,ret_stat)

 PARAMETERS:

 text: Character string that is returned.  Blank 
	if ret_stat is not equal to zero.
		(character*(*),returned)

 text_length: Length of TEXT.  Zero if ret_stat is 
	not equal to zero.
		(integer*2,returned)

 ret_stat: Status code defining which key was hit.
		(integer*2,returned)

	WHERE:

 -2: undefined key was hit
 -1: carriage return only	13: keypad 3
  0: keyboard characters only	14: keypad 4
  1: ctrl Z			15: keypad 5
  2: up arrow			16: keypad 6
  3: down arrow			17: keypad 7
  4: left arrow			18: keypad 8
  5: right arrow		19: keypad 9
  6: PF1			20: keypad period (.)
  7: PF2			21: keypad ENTER
  8: PF3			22: keypad comma (,)
  9: PF4			23: keypad minus
  10: keypad 0  
  11: keypad 1
  12: keypad 2


    If you wish to use the terminal type in another 
 module, include the following common block:

 common /TERMINAL/ ttchan, iterminal, save_modes(2), new_modes(3)

    WHERE:
	ttchan: I/O channel number.
		(integer*2,common)

 	iterminal: Terminal type (see $TTDEF for 
			equivalent names)
		(integer*2,common)

	save_modes(2): Previous terminal characteristics.
		(integer*4,common)

	new_modes(3): Current terminal characteristics.
		(integer*4,common)

 SAVE_MODES and NEW_MODES are not required.  They are here for 
 convenience (to be used in other user modules to maintain terminal
 characteristics).

 READ_LINE assigns a channel via SYS$ASSIGN.

SUBROUTINES REQUIRED:  System Services, GET_TERMTYPE, LSHIFT_STRING


!*** SCREEN_ORIENTED ***

3 Screen_Oriented
 
     These routines are used to control the output to terminal
 screens.  They favor the VT200 series devices.  They 
 treat the E and S screens as dumb hardcopy devices.




4 PAGE

 DESCRIPTION: 
     Erases the screen of a video terminal 
 or moves to a new page on a hardcopy device.  

	FORTRAN call:   call PAGE


 SUBROUTINES REQUIRED: System Services


4 SCREEN

     The SCREEN subroutine interface is designed 
 to allow convenient  access  to  the VT220 ANSI  
 Mode  Control Sequences as defined in chapter 4 
 of the VT220 Programmer Reference Manual.  

      SCREEN calls GET_TERMTYPE to get the terminal 
 type.  If the terminal is a VT type, unit 99 is 
 opened and used for the output to the terminal 
 screen.  If it is not a VT type, unit 6 is used
 for the terminal output.

     In order for cursor control of the VT220 to 
 perform satisfactorily, the wraparound feature  
 of the terminal driver is disabled by the routine. 
 (This is for VT type terminals only!!!)

	 	example FORTRAN call:   

	call SCREEN(command,parm1,parm2,string)


 PARAMETERS
	
 command: Function code of operation to be performed.
		(passed,integer*2)

 parm1,parm2: Parameter values for a specific function code.
		(passed,integer*2)

 string: Character string to be output to the terminal. 
	For functions that output no character string, 
		a blank string MUST be provided (' ').
		(passed,character*(*))

 SUBROUTINES REQUIRED: STRING_LENGTH, GET_TERMTYPE

5 OPTIONS

     The following commands are implemented.

	CODE                  FUNCTION
 	----		      --------
	  1              Position cursor
	  2		 Move cursor up
	  3 		 Move cursor down
	  4  		 Move cursor forward
	  5 		 Move cursor backward
	  6		 Double height line
	  7		 Double width line
	  8		 Restore cursor info
	  9		 Save cursor info
	  10 		 Single-width, single height line
	  11		 Erase display
	  12		 Erase line
	  13		 Set graphic rendition
	  14		 Position to beginning of next line
	  15 		 Select character set
	  16		 Set DEC private mode
	  17		 Reset DEC private mode
	  18		 Set terminal to ANSI mode
	  19		 Set scrolling region
           
5 POSITION_CURSOR	

     Position cursor to coordinates given by 
 line and column. Lines are numbered 1-24 and 
 columns 1-80. A zero is treated as a one. 

     call SCREEN(1,line,column,string) 

5 MOVE_UP                     
 
     Move the cursor up num lines. A zero is 
 treated as a one. Cursor will not move up 
 beyond top margin.
 
     call SCREEN(2,num,0,' ')

5 MOVE_DOWN

     Move the cursor down num lines. A zero is
 treated as a one. Cursor will not move below
 bottom margin.
 
     call SCREEN(3,num,0,' ')

5 MOVE_FORWARD

     Forward the cursor num columns. A zero is
 treated as a one. Cursor will not forward
 beyond right margin.
 
     call SCREEN(4,num,0,' ')

5 MOVE_BACKWARD

     Backspace the cursor num columns. A zero is
 treated as a one. Cursor will not backspace
 beyond left margin.

     call SCREEN(5,num,0,' ')
 
5 MOVE_FORWARD

      Output a double-height line starting at line
 and column.

     call SCREEN(6,line,column,' ')

5 DOUBLE_WIDTH_LINE

     Output a double width line.

     call SCREEN(7,line,column,string) 

5 RESTORE_CURSOR_INFO
 
     Restore the cursor to the saved coordinates.

     call SCREEN(8,0,0,' ')

5 SAVE_CURSOR_INFO
 
     Save the active cursor coordinates.
 
     call SCREEN(9,0,0,' ')

5 SINGLE_WIDTH_&_HEIGHT_LINE

     Output a single-width, single-height line.

     call SCREEN(10,line,column,string)

5 ERASE_DISPLAY                                           
 
     Erase the display. 

 number=0: Erase from active cursor 
	position to end of display. 
 number=1: Erase from top of display 
	to active cursor position. 
 number=2: Erase entire display.
 
     call SCREEN(11,number,0,string)

5 ERASE_LINE

     Erase the line. 

 number=0: Erase from active cursor position
	to the end of line.
 number=1: Erase from the beginning of line 
	to the active cursor position. 
 number=2: Erase entire line.
 
     call SCREEN(12,number,0,string)	  

5 SET_GRAPHIC_RENDITION

     Set graphic rendition.

 number=0: Turn all attributes off.
 number=1: Bold.
 number=2: Underscore.
 number=3: Blinking.
 number=4: Reverse image.
 number=5: Normal intensity.
 number=6: NOT underlined.
 number=7: NOT blinking.
 number=8: Positive image.

     call SCREEN(13,number,0,string)	  

5 NEXT_LINE
 
     Position cursor to beginning of next line.
 
     call SCREEN(14,0,0,string)

5 SELECT_CHARACTER_SET

    Select character set. 

 parm1=0: Indicates G0 set.
 parm1=1: Indicates G1 set. 
 parm2=0: Indicates United Kingdom set. 
 parm2=1: Indicates standard ASCII set. 
 parm2=2: Indicates special graphics set. 

     In subsequent I/O, the G0 set is selected
 by a shift in <control O>, and the G1 set is
 selected by a shift out <control N> embedded
 in the data.

     call SCREEN(15,parm1,parm2,' ')   

5 SET_MODE
     Set DEC private mode. Parm1 is mode to be set.

	   1 = DECCKM (cursor key)
	   2 = DECANM (ANSI/VT52)
	   3 = DECCOLM (column)
     	   4 = DECSCLM (scrolling)
	   5 = DECSCNM (screen)
	   6 = DECOM (origin)
	   7 = DECAWM (auto wrap)
	   8 = DECARM (auto repeating)
	   9 = DECTCEM (text cursor enable)
	  10 = KAM (keyboard action)	! ANSI standard
	  11 = IRM (insert/replace)	!   modes.
	  12 = LNM (line feed/new line)	!

     call SCREEN(16,parm1,0,' ') 

5 RESET_MODE
     Reset DEC private mode. num is the mode to be
 reset. See codes listed above for set mode.
 
     call SCREEN(17,parm1,0,' ')

5 SET_ANSI
     This is a VT52-compatible command to ensure
 the terminal is set to ANSI mode. This should
 be the first command issued in your program
 if you are not sure the target terminal is set
 to ANSI mode. This command will be ignored if
 the terminal is already in ANSI mode.

     call SCREEN(18,0,0,' ') 

5 SET_SCROLLING
     Set the scrolling region.

 parm1: Top of the scrolling region.
 parm2: Bottom of the scrolling region.
 
     call SCREEN(19,parm1,parm2,' ') 


4 SET_MODE

     This routine sets specified terminal
 modes and resets the modes to their original
 values.

  FORTRAN call:  call SET_MODE(5)

     This sets the terminal to no_broadcast
 and no_wrap_around.  
     The mode set depends on the bit that 
 is set.  To set more than one mode, 
 pass the integer value that represents 
 the required bit mask.


	AVAILABLE MODES
	---------------
	 0 = reset to original modes
	 1 = no broadcast
	 2 = no echo
	 4 = no wrap around

 More values can be added later.  If you
 have any suggestions, please see the
 system manager.


4 VT_TITLE
 DESCRIPTION: This routine displays a user 
	supplied title and identifier at the 
	current cursor position on a VT type
	terminal.  The display consists of a 
	reverse video box surrounding the title 
	in double wide and height format.
	   If the terminal is an E and S device 
	then the title 	and identifier are 
	simply printed.
	   The terminal type MUST be defined 
	using GET_TERMTYPE.
	   The following common block MUST be 
	used in the routine that calls GET_TERMTYPE.

	common /TERMINAL/ ttchan, iterminal

	Both TTCHAN and ITERMINAL are integer*2.

 	FORTRAN call:   call VT_TITLE(title,ident)


 PARAMETERS:
		title: String to be centered in box.
			(character*(*),passed)
		ident: String to be placed in last line of box
			in reverse video.
			(character*(*),passed)


 SUBROUTINES REQUIRED: string_length, fill_string, 


!*** TEXT_MANIPULATION ***

3 Text_Manipulation

4 DELETE_BLANKS

 DESCRIPTION: This routine deletes blanks 
	 in a string and then left justifies the 
	string. Trailing blanks and tabs are 
	deleted.

	FORTRAN call:   call DELETE_BLANKS (string,length)


 PARAMETERS:

	string: String to remove the blanks from.
		(character*(*),passed and returned)
	length: Length of resultant string.
		(integer*2,returned)

 SUBROUTINES REQUIRED:   none


4 FILL_STRING

 DESCRIPTION:  	This routine fills a string 
	with a specified character.

     FORTRAN call:   call FILL_STRING(string,char,length)

 PARAMETERS:

	string: String to be filled with CHAR.
		(character*(*),passed and returned)
	char: Character to fill STRING with.
		(character*1,passed)
	length: Length of STRING.
		(passed,integer*2)

 SUBROUTINES REQUIRED:  none



4 GETDESCR

 DESCRIPTION:  	This routine returns the actual 
	address of the byte character string.

     FORTRAN call:   call GET_DESCR(string,address)

 PARAMETERS:

	string: Address of descriptor to translate.
		(character*(*),passed)
	address: Address of byte character string.
		(passed,integer*4)

 SUBROUTINES REQUIRED:  none


4 LSHIFT_STRING

 DESCRIPTION: This routine deletes any left 
	justified blanks in a string by shifting 
	the string to the left.  Trailing blanks 
	are deleted.

     FORTRAN call:   call LSHIFT_STRING (string,length)

 PARAMETERS:

	string: String to be left justified.
		(character*(*),passed and returned)
	length: Length of left justified string.
		(integer*2,returned)

 SUBROUTINES REQUIRED:   none


4 STRING_LENGTH

 DESCRIPTION: This routine returns the actual 
	length of a string.
	   In this routine the end of the
	string is defined by as the right 
	most non-blank, non-tab character.

    FORTRAN call:   call STRING_LENGTH (string,length)

 PARAMETERS:

	string: String to find the length of.
		(character*(*),passed and returned)
	length: Length of string.
		(integer*2,returned)
                                    
 SUBROUTINES REQUIRED:   RTL routines.


!*** JOB_INFO ***

3 Job_Info

	These routines return information about 
		the current process.

4 CHECK_ID
	The routine checks to see if the 
 current user has the specified identifier in
 the UAF.

 FORTRAN call:  call CHECK_ID(*100,id_to_check)

 Where:
        return:	Specified identifier IS in the 
		users UAF entry.
		
       return1:	Specified identifier IS NOT in 
		the users UAF entry.
		
   id_to_check: Identifier to look for in current
		users UAF entry.
		(passed, character*(*))


4 DEVOWNER

 DESCRIPTION: Utilizes the system service 
	SYS$GETDVI to obtain the owner's PID 
	(process identification code) of a 
	specific device.

    FORTRAN call:  call DEVOWNER(devpid,devnam)

 PARAMETERS:

	devnam: Device name or device logical name.
		(passed, character*6)
	devpid: Owner's pid   
		(returned,integer*4) 

 SUBROUTINES REQUIRED:  VAX Systems Services.


4 GETPID
 DESCRIPTION: This routine utilizes VAX 
	system services to obtain the 
	calling process's PID.

  example call:  call GETPID(pid)

 PARAMETERS:

	pid: Current process's Process 
		Identification Code. 
		(returned, integer*4)

 SUBROUTINES REQUIRED:   VAX System Services.
      
                  
4 GET_USERINFO    
	
 DESCRIPTION:  Subroutine to return 
	current process information.

	FORTRAN call:  call GET_USERINFO

     You MUST include the following common block:

    common /USERINFO/ user_name, process_name

     If you need the lengths of the data 
 include the following common block:

  common /USERINFO_LENGTHS/ name_len, process_len

 Where:
	user_name:  User name string.
		(returned,character*12)
	process_name: Name of the current process.
		(returned,character*15)

   All of the returned string lengths are INTEGER*2.


 SUBROUTINES REQUIRED:  System Services



4 GET_USERNAME

 DESCRIPTION: This routine returns the USERNAME 
	of the current process.

   FORTRAN call:  call GET_USERNAME(username,length)

 PARAMETERS:

	username: "username" of the current process.
		(character*(*),returned)
	length: Length of username.
		(integer*2,returned)

 SUBROUTINES REQUIRED: none

 
4 JOBMODE

 DESCRIPTION:  Subroutine JOBMODE is similar 
	to the VAX subroutine JOBTYP.
	This subroutine utilizes the VAX 
	Run Time Library routine, LIB$GETJPI.  
	It passes back an 11-character string 
	which, depending on the mode of the 
	job currently being run, is BATCH, 
	NETWORK, or INTERACTIVE.

	example call:  call JOBMODE(mode)

 PARAMETERS: 
	mode: Contains one of the following strings
		"BATCH"
		"NETWORK"
		"INTERACTIVE"
		(character*11,returned)

 SUBROUTINES REQUIRED:  none
 

4 JOBTYP

 DESCRIPTION: Subroutine JOBTYP is the VAX 
	version of the UNIVAC subroutine 
	with the same name.  It utilizes the 
	VAX system service, SYS$GETJPI.  
	Subroutine JOBTYP passes back the 
	logical variable DEMAND which is set 
	to true if the job currently being 
	run is interactive or false if the 
	job currently being run is not interactive.

	example call:  call JOBTYP(demand)

 PARAMETERS:
	demand: TRUE if the job is demand,
		   otherwise is FALSE.
		(logical,returned)
                            
 SUBROUTINES REQUIRED:   none
 

4 SET_PROCESSNAME

     This routine will set the current process 
 name to the one specified.

  FORTRAN call:   call SET_PROCESSNAME(pname)

 WHERE:  pname: New name for the current process.
		(passed,character*(*))

	The length of PNAME is subject to 
		the system maximum.


!*** CHART_MAKING ***
  
3 Chart_Making

        These routines are used in chart making.


4 BORDER

 DESCRIPTION:  Subroutine BORDER is used by 
	the Low Frequency data 	processing 
 	system to draw chart boundaries, axes, 
	and labels for CALCOMP plotting routines.  

	   This subroutine will not correctly 
	label partial degrees.

  example call: subroutine BORDER (scale,rlonw,
			rlone,rlats,rlatn,latstp,
			lonstp,title,tics,class,
			coast,label)

 PARAMETERS:

	scale: Chart scale in inches per degree 
		longitude.
	rlonw: Leftmost longitude in degrees.
	rlone: Rightmost longitude in degrees.
	rlats: Lower latitude in degrees.
	rlatn: Upper latitude in degrees.
	latstp: Labeling increment for latitude.
	lonstp: Labeling increment for longitude.
	title: 72 character chart title.
	tics: 'TICS' if tics are required.
		Note: Tics are at 5 minute intervals 
		if labeling increment is equal to 1. 
		Otherwise, tic marks are for each 
		degree.
	class: Chart classification (ex: 'SECRET').
	coast: 'COAST' for WDBII coastline.
	label: '360' for 0 - 360 labels on lower axis.

   SCALE, RLONW, RLONE, RLATN, RLATS, LATSTP, LONSTP 
	are all real*4.

 SUBROUTINES REQUIRED:
	YMP is required for meridional parts conversion.
	CALCOMP library: use the logical name 
		CALCOMP_LIB to link program.


4 CALCIA

 DESCRIPTION: Subroutine CALCIA plots WDBII coastlines
		for VERSATEC or CALCOMP graphics packages
		on any VAX-11.
	     More information about the WDBII plotting
		system (UNIVAC based) may be found in the
		NAVOCEANO technical note, "A New Technique
		For Storing And Accessing The WDBII Coastline",
		TN 8300-03-82 by Jan C. Depner & James A.
		Hammack.

		*** example call ***

	call CALCIA (slatd,slatm,nlatd,nlatm,wlond,wlonm,
		elond,elonm,xoffset,yoffset,scale,gap)

	call CALCIA (20.5,0.,30.,0.,165.,0.,175.,0.,0.,0.,1.,1.)


 PARAMETERS:	slatd: Latitude degrees minimum.
		slatm: Latitude minutes minimum.
		nlatd: Latitude degrees maximum.
		nlatm: Latitude minutes maximum.
		wlond: Longitude degrees minimum.
		wlonm: Longitude minutes minimum.
		elond: Longitude degrees maximum.
		elonm: Longitude minutes maximum.
		xoffset: X offset in inches.
		yoffset: Y offset in inches.
		scale: Scale in inches per degree.
		gap: Increment for plotting.
			(every 'gap' points)

	*** NOTE ***   All arguments are passed as REAL*4.

	Latitude and longitude may be passed as decimal
	   degrees with the minutes portion as zero.
	Longitudes may be +-180 or 0-360.  They may wrap 
	   around to 720 if necessary.

 SUBROUTINES REQUIRED:
	YMP to convert latitudes for mercator 
		projection. 
	A similar function may be substituted 
		for other projections.


4 CHBND

     This subroutine takes a nine character 
 ASCII chart name and returns the lower left 
 and upper right corner positions in degrees 
 and the chart scale.

 A chart scale of 0 is returned for invalid input.

	example call: 

 call CHBND(chart_num,lllat,lllon,urlat,urlon,ps_scale)

  chart_num: BN Chart number in characters.
		(example: 0705-1111) 
		(passed,character*9)
  lllat: Lower left corner latitude.
		(returned,real*4)
  lllon: Lower left corner longitude.
		(returned,real*4)
  urlat: Upper right corner latitude.
		(returned,real*4)
  urlon: Upper right corner longitude.
		(returned,real*4)
  ps_scale: PS chart scale (4,8,16,32,64).
		(returned,integer*4)


 SUBROUTINE REQUIRED: none


4 DEGRAD

 DESCRIPTION: This routine converts degrees and 
	minutes to radians.

	example call:  call DEGRAD(0,degs,0,0,rads)

    This converts "degs" in decimal degrees to radians.

	example call:  call DEGRAD(1,0,idegs,mins,rads)

    This converts "idegs" in integer degrees and "mins"
		in decimal degrees to radians.

 PARAMETERS:

	code: How to convert the input...
 		(passed,integer*4)
	0--convert floating degrees to radians.
	1--convert fixed degrees and floating 
		minutes to radians.

	degs: Degrees of latitude or longitude.
		(passed,real*4)
 	idegs: Degrees of latitude or longitude.
		(passed,integer*4)
	mins: Minutes of latitude or longitude.
		(passed,real*4)
	rads: Latitude or longitude in radians.
		(returned,real*4)

 SUBROUTINES REQUIRED:   None.


4 GEOBATH

     This routine gives geoid height and 
 bathymetry for a lat and lon.  Coordinates 
 can be total minutes (360 or 180).  Minutes 
 can be absolute or signed.

     Assigns bathmetry file: 

  DISK$USER:[SECRET.SHARED]GEOID_BATH.DAT

	   on unit 11.

	example call:  

  call GEOBATH(latd,latm,lond,lonm,geoid,bath)

  latd: Latitude degrees of lower left corner.
		(passed,integer*4)
  latm: Latitude minutes of lower left corner.
 		(passed,integer*4)
  lond: Longitude degrees of lower left corner.
		(passed,integer*4)
  lonm: Longitude minutes of lower left corner.
		(passed,integer*4)
  geoid: Geoid height in meters.
		(returned,real*4)
  bath: Bathymetry in meters.
		(passed,integer*4)

    TO READ A 5 DEG X 5 DEG ARRAY
 PUT THE FOLLOWING IN CALLING PROGRAM

	dimension barray(3712)
	common /FREDA/ barray


4 LANDMASK

     Subroutine LANDMASK reads data from 
 the file: LANDMASK.DAT in GRAVLIB$GENERAL. 
 It returns a value of 1 or 0 depending on 
 whether the whether the data in the specified 
 area is land or water.

	example call: 

  call LANDMASK(dlatd,dlatm,dlond,dlonm,mask)

  dlatd: Degree latitude requested.
		(passed,real*4)
  dlatm: Minute latitude requested.
		(passed,real*4)
  dlond: degree longitude requested.
		(passed,real*4)
  dlonm:  minute longitude requested
		(passed,real*4)
  imask:  equals 1 if the requested record is land.
	equals 0 if the requested record is water.
		(returned,integer*4)


 SUBROUTINES REQUIRED:   none


4 MAPDEX

     This routine computes the BNC chart 
 number from latitude and longitude.  The
 chart number is a PS-16 number.

 FORTRAN call:  call MAPDEX(dlat,dlon,iew,ns,jsss)

 Where:

     dlat: Latitude in decimal degrees.
		(passed,double precision)

     dlon: Longitude in decimal degrees.
		(passed,double precision)

      iew: East/West component of the chart number.
		(returned,integer*4)

      ins: North/South component of the chart number.
		(returned,integer*4)

     jsss: Last four digits of the chart number.
		(returned,integer*4)


     The PS-4 component of the chart number is computed
 as follows:  IEW * 100 + NS.


      SUBROUTINE REQUIRED: none


4 RADDEG

 DESCRIPTION: This routine converts radians to 
	degrees and minutes of latitude or 
	longitude.

    example call:  call RADDEG(0,rads,degs,0,0)

    This converts "rads" in radians to 
		decimal degrees.

    example call:  call RADDEG(1,rads,0,idegs,mins)

    This converts "rads" in radians to integer 
		degrees and decimal minutes.

 PARAMETERS:

	code: how to convert the input
	0--convert radians to floating degrees.
	1--convert radians to fixed degrees and 
		floating minutes.

	rads: Latitude or longitude in radians.
		(passed,real*4)
	degs: degrees of latitude or longitude.
		(returned,real*4)
	idegs: degrees of latitude or longitude.
		(returned,integer*4)
	mins: minutes of latitude or longitude.
		(returned,real*4)

 SUBROUTINES REQUIRED:  None.


4 YMP

 DESCRIPTION: This function converts latitude 
	(decimal minutes)to meridianal parts.  

	example call:  ymplat = YMP(y)

 PARAMETERS:  y: latitude in decimal minutes
		(passed,real*4)

   The meridional parts is returned thru the 
	function name.

 SUBROUTINES REQUIRED:   None.




!*** LOGICAL_NAMES ***

3 Logical_Names

4 CREATE_LOGNAME

     This routine creates the specified logical
 name association in the specified logical name 
 table.  For more information see the System 
 Services manual.

	FORTRAN call:  

   call CREATE_LOGNAME(*100,lognam,equivnam,table)

   return1: Unable to create logical name association.

   lognam: Logical name.
		(passed,character*(*))
   equivnam: Equivalence name.
		(passed,character*(*))
   table: Table to place the logical name in.
		(passed,character*(*))


 SUBROUTINES REQUIRED:  STRING_LENGTH, System Services.


4 TRAN_LOGNAME

     This routine translates a logical name 
 until it finally locates the base equivalent 
 name.  By default the following logical name 
 tables are searched in this order: LNM$PROCESS,
 LNM$JOB, LNM$GROUP, LNM$SYSTEM.  
 
	FORTRAN call:   

 call TRAN_LOGNAME(*100,logname,equivname,equivlen,table)


  return1: No logical name translation found.

  logname: Logical name to be translated.
		(passed,character*(*))
  equivname: Logical name equivalence.
		(returned,character*(*))
  equivlen: Length of equivalent name.
		(returned,integer*2)
  table: Table to search for logical name.
		(passed,character*(*))
		If blank then the tables are
		searched in the default order...
		else, only the specified table
		is searched.

 SUBROUTINES REQUIRED: STRING_LENGTH, System Services


!*** OTHER_STUFF ***

3 Other_Stuff           

		These are miscellaneous routines.


4 ARGCNT
     This routine returns the number of 
 arguments passed to the previously called 
 subroutine.  The call to ARGCNT must 
 immediately follow the subroutine statement 
 or as soon as possible.
      
	FORTRAN CALL:  call ARGCNT(numargs)

    numargs: number of arguments passed to subroutine.
		(integer*2,returned)

	example use:

	subroutine sub1(n1,n2,n3...nn)
		. . . . . . . 
	call ARGCNT(numargs)


 ******************* WARNING ********************
 * This will not work if the skipped argument   *
 * is typed CHARACTER in the subroutine that    *
 * calls ARGCNT.   				*
 ************************************************

 SUBROUTINES REQUIRED:   none


4 ASCFAD

   Function to convert an ASCII doublet 
		to an ASCII string.

	FORTRAN call:   = ASCFAD(ad)     

    The function must be typed to CHARACTER*4.


	ad:  ASCII doublet to be converted.
		(passed, integer*4)

 *** See the VAX  system manager for addition assistance. ***


4 BSET_Q

     This routine sets the specified bit of the 
 quadword.  The following example sets the 35th 
 bit of the passed quadword.

	FORTRAN call:	status = BSET_Q(qword,35)

     BSET_Q is a logical function.  Status is 
 always set to TRUE.


4 BTEST_Q

     This routine returns TRUE if the specified bit of 
 the quadword is set.  The following example tests the 
 35th bit of the passed quadword.

	FORTRAN call:	status = BTEST_Q(qword,35)

     BTEST_Q is a logical function.


4 CLEAR

 This routine loads the passed array with zeros.

 There are four clear routines, CLEAR4, CLEAR2,
		CLEAR4_REST and CLEAR2D2.

      No subroutines are required.

 CLEAR4
 ------

    example call: call CLEAR4(array,256)

	array: The array to be zeroed.
 	(passed and returned,integer*4,variable length)
       
	size: The size of the array to be zeroed.
		(passed,integer*4)

 CLEAR2
 ------

    example call: call CLEAR2(array,256)

	array: The array to be zeroed.
	(passed and returned,integer*2,variable length)
                                                           
	size: The size of the array to be zeroed.
		(passed,integer*2)

 CLEAR4_REST
 -----------

     This routine will fill, with zero's, an array
 that has only been partially filled with data.

   example call:  call CLEAR4_REST(array,start,end)

	array: Name of array to be filled.
		(passed,integer*4)

	start: Point at which zero filling is to begin.
		(passed,integer*4)

	end: Size of array to be filled, end of zero fill.
		(passed,integer*4)


 CLEAR2D2
 --------

     example call: call CLEAR2D2(array,256)

	array: The two dimensional array to be zeroed.
	(passed and returned,integer*2,variable length)
                                                           
	size: The size of the array to be zeroed.
		(passed,integer*4)

     This routine clears both dimensions of the array.


4 DOUB

 DESCRIPTION: VAX double precision number from 
		UNIVAC double precision. 

   This is the real conversion routine butchered by 
	Steve Lingsch to handle double precision.
	
	NOTE: this routine and the calling routine 
	must be compiled with the /G_FLOAT option.

   The function name must be typed double precision.

	example call:       = DOUB(sd, low, ier )

 PARAMETERS:

   The argument 'sd' must be in the same form as
 in the real function (see RFRD).  The argument
 'low' is bits 33-36 of the first UNIVAC word and
 the remaining bits are bits 1-28 of the second 
 UNIVAC word.

	(1,1)              (2,1)
      ***************************************
      *                   *                 *
 sd   * higher end of     *  lower end of   *
      *  UNIVAC bits      *   UNIVAC bits   *
      *    1-18           *     19-32       *
      ***************************************

      ***************************************
      *       *                             *
 low  * 33-36 *            1-28             *
      *       *                             *
      ***************************************
      


4 ENABLE_CTRLY

 DESCRIPTION: This subroutine enables control Y 
	interrupts that were disabled by 
	ENABLE_CTRLY_AST.


	FORTRAN call:  call ENABLE_CTRLY


 PARAMETERS:  none


 SUBROUTINES REQUIRED: System Services


4 ENABLE_CTRLY_AST
 DESCRIPTION: This subroutine disables CONTROL_Y 
		interrupts and enables a CONTROL_Y 
		attention AST for the terminal.  

  FORTRAN call:  call ENABLE_CTRLY_AST(ttchan,routine,arg)

 PARAMETERS:

	ttchan: Channel number of terminal to 
		disable Control_Y on.
			(passed,integer*2)

	routine: Routine to be executed upon CTRL_Y. 
		 The routine name MUST be EXTERNALed.
			(passed,integer*4)

	arg: Argument that will be passed to ROUTINE.  
		This MUST be passed, however it can be
		a dummy variable.  It need not be used.
			(passed,integer*4)

 SUBROUTINES REQUIRED: System Services

  
4 FILESPECS

      This routine parses a file specification 
 into its basic parts.  Any parts of the 
 specification that are missing are filled in 
 with the current defaults. The entire file 
 specification is returned in "fullfilespec".
     The "flags" argument returns a bit set for
 each element of the file specification found
 in the argument "filespec".


 FORTRAN call:  call FILESPECS(*9000,filespec,node,
			device,root,dir,fname,type,
			vers,fullfilespec,flags)

 Where:                                        
      return1: Error in passed file specification.

     filespec: File specification to parse.
		(passed, character*(*))
         node: Node the file is on.
		(returned, character*(*))
       device: Physical device the file is on.
		(returned, character*(*))
         root: Root directory of the file.
		(returned, character*(*))
    directory: Directory the file is in. 
     		(returned, character*(*))
        fname: Name of file.
		(returned, character*(*))
         type: File type.
		(returned, character*(*))
         vers: File version.
		(returned, character*(*))
 fullfilespec: Complete file specification.
  		(returned, character*(*))
        flags: Indicates which parts of the output
		specification were in the input
		file specifcation.  
		(returned, integer*4)

		BIT   MEANING
		 0     node
		 1     device
		 2     root directory
	 	 3     directory
		 4     file name
		 5     file type
		 6     version

		Please see the SYSTEM SERVICES manual 
		($FILESCAN) for more information on 
		these flags.

  SUBROUTINES REQUIRED: LIB$FILE_FILE, SYS$FILESCAN

4 FLIP
      
 DESCRIPTION: This routine flips the bytes 
	in an INTEGER*2 word or INTEGER*4 
	longword.
      
   FORTRAN CALL:  call FLIP(in,nchars,out)

 PARAMETERS:
             
     in: Input array or character string.
	(integer*2, (*4), or character string, passed)
     nchars: Number of characters or bytes in "IN".
	(integer*2, passed)
     out: Output array or character string.
	(integer*2, (*4), or character string, returned)
 
      
 SUBROUTINES REQUIRED:   none
      
   This routine is used by the Calcomp SYMBOL.


  ***** There are two versions of FLIP *****

  MPLIB library contains the INTEGER*4 version         

  CALCOMP library contains the INTEGER*2 version        


4 GET_ELEMENT

     GET_ELEMENT returns one element at a time
 of a delimited string.

 FORTRAN call:   call GET_ELEMENT(*100,element,
			string,delimiter,context)


 WHERE:	return1: No more elements in STRING.
		(returned,character*(*))

        element: Element of string.
		(returned,character*(*))

        string: String of elements separated by
		   delimiters.
		(passed,character*(*))

        delimiter: Element separator.
		(returned,character*1)

	context: Number of ELEMENT's returned.
		(Must be zero on first call)
		(modified,integer*2)



4 GET_SPEED

     GET_SPEED returns the current SYS$INPUT
 terminal baud rates.

 FORTRAN call:   call GET_SPEED(rspeed,tspeed)


 WHERE:  rspeed: Receive baud rate.
		(returned,integer*2)

         tspeed: Transmit baud rate.
		(returned,integer*2)


4 GET_TERMTYPE 

     This routine returns the type of 
 terminal currently in use for SYS$INPUT.  
 If SYS$INPUT is part of a batch job or 
 not a terminal then -1 is returned.

    FORTRAN call:  call GET_TERMTYPE (type)

 PARAMETERS:

	type: Type of terminal currently in 
		use by SYS$INPUT.
		(integer*2,returned)

	See $TTDEF in SYS$LIBRARY:FORSYSDEF.TLB 
		for numerical equivalents.

    VT_240 is not currently supported in $TTDEF so...
      GET_TERMTYPE returns the value 120 for VT240.


 SUBROUTINES REQUIRED: none


4 IFID

 DESCRIPTION: VAX integer from UNIVAC integer doublet.

     The function IFID converts a UNIVAC one's 
 compliment integer to a VAX two's compliment 
 integer.  The function expects the first 18 
 bits (lower end of the word) in the first 
 18 bits of 'sh(2,1)' and the higher end of 
 the word in the first 18 bits of 'sh(1,1)'.
	
  The function must be typed as integer.

	FORTRAN call:     = IFID(sd,iover)
 
 PARAMETERS:

     sd:  
	(passed, integer*4, dimensioned to (2,1))

     iover:   
	(returned,


4 JULMIN            

 DESCRIPTION:  This subroutine converts day, 
	hours, and minutes to julian minutes.
	

  Entry JULMIN:      call JULMIN(day,hr,min,jmin)
  
	day:   julian day 
		(passed,integer*4)
	hr:   hour 
		(passed,integer*4)
	mins:   minutes 
		(passed,integer*4)
	jmin:  julian minutes 
		(returned,integer*4)


  Entry JLMIN1	   call JLMIN1(day,hrmin,jmin)

	jmin and day are the same as for JULMIN.

	hrmin:  hours and minutes combined
		(passed,integer*4)

4JULSEC
      
 DESCRIPTION: This routine has two entry points.
         
	JULSEC: converts day,hours,minutes,seconds 
		to julian seconds.
      
   example call: call JULSEC(day,hour,min,sec,time)


  SECJUL: converts julian seconds to day,hours,minutes
                       and seconds.

   example call: call SECJUL(time,day,hour,min,sec)

      
 PARAMETERS:
      
	entry point JULSEC:
      
	day: Julian day 
		(passed,integer*4)
	hour: Two digit hour 
		(passed,integer*4)
	minutes: Two digit minutes 
		(passed,integer*4)
	seconds: Two digit seconds 
		(passed,integer*4)
	time: Julian seconds 
		(returned,integer*4)
      
      
	entry point SECJUL:
      
	time: Julian seconds 
		(passed,integer*4)
	day: Julian day 
		(returned,integer*4)
	hour: Two digit hour 
		(returned,integer*4)
	minutes: Two digit minutes 
		(returned,integer*4)
	seconds: Two digit seconds 
		(returned,integer*4)

 SUBROUTINES REQUIRED: none
      

4 MINJUL            

 DESCRIPTION:  This subroutine converts minutes to  
		julian day, hours and minutes.

  Entry MINJUL:      call MINJUL(jmin,day,hr,min)

	    jmin:  julian minutes 
		(passed,integer*4)

	    day:  julian day 
		(returned,integer*4)

	    hr:  hour 
		(returned,integer*4)

	    mins:  minutes 
		(returned,integer*4)


  Entry MINJL1	   call MINJL1(jmin,day,hrmin)
  
	    jmin and day are the same as for MINJUL.

	    hrmin:  hours and minutes combined
		(returned,integer*4)


4 MVBITS


 This is the FORTRAN library function MoVe BITS.

 This routine transfers a bit field from one 
	storage location to another.

  FORTRAN call: call MVBITS(in,in_start,in_len,out,out_start)

  in: Name of source location.

  in_start: First bit position of "in" to be transfered.

  in_len: Number of bits to be moved from "in" starting 
			at "in_start".

  out: Name of destination location.

  out_start: Location of first bit transfered from "in".


	Bits are numbered right to left (32-0).


4 RFRD

 DESCRIPTION: VAX real number from UNIVAC real doublet.

  'sd' is assumed to be a two dimensional i*4 array
  dimensioned (2,1).  The higer end of the UNIVAC
  real is stored in 'sd(1,1)', and the lower end 
  (least significant) is stored in 'sd(2,1)'.

	ex: set up in the calling routine

   call MVBITS(univac,18,14,sh(1,1),0)
   call MVBITS(univac,0,14,sh(2,1),4)

  In this example the tape is written quarter word 
  sensitive on the UNIVAC therefor only 32 bits
  of the UNIVAC real are transfered.  
  if all 36 bits were transfered the two words 
  would be set up so that sd(2,1) would contain
  all 18 bits in the lower end of the word.

	The function must be typed REAL.

	example call:        = RFRD(sd,ier)


  See the VAX manager for additional assistance.


4 SNDOPR

     This routine sends a user specified message
 to the CENTRAL operator console and to the 
 file OPERATOR.LOG.

	FORTRAN call: call SNDOPR(message)

 WHERE:   message: Message to send.  

	The message can be up to 255 characters
 long.  Any carriage control MUST be imbedded in
 the message text by the user.


4 STRIPD

 DESCRIPTION: This routine strips the descriptor off 
	the character string.  Thus, making an integer 
	array containing a Hollerith string(s).
  
	FORTRAN CALL:  call STRIPD(in,nchars,out)
  
 PARAMETERS:
         
    in: Input array or character string.
 	(passed,integer*2, or character string)

  nchars: Number of characters or bytes in "IN".
	(passed,integer*4)
  
  out: Output array.
	(returned,integer*2)
  

4 USER_DIRECTORY

	This program will provide a formatted directory	listing 
	of names only.  USER_DIRECTORY is designed to be used
	as a foreign commmand.  The command line passes both the
	directory wild card search string, and the title to display
	if any files are found.

	USER_DIRECTORY  Search_String[|"Title...Title....Title"]

	Note that the leading " and the trailing " in the title line
	are required if a title is present. The title is optional.

	The display is set to 

			Title...Title...Title
	
	File1		File2		File3		File4
	File5		File6		File7		File8
	File9		File10		file11		File12


4 WAIT

	This a description of the RTL function LIB$WAIT.  

		To use this make sure that: 

		1) LIB$WAIT is integer*4.
		2) That the value passed to LIB$WAIT is a floating
				point number.
 			
	example call: call LIB$WAIT(5.0)   ! This waits five seconds.


4 YES_OR_NO
     This routine tests the specified string
 for YES of NO.  If the first character of
 the string is 'Y' then the answer is YES.
 If the first character of the string is 'N'
 then the answer is NO.

     FORTRAN call:  call YES_OR_NO(*1,*2,*3,ans)

 WHERE: return1: The answer is YES. 

	return2: The answer is NO.

	return3: The answer is neither YES 
			nor NO.
	ans:  String to test.
		(passed, character*(*))


!*** SPECIAL_E&S ***
                                            
3 Special_E&S

	These routines are specific to E&S.
 
4 DIRECTORY 
 E & S Directory Routines

     This module is a general menu routine 
 for use on E & S terminals.  It enables the 
 user to put custom data entry menus up on 
 the screen.  There are five routines in 
 this module:

	1) BUILD_DIRECTORY
	2) READ_DIRECTORY
	3) LIST_DIRECTORY
	4) HIT_DIRECTORY
	5) CLEAR_BUFFER

     BUILD_DIRECTORY creates the menu box 
 and prints the headers.  BUILD_DIRECTORY 
 calls READ_DIRECTORY to load the user 
 accessible array FILES with the filenames 
 from the specified directory.
 
     HIT_DIRECTORY returns a pointer into 
 the array FILES corresponding to the element 
 hit on the menu.  There are two special menu 
 locations (SCROLL UP and SCROLL DOWN) that 
 scroll the menu.  These can be disabled by 
 loading HEAD1 and HEAD2 with blanks.

     LIST_DIRECTORY displays the array FILES 
 in either static or blinking mode.

     READ_DIRECTORY reads and stores all of 
 the files of the directory being processed
 in the array FILES.  Up to 100 files can
 be stored in this array.  If the directory
 can not be found an error message will be
 printed and control returned to the caller.
 READ_DIRECTORY is called after BUILD_DIRECTORY
 and before LIST_DIRECTORY.

     CLEAR_BUFFER blanks out the entire FILES 
 array.  It should be used before the array 
 FILES is loaded by the user.

     You can use these routines to build 
 a list of files in a directory or you can 
 create your own menu.
     To create your own menu (this can be 
 a list of anything) you must load the 
 array FILES with the data you want displayed.
     The variable num_files MUST contain the 
 number of entries in FILES.  Next call the 
 directory routines in the following order:

	BUILD_DIRECTORY
	READ_DIRECTORY
	LIST_DIRECTORY
	HIT_DIRECTORY
   and optionally CLEAR_BUFFER

5 BUILD_DIRECTORY
 FORTRAN call:  call BUILD_DIRECTORY(segment,search,title)

 WHERE:	segment: Segment number for display.
		(passed,integer*2)
        search: Directory to be displayed.  This can
		include wildcard characters.
		(passed,character*(*))
	title: Title to be placed at the top of the menu.
		(passed,character*(*))

     The following are common blocks that are REQUIRED.

	common /FILELIST/ files, num_files
	common /HEADING/ head1, head2

 WHERE:	files: List of up to 100 files (or any entries)
		to be displayed by LIST_DIRECTORY.
		BUILD_DIRECTORY loads this with the 
		files corresponding to the SEARCH 
		argument.  
			(common,character*80(100))
	num_files: Number of entries in FILES.
			(common,integer*2)
	head1, head2: Two heading lines above the list
		of menu items (files).  Normally these
		are used for SCROLL UP and SCROLL DOWN.
		However, you may use them for other 
		functions if you wish.  To disable them
		load them with blanks.
			(common,character*12)
		

5 CLEAR_BUFFER
     This is an optional function.  It will clear the 
 array FILES.  This is done by BUILD_DIRECTORY.  
     The user should do this before loading the 
 array FILES.

		call CLEAR_BUFFER


5 HIT_DIRECTORY
	call HIT_DIRECTORY(*10,*20,segment,ret_pointer)
        
 WHERE:	return1: Up or Down scroll.  This return is 
		taken as long as HEAD1 or HEAD2 is NOT
		disabled with blanks.
	return2: Menu was not hit.
	segment: Segment number for display.  MUST be the
		same as in BUILD_DIRECTORY.
			(passed,integer*2)
	ret_pointer: Entry in FILES that was hit.
			(passed,integer*2)


5 LIST_DIRECTORY
	call LIST_DIRECTORY(segment,function,element)

 WHERE:	segment: Segment number for display.  MUST be the
		same as in BUILD_DIRECTORY.
			(passed,integer*2)
        function: Function to be performed.
		   0: Blank segments
		   1: Blink list entry
		   2: Display original list
		   3: Delete segments
		   	(passed,integer*2)
	element: Pointer to entry in FILES selected
		by HIT_DIRECTORY.  Used to blink an 
		entry in the display list.  (When
		LIST_DIRECTORY is first called to
		display a menu a zero is passed here)
			(passed,integer*2)

5 READ_DIRECTORY
	call READ_DIRECTORY(*)

 WHERE: return1: Error on read of directory.


4 MPS_TEXT
    This routine performs the function of the 
 MPS function "CTEXT".  Using this routine 
 eliminates the need for the user to know the 
 length of the string to be output to the screen.
    This routine also takes care of positioning 
 the text.

 FORTRAN call: call MPS_TEXT(string,x,y)

 WHERE:	string: Text to be placed at X and Y 
		on the screen.
			(passed,character*(*))
	x, y: Coordinates to place STRING at.
			(passed,integer*2)


4 PREVIEW

     Using this module will allow CALCOMP or 
 VERSATEC plots to be displayed on Evans and 
 Sutherland MPS terminals.

     Use the symbol MPS_PREVIEW followed by 
 CALCOMP_LIB/LIB when linking.

 Ex: link user_program,mps_preview,calcomp_lib/lib


4 TEXT_WINDOW
     This routine is used to display text in 
 a user specified segment on an E & S terminal.

 FORTRAN call:	call TEXT_WINDOW(string,seg,x,y,blink)

 PARAMETERS:
	string:  Text to be displayed on E & S terminal.
			(passed,character*(*))
	seg:  Segment number to display text.
			(passed,integer*2)
	x,y:  E & S coordinate location of the text.
			(passed,integer*2)
	blink: Switch to set blinking mode for text.
			(passed,logical*1)

 SUBROUTINES REQUIRED:  MPS Routines, MPS_TEXT


