Multiple job name
- Giorgio Garabello
- Gold Card
- Posts: 277
- Joined: Tue Jun 30, 2015 8:39 am
- Location: Turin, Italy
- Contact:
Multiple job name
Ok, the problem is this:
in BOOT I have to launch a certain program, let's call it PIPPO a certain number of times.
Each launch will be made with a different parameter. (because the program based on the parameter will do different things.)
so in my job list will appear a number of programs all with the same name.
At a certain point I may need to close only one of these jobs, the one launched with a certain parameter ....
How can I distinguish them?
Can a job change its name independently?
sorry for my bad english..
Giorgio
in BOOT I have to launch a certain program, let's call it PIPPO a certain number of times.
Each launch will be made with a different parameter. (because the program based on the parameter will do different things.)
so in my job list will appear a number of programs all with the same name.
At a certain point I may need to close only one of these jobs, the one launched with a certain parameter ....
How can I distinguish them?
Can a job change its name independently?
sorry for my bad english..
Giorgio
Quantum Technology
http://www.hunggartorino.it/ql/language/en/
http://www.hunggartorino.it/ql/language/en/
Re: Multiple job name
Giorgio,
yes, a job can change its name, if it is prepared to do so. Some programs change the job name to the file that is being worked on - QD, for example will display the file being edited as part of the job name. It is, however, close to impossible to change a jobs name "from the outside", because it is only the programmer of the job that knows how much space he reserved for the name (which lives inside the job's memory), and by far the most executable programs assume a constant string and a constant length for the name - So, normally, there's just no room in the job to patch the name (and it is actually a bit complex to get the address of a job's name).
Distinguishing jobs by their name is also not a very good method - there is no guarantee at all that a job's name is unique - What's unique in the system ist its job ID.
What you can do easily, however, is to use FEX (which returns the job ID of the newly started job) instead of EX to start a job and remember the job IDs in BASIC variables (or wherever else you prefer, on a file in a ram disk, for example):
will do the same as
but save the job ID of the executable job in a and kill the job using its job ID and tag in line 2000.
Note all of this will only work on newer SMSQ/Es
Tobias
yes, a job can change its name, if it is prepared to do so. Some programs change the job name to the file that is being worked on - QD, for example will display the file being edited as part of the job name. It is, however, close to impossible to change a jobs name "from the outside", because it is only the programmer of the job that knows how much space he reserved for the name (which lives inside the job's memory), and by far the most executable programs assume a constant string and a constant length for the name - So, normally, there's just no room in the job to patch the name (and it is actually a bit complex to get the address of a job's name).
Distinguishing jobs by their name is also not a very good method - there is no guarantee at all that a job's name is unique - What's unique in the system ist its job ID.
What you can do easily, however, is to use FEX (which returns the job ID of the newly started job) instead of EX to start a job and remember the job IDs in BASIC variables (or wherever else you prefer, on a file in a ram disk, for example):
Code: Select all
100 a = FEX ("win1_progs_qd")
1000 REM Lots of program lines.....
2000 RJOB a MOD $10000,a DIV $10000,0
Code: Select all
100 EX "win1_progs_qd"
Note all of this will only work on newer SMSQ/Es
Tobias
ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
- Giorgio Garabello
- Gold Card
- Posts: 277
- Joined: Tue Jun 30, 2015 8:39 am
- Location: Turin, Italy
- Contact:
Re: Multiple job name
Hello, I'm talking about a program written by me in SBasic, but I did not understand how to do .... be patient, my English suckstofro wrote:Giorgio,
yes, a job can change its name, if it is prepared to do so. Some programs change the job name to the file that is being worked on - QD, for example will display the file being edited as part of the job name. It is, however, close to impossible to change a jobs name "from the outside", because it is only the programmer of the job that knows how much space he reserved for the name (which lives inside the job's memory), and by far the most executable programs assume a constant string and a constant length for the name - So, normally, there's just no room in the job to patch the name (and it is actually a bit complex to get the address of a job's name).
Distinguishing jobs by their name is also not a very good method - there is no guarantee at all that a job's name is unique - What's unique in the system ist its job ID.
What you can do easily, however, is to use FEX (which returns the job ID of the newly started job) instead of EX to start a job and remember the job IDs in BASIC variables (or wherever else you prefer, on a file in a ram disk, for example):will do the same asCode: Select all
100 a = FEX ("win1_progs_qd") 1000 REM Lots of program lines..... 2000 RJOB a MOD $10000,a DIV $10000,0
but save the job ID of the executable job in a and kill the job using its job ID and tag in line 2000.Code: Select all
100 EX "win1_progs_qd"
Note all of this will only work on newer SMSQ/Es
Tobias
Quantum Technology
http://www.hunggartorino.it/ql/language/en/
http://www.hunggartorino.it/ql/language/en/
Re: Multiple job name
In SBASIC you could just
JOB_NAME pippo & HEX$(DATE,32)
to create a unique job name. This name can be changed in the same way while the (SBASIC) job is running. Cant remember the name length limit, although it must be more than 40+ char.
In QLiberated programs there is no documented way to change the name of the job from within the job (although Ive written a small toolkit that does exactly that). The name length limit is in the current version of QLib is, sadly, only 22 char. Hopefully this will change in the next version of QLiberator!
It should be possible to change a job's name from "outside" the job, provided you know the space available (eg 22 char for QLibed jobs).
JOB_NAME pippo & HEX$(DATE,32)
to create a unique job name. This name can be changed in the same way while the (SBASIC) job is running. Cant remember the name length limit, although it must be more than 40+ char.
In QLiberated programs there is no documented way to change the name of the job from within the job (although Ive written a small toolkit that does exactly that). The name length limit is in the current version of QLib is, sadly, only 22 char. Hopefully this will change in the next version of QLiberator!
It should be possible to change a job's name from "outside" the job, provided you know the space available (eg 22 char for QLibed jobs).
Per
dont be happy. worry
- ?
dont be happy. worry
- ?
- Giorgio Garabello
- Gold Card
- Posts: 277
- Joined: Tue Jun 30, 2015 8:39 am
- Location: Turin, Italy
- Contact:
Re: Multiple job name
but job_name don't work with compiled programs....pjw wrote:In SBASIC you could just
JOB_NAME pippo & HEX$(DATE,32)
to create a unique job name. This name can be changed in the same way while the (SBASIC) job is running. Cant remember the name length limit, although it must be more than 40+ char.
In QLiberated programs there is no documented way to change the name of the job from within the job (although Ive written a small toolkit that does exactly that). The name length limit is in the current version of QLib is, sadly, only 22 char. Hopefully this will change in the next version of QLiberator!
It should be possible to change a job's name from "outside" the job, provided you know the space available (eg 22 char for QLibed jobs).
Quantum Technology
http://www.hunggartorino.it/ql/language/en/
http://www.hunggartorino.it/ql/language/en/
Re: Multiple job name
Or justtofro wrote:Code: Select all
100 a = FEX ("win1_progs_qd") 1000 REM Lots of program lines..... 2000 RJOB a MOD $10000,a DIV $10000,0
Code: Select all
100 jid = FEX ("win1_progs_qd")
1000 REM Lots of program lines.....
2000 RJOB jid,0
Per
dont be happy. worry
- ?
dont be happy. worry
- ?
- Giorgio Garabello
- Gold Card
- Posts: 277
- Joined: Tue Jun 30, 2015 8:39 am
- Location: Turin, Italy
- Contact:
Re: Multiple job name
sorry, I did not write all the information, I'm talking about programs written in SBASIC and compiled with QLIBERATOR
Quantum Technology
http://www.hunggartorino.it/ql/language/en/
http://www.hunggartorino.it/ql/language/en/
Re: Multiple job name
You said SBASIC With QLiberated programs you need my toolkit. I'll send a copy to you by email. Remember, the (undocumented) job name length limit for QLiberated programs is only 22 char.Giorgio Garabello wrote:sorry, I did not write all the information, I'm talking about programs written in SBASIC and compiled with QLIBERATOR
Per
dont be happy. worry
- ?
dont be happy. worry
- ?
- Giorgio Garabello
- Gold Card
- Posts: 277
- Joined: Tue Jun 30, 2015 8:39 am
- Location: Turin, Italy
- Contact:
Re: Multiple job name
Sorry, my faultpjw wrote:You said SBASIC With QLiberated programs you need my toolkit. I'll send a copy to you by email. Remember, the (undocumented) job name length limit for QLiberated programs is only 22 char.Giorgio Garabello wrote:sorry, I did not write all the information, I'm talking about programs written in SBASIC and compiled with QLIBERATOR
Giorgio
Quantum Technology
http://www.hunggartorino.it/ql/language/en/
http://www.hunggartorino.it/ql/language/en/
Re: Multiple job name
Alternatively, you have to "remember" the ID of each job:
Saving the best for last: Another way of giving a job a different name from the outside is to use EXEP or its function equivalent, FEP:
I hope one of these methods help..
Code: Select all
DIM jobIDs(20), JobPar$(20, 20): rem or whatever
jobp = 0
..
JobPar$(jobp) = <param_jobp>
jobID(jobp) = FEX(<path>&"PIPPO"; JobPar$(jobp)
jobp = jobp + 1
etc
..
job2kill = Scan(<param_n>): rem Scan JobPar$ for required parameter; ret 0 for not found
if job2kill > 0: RJOB job2kill, 0
Code: Select all
jid = FEP(<path>& "Pippo"; "myparams", "pippo param1")
..
RJOB jid, 0
Per
dont be happy. worry
- ?
dont be happy. worry
- ?