Saturday, March 7, 2026

Maximum IF-THEN Levels Includes All IF-THEN Clauses

08-Mar-2026

Last Friday, I was doing an update to an existing command procedure. I needed to make a continuous check for values comparing it with a reference value.

I knew aboug that maximum depth for the IF-THEN clause. What I didn't know is that it includes any subsequent IF-THEN clauses within an enclosing IF-THEN clause.

Anyway, when I tested the program, I saw the error, UNDEFINED IF-THEN% something-something, and I checked where I have done the change.

I caught it. It was the long IF-THEN clauses, but this time, there is already the IF-THEN clause at the top level. How did I got it fixed? 

Good thing there is GOSUB.

I found a nice location where it won't affect the rest of the loops and all, et voila!

So, there you have it.

Maximum IF-THEN levels is still 15, and it applies to the enclosing IF-THEN clause down to subsequent IF-THEN clauses. Use GOSUB, or any other applicable lexicals to effect the logic you need.

Till then!

Saturday, January 17, 2026

How do I get the DCL variable into PCL?

17-Jan-2025


How do I get the DCL variable into PCL?

When creating scripts, you usually switch between PROMIS and VMS. You write Scripts (.scr) and command procedures (.com), and you extract data either by running PROMIS scripts or by running TP commands. And 99.9% of the time, evaluation and decision-making is at the DCL level.

When you have the set of commands and variables that you want to run in PROMIS, how do you make these available in PROMIS (PCL)?

Quite simple, actually. And you would feel it silly once you know it.

Here's how. Really simple.

Let's say in DCL, you have a variable named var:

$ var :== this_value

At this points, this is only available in DCL, and when you go up to PCL, issuing %var will result in error.

To make 'var' variable available in PCL, just prefix it with 'pcl_'. Yes, that simple.

So

$ var == this_value

becomes

$ pcl_var == this_value

and then when you issue %var in PCL, the value will be resolved.

No, you don't use %pcl_var in PCL, only %var.

So what if you want to retain var variable in DCL?

Just add a line to assign the value of var into another variable, but that variable has to have 'pcl_' prefix, like this:

$ var == this_value

$ pcl_pvar == ''var'

or, if you want string value, just add double quotation mark before and after the assignment, like so:

$ pcl_pvar == "''var'"

Then at PCL, you can use '%pvar' and the value is resolved.

Alright. That's it for now. Hope this helps.

Till then!