• Determining the full filename of a TACL script file

    From Andrew Mould@21:1/5 to All on Sun Mar 26 14:06:17 2023
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From FSGWGB@21:1/5 to Andrew Mould on Mon Mar 27 11:45:55 2023
    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 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
    run tryit
    \SYFDEV.$USER.WAYNE.TRYIT

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Randall@21:1/5 to FSGWGB on Mon Mar 27 12:42:47 2023
    On Monday, March 27, 2023 at 2:45:57 p.m. UTC-4, FSGWGB wrote:
    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 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
    run tryit
    \SYFDEV.$USER.WAYNE.TRYIT

    You can do this as above for TACL MACROs but not for TACL ROUTINEs, AFAIK. --Randall

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andrew Mould@21:1/5 to Randall on Mon Mar 27 22:59:28 2023
    On Monday, March 27, 2023 at 12:42:48 PM UTC-7, Randall wrote:
    On Monday, March 27, 2023 at 2:45:57 p.m. UTC-4, FSGWGB wrote:
    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
    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
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)