I inherited a code for conversion of SAC to ASCII with extra information going into the top of the ASCII file (ready for input to another program). It&#39;s something I haven&#39;t used for quite some time and I&#39;ve installed SAC 101.2 since the last time I used it. Something seems to have changed with respect to some of the data formatting, so I recompiled the source code and reran it. This solved one of my data formatting problems, but appears to have created another. There appears to be some spurious white space in front of station and component names which is creating an issue for the program and its use as input to another code. I extracted the relevant piece of fortran from the code; here it is:<br>
<br>character*4 kstnm<br>character*100 fin,fout<br>write(*,*)&#39;Enter infile&#39;<br>read(*,*)fin<br>call rsac1(fin,x,nlen,beg,del,NMAX,nerr)<br>call getkhv(&#39;KSTNM&#39;,kstnm,nerr)<br>write(*,*) KSTNM<br>open(unit=10,file=&#39;nmresult&#39;,status=&#39;unknown&#39;)<br>
write(10,*),KSTNM<br>close(10)<br>stop<br>end<br><br>For a SAC file in which the station name is AKVQ, I get the following result:<br>Standard output:<br> AKV<br><br>File nmresult (viewed in nedit):<br> AKV&lt;nul&gt;<br>
<br>(In each case there is a single space in front of the station or component name)<br>If I change the character*4 statement for a larger number, I get the full station name, but still with the space in front and the &lt;nul&gt; marker in the file under nedit. The space and the nul cause problems for inputting the station/component information to the next stage of the data analysis procedure.<br>
So my question is simply: why the space in front of the names, and is there a way to eradicate it?<br><br>Thanks,<br><br>Fiona Darbyshire<br>Université du Québec à Montréal<br>