Running DXL script in the background

Hello everyone,

I have a dxl script which is running perfetly at DOORS Gui. But I want to run this .dxl script on the command line(cmd). 

When I write a a command like : 

%ProgramFiles%\IBM\Rational\ DOORS\9.3\bin\doors.exe" -d 23667@bi35 -u "xxx yyy" -P don -b "d:\workset\deneme\dene\addins\Devel\ exporterRTF.dxl

 

I am getting lots of errors. It is generally about "undeclared variable" or "incorrectly concatenated tokens". 

In my code i include like this => #include <utils/doctools/itfutil.inc>

and the problems genarally refer to this point. What should I do for working on command line ? Because normally it works when i try in the DOORS Gui.

 

Thanks in advance.


Searil - Wed Nov 27 09:05:10 EST 2013

Re: Running DXL script in the background
SudarshanRao - Thu Nov 28 11:51:07 EST 2013

Its difficult to comment without looking at the exact errors.

But the file you refer to - itfutil.inc has quite a few functions that use DB/DBE (for example, DisplayInvalidChars), which aren't compatible to be run in batch mode. I'd suggest to pick just the functions you require for your DXL, use it in a different file and do an include on that file instead.

Re: Running DXL script in the background
Searil - Thu Nov 28 12:16:49 EST 2013

SudarshanRao - Thu Nov 28 11:51:07 EST 2013

Its difficult to comment without looking at the exact errors.

But the file you refer to - itfutil.inc has quite a few functions that use DB/DBE (for example, DisplayInvalidChars), which aren't compatible to be run in batch mode. I'd suggest to pick just the functions you require for your DXL, use it in a different file and do an include on that file instead.

I copied the error messages to below. I can do 2 things. One is first open the gui via command line, do some staff, close again the gui so i learnt that this is "Interactive Batch" or I start the .dxl script via command line always without gui. Actually if you explain more detailly what should i do for remove this error message i will happy because i am very new at this doors and I have to do this task in a little time.

Remind : The dxl works fine at Gui, but when i try on command line everything is going wrong. I don't understand why it is like that. :/ 

If you want I can also add the source code. 

Thanks for helps.

 

-E- DXL: <utils/doctools/itfutil.inc:25> (AHeading) already declared in this scope
Included from:
<d:\workset\mc_tool_doors\addins\Devel\exporterRTF.dxl:6> 
<Line:1> 
-E- DXL: <utils/doctools/itfutil.inc:26> (AShortText) already declared in this scope
Included from:
<d:\workset\mc_tool_doors\addins\Devel\exporterRTF.dxl:6> 
<Line:1> 
-E- DXL: <utils/doctools/itfutil.inc:27> (ALongText) already declared in this scope
Included from:
<d:\workset\mc_tool_doors\addins\Devel\exporterRTF.dxl:6> 
<Line:1> 
-E- DXL: <utils/doctools/itfutil.inc:29> (AName) already declared in this scope
Included from:
<d:\workset\mc_tool_doors\addins\Devel\exporterRTF.dxl:6> 
<Line:1> 
-E- DXL: <d:\workset\mc_tool_doors\addins\Devel\exporterRTF.dxl:78> (fontTable) already declared in this scope
Included from:
<Line:1> 
-E- DXL: <d:\workset\mc_tool_doors\addins\Devel\exporterRTF.dxl:102> incorrect arguments for (<<)
Included from:
<Line:1> 
-E- DXL: <d:\workset\mc_tool_doors\addins\Devel\exporterRTF.dxl:187> incorrect arguments for function (richTextFragment)
Included from:
<Line:1> 
-E- DXL: <d:\workset\mc_tool_doors\addins\Devel\exporterRTF.dxl:187> incorrectly concatenated tokens
Included from:
<Line:1> 
-E- DXL: <d:\workset\mc_tool_doors\addins\Devel\exporterRTF.dxl:202> incorrect arguments for function (richTextFragment)
Included from:
<Line:1> 
-E- DXL: <d:\workset\mc_tool_doors\addins\Devel\exporterRTF.dxl:202> incorrectly concatenated tokens
Included from:
<Line:1> 
  too many messages -- suspending error reporting

