Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Problem with SAY or Compound variable using OUTTRAP

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1013
Location: India

PostPosted: Wed Jan 07, 2009 5:26 pm    Post subject: Problem with SAY or Compound variable using OUTTRAP
Reply with quote

Hi,
As i was learning little bit of rexx. I came upon a, not a valid SAY output.
Following is the rexx program. The 'SAY' in main-prg loop is giving output as 0.
The loop will be executed 5 times, it must display 2 valid output & remaining 3 are suppose to be null.
According to the trace information, it has valid outputs, but 'SAY' is not giving valid outputs.
Why is 5 zeros coming in the output.

Code:
/**** REXX ************************************/                     
VAR. = NOT LISTED             
WAR. = NO ENTRY                                                       
CALL LISTCSUB 'VAR.'         
CALL TSOHELP 'WAR.'                                                   
TRACE I                                                               
Z=OUTTRAP('XAR.',2)           
"LISTDS 'HXSULL.QUERY.TEST'"
DO I=1 TO 5                 
   SAY 'XAR' I = XAR.I                                               
END                                                                   
Z=OUTTRAP('OFF')             
EXIT                                                                 

                                                                     
LISTCSUB:PROCEDURE                                                   
X=OUTTRAP(ARG(1))                                                     
SAY 'ARG 1 = 'ARG(1)                                                 
"LISTC"                                                               
SAY 'NUMBER OF LINES OUT-TRAPED FOR VAR= ' VAR.0                     
DO I=1 TO 5                                                           
   SAY 'VAR 'I '= ' VAR.I                                             
END                                                                   
SAY 'VAR.500 = ' VAR.500       
X=OUTTRAP('OFF')               
RETURN                                                               
                                                                     
TSOHELP:                                                             
Y=OUTTRAP(ARG(1),5)                                                   
"HELP LISTDS"                                                         
SAY 'NUMBER OF LINES OUT-TRAPED FOR WAR= ' WAR.0                     
DO I=1 TO 6                                                           
   SAY 'WAR 'I '= ' WAR.I                                         
END                                                               
SAY 'WAR 500 = ' WAR.500     
Y=OUTTRAP('OFF')                                                 
RETURN                                                           

Trace Output:
Code:
1ARG 1 = VAR.
 NUMBER OF LINES OUT-TRAPED FOR VAR=  95
 VAR 1 =  IN CATALOG:USERCAT.USERID3
 VAR 2 =  HXSULL.CBT471.FILE314.PDS
 VAR 3 =  HXSULL.DBA.UT
 VAR 4 =  HXSULL.DBAUTIL.JCLS
 VAR 5 =  HXSULL.DB2.JCL
 VAR.500 =  VAR.500
 NUMBER OF LINES OUT-TRAPED FOR WAR=  5
 WAR 1 =  DATA SET TCPIP.SEZAHELP NOT ON VOLUME AS INDICATED IN THE CATALOG OR V
 WAR 2 =
 WAR 3 =  Function -
 WAR 4 =    The LISTDS command displays basic attributes of data sets specified.
 WAR 5 =
 WAR 6 =  NO ENTRY
 WAR 500 =  NO ENTRY
     12 *-* Z=OUTTRAP('XAR.',2)           /* SET OUTTRAP */
        >L>   "XAR."
        >L>   "2"
        >F>   "XAR."
     13 *-* "LISTDS 'HXSULL.QUERY.TEST'" /* TSO COMMANDS CAN BE EXECUTED      */
        >L>   "LISTDS 'HXSULL.QUERY.TEST'"
     14 *-* DO I=1 TO 5                   /* WITHOUT TSO PREFIX */
        >L>   "1"
        >L>   "5"
     15 *-*  SAY 'XAR' I = XAR.I
        >L>    "XAR"
        >V>    "1"
        >O>    "XAR 1"
        >C>    "XAR.1"
        >V>    "HXSULL.QUERY.TEST"
        >O>    "0"
 0
     16 *-* END
     14 *-* DO I=1 TO 5                   /* WITHOUT TSO PREFIX */
     15 *-*  SAY 'XAR' I = XAR.I
        >L>    "XAR"
        >V>    "2"
        >O>    "XAR 2"
        >C>    "XAR.2"
        >V>    "--RECFM-LRECL-BLKSIZE-DSORG"
        >O>    "0"
 0
     16 *-* END
     14 *-* DO I=1 TO 5                   /* WITHOUT TSO PREFIX */
     15 *-*  SAY 'XAR' I = XAR.I
        >L>    "XAR"
        >V>    "3"
        >O>    "XAR 3"
        >C>    "XAR.3"
        >L>    "XAR.3"
        >O>    "0"
 0
     16 *-* END
     14 *-* DO I=1 TO 5                   /* WITHOUT TSO PREFIX */
     15 *-*  SAY 'XAR' I = XAR.I
