Question
· Feb 10, 2021

Execute shell script command line with argument exceeding 256 chars

Hello everyone,

I have an issue with using "Open" function.

My goal is to execute a shell script with parameters like as:

/trak/FRXX/config/shells/transportIDE.sh "login|password|NOMUSUEL|PRENOM|NOMDENAISSANCE|1234567891320|199999999999999999999999|09%2099%2099%2099%2099|31%2F12%2F1999|242%20IMPASSE%20DES%20MACHINCHOOOOOOOOSE%20||99999|SAINT%20BIDULETRUC%20DE%20MACHINCHOSE|isc%24jhu|123456|123456798"" 2>&1"

But when some parameters are too long, I have a <NAMEADD> error.

I would like to avoid to write the %String command line in a temporary file and execute this file using : Open strCmd:"QR"
Is there a way to call a script with parameters using Open?

Thank you very much for your help.

Cheers

Jacques

Test script is:

 ClassMethod TestScript()
{
   #dim tSC as %Library.Status = $$$OK
   try {
      set (data,x) = ""
      set EOF = $zutil(68, 40)
      do $zutil(68, 40, 1)
      set strCmd = "/trak/FRXX/config/shells/transportIDE.sh ""login|password|NOMUSUEL|PRENOM|NOMDENAISSANCE|1234567891320|199999999999999999999999|09%2099%2099%2099%2099|31%2F12%2F1999|242%20IMPASSE%20DES%20MACHINCHOOOOOOOOSE%20||99999|SAINT%20BIDULETRUC%20DE%20MACHINCHOSE|isc%24jhu|123456|123456798"" 2>&1"
      open strCmd:"QR"
      for
      {
         use strCmd read x
         quit:$zeof=-1
         use 0
         write data, !
         set data = data _ x
      }
      close strCmd
      do $zutil(68, 40, EOF)
      use 0
      write data, !
catch (SysEx) {
       set tSC = SysEx.AsStatus()
   }
   if $$$ISERR(tSC) write $system.Status.GetErrorText(tSC) }
   quit
}
Product version: IRIS 2019.1
$ZV: IRIS for UNIX (Red Hat Enterprise Linux for x86-64) 2019.1 (Build 510_4_20145U) Tue Aug 25 2020 23:59:58 EDT
Discussion (4)2
Log in or sign up to continue

@Jack Huser ,

Instead of using a regular pipe, have you tried a Command Pipe ( |CPIPE| )?

OPEN "|CPIPE|321":"/trak/FRXX/config/shells/transportIDE.sh ""login|password|NOMUSUEL|PRENOM|NOMDENAISSANCE|1234567891320|199999999999999999999999|09%2099%2099%2099%2099|31%2F12%2F1999|242%20IMPASSE%20DES%20MACHINCHOOOOOOOOSE%20||99999|SAINT%20BIDULETRUC%20DE%20MACHINCHOSE|isc%24jhu|123456|123456798"" 2>&1":100

Per this documentation: https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=GIOD_interproccomm a CPIPE doesn't suffer from the 256(ish) character limit because the command called is the 2nd parameter.

Hope this helps!