Re: Running DXL script in the background
SudarshanRao - Thu Nov 28 13:04:48 EST 2013

Searil - Thu Nov 28 12:16:49 EST 2013

I copied the error messages to below. I can do 2 things. One is first open the gui via command line, do some staff, close again the gui so i learnt that this is "Interactive Batch" or I start the .dxl script via command line always without gui. Actually if you explain more detailly what should i do for remove this error message i will happy because i am very new at this doors and I have to do this task in a little time.

Remind : The dxl works fine at Gui, but when i try on command line everything is going wrong. I don't understand why it is like that. :/ 

If you want I can also add the source code. 

Thanks for helps.

 

-E- DXL: <utils/doctools/itfutil.inc:25> (AHeading) already declared in this scope
Included from:
<d:\workset\mc_tool_doors\addins\Devel\exporterRTF.dxl:6> 
<Line:1> 
-E- DXL: <utils/doctools/itfutil.inc:26> (AShortText) already declared in this scope
Included from:
<d:\workset\mc_tool_doors\addins\Devel\exporterRTF.dxl:6> 
<Line:1> 
-E- DXL: <utils/doctools/itfutil.inc:27> (ALongText) already declared in this scope
Included from:
<d:\workset\mc_tool_doors\addins\Devel\exporterRTF.dxl:6> 
<Line:1> 
-E- DXL: <utils/doctools/itfutil.inc:29> (AName) already declared in this scope
Included from:
<d:\workset\mc_tool_doors\addins\Devel\exporterRTF.dxl:6> 
<Line:1> 
-E- DXL: <d:\workset\mc_tool_doors\addins\Devel\exporterRTF.dxl:78> (fontTable) already declared in this scope
Included from:
<Line:1> 
-E- DXL: <d:\workset\mc_tool_doors\addins\Devel\exporterRTF.dxl:102> incorrect arguments for (<<)
Included from:
<Line:1> 
-E- DXL: <d:\workset\mc_tool_doors\addins\Devel\exporterRTF.dxl:187> incorrect arguments for function (richTextFragment)
Included from:
<Line:1> 
-E- DXL: <d:\workset\mc_tool_doors\addins\Devel\exporterRTF.dxl:187> incorrectly concatenated tokens
Included from:
<Line:1> 
-E- DXL: <d:\workset\mc_tool_doors\addins\Devel\exporterRTF.dxl:202> incorrect arguments for function (richTextFragment)
Included from:
<Line:1> 
-E- DXL: <d:\workset\mc_tool_doors\addins\Devel\exporterRTF.dxl:202> incorrectly concatenated tokens
Included from:
<Line:1> 
  too many messages -- suspending error reporting

There must be something different you're doing, to get the script to work in GUI.

The errors in itself is because there are variables declared  in exporterRTF.dxl, which are also declared in itfutil.inc (AHeading, AShortText, ALongText, AName etc), which needs removed from one of these and managed in some other way. There could be more such conflicts/errors, since it says "too many messages - suspending error reporting" towards the end.

Re: Running DXL script in the background
Mathias Mamsch - Sun Dec 01 10:25:08 EST 2013

Searil - Thu Nov 28 12:16:49 EST 2013

I copied the error messages to below. I can do 2 things. One is first open the gui via command line, do some staff, close again the gui so i learnt that this is "Interactive Batch" or I start the .dxl script via command line always without gui. Actually if you explain more detailly what should i do for remove this error message i will happy because i am very new at this doors and I have to do this task in a little time.

Remind : The dxl works fine at Gui, but when i try on command line everything is going wrong. I don't understand why it is like that. :/ 

If you want I can also add the source code. 

Thanks for helps.

 

