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

Home » Public Forums » archive » problem with ASSOC
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
problem with ASSOC [message #9474] Wed, 02 July 1997 00:00
jackel[1] is currently offline  jackel[1]
Messages: 11
Registered: May 1997
Junior Member
Greetings

I've run across some strange behaviour with ASSOC (used for easy
random file access), and I was wondering if

1) anyone has seen this before
2) anyone would like to test my sample script on other platforms

Basically, I make a small file with a number of records, and can read
it back in with READU. However, trying to ASSOC gives some very
strange results. Any comments would be greatly appreciated. The
sample script is included below.



;1997/07/02 Brian Jackel jackel@danlon.physics.uwo.ca
;
;Platform: Win95
;Version: 4.0.1 and 5.0 pre-release beta
;
;This IDL script isolates a problem where ASSOC doesn't
;appear to work properly. Everything works well using
;READU, but ASSOC has trouble with the floating point value,
;and runs out of records. The output is included at the
;end of this file.
;


;Create a small record
;
recordtype= {Test, hh:0, mm:0, ss:0, ut:0.0}
record= recordtype
record.hh= 12
record.ss= 5
record.ut= 10.5

;Write several copies to a file (all identical)
;
filename= 'test.dat'
OPENW,1,filename
FOR indx=0,10 DO WRITEU,1,record
CLOSE,1

;Read the first one back in, see if it's okay
;
PRINT,'Results using READU'
OPENR,1,filename
READU,1,record
HELP,/str,record
POINT_LUN,1,0
FOR indx=0,10 DO BEGIN
READU,1,record
PRINT,indx,record.ut
ENDFOR
CLOSE,1

;
;Use "assoc" to read in a file, see what happens.
;
PRINT,'Results using ASSOC'
OPENR,1,filename,BUFSIZE=1024
read_data= ASSOC(1,recordtype)
test= read_data(0)
HELP,/STR,test
FOR indx=0,10 DO BEGIN
test= READ_DATA(indx)
print,indx,test.ut
ENDFOR

CLOSE,1

END

;IDL> .RUN E:\DATA\EISCAT\1992\DATA\TEST.PRO
;% Compiled module: $MAIN$.
;Results using READU
;** Structure TEST, 4 tags, length=12:
; HH INT 12
; MM INT 0
; SS INT 5
; UT FLOAT 10.5000
; 0 10.5000
; 1 10.5000
; 2 10.5000
; 3 10.5000
; 4 10.5000
; 5 10.5000
; 6 10.5000
; 7 10.5000
; 8 10.5000
; 9 10.5000
; 10 10.5000
;Results using ASSOC
;** Structure TEST, 4 tags, length=12:
; HH INT 12
; MM INT 0
; SS INT 5
; UT FLOAT 1.12540e-039
; 0 1.12540e-039
; 1 1.68156e-044
; 2 4.59177e-040
; 3 7.00649e-045
; 4 10.5000
; 5 1.12540e-039
; 6 1.68156e-044
; 7 4.59177e-040
; 8 7.00649e-045
;% End of file encountered. Unit: 1
; File: E:\data\EISCAT\1992\data\test.dat
;% Execution halted at: $MAIN$ 43
; E:\DATA\EISCAT\1992\DATA\TEST.PRO
Re: problem with ASSOC [message #9475 is a reply to message #9474] Wed, 02 July 1997 00:00 Go to previous message
jackel[1] is currently offline  jackel[1]
Messages: 11
Registered: May 1997
Junior Member
BTW, in my previous article, there is a line

> OPENR,1,filename,BUFSIZE=1024

but the results are the same no matter what BUFSIZE is set to,
or if it's not set at all. Sorry for any confusion.

Brian
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: debuggin code
Next Topic: Widget problem in PV-Wave 6.1

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

Current Time: Wed Oct 08 19:14:30 PDT 2025

Total time taken to generate the page: 0.00577 seconds