cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
lwx228
Level VIII

How do write code in JSL to call another JSL?

Hello everyone!
In  AAA.jsl, how do  write code that calls another JSL to continue running: for example, this another JSL is  BBB.jsl with the same path


When BBB. jsl finished, AAA. JSL continues to run the rest of the code.

thanks you!

6 REPLIES 6
txnelson
Super User

Re: How do write code in JSL to call another JSL?

Use the 

     Include();

function.

I strongly advise that you spend time and read the Scripting Guide

     Help==>Books==>Scripting Guide

 

Jim
lwx228
Level VIII

Re: How do write code in JSL to call another JSL?


This seems to work,

where bbb. JSL only performs 2 files at a time, and moves the resulting file to another path in a timely manner, with code to clear the variable:
Include("d:\BBB.jsl");Wait(0);
Include("d:\BBB.jsl");Wait(0);
Include("d:\BBB.jsl");Wait(0);
Include("d:\BBB.jsl");Wait(0);
Include("d:\BBB.jsl");Wait(0);
……



Clear Log(); Clear Globals(); Close All(DataTables,"No Save");


This reduces the number of automatic exits.
lwx228
Level VIII

Re: How do write code in JSL to call another JSL?


Please consult experts:


What else should you pay attention to in JSL, such as freeing memory and erasing variables?Thank you!

Except the following:Clear Log(); Clear Globals(); Close All(DataTables,"No Save");
txnelson
Super User

Re: How do write code in JSL to call another JSL?

Clear symbols();
Jim
gzmorgan0
Super User (Alumni)

Re: How do write code in JSL to call another JSL?

Jim provided the correct answer, but this blog took another turn.

 

I recommend that you investigate scoping, specifically Names Default to Here() and New Context when working with Include();

 

Without proper scoping, clear symbols() could lead to unwarranted behavior.  

 

You likely do not need this, but as an FYI, Run Program() can be used to create a new instance of JMP and execute a script or commands, then return to your session.  There is no sharing of data or variables.

 

lwx228
Level VIII

Re: How do write code in JSL to call another JSL?

Well, Thanks for the way. I'll write them to BBB.jsl.