0

I have been trying to think of solutions for this but have not had much luck on my own.

I am trying to create a macro/routine that will filter out certain results from the system as we normally get flooded by them.

Is there a way to filter results that contain 512345 or any other numbers.

I have thought about maybe outputting the history results into a file and then making some sort of loop to read said file and try filter it out that way but i don't even know how to do that as I have no examples to work off of.

This is the current history command i'm trying to use.

History all,,substandard approval rate

Any ideas/help would be great;y appreciated

Thanks.

Gizmo0
  • 13
  • 5

3 Answers3

1

The builtin TACL history command only accepts one (optional) argument which is the number of old commands to show you, so it's not obvious that you are using that from your example. It also uses #HISTORY which has a buffer of 1000 characters.

Assuming that you are using the builtin command, you can see how it is written and write your own TACL routine that does filtering. You would have to redirect #OUT to capture the output.
This is what the existing command looks like:

    $AS ASHOME 3> outvar history
    #FRAME
    #PUSH :^lines
    [#CASE [#ARGUMENT/VALUE :^lines/ NUMBER END]
    |1| [#IF [#ARGUMENT END]]
    |2| #SET :^lines 10
    ]
    #HISTORY/SHOW :^lines/
    #UNFRAME

So you can do something along these lines:


    $AS ASHOME 4> #PUSH #OUT
    $AS ASHOME 5> #SET #OUT a
    $AS ASHOME 6> #HISTORY/SHOW 100/
    $AS ASHOME 7> #POP #OUT
    $AS ASHOME 8> #PUSH cmds
    $AS ASHOME 9> FILETOVAR a cmds
    $AS ASHOME 10> #OUTPUTV cmds

You now have the history in file a and also in a TACL variable cmds and you can process it as you want.

Andy Simpson
  • 367
  • 2
  • 6
  • I am unsure of what all the tags you use means i'll go off and look at the manuals and do some reading on them to better understand them. If i understand you right you are saying i can put the history output into a variable and then filter through that without having to make a file? I will give this ago when i get free time as I am trying to do this during down time at work to try learn thank :) – Gizmo0 Jul 27 '20 at 15:11
  • Ok sorry I guess i was unclear in what my question was and should have thought of more detail at the time. I am currently trying to run an **INLINE** history command that i want to capture the results of the code you provided shows the history of commands that have been run on my TACL session. Still cool to know that's possible but not what i am trying to do. If tou would like more code examples i can edit the post above if needed. – Gizmo0 Jul 27 '20 at 15:28
  • OK, since TACL itself contains a built-in command called history there is a certain amount of confusion :) – Andy Simpson Jul 28 '20 at 23:09
  • Changing the question to show the commands you issue and some sample output should help (starting from naked TACL, but obviously mask anything sensitive). – Andy Simpson Jul 28 '20 at 23:28
  • I'll try to add something when I get back to work after my weekend. I have also been talking to come people on a google form here if you're interested. https://groups.google.com/forum/#!topic/comp.sys.tandem/dYK820yNnwI – Gizmo0 Jul 30 '20 at 03:55
0

You see you can use the above explanation and store the logs in a variable and later filter that variable using appropriate filters to get the desired results.

If you are using an inline process, make sure to close the process before exiting or else it will interrupt saying an inline process already exists.

ouflak
  • 2,458
  • 10
  • 44
  • 49
0

I very recently wrote a ?tacl routine to display commands which match a given string and allows you to choose one for re-execution; it's not well tested and also does not mimic FC, i.e. allow you to edit the command prior to running it.

My apologies for any bugs or awkwardness; My non-stop skills are a bit rusty.

    ?section incr routine
    #frame
    #push var_to_incr
    [#loop |while| [#more] |do|
      sink [#argument /text var_to_incr/ variable /syntax/]
      #set [var_to_incr] [#compute [var_to_incr] + 1]
    ]
    #unframe


    ?section isdigit routine
    #frame
    push var off ch nope
    #set off 1
    #set nope 12345678
    #set var [#rest]
    [#loop |while| [off] <= [#charcount var] |do|
      #set ch [#charget var [off] for 1]
      [#CASE [ch]
        | 0 |
        | 1 |
        | 2 |
        | 3 |
        | 4 |
        | 5 |
        | 6 |
        | 7 |
        | 8 |
        | 9 |
        | OTHERWISE |
          #set off [#compute [nope]-1]
      ]
      incr off
    ]

    [#if [off] = [nope] |then|
      #result 0
    |else|
      #result 1
    ]
    #unframe


    ?section tmpfile routine

    push tmpfile^tdir tmpfile^tfil tmpfile^cmds

    [#if [#more] |then|   == have args
      #if [#argument /value tmpfile^tdir/ word /space/]
      [#set tmpfile^tdir [tmpfile^tdir].]
    ]

    #SET/TYPE DELTA/tmpfile^cmds 0,Z-4K
    [ #LOOP |DO|
      #SET tmpfile^tfil [tmpfile^tdir]z6[ #DELTA/COMMANDS tmpfile^cmds/
      [#TIMESTAMP] ]
      |UNTIL| NOT
      [ #FILEINFO/EXISTENCE/ [tmpfile^tfil ]]
    ]

    #result [tmpfile^tfil]
    pop tmpfile^tfil tmpfile^tdir tmpfile^cmds


    ?section selhist routine

    == get optional search arg
    push argv
    #if [#argument/peek, text argv/text otherwise]
    [#if "[argv]" '<>' "" |then|
      #if [#argument/text argv/word]   == get it
    ]

    == get history
    push tfil hist
    #set tfil [tmpfile [tmpdir]]
    push #out
    #set #out [tfil]
    history 100
    pop #out
    filetovar [tfil] hist

    == display history
    push cmd fvar
    [#loop |while| not [#emptyv hist] |do|
      #extractv hist cmd
      [#set fvar]
      [#if not [#emptyv cmd] |then|
        [#if "[argv]" '<>' "" |then|
          vfind/quiet, to fvar/ cmd "[argv]"
        |else|
          [#set fvar [cmd]]
        ]
        [#if "[fvar]" '<>' "" |then|
          #output [cmd]
          push ohist
          [#set ohist [cmd]]
        ]
      ]
    ]

    push sel
    [#set sel]
    #inputv sel   "Which command: "
    [#if "[sel]" '<>' "" AND [isdigit [sel]] |then|
      == choice made -- find and reexcute it
      [#set sel [sel]>]
      push lenof
      [#set lenof [#charcount sel]]
      [#loop |while| [#variableinfo/existence/ ohist] |do|
        [#set cmd [#charget ohist 1 for [lenof]]]
        [#if "[cmd]" '=' "[sel]" |then|
          incr lenof
          [#set cmd [#charget ohist [lenof] for [#charcount ohist]]]
          [cmd]
        ]
        pop ohist
      ]
      pop lenof
    |else|
      pop ohist
    ]

    pop argv
    remove [tfil]
    pop tfil
    pop hist
    pop cmd
    pop fvar
    pop sel