Indiana University of Pennsylvania
Computer Science Department
CO110 Spring 1984
McKelvey and Wolfe

              
           Programming Project #4

    For project four you are to write a program to produce a graphical profile of a patient's blood based on a number of analytical tests.  Test values which are exceptionally low or high compared with the average expected results are to be reported also.  The actual number of tests may change from one run of the program to another, but you may assume that the number of tests is at most 50.

    The data to be used by your program is contained in a file on the COMPSCI account, you will not have to type it.  In order to access this file with your program, you must place the following FORTRAN statement near the beginning of your program before any READ* statements are reached.

    OPEN(105,FILE='110-BLOOD-TESTS.COMPSCI',USAGE='INPUT,SHARED')

    The first data record contains a pair of integers, the count of the number of tests for this run of the program and the number of patients.  Each patient has the same number of tests.

    Beginning on the second record, there follows a list of character strings and pairs of real numbers.  Each string, at most 20 characters in length, is the name of the blood constituent which is analyzed in a particular test.  The pair of real numbers on the same record represents:  first, the average expected value for this constituent and second, the tolerance range allowed for this constituent in a normal blood sample.  For example the following record might appear.

         'Phosphorous'  29.8   2.3

There is one of these records for each test.

    The rest of the data consists of sets of patient information, each beginning on a new record.  One set is comprised of the following items:  the name of the patient's doctor, the patient's name, two address fields and the list of his, real number, test results.  The number of test results on one record will vary from record to the next.

    Your program must produce a formatted report of each patient as described in the layout below.  The comments between < and >'s are there to describe spacing.  Placement of character variables is indicated by strings of X's, numeric variables by strings of d's with a decimal point and variable length strings of *'s are indicated by strings of *'s.  All other characters are required headings and titles to be used exactly as shown in your report.

<top of page>            IUP ANALYTICAL SERVICE
                        <column 29>
<3 blank lines>

<column 5>                            <column 50>
Patient:  XX...X                      Physician:  XX...X
Address:  XX...X
         XX...X

<2 blank lines>

                        <column 34>
                        Blood Profile
<1 blank line>

      <column 12> <column 30>  <column 45>
      Test        % of Normal  85   90   95  100  105  110  115
      ----        -----------  |----|----|----|----|----|----|
1  XX...X            ddd.d     |*************
2  XX...X            ddd.d     |*****
...  ...               ...         ...

<2 blank lines>

<column 5>
You should consult your physician concerning the results of each
of the following tests of your blood:

<1 blank line>

<column 5>            <column 30>        <column 55>
XX...X                XX...X             XX...X
...                   ...

                             <or>

All of your test results lie within the normal range of the
average expected readings.

________________________________________________________________


    Your program must perform several computations in order to produce the report.  Each test result must be converted to a percentage based on the average result for the same test.

              Patient Result
         ------------------------ * 100 = % of Normal
          Average Expected Value

If the rounded integer percentage of the above computation is greater than 85 then the program must print one asterisk on the graph at the right for each percentage point greater than 85 and less than or equal to 115.  For example, with 96.7%, print 12 *'s; with 120 % print 30 *'s, no extra *'s for values greater than 115;  with 79 % don't print any *'s.
    If the absolute value of the difference between a patient's test result and the average expected value is greater than the corresponding tolerance range then the test name must be printed at the bottom of the report after the first message indicated in the layout above. If there are several such names, they should be printed three per line. If no values are outside the tolerance range, print the second message.

    You must turn in a batch job of your program with a listing and output.  In order to batch your program from a terminal you should build a file, called JCL-4 for example, containing IBEX commands beginning in column 1 with the exclamation point.

              !JOB SCAN,WSN=MACK
              !FORTRAN PROG-4 (LS,ANS)
              !RUN

This example assumes your program is stored in a file called PROG-4.  Then from your terminal type:

              !BATCH JCL-4

This submits your job to the batch queue just as if you had placed a card deck in the card reader.  The SCAN option causes IBEX to check your syntax and report errors.  The option WSN=MACK should be used ONLY IF you want to get your print out at the Mack Data Center.  During program development you can execute your JCL file on-line by typing the following command:

              !XEQ JCL-4


    You are also required to turn in a flow chart of your program.  It should be on 8 1/2 by 11 inch paper.  If more than one sheet of paper is needed, use connectors to show how the different pages fit together.

    As in your other projects, you should provide documentation with your program including a title, author, data table, and comments explaining what the program does.  Use indentation and space lines to clarify your coding.  Use parameter(s) where you think the problem calls for them.  Remember to properly label your project with your name, course number, section number, date and project number.