Subroutine RDQDP

Next: Subroutine PLT Up: Fortran interface Previous: Programming PLT

Subroutine RDQDP

The calling sequence for the RDQDP subroutine is:

      REAL      Y(MXPTS)
C Opens and reads a QDP file.
C ICHAT     I    >10 means print comment lines, >0 print row/col info.
C LUNIN     I    <>0 means file already open on LUN.
C CNAM      I/O  File name.
C Y           O  The data array
C MXPTS     I    The actual size of the Y array.
C IERY        O  The PLT error flag array
C MXVEC     I    The actual size of the IERY array
C NROW        O  Maximum number of rows that the file could contain.
C NPTS,NVEC   O  Needed by PLT
C CMD         O  Command array (MXCMD input dimension).
C NCMD        O  Number of commands read
C IER         O  =-1 if user entered EOF, =0 file read, =1 no file read.

There are several ways to specify a file to be read by RDQDP. RDQDP will go through the following steps to determine what file to read. Once a file has been determined the remaining steps will be skipped. Specifically RDQDP will do the following:

  • If the variable LUNIN is non-zero then RDQDP will assume that the input file has already been opened and is attached to the specified unit number.

  • If the variable CNAM is non-blank, then RDQDP opens a file with the specified name.

  • At this point it is necessary to obtain a file name from an external source and the parser is called to handle this. If this is the first time the parser has been called in the current program, an attempt will be made to read the command line. If a QDP file name is found on the command line, then that file is opened.

  • If no file name could be found, or the file could not be opened, then RDQDP will prompt the user for an input file name. If the user enters an end-of-file (^Z under VMS, or /* under all systems), then RDQDP will exit with IER=-1. If the user enters a blank line for the file name, RDQDP will exit IER>0. Of course, if the user enters a valid file name, then that file is opened, and IER will return a value of 0.

Once a file has been opened, and if MXCMD>1, RDQDP will add a LAbel F command to the CMD array that contains the name of the file actually opened. Of course, if the file contains a LAbel F command, then that command will overwrite the label that RDQDP creates.

ICHAT is the `chatter' flag. If ICHAT>10 then RDQDP will display lines that have ! in the first column, on your terminal screen. Displaying these lines, provides a useful way to confirm that RDQDP has opened the correct file. Such comment lines are completely ignored, and the comments will be removed from any other line containing a comment. RDQDP examines the beginning of each line and if the line contains a QDP command, RDQDP proceeds to interpret the command and set the appropriate variables to be passed to PLT. If the line starts with a PLT command and NCMD<MXCMD, then RDQDP will increment NCMD and add the line to the CMD array. For lines containing data, RDQDP interprets the line into real numbers and stores these numbers in the Y array.

The RDQDP routine does not open and read any indirect command files, but just stores the command in the CMD array. Therefore you cannot use an indirect command file to contain the data array. Since the calling program determines the size of the CMD array it is sometimes useful to store all PLT commands in an indirect command file and to add one line to the QDP file to read the indirect file. When PLT reads an read indirect file it will accept command lines up to 250 characters long, and there is no limit on the number of lines that can be read.

When RDQDP reads the first data line, it determines the number of columns in that line. Based on this number of columns, and the size of MXPTS passed in, RDQDP proceeds to calculate the maximum number of rows that would fit into the Y array. If the ICHAT>0, RDQDP will then display on the terminal, the number of columns, the numbers of vectors (calculated from the data from in any READ lines), and the maximum number of rows.

next up previous contents
Next: Subroutine PLT Up: Fortran interface Previous: Programming PLT

Web Page Maintained by: Dr. Lawrence E. Brown