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?If the script is a ?TACL MACRO you can reference %0% to retrieve the name of the Macro file.
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
run tryit\SYFDEV.$USER.WAYNE.TRYIT
On Sunday, March 26, 2023 at 4:06:19rC>PM UTC-5, Andrew Mould wrote:You can do this as above for TACL MACROs but not for TACL ROUTINEs, AFAIK. --Randall
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!
- 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:57rC>p.m. UTC-4, FSGWGB wrote:Yeah I was only thinking about TACL ROUTINEs, but using a TACL MACRO wrapper will actually work.
On Sunday, March 26, 2023 at 4:06:19rC>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 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!
- 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: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 65 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 00:52:51 |
| Calls: | 862 |
| Files: | 1,311 |
| D/L today: |
10 files (20,373K bytes) |
| Messages: | 264,186 |