-E- DXL: <utils/doctools/itfutil.inc:25> (AHeading) already declared in this scope
Included from:
<d:\workset\mc_tool_doors\addins\Devel\exporterRTF.dxl:6> 
<Line:1> 
-E- DXL: <utils/doctools/itfutil.inc:26> (AShortText) already declared in this scope
Included from:
<d:\workset\mc_tool_doors\addins\Devel\exporterRTF.dxl:6> 
<Line:1> 
-E- DXL: <utils/doctools/itfutil.inc:27> (ALongText) already declared in this scope
Included from:
<d:\workset\mc_tool_doors\addins\Devel\exporterRTF.dxl:6> 
<Line:1> 
-E- DXL: <utils/doctools/itfutil.inc:29> (AName) already declared in this scope
Included from:
<d:\workset\mc_tool_doors\addins\Devel\exporterRTF.dxl:6> 
<Line:1> 
-E- DXL: <d:\workset\mc_tool_doors\addins\Devel\exporterRTF.dxl:78> (fontTable) already declared in this scope
Included from:
<Line:1> 
-E- DXL: <d:\workset\mc_tool_doors\addins\Devel\exporterRTF.dxl:102> incorrect arguments for (<<)
Included from:
<Line:1> 
-E- DXL: <d:\workset\mc_tool_doors\addins\Devel\exporterRTF.dxl:187> incorrect arguments for function (richTextFragment)
Included from:
<Line:1> 
-E- DXL: <d:\workset\mc_tool_doors\addins\Devel\exporterRTF.dxl:187> incorrectly concatenated tokens
Included from:
<Line:1> 
-E- DXL: <d:\workset\mc_tool_doors\addins\Devel\exporterRTF.dxl:202> incorrect arguments for function (richTextFragment)
Included from:
<Line:1> 
-E- DXL: <d:\workset\mc_tool_doors\addins\Devel\exporterRTF.dxl:202> incorrectly concatenated tokens
Included from:
<Line:1> 
  too many messages -- suspending error reporting

You need to know that DOORS is using a different set of include files, when running in batch vs. interactive mode. Whenever you get a bunch of errors about "Symbol is already declared" that means that you quite certainly included the same include file twice. Check your startup.dxl vs. you startupBatch.dxl  in your lib/dxl folder of your client to see the differences in the include file.

And the solution is normally easy: just comment out the problematic include and you will get rid of those errors.

However if you want a script to be runnable in both batch and interactive mode, but one include is missing in batch mode but is included in interactive mode (or vice versa), then you need a wrapper script to start the script in batch mode, that contains the relevant includes. E.g.

#include <utils/doctools/itfutil.inc>
#include <your program.dxl>

for batch mode, and for interactive mode you only use <your program.dxl> ... this way you make sure, that in both modes the relevant include is incorporated.

Also you need to be aware that batch mode programs really run on the highest possible DXL context level. Due to some inconsistencies in the DXL parser this will give you problems, when running programs in batch mode with some code, that will run fine in interactive mode. Forward references and also redeclarations can be a problem here ... The solution for this is normally to wrap the DXL program for batch mode in  { ... } braces, this way the DXL parser will use the same scoping rules like in interactive mode and everything works smoothly.  (as weird as that sounds!)

In your case my guess is, that both modes (batch and interactive) might include the itfutil.inc but while from interactive mode it is perfectly fine to reinclude itfutil.inc, its not fine for code that runs on top level. So just wrap your DXL program in { } and see if that solves your problem.

Hope this helps, regards, Mathias

Re: Running DXL script in the background
Searil - Mon Dec 02 06:27:35 EST 2013

Mathias Mamsch - Sun Dec 01 10:25:08 EST 2013

You need to know that DOORS is using a different set of include files, when running in batch vs. interactive mode. Whenever you get a bunch of errors about "Symbol is already declared" that means that you quite certainly included the same include file twice. Check your startup.dxl vs. you startupBatch.dxl  in your lib/dxl folder of your client to see the differences in the include file.

And the solution is normally easy: just comment out the problematic include and you will get rid of those errors.

However if you want a script to be runnable in both batch and interactive mode, but one include is missing in batch mode but is included in interactive mode (or vice versa), then you need a wrapper script to start the script in batch mode, that contains the relevant includes. E.g.

#include <utils/doctools/itfutil.inc>
#include <your program.dxl>

for batch mode, and for interactive mode you only use <your program.dxl> ... this way you make sure, that in both modes the relevant include is incorporated.

Also you need to be aware that batch mode programs really run on the highest possible DXL context level. Due to some inconsistencies in the DXL parser this will give you problems, when running programs in batch mode with some code, that will run fine in interactive mode. Forward references and also redeclarations can be a problem here ... The solution for this is normally to wrap the DXL program for batch mode in  { ... } braces, this way the DXL parser will use the same scoping rules like in interactive mode and everything works smoothly.  (as weird as that sounds!)

