Convoluted and not intuitive but it works. On Tue, Jan 21, 2025 at 6:05 PM Glenn Knickerbocker <n...@bestweb.net> wrote: > > On Thu, 16 Jan 2025 21:10:57 -0600, Lionel B Dyck <lbd...@gmail.com> wrote: > >Corrected URL as the article was moved to the Tutorials section of the site > >https://dinoframe.io/tutorial/a-rexx-outtrap-secret > > It took me a while to understand what the alternative was to > > call outtrap 't.' > x = sayit('Calling LISTD') > > that *didn't* capture the output. > > I thought at first you might be pointing out a difference between calling > SAYIT as a function: > x = sayit('Calling LISTD') > and as a command: > 'SAYIT Calling LISTD' > > But no, the output is trapped either way. It finally dawned on me that you > were hoping for OUTTRAP to capture the exec's own console output: > > call outtrap 't.' > say 'Calling LISTD' /* trap this to be processed later */ > > So the real "secret" here is that the scope of "command output" captured by > OUTTRAP is the output of commands issued by the exec (where an external > function or subroutine is effectively called as a command), and doesn't > include the exec's own output. > > The presumption was probably that your exec could manage its own output and > didn't need OUTTRAP to process it. Unfortunately, you can't just increment > OUTTRAP's index yourself and insert your own lines, something like: > > next = t.0 + 1 > t.next = 'Calling LISTD' > t.0 = next /* nope, OUTTRAP won't use this */ > > because OUTTRAP keeps its own index internally and won't refer back to T.0 to > see where to save the next line of output. You'd have to keep a "stem of > stems" and then process them all together later: > > t.0 = 0 > ... > next = t.0 + 1 > t.0 = next > t.next.1 = 'Calling LISTD' > t.text.2 = ' ' > t.next.0 = 2 > > next = t.0 + 1 > t.0 = next > Call Outtrap 'T.'next'.' > "listd 'sys1.parmlib'" > > next = t.0 + 1 > t.0 = next > t.next.1 = ' ' > t.next.2 = 'LISTD Completed.' > t.next.0 = 2 > ... > Call Outtrap 'OFF' > Do i = 1 to t.0 > Do j = 1 to t.i.0 > Say t.i.j > End > End > > ¬R > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
-- Lionel B. Dyck <>< Website:https://github.com/lbdyck "Worry more about your character than your reputation. Character is what you are, reputation merely what others think you are." - John Wooden ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN