Jonathan Harris · Dec 26, 2025 go to post

This gave me errors, but I tried a simple subtraction and it worked.

Strangely, they use hundredths of minutes and hours instead of 60, so to subtract 5 hours, multiply 5*100*100 = 50000.

Jonathan Harris · Oct 24, 2024 go to post

Now there is an issue. When a data field is 0, it does not read it as numeric.

Example, I have input values of 3.5 and 0 and want to subtract them, but I don't get output

Example, I have input values of 3.5 and 1 and want to subtract them, output is 2.5.

Jonathan Harris · Mar 26, 2024 go to post

I am trying to avoid using tar.

Let me simplify as I am trying to work with just one file now.

I tried this command;

gzip -9 -r -q test001.zip /path

Where /path is the directory I want to zip all files in and I want to have as output test001.zip, which unix complains that test001.zip does not exist, which I don't understand as I am trying to create this.

Am I misunderstanding the arguments?

Jonathan Harris · Jul 18, 2022 go to post

Not sure how to accept a reply, but the $EXTRACT(input,$FIND(input,"(")-1,*) did the trick once I worked out the details of syntax. Thanks again. Now I dive in further over my head to the next "we never did this before" project.

Jonathan Harris · Jul 8, 2022 go to post

I put the $ in and the code worked. I wound up using this, $EXTRACT(input,$FIND(input,"(")-1,*).

Jonathan Harris · Jul 7, 2022 go to post

This version does not recognize EXTRACT or FIND.

Is it possible to do a SubString from an index to the end

It seems like they have no function for this.

..ReplaceStr(input,start to "(","(") where I replace everything up to the first parens with just a parens.

This would be so simple, I thought.

Jonathan Harris · Mar 4, 2022 go to post

I'm having trouble getting the shell script get the output, which will be multiple lines, into a file.

Right now I have this

NAMESPACE='XXXXX'
irissession XXXXX <<EOM
znspace="${NAMESPACE}"
set mysqlstat="select * from file.Log where ConfigName='hhhhhhhhhhh"
set sr=##class(%SQL.Statement).%ExecDirect(,mysqlstat) if sr.%SQLCODE=0 do sr.%Display()
halt
EOM

This works great to get output to a screen. I tried the statements from your last reply but still get screen output, nothing to the file, and an occasional objection to my syntax. I have a lot of experience with the shell scripting but the SQL and objectscript are relatively new. It's getting the output into a flat file that is the missing link for me. Once there, I can parse, search, and format output all day.

Jonathan Harris · Mar 4, 2022 go to post

This solved my first issue, getting the data from a script. I want to get it into a file. My last set statement outputs using variable.%Display(). I've been searching the documentation but haven't found how to write output to a text file. It seems like I can't find the command for it, which I think would look like variable.%OutputCommand(file path).

Jonathan Harris · Mar 3, 2022 go to post

Let me step back and work with just the two prompts that don't seem to play well together.
I run the irissession SERVER command and there I can use the set statements, one using a set and the other calling a class. This output comes to the screen. I cannot run these if I don't run the irissession command. I can't run unix commands like grep or output to a file if I do.

I'd like to be able to have a script that gets access to this data and then gets out. My script can run the irissession command but after that nothing in the script gets accessed.