Re: REXX Porblem - OUTTRAP function

2008-09-10 Thread Shmuel Metz (Seymour J.)
In [EMAIL PROTECTED], on 09/06/2008
   at 04:22 AM, SUBSCRIBE IBM-MAIN Neo [EMAIL PROTECTED] said:

Strange things happened when I executed the code below.

That's because you code depends on X being uninitialized but you assign
it a value. You need to be careful about overloading variable names.

OBJ_D2:   

OBJ_D2: PROCEDURE

See also http://www.rexxla.org/Newsletter/9812safe.html and
http://www.rexxla.org/Newsletter/9901safe.html.
 
-- 
 Shmuel (Seymour J.) Metz, SysProg and JOAT
 ISO position; see http://patriot.net/~shmuel/resume/brief.html 
We don't care. We don't have to care, we're Congress.
(S877: The Shut up and Eat Your spam act of 2003)

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html



Re: REXX Porblem - OUTTRAP function

2008-09-07 Thread Kenneth E Tomiak
X is always a bad choice for a variable name in Rexx. Sooner or later you will 
try to append it to a literal and complain it does not work.

do x = 1 to 25
say '  'x
end


The ' 'x says you want a hex value, not a blank and the value of x. When you 
come back to the code you may wish you had used longer and meaningful 
names. Then again some coders like to struggle and figure out what their code 
was supposed to do. Rexx Style has been presented at the SHARE Conference 
Meetings, maybe you should get a copy and avoid some other problems 
headed your way.


On Sat, 6 Sep 2008 04:22:08 -0500, SUBSCRIBE IBM-MAIN Neo 
[EMAIL PROTECTED] wrote:

Strange things happened when I executed the code below.
After I entered 2 for OPTS to ran OBJ_D2, I could never leave the loop.
But if I comment out the OUTTRAP statements, everything will go fine.
So could anyone explain what OUTTRAP has done to my loop?
Thanks in advance.

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html



Re: REXX Porblem - OUTTRAP function

2008-09-06 Thread Gerhard Postpischil

--- Neo wrote:

DO FOREVER 
  WHEN OPTS = X 



OBJ_D2: 
   X = OUTTRAP(COMP_VAR,5,CONCAT)  


The loop terminates only when your PULL OPTS (why just PULL in
the routine) matches the value in variable X, which you are
changing with the OUTTRAP. If you meant to have variables in
OBJ_D2 local only, you need to change it to a PROCEDURE, with
explicit definitions of non-local variables. The simplest fix is
to change the original WHEN to OPTS = 'X'

Gerhard Postpischil
Bradford, VT

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html



Re: REXX Porblem - OUTTRAP function

2008-09-06 Thread Paul Gilmartin
On Sat, 6 Sep 2008 09:07:09 -0400, Gerhard Postpischil wrote:

--- Neo wrote:

   WHEN OPTS = X

X = OUTTRAP(COMP_VAR,5,CONCAT)

explicit definitions of non-local variables. The simplest fix is
to change the original WHEN to OPTS = 'X'

A strong concurrence.  Generally eschew unquoted literals.  And
keep yourself honest by starting every EXEC with SIGNAL ON NOVALUE.

-- gil

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html



Re: REXX Porblem - OUTTRAP function

2008-09-06 Thread tomas_anderson
 Thanks, you find the problem.
Now I remember I didn't quote X because I wanted the opts to be case 
insensitive.
I'll choose another variable name for OUTTRAP statement.
Thanks again for your help.
 
 
 


在2008-09-06 21:07:09,Gerhard Postpischil [EMAIL PROTECTED] 写道:
--- Neo wrote:

 DO FOREVER   
   
   WHEN OPTS = X 


 OBJ_D2: 
X = OUTTRAP(COMP_VAR,5,CONCAT)  

The loop terminates only when your PULL OPTS (why just PULL in
the routine) matches the value in variable X, which you are
changing with the OUTTRAP. If you meant to have variables in
OBJ_D2 local only, you need to change it to a PROCEDURE, with
explicit definitions of non-local variables. The simplest fix is
to change the original WHEN to OPTS = 'X'

Gerhard Postpischil
Bradford, VT

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html