Just create a "job wrapper" around the function, then JOB the subroutine:
JOBEXPORT ; SET UP A ROUTINE TO EXPORT A FILE.Q; USE SEPARATE ENTRY POINT, JUST IN CASE...;
SAVE ; HERE'S THE ACTUAL SUBROUTINE TO EXPORT THE ROUTINE.; IT THROWS AWAY ANY I/O, MAYBE YOU DON'T WANT THAT.D$SYSTEM.OBJ.Export("RTOSAVE.INT","E:\Z\SAVEDROUTINE.RTN")
Q
ObjectScript
ObjectScript
Then, just JOB the subroutine and get the job number:
JOB SAVE^JOBEXPORTSET CHLD=$ZCHILDWRITE CHLD,!
ObjectScript
ObjectScript
( This prints the child process ID, if you don't need to see it you can omit the last WRITE statement. )
Later, to see if the routine is still working, use the $DATA and $^JOB functions:
WRITE$DATA(^$JOB(CHLD))
ObjectScript
ObjectScript
If the 0 the job has completed (or possibly crashed, I suppose) - if it's 1 then the task is still running. There are utilities both in the Management Portal and in the %SYS namespace to terminate rogue processes.
Hope this helps!
[[ Edited for minor error in code... there might be more. ]]
This is possible, but you have to use it the correct way. $SYSTEM.OBJ is just a shorthand for ##class(%SYSTEM.OBJECT), so the correct syntax for your desire is:
When you JOB a process you can get the ID of the child Process with $ZCHILD.
You can then check to see if that process is still running.
Not sure whether you can HALT the process or not, and depending on what it is you are running, it might not be a good idea.
THANKS FOR THAT.
THE MORE IMPORTANT PART OF THE QUESTION IS CAN YOU "JOB $SYSTEM.OBJ" FUNCTION. ON MY MACHINE, I GET THIS:
USER>JOB $SYSTEM.OBJ.Export("RICHS.int","c:\ads\richh.rtn")
JOB $SYSTEM.OBJ.Export("RICHS.int","c:\AAA\richh.rtn")
^
<UNIMPLEMENTED>
USER>
Just create a "job wrapper" around the function, then JOB the subroutine:
JOBEXPORT ; SET UP A ROUTINE TO EXPORT A FILE. Q ; USE SEPARATE ENTRY POINT, JUST IN CASE... ; SAVE ; HERE'S THE ACTUAL SUBROUTINE TO EXPORT THE ROUTINE. ; IT THROWS AWAY ANY I/O, MAYBE YOU DON'T WANT THAT. D $SYSTEM.OBJ.Export("RTOSAVE.INT","E:\Z\SAVEDROUTINE.RTN") Q
Then, just JOB the subroutine and get the job number:
JOB SAVE^JOBEXPORT SET CHLD=$ZCHILD WRITE CHLD,!
( This prints the child process ID, if you don't need to see it you can omit the last WRITE statement. )
Later, to see if the routine is still working, use the $DATA and $^JOB functions:
WRITE $DATA(^$JOB(CHLD))
If the 0 the job has completed (or possibly crashed, I suppose) - if it's 1 then the task is still running. There are utilities both in the Management Portal and in the %SYS namespace to terminate rogue processes.
Hope this helps!
[[ Edited for minor error in code... there might be more. ]]
Instead of the $SYSTEM "shortcut", use the actual full syntax:
JOB ##class(%SYSTEM.OBJ).Export("RICHS.int","c:\AAA\richh.rtn")
This is possible, but you have to use it the correct way. $SYSTEM.OBJ is just a shorthand for ##class(%SYSTEM.OBJECT), so the correct syntax for your desire is:
job ##class(%SYSTEM.OBJ).Export("yourRoutine.mac","yourPathAndFilename.xml")