Thread: Sac101.6 unable to accept arguments

Started: 2013-08-11 05:11:35
Last activity: 2013-08-11 05:11:35
Topics: SAC Help
Martha Savage
2013-08-11 05:11:35
Hi,

I have a similar problem with passing arguments in version 101.6 and not with any of the earlier versions. I have had to revert to the old version to get my codes to work. The problem seems to be that a variable that was defined by the "keys" command isn't passed properly into a "do" loop. (the variable in question is called "file". I tried calling it "filein" in case there was a pre-set definition of "file" but that didn't change anything.)
I also tried leaving out the quotes in the commands, as was recommended for a different problem, but it gave worse errors, crashing the system.

I have modified my code to show the essence of the problem: Here are examples of how it works in 101.6 and 101.4 and how it works now, using the "echo on" command, and the relevant code:
$keys file
echo on
setbb compsbb "e n z"
message "file " $file$
*# construct list of files for each component
setbb files ""
setbb compx ""
do ext list %compsbb
message "ext " $ext$
message "file " $file$
setbb files "%files% $file$.$ext$"
* setbb files %files% $file$.$ext$
setbb compx "%compx%$ext$"
enddo
message "files: %files%"

Response of code in 101.6:
SAC> macro ../../mfast/macros/checkpick_test file ./2002.054.09.47.lhor2 setbb compsbb "e n z"
message "file " $file$
==> message "file " ./2002.054.09.47.lhor2
file
./2002.054.09.47.lhor2
*# construct list of files for each component
setbb files ""
setbb compx ""
do ext list %compsbb
==> do ext list e n z
message "ext " $ext$
==> message "ext " e n z
ext
e n z
message "file " $file$
==> message "file " COMPX
file
COMPX
setbb files "%files% $file$.$ext$"
==> setbb files " $file$.$ext$.e n z"
* setbb files %files% $file$.$ext$
setbb compx "%compx%$ext$"
==> setbb compx "e n z"
enddo
message "files: %files%"
==> message "files: $file$.$ext$.e n z"
files: $file$.$ext$.e n z


Here is the output from using sac-101.4

SAC> macro ../../mfast/macros/checkpick_test file ./2002.054.09.47.lhor2
macro ../../mfast/macros/checkpick_test file ./2002.054.09.47.lhor2
echo on
setbb compsbb "e n z"
message "file " $file$
==> message "file " ./2002.054.09.47.lhor2
file
./2002.054.09.47.lhor2
*# construct list of files for each component
setbb files ""
setbb compx ""
do ext list %compsbb
==> do ext list e n z
message "ext " $ext$
==> message "ext " e
ext
e
message "file " $file$
==> message "file " ./2002.054.09.47.lhor2
file
./2002.054.09.47.lhor2
setbb files "%files% $file$.$ext$"
==> setbb files " ./2002.054.09.47.lhor2.e"
setbb compx "%compx%$ext$"
==> setbb compx "e"
enddo
message "ext " $ext$
==> message "ext " n
ext
n
message "file " $file$
==> message "file " ./2002.054.09.47.lhor2
file
./2002.054.09.47.lhor2
setbb files "%files% $file$.$ext$"
==> setbb files " ./2002.054.09.47.lhor2.e ./2002.054.09.47.lhor2.n"
setbb compx "%compx%$ext$"
==> setbb compx "en"
enddo
message "ext " $ext$
==> message "ext " z
ext
z
message "file " $file$
==> message "file " ./2002.054.09.47.lhor2
file
./2002.054.09.47.lhor2
setbb files "%files% $file$.$ext$"
==> setbb files " ./2002.054.09.47.lhor2.e ./2002.054.09.47.lhor2.n ./2002.054.09.47.lhor2.z"
setbb compx "%compx%$ext$"
==> setbb compx "enz"
enddo
message "files: %files%"
==> message "files: ./2002.054.09.47.lhor2.e ./2002.054.09.47.lhor2.n ./2002.054.09.47.lhor2.z"
files: ./2002.054.09.47.lhor2.e ./2002.054.09.47.lhor2.n ./2002.054.09.47.lhor2.z

You see that it properly named my files with the extensions so that I can read them in later.

Thanks for any help you can give me.

Kind Regards,

Martha Savage
Professor of Geophysics
SGEES
Victoria University of Wellington
Te Whare Wananga o te Upoko o te Ika a Maui
Cotton 522
Box 600, Wellington, 6140
New Zealand

Email: Martha.Savage<at>vuw.ac.nz
DDI: +64 (0)4 463-5961
mobile: 021-262-7516


16:18:23 v.22510d55