comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » ASSOC and structures - structure size problem
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
ASSOC and structures - structure size problem [message #8807] Mon, 28 April 1997 00:00 Go to next message
sdpp is currently offline  sdpp
Messages: 2
Registered: January 1997
Junior Member
I'm trying to use ASSOC to link a structure with a large file.

The structure consists of lonarr(48) followed by intarr(14423). This pattern
being repeated 16036 times in the file.

I ASSOC the structure with the file (including 16252 byte offset for a file
header)

The structure size should be 29038 bytes , but HELP,/STRUCT gives it as 29040.

I would accept the 2 byte difference as a structure ID or something. But the
data values I'm getting are all wrong - suggesting that ASSOC is not mapping
the structure onto the file correctly, or it's using the wrong structure size
?

Can anyone explain this anomaly.

I'm using DEC Unix 3.2 on an Alpha.

Thanks

Steve

Anite Systems

Bristol UK
Re: ASSOC and structures - structure size problem [message #8868 is a reply to message #8807] Fri, 02 May 1997 00:00 Go to previous message
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
sdpp@anitesystems.co.uk (Steve Phillips) writes:


> I'm trying to use ASSOC to link a structure with a large file.

> The structure consists of lonarr(48) followed by intarr(14423). This pattern
> being repeated 16036 times in the file.

> I ASSOC the structure with the file (including 16252 byte offset for a file
> header)

> The structure size should be 29038 bytes , but HELP,/STRUCT gives it as 29040.

> I would accept the 2 byte difference as a structure ID or something. But the
> data values I'm getting are all wrong - suggesting that ASSOC is not mapping
> the structure onto the file correctly, or it's using the wrong structure size
> ?

> Can anyone explain this anomaly.

> I'm using DEC Unix 3.2 on an Alpha.

I suspect that what is happening is that the structure is being padded to end
on a word boundary. You should be able to read in the first instance of your
structure correctly, but the alignment will be wrong for any others, so you'll
read in garbage data.

An alternative way to read the file would be to use the commands POINT_LUN to
move to a specific byte in the file, and READU to read in the data. For
example, if you wanted to read in the third structure, you'd enter the commands

IDL> POINT_LUN, UNIT, 16252 + 2*29038
IDL> READU, UNIT, MY_STRUCT

Bill Thompson
Re: ASSOC and structures - structure size problem [message #8898 is a reply to message #8807] Tue, 29 April 1997 00:00 Go to previous message
Joseph M Zawodny is currently offline  Joseph M Zawodny
Messages: 24
Registered: March 1996
Junior Member
Steve Phillips wrote:
>
> I'm trying to use ASSOC to link a structure with a large file.
>
> The structure consists of lonarr(48) followed by intarr(14423). This pattern
> being repeated 16036 times in the file.
>
> I ASSOC the structure with the file (including 16252 byte offset for a file
> header)
>
> The structure size should be 29038 bytes , but HELP,/STRUCT gives it as 29040.
>
> I would accept the 2 byte difference as a structure ID or something. But the
> data values I'm getting are all wrong - suggesting that ASSOC is not mapping
> the structure onto the file correctly, or it's using the wrong structure size
> ?
>
> Can anyone explain this anomaly.

Chances are that the problem is related to the odd number of 2-byte
integers in the second vector of your structure. Make a test file
with an even number (like 14424) of elements and I bet it will work.

Sorry, I do not have a fix for this though.

Good Luck.

JMZ
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Windows selection in PV-Wave
Next Topic: Re: PRINTING IN IDL4.0

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 23:16:20 PDT 2025

Total time taken to generate the page: 1.60218 seconds