In your case my guess is, that both modes (batch and interactive) might include the itfutil.inc but while from interactive mode it is perfectly fine to reinclude itfutil.inc, its not fine for code that runs on top level. So just wrap your DXL program in { } and see if that solves your problem.

Hope this helps, regards, Mathias

Hello Mathias, thanks for your reply. I wrapped my dxl program with {... } and the error number is decrease but it shows still 40 errors.

First of all my command line script is this :

"C:\ProgramFiles\....\doors.exe" -d 3636@pvbd-01 -u "username" -P "password" -b "myprogram.dxl"

1) myprogram.dxl contain 2 includes

2) Should I put myprogram.dxl with .inc files in same directory ?

3) The problem on my side is this dxl files is not written by me. I only try to fix for starting this .dxl from command line.

So the problem is still continue. Do you explain the solution in different way :/

Thanks in advance. 

 

Re: Running DXL script in the background
Mathias Mamsch - Tue Dec 10 07:57:17 EST 2013

Searil - Mon Dec 02 06:27:35 EST 2013

Hello Mathias, thanks for your reply. I wrapped my dxl program with {... } and the error number is decrease but it shows still 40 errors.

First of all my command line script is this :

"C:\ProgramFiles\....\doors.exe" -d 3636@pvbd-01 -u "username" -P "password" -b "myprogram.dxl"

1) myprogram.dxl contain 2 includes

2) Should I put myprogram.dxl with .inc files in same directory ?

3) The problem on my side is this dxl files is not written by me. I only try to fix for starting this .dxl from command line.

So the problem is still continue. Do you explain the solution in different way :/

Thanks in advance. 

 

Did you solve your problem? If not please post an example dxl file that reproduces the error, your command line call and the DOORS version that you are using. Regards, Mathias

Re: Running DXL script in the background
Searil - Tue Dec 10 11:11:04 EST 2013

Mathias Mamsch - Tue Dec 10 07:57:17 EST 2013

Did you solve your problem? If not please post an example dxl file that reproduces the error, your command line call and the DOORS version that you are using. Regards, Mathias

No , I am not. 

This is the my dxl program : http://paste.ubuntu.com/6509308/

This is the first include file which in the dxl(on the top) : http://paste.ubuntu.com/6509314/

This is the second include file which in the dxl(on the top): http://paste.ubuntu.com/6509320/

This is the third include file which is in the 1103 line : http://paste.ubuntu.com/6551816/

This is my command line command : "%ProgramFiles%\IBM\Rational\ DOORS\9.3\bin\doors.exe" -d 36@bie01 -u "username" -P don -b "d:\workset\mc_tool_ doors\addins\Devel\ exporterDoc.dxl"

 

I am trying to figure out why it doesn't work nearly 1 week. I will getting crazy:/ any help is appreciated.

Re: Running DXL script in the background
Searil - Tue Dec 10 11:11:09 EST 2013

Mathias Mamsch - Tue Dec 10 07:57:17 EST 2013

Did you solve your problem? If not please post an example dxl file that reproduces the error, your command line call and the DOORS version that you are using. Regards, Mathias

No , I am not. 

This is the my dxl program : http://paste.ubuntu.com/6509308/

This is the first include file which in the dxl(on the top) : http://paste.ubuntu.com/6509314/

This is the second include file which in the dxl(on the top): http://paste.ubuntu.com/6509320/

This is the third include file which is in the 1103 line : http://paste.ubuntu.com/6551816/

This is my command line command : "%ProgramFiles%\IBM\Rational\ DOORS\9.3\bin\doors.exe" -d 36@bie01 -u "username" -P don -b "d:\workset\mc_tool_ doors\addins\Devel\ exporterDoc.dxl"

 

I am trying to figure out why it doesn't work nearly 1 week. I will getting crazy:/ any help is appreciated.

Re: Running DXL script in the background
Mathias Mamsch - Tue Dec 10 16:47:09 EST 2013

Searil - Tue Dec 10 11:11:09 EST 2013

No , I am not. 

This is the my dxl program : http://paste.ubuntu.com/6509308/

