IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

OUTTRAP Equivalent function in CLIST


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
upendrasri

Active User


Joined: 28 Sep 2017
Posts: 121
Location: India

PostPosted: Thu Mar 12, 2020 12:12 pm
Reply with quote

Hi All,

Am using below CLIST to get LISTCAT details of a dataset
Code:

PROC 1 FOO                 
LISTCAT ENTRIES(&FOO) ALL   
END                         


The above CLIST works fine but output populated in mainframe screen. I want to capture the output in a file.

I know in REXX we can do that using OUTTRAP Function. Do we have any equivalent function in CLIST?

Thanks!
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Mar 12, 2020 1:27 pm
Reply with quote

the chances of getting help on CLIST issues are pretty slim,
when using rexx is a better alternative
Back to top
View user's profile Send private message
upendrasri

Active User


Joined: 28 Sep 2017
Posts: 121
Location: India

PostPosted: Thu Mar 12, 2020 1:54 pm
Reply with quote

Hi Enrico,

Yes.. Am totally agree with you. Since we have old CLIST's in our environment and some times we may have to modify them as per the new requirements .
So thought of grabbing some knowledge on CLIST.

Thanks!
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1245
Location: Bamberg, Germany

PostPosted: Thu Mar 12, 2020 3:50 pm
Reply with quote

@upendrasri: Have a look here to get a clue https://stackoverflow.com/questions/3479772/can-clist-access-pds-member-and-gdg-file
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Thu Mar 12, 2020 8:00 pm
Reply with quote

Yes, there is an OUTTRAP idea in CLIST to spool command output in storage. It works much the same as in Rexx; you specify you want it done; run your command, and then you can retrieve the lines.

Regardless of Rexx or CLIST, OUTTRAP only works when the output is coming directly from the command using standard TSO services. LISTCAT works well because it's a TSO command writing output to the terminal using TSO services rather than lower level services.

Look in z/OS TSO/E CLISTs for your z/OS release. Try this link.

For example -
Code:
00100 PROC 0
00200 CONTROL LIST
00300 SET &SYSOUTTRAP = 500
00400 LISTC LE(XXX.ZJ)
00500 SET SYSOUTTRAP = 0
00600 SET J = &SYSOUTLINE
00700 WRITE J = &J
00800 IF &J > 0 THEN +
00900  DO &I = 1 TO &J BY 1
01000   SET Z = &STR(&&SYSOUTLINE&I)
01100   WRITE &STR(&Z)
01200  END

Rexx - not that I'm a big fan of Rexx - is usually better than CLIST for this type of stuff. It took me far too long to create the example by cribbing from the example in the manual. The SET Z = &STR(&&SYSOUTLINE&I) line is far from intuitive!
Back to top
View user's profile Send private message
upendrasri

Active User


Joined: 28 Sep 2017
Posts: 121
Location: India

PostPosted: Thu Mar 12, 2020 10:09 pm
Reply with quote

Hi Joerg and Steve,

Thank you for your time and suggestions. Above code is exactly working as expected.

Thanks!
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts CLIST - Virtual storage allocation error CLIST & REXX 5
No new posts Calling an Open C library function in... CICS 1
No new posts DATE2 function SYNCSORT 15
No new posts Help on PL/I jsonPutValue function PL/I & Assembler 8
No new posts how to use Tso outtrap external function All Other Mainframe Topics 8
Search our Forums:

Back to Top