Page 1 of 1

Unable to execute DRAW Rexx program sample

PostPosted: Wed Nov 24, 2021 9:11 pm
by Aech
Hi,
I am trying to execute DRAW Rexx code supplied as an example in IBM manual below

https://www.ibm.com/docs/en/db2-for-zos/11?topic=examples-sample-db2-rexx-application

Also I have not modified anything in the code, I have just copy pasted from the IBM manual to my mainframe dataset, just changing the special character (^ to /), example
From:
SQLCODE ^= 0
To:
SQLCODE \= 0

And I am getting the below error.

  31 +++ BndSize = RightBnd - LeftBnd + 1                  
 Error running DRAW, line 31: Bad arithmetic conversion      


Could someone please help me.

Re: Unable to execute DRAW Rexx program sample

PostPosted: Wed Nov 24, 2021 9:14 pm
by prino
@ line 30.5: say , say, say

Re: Unable to execute DRAW Rexx program sample

PostPosted: Wed Nov 24, 2021 9:51 pm
by Aech
Hi,

I tried to run a trace and this is what I could see

   30 *-* "ISREDIT (LEFTBND,RIGHTBND) = BOUNDS"      
       >>>   "ISREDIT (LEFTBND,RIGHTBND) = BOUNDS"    
       +++ RC(20) +++                                  
    31 *-* "ISREDIT (LRECL) = DATA_WIDTH" /*LRECL*/    
       >>>   "ISREDIT (LRECL) = DATA_WIDTH"            
       +++ RC(20) +++                                  
    32 *-* BndSize = RightBnd - LeftBnd + 1            
    32 +++ BndSize = RightBnd - LeftBnd + 1            
Error running DRAW, line 32: Bad arithmetic conversion

Re: Unable to execute DRAW Rexx program sample

PostPosted: Wed Nov 24, 2021 10:38 pm
by sergeyken
DRAW must be invoked from the command line of an ISPF edit session.


Is that true in your case?

Re: Unable to execute DRAW Rexx program sample

PostPosted: Wed Nov 24, 2021 10:48 pm
by Aech
sergeyken wrote:
DRAW must be invoked from the command line of an ISPF edit session.


Is that true in your case?


Ahh It makes sense now.. It is working now when I tried to run the command inside a dataset. Good catch, thank you :D

Re: Unable to execute DRAW Rexx program sample

PostPosted: Wed Nov 24, 2021 11:22 pm
by Pedro
It is an example of doing DB2 stuff, but it should be more robust. It should check for return codes from at least the first ISREDIT statement.

Often times, a RC 20 is an environment problem.

Re: Unable to execute DRAW Rexx program sample

PostPosted: Wed Nov 24, 2021 11:26 pm
by sergeyken
Aech wrote:
sergeyken wrote:
DRAW must be invoked from the command line of an ISPF edit session.

Is that true in your case?

Ahh It makes sense now.. It is working now when I tried to run the command inside a dataset. Good catch, thank you :D


The DRAW developers had mandatory to add the verification statements at the very beginning: what is the environment where it has been called?
Especially when their sample is supposed to be the source of training for many others.
But people are (almost) always lazy doing these trivial checking, and hence later many, many people start hitting brick walls with their elbows... :cry: