1

I have to modify a scr.file at work. The script was purchased externally several years ago. I can unterstand the code to some extent, but i can't recognize what scripting language it's written in.

Heres a code snippet:

main()
{
  _ErrLevel->Set(0);                      
  _ErrExecLevel->Set(1);  
  _ErrExecTraceLevel->Set(2); 
  _ActualLevel->Set($_ErrExecTraceLevel);

  _ExtSysID->Set("TDM");
  local tString sScriptName("NFORG.scr");
  env->PutEnv("DB_protID", "NFORG");

  local tInt iMsgCounter(0);
  local tInt iError(0);
  local tDateTime datetime();
  local tString sDateTime();
  local tSql sqlTmp();

  msg->SetMsgOutputToDB(139);

  sqlTmp->Execute(,0, "delete from DB_prot
                       where DB_prot.protID = 'NFORG' 
                       and DB_prot.protTIMESTAMP < ($THISTIMESTAMP - 86400)");
  sqlTmp->Commit();

  if($_ActualLevel >= $_ErrExecLevel){iMsgCounter++;msg->Message("Scr: $sScriptName$ / (%03s) START of NFORG loop.", "$iMsgCounter$");}
  msg->Sleep(1000);
  env->PutEnv("NFORGLOG", "$&DB_CLIENTHOME$\TMP", 1);
  _ENVVAR->Set("NFORG");

  global tTable tblFile();

  if(!tblFile->SetDir("$_ENVVAR", "*.org",0,0,0,"BaseFileName"))
  {
    msg->Sleep(1000);
    if($_ActualLevel >= $_ErrExecLevel){iMsgCounter++;msg->Message("Scr: $sScriptName$ / (%03s) END of NFORG loop.", "$iMsgCounter$");}
    msg->ResetMsgOutputToDB();
    return SOC_OK;
  }
  if($tblFile->CountRows == 0)
  {
    if($_ActualLevel >= $_ErrExecLevel){iMsgCounter++;msg->Message("Scr: $sScriptName$ / (%03s) END of NFORG loop.", "$iMsgCounter$");}
    msg->ResetMsgOutputToDB();
    return SOC_OK;
  }
  else
  {
    if($_ActualLevel >= $_ErrExecLevel){iMsgCounter++;msg->Message("Scr: $sScriptName$ / (%03s)", "$iMsgCounter$");}
  }

  _DoCopy->Set("1");

Can anyone recognize the language?

I am grateful for any help.

Shaggy
  • 27
  • 1

2 Answers2

0

Its shell script

It was used between batch and vbscript

-1

Based on a few searches of functions here, It appears to be a language called Root:

https://en.wikipedia.org/wiki/ROOT

"CERN maintained a program library written in FORTRAN for many years; development and maintenance were discontinued in 2003 in favour of ROOT, written in C++."

Good luck :)

Josh Sharkey
  • 1,008
  • 9
  • 34
  • Was this what you were looking for @Shaggy ? Interesting question trying to determine what language the code is from. – Rich May 03 '18 at 18:09
  • Thanks for your reply. Thanks to you i found an interesting paper about Root. There are definitely similarities between my code and root. But i'm not sure if it's the same yet. In root there are apparently no variables with prefixes like in my code (e.g. $_). My code looks more like a combination of C++ and Perl (and maybe Root) to me. Link to the paper if anyone is interested: http://www-ekp.physik.uni-karlsruhe.de/~quast/Skripte/diving_into_ROOT.pdf – Shaggy May 03 '18 at 19:24
  • The $_ prefix reminds me of php: http://php.net/manual/en/language.variables.predefined.php – Rich May 03 '18 at 21:37
  • not root. (stackoverflow tag [root-framework]). root code is still valid c++ and `main()` lacks a return type, `local` and `global` aren't c++ keywords, root class names start with upper case T (except for some typedefs needed in older C/C++ standards, like Bool_t) – pseyfert May 22 '18 at 14:06