String Handling in GrADS1.9.0-rc1 win32

Stephen R McMillan smcmillan at PLANALYTICS.COM
Thu Mar 6 01:46:24 EST 2008


Arlindo,
I have been unable to figure out why the V1.9.0-rc1 win32 superpack 
appears to handle strings differently than v1.8SL11 does.  So far, I have 
encountered this problem only when reading text data files, but it is 
keeping me from applying many of my data scripts in the newer version. I 
submitted something similar before, but I'm sending another example to see 
if someone in the user community may have an "aha!" answer. I've attached 
four text files, respectively from left, (1) test script, (2) data file, 
(3) screen-dump output from v1.9, and (4) output from v1.8. Both sessions 
were done on the same pc with MS Windows XP Pro (SP2). I've also included 
text of script here for convenience.

test19.gs:

datfile='d:\temp\apr06.txt'
say 'This is a test!'
datastr=ReaData(datfile)
c=subwrd(datastr,1);d=subwrd(datastr,2);ldate=subwrd(datastr,3)
say 'Total dates: 'c
say 'Total read: 'd
r=c-d
say 'Days remaining: 'r
say 'Last date: 'ldate
if(ldate=07Apr2006|ldate=15Apr2006)
  say 'Date found!!'
else
  say 'Date not found!'
endif

function ReaData(datfile)
dat=read(datfile)
ec=sublin(dat,1)
c=sublin(dat,2)
d=0
while(1)
  dat=read(datfile)
  ec=sublin(dat,1)
  if(ec=0)
    date=sublin(dat,2)
    d=d+1
    say date
  else
    break
  endif
  if(date=07Apr2006|date=15Apr2006)
    break
  endif
endwhile
say 'Done reading data!'
dummy=close(datfile)
return c' 'd' 'date
---------------------------------------------------------------

The test19 script itself serves no useful purpose other than to illustrate 
the differences. The v1.8 output is what I expected from running it--no 
problem there. However, running the same script in v1.9 produces a 
different result. It appears to handle the variables differently than v1.8 
does, e.g., numeric versus non-numeric. Any ideas? Do we have to declare 
variables as strings, integers, etc. in v1.9?

Stephen



***************************************************
The information contained in this e-mail message is intended only for the use of the recipient(s) named above and may contain information that is privileged, confidential, and/or proprietary.  If you are not the intended recipient, you may not review, copy or distribute this message.  If you have received this communication in error, please notify the sender immediately by e-mail, and delete the original message.
***************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20080306/c3be077e/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test19.gs
Type: application/octet-stream
Size: 703 bytes
Desc: not available
Url : http://gradsusr.org/pipermail/gradsusr/attachments/20080306/c3be077e/attachment.obj 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Apr06.txt
Url: http://gradsusr.org/pipermail/gradsusr/attachments/20080306/c3be077e/attachment.txt 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: grads1.9-test19.png
Type: application/octet-stream
Size: 17686 bytes
Desc: not available
Url : http://gradsusr.org/pipermail/gradsusr/attachments/20080306/c3be077e/attachment-0001.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: grads1.8-test19.png
Type: application/octet-stream
Size: 16427 bytes
Desc: not available
Url : http://gradsusr.org/pipermail/gradsusr/attachments/20080306/c3be077e/attachment-0002.obj 


More information about the gradsusr mailing list