DOORS DXL - Introduction » TheCloudStrap (2024)

DOORS DXL - Introduction » TheCloudStrap (1)

DOORS DXL – Introduction

Table of Contents hide

1. DOORS DXL – Introduction

1.1. What is DXL?

1.2. Features of DXL Scripting:

1.3. Is DXL interpreted or compiled?

1.4. Hello World Program in DXL

1.6. Hello World Program Output

1.7. Print Function – String

1.8. Print Function – Other Data Types

1.9. Conclusion

1.10. Related posts:

In this series of articles, I am going to explain to you IBM DOORS DXL scripting from scratch. So, if you are a beginner in DXL scripting, hopefully, this article will help you. This is part-1 of the DOORS DXL tutorial.

So, if you are looking for a starting point to learn DXL scripting and looking for a DOORS DXL tutorial, you are on the right page! I know, there is a DXL reference manual and it’s a bit concise and difficult to grasp for newcomers, especially if you do not have any previous experience in other programming languages.

In this article series, I will explain the basic concepts of DXL scripting step-by-step with simple enough DXL scripts.

This is our first article in this series, and I will explain how to write a simple DXL script to print the “Hello World” string.

What is DXL?

DXL stands for DOORS eXtension Language. It is a scripting language for rational DOORS. The Rational DOORS is nothing but a requirement management tool that helps to capture and manage the requirements for large projects.

DXL was developed based on the C/C++ programming language. That’s why you would notice that the syntax of DXL is very similar to C/C++. However, there is no concept of the main() function in DXL. You do not need to write a mandatory main() function in DXL. Also, keeping a semicolon at the end of the statement is not mandatory in DXL. There is no concept of the pointer in DXL. This was done to make the DXL simpler.

Features of DXL Scripting:

  1. It is an interpreted language.
  2. DXL is very similar to the C programming language.
  3. It is procedural in nature.
  4. The pointer is not available in DXL.
  5. Manual garbage collection.

DXL scripting is mainly used for automating repetitive tasks in DOORS. It is an extension of the DOORS tool. Each and every GUI operation that you perform in DOORS via GUI can be automated via DXL scripting. With a decent knowledge of DXL scripting, you can even create a brand new tool with GUI that can be used as a customized tool to meet specific needs.

Is DXL interpreted or compiled?

Even though the syntax is similar to C/C++, DXL is an interpreted language. There is a DXL interpreter that interprets the DXL script line by line and executes the program.

So, the DXL interpreter is responsible to execute the DXL script.

DOORS DXL - Introduction » TheCloudStrap (2)

Hello World Program in DXL

Traditionally, we write the “Hello World” program as the first program, while learning any new programming language. In this section, let’s see, how to write and execute a simple hello world DXL script:

// www.TheCloudStrap.Com/************************************************************************* $FILENAME: d1.1.dxl* $DESCRIPTION: This is a sample DXL program.** NOTICE: Copyright www.TheCloudStrap.Com. All rights reserved.* Software comes without any warranties and guarantees, is provided * as is and is not supported. Use this software at your own risk. * Authors resume no liabilities.* * Contact: admin {at} TheCloudStrap.com************************************************************************/print "Hello World"

Now, let us look at the above code closely and explain how it works.

In DXL we use // for single line comment and /* */ for multiline comment. So, clearly, the commenting style is the same as C/C++. Line no-1 is a single-line comment which starts with //. Line No-3 is the starting of the multiline comment i.e. /* and ends at Line No-7 with */. Comments are in general used to make the code more readable and explain the algorithm. Comments are ignored by the DXL interpreter.

To print a string, you just need to use “print”. However, please note that it is not mandatory to put a semicolon at the end of the statement in DXL. However, you can put a semicolon at the end of the statement if you wish to. But, most experienced programmer tends to avoid the semicolon to differentiate the DXL script from C/C++ program.

Now, that we understand the above program, let us now see how to execute it.

How to execute the Hello World DXL Script?

To execute the program, you need to open your DOORS and navigate to: Tools -> Edit DXL. You will find the DXL Interaction window as shown below.

DOORS DXL - Introduction » TheCloudStrap (3)

You can type your script in the “DXL Input” pane (the upper half of the DXL Interaction Window) and then click on the “Run” button to execute the script. The output will be displayed in the “DXL output” pane (the bottom half of the DXL Interaction window).

Hello World Program Output

Now let’s run the program by clicking on the “Run” button and see the output. As you can see in the below image, the output is displayed in the “DXL output” pane.