This is the first include file which in the dxl(on the top) : http://paste.ubuntu.com/6509314/

This is the second include file which in the dxl(on the top): http://paste.ubuntu.com/6509320/

This is the third include file which is in the 1103 line : http://paste.ubuntu.com/6551816/

This is my command line command : "%ProgramFiles%\IBM\Rational\ DOORS\9.3\bin\doors.exe" -d 36@bie01 -u "username" -P don -b "d:\workset\mc_tool_ doors\addins\Devel\ exporterDoc.dxl"

 

I am trying to figure out why it doesn't work nearly 1 week. I will getting crazy:/ any help is appreciated.

Sorry for ignoring that post so long. If take your myprogram.dxl replace the two includes at the top by the following lines:

// Export RTF
{
pragma runLim,0
DB dbExplorer
#include <standard/help/codes.inc>
#include <utils/tabUtils.inc>
#include <utils/openModulesMemoryManagement.inc>

#include <utils/doctools/itfutil.inc>
#include <utils/doctools/rtfattr.inc>

...

Then at least the include errors vanish. A "no current module" error appears, however that is to be expected. Can you try this please?

Regards, Mathias

P.S.: It is always tricky to get scripts that were designed for the GUI to run in batch mode. Sometimes you need to declare some internal variables (like above: dbExplorer to avoid having to include the whole GUI stack). That will work only of course if no function that actually uses this variable is called.

Re: Running DXL script in the background
Searil - Wed Dec 11 03:54:03 EST 2013

Mathias Mamsch - Tue Dec 10 16:47:09 EST 2013

Sorry for ignoring that post so long. If take your myprogram.dxl replace the two includes at the top by the following lines:

// Export RTF
{
pragma runLim,0
DB dbExplorer
#include <standard/help/codes.inc>
#include <utils/tabUtils.inc>
#include <utils/openModulesMemoryManagement.inc>

#include <utils/doctools/itfutil.inc>
#include <utils/doctools/rtfattr.inc>

...

Then at least the include errors vanish. A "no current module" error appears, however that is to be expected. Can you try this please?

Regards, Mathias

P.S.: It is always tricky to get scripts that were designed for the GUI to run in batch mode. Sometimes you need to declare some internal variables (like above: dbExplorer to avoid having to include the whole GUI stack). That will work only of course if no function that actually uses this variable is called.

Hello Mathias,

I added this part into my code :

DB dbExplorer
#include <standard/help/codes.inc>
#include <utils/tabUtils.inc>
#include <utils/openModulesMemoryManagement.inc>

Now on, I take the error message of :

-R-E- DXL: <.........dxl:1130> unassigned variable <dbExplorer>

Backtrace:

                   <...............dxl:1130>

                   <...............dxl:1142>

-I- DXL: Execution halted

Actually to many errors are disappered but still  not working. Also if it is more easy and if  you show some tips to me I can also try :

1) Run gui (via command line)

2) Run the script

3) Close the gui again

Re: Running DXL script in the background
Mathias Mamsch - Wed Dec 11 07:19:13 EST 2013

Searil - Wed Dec 11 03:54:03 EST 2013

Hello Mathias,

I added this part into my code :

DB dbExplorer
#include <standard/help/codes.inc>
#include <utils/tabUtils.inc>
#include <utils/openModulesMemoryManagement.inc>

Now on, I take the error message of :

-R-E- DXL: <.........dxl:1130> unassigned variable <dbExplorer>

Backtrace:

                   <...............dxl:1130>

                   <...............dxl:1142>

-I- DXL: Execution halted

Actually to many errors are disappered but still  not working. Also if it is more easy and if  you show some tips to me I can also try :

1) Run gui (via command line)

2) Run the script

3) Close the gui again

Well at least your script starts running now (so no parser errors anymore) If part of your scripts use interactive features you need to use interactive mode, not batch mode. Remove the includes you added from your file again and start your script in in "interactive batch". You can use the exit_() perm to quit the DOORS interpreter after finishing your script.

See here for an example to make an "interactive batch" and how to pass a parameter to a script over the command line:

https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014587301&ps=25

or see here for a discussion on command line parameters for DXL scripts:

https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014484459&ps=25

Regards, Mathias