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?there has to be a better way.
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
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.If the script is a ?TACL MACRO you can reference %0% to retrieve the name of the Macro file.
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
run tryit\SYFDEV.$USER.WAYNE.TRYIT
On Sunday, March 26, 2023 at 4:06:19 PM UTC-5, Andrew Mould wrote:there has to be a better way.
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
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!
- AndrewIf 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
run tryit\SYFDEV.$USER.WAYNE.TRYIT
On Monday, March 27, 2023 at 2:45:57 p.m. UTC-4, FSGWGB wrote:think there has to be a better way.
On Sunday, March 26, 2023 at 4:06:19 PM UTC-5, Andrew Mould wrote:
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
Yeah I was only thinking about TACL ROUTINEs, but using a TACL MACRO wrapper will actually work.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!
- AndrewIf the script is a ?TACL MACRO you can reference %0% to retrieve the name of the Macro file.
for example
fup copy tryitYou can do this as above for TACL MACROs but not for TACL ROUTINEs, AFAIK. --Randall
?Tacl Macro
#OUTPUT %0%
2 RECORDS TRANSFERRED
run tryit\SYFDEV.$USER.WAYNE.TRYIT
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 297 |
Nodes: | 16 (0 / 16) |
Uptime: | 02:59:01 |
Calls: | 6,669 |
Calls today: | 1 |
Files: | 12,217 |
Messages: | 5,338,640 |