<< Click to Display Table of Contents >> Navigation: 3. Script Language > JXX. - Jump - Instructions > JXX-Commands: "Jump If ..." |
MiniRobotLanguage (MRL)
JNJ. Unconditional Script Call/Jump
Jump in New file and Jump to label
Intention
Continues Script Execution in another File optionally directly at a specified Label.
The second Parameter - if given - must be a Label, which is the Start-point in the other file.
Parameters P3 ..Px can be given as Parameter like in JNF. These parameters will be available in the other script file as §§_02 ...§§_25
Can use Parameters. You give the parameter separated with a | (Pipe) Symbol after the JNJ.-call. Like this:
JNJ.MySubscript.mrt|Startlabel|Param01|Param02
END.
In the Target script that is called, the parameters appear in:
Startlabel:
§§_00 -> number of given parameters (here 2)
§§_01 -> contains the Label (here "Startlabel")
§§_02 -> first Parameter (here "Param01")
§§_03 -> second Parameter (here "Param02")
You can use up to 24 Parameters in case you need them.
Can use script-local variables that are local to each file.
JNJ's and JNF.'s can be nested to unlimited depth, even recursive.
Return to the calling Script with RTS.(ReTurn from Subroutine)-Command or ENR. (End-Return). This will restore the script-local variables of the calling script, including the parameter-variables.
Syntax
JNJ.P1[|P2][|P3..Px]
Parameter Explanation
P1 - Scriptfilename
P2 - (optional) Label to Start at
P3 ... Px - up to 24 Parameters
Please note, that even if the "Goto 1st Parameter" has been done, §§_01 still contains the Label.
Therefore the first "real" Parameter is in §§_02.
Example
We need to have 2 Script Files for this simple Example.
Both need to be in the same folder.
The first Scriptfile, "First.txt" that is run defines ?path, which is the folder where it is. it calls the second file "second.txt".
'***********************************************
' Example 1 - without Parameters,
' with local and global variables
'***********************************************
[First.txt]
JNJ.Second.txt|Laba
PRT. Resultat ist: $$GLO
END.
[Second.txt]
:Labb
: $$GLO=2
JMP.Labc
:Laba
: $$GLO=3
:Labc
RTS.
'***********************************************
' Example 2 - with 2 Parameters
'***********************************************
[Main.txt]
JNJ.Sub.txt|LabC|Parameter 1
END.
[Sub.txt]
: §§AAA=This Command wont get executed!
:LabC
: §§AAA=This Command will get executed!
' The following Variable will get the Parameter 1, as §§_01 contains the Label.
: §§AAB=§§_02
RTS\
Remarks
§§_00 is the number of parameters given to the Script using JNF. or JNJ.
§§_01 ... §§_24 are used for Parameters in the target Script file.
Limitations:
You can use up to 24 Parameters with JNJ. If you need more, use Global variables or the Block-Commands (SIB. etc).
See also:
• RTS. - ReTurn from Subroutine