1       >L>    "XAR"
        >V>    "4"
        >O>    "XAR 4"
        >C>    "XAR.4"
        >L>    "XAR.4"
        >O>    "0"
 0
     16 *-* END
     14 *-* DO I=1 TO 5                   /* WITHOUT TSO PREFIX */
     15 *-*  SAY 'XAR' I = XAR.I
        >L>    "XAR"
        >V>    "5"
        >O>    "XAR 5"
        >C>    "XAR.5"
        >L>    "XAR.5"
        >O>    "0"
 0
     16 *-* END
     14 *-* DO I=1 TO 5                   /* WITHOUT TSO PREFIX */
     17 *-* Z=OUTTRAP('OFF')              /* SET OFF OUTTRAP */
        >L>   "OFF"
        >F>   "OFF"
     18 *-* EXIT


This is the Valid output that should come,
Code:
"HXSULL.QUERY.TEST"
"--RECFM-LRECL-BLKSIZE-DSORG



Thank You,
Sushanth Bobby
Back to top
View user's profile Send private message

Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2033
Location: Silicon Valley

PostPosted: Wed Jan 07, 2009 10:19 pm    Post subject: Reply to: Problem with SAY or Compound variable using OUTTRA
Reply with quote

Not sure, but
Code:
SAY 'XAR' I = XAR.I     

I think you want the equal sign to be within quotes.

Please take the time to simplify your examples. We do not need to see the parts that work. It just clouds the example and makes it hard to find where you are having the problem.
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Thu Jan 08, 2009 1:12 am    Post subject: Reply to: Problem with SAY or Compound variable using OUTTRA
Reply with quote

I copied the code and tested it. I don't see a problem as it stands, although I don't really understand the original question.
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2033
Location: Silicon Valley

PostPosted: Thu Jan 08, 2009 2:49 am    Post subject: Reply to: Problem with SAY or Compound variable using OUTTRA
Reply with quote

Code:
SAY 'XAR' I = XAR.I


It looks like a comparison is being done. "I = XAR.I" is either true or false. And it seem to always be false, so you see a zero displayed. If you put the equal sign within quotes, the comparison will be removed.
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1013
Location: India

PostPosted: Thu Jan 08, 2009 10:10 am    Post subject:
Reply with quote

Thank You Pedro, Thank You Very Much,
Next time onwards i will simplify my examples when i post it.

SuperK,
Quote:
I don't really understand the original question.

I didn't get the expected output in the following code.
Code:
Z=OUTTRAP('XAR.',2)         
"LISTDS 'HXSULL.QUERY.TEST'"
DO I=1 TO 5                 
   SAY 'XAR ' I = XAR.I   
END                         
Z=OUTTRAP('OFF')           
EXIT                       


'SAY' in the loop was displaying 5 zero's
The expected answer is
Code:
"HXSULL.QUERY.TEST"
"--RECFM-LRECL-BLKSIZE-DSORG


Solution
A comparison seem to have happened, i should have put equal to within quotes '=' to get the desired result.

Thank You,
Sushanth
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1226
Location: Israel

PostPosted: Thu Jan 08, 2009 10:45 pm    Post subject:
Reply with quote

Again and again...

Quote:
VAR. = NOT LISTED
WAR. = NO ENTRY
and all other assignments done without quotes is wrong !!!

Try the following:
Code:
LISTED = 5
VAR. = NOT LISTED
SAY VAR.2

then try:
Code:
LISTED = 5
VAR. = 'NOT LISTED'
SAY VAR.2


See any difference ????
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1013
Location: India

PostPosted: Fri Jan 09, 2009 10:13 am    Post subject:
Reply with quote

Yeah marso,

I see the difference. Here on i'll do all the assignments in the right way.

Sushanth
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Problem reading GTF trace output danik56 ABENDS & Debugging 7 Thu Mar 16, 2017 1:02 pm
No new posts Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm
No new posts SYMNAMES problem jacobdng DFSORT/ICETOOL 7 Thu Dec 22, 2016 7:47 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us