Discussion:
Determining the full filename of a TACL script file
(too old to reply)
Andrew Mould
2023-03-26 21:06:17 UTC
Permalink
Anyone know of a method or trick to reliably determine the full filename (ie including subvolume) of a TACL script file when it's executed? Something like the equivalent of Bash's $0 variable?

I often want to know where the script file is located in order to find related files in the same subvolume. The only reliable way I see to achieve this is to pass the subvolume info in to the script as a param. Every time I face this problem I think there has to be a better way.

Note I want this to be reliable. There are convoluted tricks you can do when operating at the command line, which don't work when a script file is invoked from another TACL macro / routine.

I don't hold out much hope. The TACL reference manual itself says: "...a routine stored in a ?TACL ROUTINE file cannot determine the name of the file it is stored in...". But I thought I'd poll the collective brain trust!

- Andrew
FSGWGB
2023-03-27 18:45:55 UTC
Permalink
Post by Andrew Mould
Anyone know of a method or trick to reliably determine the full filename (ie including subvolume) of a TACL script file when it's executed? Something like the equivalent of Bash's $0 variable?
I often want to know where the script file is located in order to find related files in the same subvolume. The only reliable way I see to achieve this is to pass the subvolume info in to the script as a param. Every time I face this problem I think there has to be a better way.
Note I want this to be reliable. There are convoluted tricks you can do when operating at the command line, which don't work when a script file is invoked from another TACL macro / routine.
I don't hold out much hope. The TACL reference manual itself says: "...a routine stored in a ?TACL ROUTINE file cannot determine the name of the file it is stored in...". But I thought I'd poll the collective brain trust!
- Andrew
If the script is a ?TACL MACRO you can reference %0% to retrieve the name of the Macro file.

for example

fup copy tryit
?Tacl Macro
#OUTPUT %0%
2 RECORDS TRANSFERRED
13> run tryit
\SYFDEV.$USER.WAYNE.TRYIT
Randall
2023-03-27 19:42:47 UTC
Permalink
Post by FSGWGB
Post by Andrew Mould
Anyone know of a method or trick to reliably determine the full filename (ie including subvolume) of a TACL script file when it's executed? Something like the equivalent of Bash's $0 variable?
I often want to know where the script file is located in order to find related files in the same subvolume. The only reliable way I see to achieve this is to pass the subvolume info in to the script as a param. Every time I face this problem I think there has to be a better way.
Note I want this to be reliable. There are convoluted tricks you can do when operating at the command line, which don't work when a script file is invoked from another TACL macro / routine.
I don't hold out much hope. The TACL reference manual itself says: "...a routine stored in a ?TACL ROUTINE file cannot determine the name of the file it is stored in...". But I thought I'd poll the collective brain trust!
- Andrew
If the script is a ?TACL MACRO you can reference %0% to retrieve the name of the Macro file.
for example
fup copy tryit
?Tacl Macro
#OUTPUT %0%
2 RECORDS TRANSFERRED
13> run tryit
\SYFDEV.$USER.WAYNE.TRYIT
You can do this as above for TACL MACROs but not for TACL ROUTINEs, AFAIK.
--Randall
Andrew Mould
2023-03-28 05:59:28 UTC
Permalink
Post by Randall
Post by FSGWGB
Post by Andrew Mould
Anyone know of a method or trick to reliably determine the full filename (ie including subvolume) of a TACL script file when it's executed? Something like the equivalent of Bash's $0 variable?
I often want to know where the script file is located in order to find related files in the same subvolume. The only reliable way I see to achieve this is to pass the subvolume info in to the script as a param. Every time I face this problem I think there has to be a better way.
Note I want this to be reliable. There are convoluted tricks you can do when operating at the command line, which don't work when a script file is invoked from another TACL macro / routine.
I don't hold out much hope. The TACL reference manual itself says: "...a routine stored in a ?TACL ROUTINE file cannot determine the name of the file it is stored in...". But I thought I'd poll the collective brain trust!
- Andrew
If the script is a ?TACL MACRO you can reference %0% to retrieve the name of the Macro file.
for example
fup copy tryit
?Tacl Macro
#OUTPUT %0%
2 RECORDS TRANSFERRED
13> run tryit
\SYFDEV.$USER.WAYNE.TRYIT
You can do this as above for TACL MACROs but not for TACL ROUTINEs, AFAIK.
--Randall
Yeah I was only thinking about TACL ROUTINEs, but using a TACL MACRO wrapper will actually work.

Thanks to both of you

- Andrew

Loading...