I’m a complete novice with ObjectScript.
I’m trying to write some Object Script directly into command line interface on Linux using some examples on the internet
sudo -u irisowner iris session SCRTC
Username: superuser
Password: ************
AUMHSCRTC:USER>a SET x=1
AUMHSCRTC:USER> WHILE x<10 {
AUMHSCRTC:USER> WRITE !," Looping",x
AUMHSCRTC:USER> SET x=x+1
AUMHSCRTC:USER> }
AUMHSCRTC:USER> WRITE !,"DONE"
AUMHSCRTC:USER>do a
Looping1
Looping2
Looping3
Looping4
Looping5
Looping6
Looping7
Looping8
Looping9
DONE
That seems to work!
How if I put these commands into a file:
cat > /tmp/a.scr
_superuser_
_xyz_
_a SET x=1_
_ WHILE x<10 {_
_ WRITE !," Looping",x_
_ SET x=x+1_
_ }_
_ WRITE !,"DONE"_
_do a_
Then:
cat /tmp/a.scr|sudo -u irisowner iris session SCRTC
DOES NOT work.
**Why?**
Also “routine” or “class” code in Wikipedia - https://en.wikipedia.org/wiki/Cach%C3%A9_ObjectScript these examples do not work either directly or in a file:
_hello // hello world routine_
_ write "hello world"_
_end quit // end_
_DO ^hello_
AND
_Class User.Helloworld_
_{_
_ ClassMethod HelloWorld()_
_ {_
_ // Write to console_
_ Write "Hello World"_
_ Quit_
_ }_
_}_
_DO ##class(User.Helloworld).HelloWorld()_
**Why?**
Thanks for any help