· Dec 5, 2022

How to transform a routine into a line to use in the terminal

Hello everyone,

I talked to a colleague and he said that at the other company he worked, they converted a routine into a line and used that in the terminal like a command. So, I want to know if we have this function native in Intersystems products, or maybe was a program they created, my colleague doesn't remember and this would be useful for me now.


Example of function:

  set var="Test"
  write var
  quit 0

Become a line command:

 USER>set var="Test" write var quit 0

Best Regards,

Product version: IRIS 2020.2
Discussion (9)2
Log in or sign up to continue

Yes there is a way since I have seen it.

The ZLOAD and ZREMOVE commands are combined. Here is a sample I was sent.

showAdmins() n rs1,rs2,rc1,rc2,$NAMESPACE,user,adminrole,roles
  s rs1=##class(%ResultSet).%New("Security.Roles:List")
  d rs1.Execute("*","%Admin_Manage:U,%Admin_Operate:U,%Admin_Secure:U")
  f  s rc1=rs1.Next() q:rc1=0  d
  . s adminrole=rs1.Data("Name")
  . s rs2=##class(%ResultSet).%New("Security.Users:List")
  . d rs2.Execute("*",adminrole)
  . f  s rc2=rs2.Next() q:rc2=0  w rs2.Data("Name"),"|",rs2.Data("Roles"),!
d showAdmins