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

Problem with SAY or Compound variable using OUTTRAP


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

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Wed Jan 07, 2009 5:26 pm
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

Global Moderator


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

PostPosted: Wed Jan 07, 2009 10:19 pm
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

Global Moderator


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

PostPosted: Thu Jan 08, 2009 1:12 am
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

Global Moderator


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

PostPosted: Thu Jan 08, 2009 2:49 am
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: 1020
Location: India

PostPosted: Thu Jan 08, 2009 10:10 am
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: 1353
Location: Israel

PostPosted: Thu Jan 08, 2009 10:45 pm
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: 1020
Location: India

PostPosted: Fri Jan 09, 2009 10:13 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts Variable Output file name DFSORT/ICETOOL 8
No new posts how to use Tso outtrap external function All Other Mainframe Topics 8
No new posts Moving Or setting POINTER to another ... COBOL Programming 2
Search our Forums:

Back to Top