HP3000-L Archives

June 2000, Week 1

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Bruce Toback <[log in to unmask]>
Reply To:
Bruce Toback <[log in to unmask]>
Date:
Tue, 6 Jun 2000 13:07:47 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (68 lines)
Hi all,

My mind is going. I can feel it.

I have just spent the last three hours trying to track down what I
thought was a bug in some programs I've written. These programs -- in
this case a "master" and a "slave" -- communicate via message files
created dynamically by the master. The message files are created with a
record length of 8190 bytes (ASCII), and variable-length. The :LISTF
output from one looks like:

>BLO73            8190B  VAM          0       1031   1      256  1  * (TEMP)

which is exactly what I expected.

The problem occurs when the master program reads from one of these. No
matter what the record length written to the file by the slave, the
master's FREAD always returned the value of the buffer length parameter,
and the buffer is padded with blanks. This does not happen on the slave
side; the slave side always gets a correct value for the record length.

The master side final HPFOPEN looks like:

>    HPFOPEN(&tempFileNumber, &hpeError,  2, fileName,
>                                         3, &domainOldtemp,
>                                        11, &accessType,
>                                        13, &exclusive);

where accessType is 0, exclusive is 1 (which for a message file means one
reader and one writer), and domainOldTemp is 2. The slave side's HPFOPEN
for its input file looks identical.

In desperation, I added:

>                                         6, &recordFormat,

where recordFormat was 1, for variable. Now I get FREAD return values
that actually reflect the number of bytes written, and the buffer is no
longer automatically blank-filled.

I don't get it:

a) The same call works fine on the slave side, and
b) recordFormat is an FOPTION, so it's an intrinsic characteristic
   of the file and can't (in theory) be changed by the FOPEN. Yet
   specifying it on the HPFOPEN call changes the behavior.

I know I'm not accidentally opening the wrong file, because I've verified
it by hand (checking after the HPFOPEN to make sure that :LISTFILE
--,ACCESS shows that the expected file is being accessed) and because
just adding the record format parameter changes the behavior.

Any clues as to what might be happening?

-- Bruce



--------------------------------------------------------------------------
Bruce Toback    Tel: (602) 996-8601| My candle burns at both ends;
OPT, Inc.            (800) 858-4507| It will not last the night;
11801 N. Tatum Blvd. Ste. 142      | But ah, my foes, and oh, my friends -
Phoenix AZ 85028                   | It gives a lovely light.
btoback AT optc.com                |     -- Edna St. Vincent Millay
Mail sent to [log in to unmask] will be inspected for a
fee of US$250. Mailing to said address constitutes agreement to
pay, including collection costs.

ATOM RSS1 RSS2