DOORS DXL - Introduction » TheCloudStrap (4)

Print Function – String

So far, we have seen how to write/edit a simple DXL script and execute it. We have seen, how to display a string in the DXL output window using the print function.

In this section, let us understand the print function in depth.

Print is a function that is used to display a string or other native data variable in the DXL output window. It is optional to use the parentheses for print. You can either use print or print(). In general, you can avoid the parenthesis for zero or single argument function call.

So, you could write the code as:

// www.TheCloudStrap.Com/************************************************************************* $FILENAME: d1.2.dxl* $DESCRIPTION: This is a sample DXL program.** NOTICE: Copyright www.TheCloudStrap.Com. All rights reserved.* Software comes without any warranties and guarantees, is provided * as is and is not supported. Use this software at your own risk. * Authors resume no liabilities.* * Contact: admin {at} TheCloudStrap.com************************************************************************/print("Hello World")
DOORS DXL - Introduction » TheCloudStrap (5)

Notice that the print is used along with the parentheses. You can also add new line character or a tab character if you wish to:

// www.TheCloudStrap.Com/************************************************************************* $FILENAME: d1.3.dxl* $DESCRIPTION: This is a sample DXL program.** NOTICE: Copyright www.TheCloudStrap.Com. All rights reserved.* Software comes without any warranties and guarantees, is provided * as is and is not supported. Use this software at your own risk. * Authors resume no liabilities.* * Contact: admin {at} TheCloudStrap.com************************************************************************/print("\tHello World\n")

You will see the output as:

DOORS DXL - Introduction » TheCloudStrap (6)

You can clearly notice that the \t is used to put the tab character before Hello World.

Print Function – Other Data Types

So far, we have seen how to print a string using DXL scripting. Let us now look into an example that will print the value of other data type variables such as – int, real, bool, etc. Notice that I have intentionally put semicolons in some of the statements in Lines No-10, 11, 14, and 15.

But, normally whichever notation you are following, you need to be consistent in following that. If you do not wish to put a semicolon, do not use it anywhere in the program. You should always avoid mixing the style.

// www.TheCloudStrap.Com/************************************************************************* $FILENAME: d1.4.dxl* $DESCRIPTION: This is a sample DXL program.** NOTICE: Copyright www.TheCloudStrap.Com. All rights reserved.* Software comes without any warranties and guarantees, is provided * as is and is not supported. Use this software at your own risk. * Authors resume no liabilities.* * Contact: admin {at} TheCloudStrap.com************************************************************************/int i = 100real r = 200.58;bool b = true;string s = "Welcome to DXL!"print("i = " i "\n");print("r = " r "\n");print("b = " b "\n")print("s = " s "\n")
DOORS DXL - Introduction » TheCloudStrap (7)

In this example, I have mentioned integer, real, bool, and string-type variables. In the following article, we will look into these data types in detail.

Conclusion

This was the first part of the DOORS DXL tutorial. The intention of this article was to familiarize with DOORS DXL and show you how to edit and execute a simple program. Please comment below if you have any questions/suggestions.

DOORS DXL – Introduction

DOORS DXL - Introduction » TheCloudStrap (8)

Admin

This post was published by Admin.

Email: admin@TheCloudStrap.Com

Related posts:

  1. DOORS DXL – Basic data types
  2. DOORS DXL – Character
  3. DOORS DXL Array
  4. DOORS DXL Skip List
  5. DOORS DXL Items
  6. DOORS DXL File Operation
  7. DOORS DXL Dialog Box
  8. DOORS DXL Skip List Advanced
  9. 5+ Best Practices for DXL Scripting in IBM DOORS: Ensuring Efficiency and Maintainability
  10. Customizing IBM DOORS with DXL: Tailoring the Tool to Fit Your Organization’s Needs
DOORS DXL - Introduction » TheCloudStrap (2024)

References

Top Articles
Latest Posts
Article information

Author: Roderick King

Last Updated:

Views: 5927

Rating: 4 / 5 (51 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Roderick King

Birthday: 1997-10-09

Address: 3782 Madge Knoll, East Dudley, MA 63913

Phone: +2521695290067

Job: Customer Sales Coordinator

Hobby: Gunsmithing, Embroidery, Parkour, Kitesurfing, Rock climbing, Sand art, Beekeeping

Introduction: My name is Roderick King, I am a cute, splendid, excited, perfect, gentle, funny, vivacious person who loves writing and wants to share my knowledge and understanding with you.