IBM MAINFRAME HELP & SUPPORT FORUMS
Technical Forums for IBM Mainframe Applications like COBOL, JCL, CICS, DB2, FileAid, DFSORT, Endevor, Xpediter, CoolGen, CA-7&11, AbendAid, IMS, IDMS, PL/I, MqSeries, SyncSort, Assembler, ChangeMan, Easytrieve, InterTest, REXX, CLIST etc...
 

Why do we use Outtrap for in the following code?

THIS IS AN ARCHIVE FORUM: CLICK HERE TO GO TO THE ORIGINAL TOPIC

 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> CLIST & REXX
View previous topic :: View next topic  
Author Message
surya.kalyan



Joined: 09 Jan 2007
Posts: 14
Location: Mumbai

Posted: Wed Jul 02, 2008 4:12 pm    Post subject: Why do we use Outtrap for in the following code?  

Code:
/*REXX*/                                         
INPUT  = 'T.TCS.CR.KALYAN.TEMP'                 
            X = OUTTRAP(MEMS.)                   
/* TO GET THE MEMBER LIST FROM THE INPUT PDS */ 
            "LISTDS '"INPUT"' MEM"               
            X = OUTTRAP(OFF)                     
DO I=7 TO MEMS.0                                 
      MEMS.I = STRIP(MEMS.I)                     
       SAY 'MEMBER:'MEMS.I                       
END                                             
EXIT                                             


In the above code mentioned which lists the members of a PDS, Can any one explain me why we use OUTTRAP for??

I did a QW but failed to understand the exact reason.
Back to top  
PeD



Joined: 26 Nov 2005
Posts: 313
Location: Belgium

Posted: Wed Jul 02, 2008 4:24 pm    Post subject:  

To avoid receiving all superfluous messages from LISTDS and to be able to process the stem
Back to top  
superk



Joined: 26 Apr 2004
Posts: 3304
Location: Charlotte,NC USA

Posted: Wed Jul 02, 2008 4:38 pm    Post subject: Reply to: Why do we use Outtrap for in the following code?  

A few notes about OUTTRAP:
Quote:
In general, the OUTTRAP function traps all output from a TSO/E command. For example, OUTTRAP traps broadcast messages from LISTBC, the list of allocated data sets from LISTALC, catalog entries from LISTCAT, and so on.

If you plan to write your own command processors for use in REXX execs, and you plan to use the OUTTRAP external function to trap command output, note the OUTTRAP function does not trap command output that is sent to the terminal by:

TPUT
WTO macro
messages issued by TSO/E REXX (that is, messages beginning with IRX)
messages issued by TRACE output

However, OUTTRAP does trap output from the PUTLINE macro with DATA or INFOR keywords.
Back to top  
Marso



Joined: 13 Mar 2006
Posts: 335
Location: Israel

Posted: Wed Jul 02, 2008 4:39 pm    Post subject:  

Just try without the OUTTRAP: the output of the LISTDS command will be displayed on your screen, and your REXX program will have no idea of what the result was.

OUTTRAP will just do what it says: it TRAPS the OUTput from TSO commands and make it available to the REXX program.
Back to top  
 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> CLIST & REXX
Page 1 of 1
THIS IS AN ARCIVE FORUM IN READ ONLY MODE. IF YOU WANT TO ASK YOUR DOUBTS USE THE ACTUAL FORUM