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
 

 

What is the keyword to see error description in REXX

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

New User


Joined: 02 Aug 2011
Posts: 10
Location: India

PostPosted: Mon Oct 03, 2011 5:25 pm    Post subject: What is the keyword to see error description in REXX
Reply with quote

Hi,

Can somebody tell me what keyword can be used to see error description after any REXX command.

Thanks,
Shweta
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10210
Location: italy

PostPosted: Mon Oct 03, 2011 5:30 pm    Post subject: Reply to: What is the keyword to see error description in RE
Reply with quote

Quote:
Can somebody tell me what keyword can be used to see error description after any REXX command.


please provide the key to decipher the question

the error description is the one reported in the relevant rexx message
what else ???

after a <command> the only thing that is filled is the RC variable

Code:
Address TSO "some command"
if RC ^= 0 then do
   say "i' ve got a RC="RC
   exit
end


and read the manual for the meaning of the return code
Back to top
View user's profile Send private message
shweta bansal5

New User


Joined: 02 Aug 2011
Posts: 10
Location: India

PostPosted: Mon Oct 03, 2011 5:31 pm    Post subject:
Reply with quote

I know about RC. But RC just gives you one numeric value. It doesn't tell me anything about the error. Is there something that tells me about error as well. some kind of error message?
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10210
Location: italy

PostPosted: Mon Oct 03, 2011 5:38 pm    Post subject: Reply to: What is the keyword to see error description in RE
Reply with quote

Quote:
It doesn't tell me anything about the error. Is there something that tells me about error as well. some kind of error message?

what is that You do not understand about the RC concept...
You have mixed up the duties of each component

why should it, ... REXX does not have any legal/logical/reasonable duty of displaying a message for what somebody else has done
to issue proper error messages is something that the <called> command must do
the RC is a way of makingREXX aware thet the called <PROCESS> has somehow failed

read the manual describing the called command to see the meaning of the RC

You do not really expect that REXX might know the zillions of error situations for the zillions of <callable> command
Back to top
View user's profile Send private message
Stefan

Active User


Joined: 12 Jan 2006
Posts: 110
Location: Germany

PostPosted: Tue Oct 04, 2011 5:22 pm    Post subject: Re: What is the keyword to see error description in REXX
Reply with quote

You probably mean the built-in function ERRORTEXT().
This function returns the REXX error text associated with the error number passed as an argument to the function. The valid argument range is from 0 to 99. Use the TSO/E REXX Reference manual for more details on this topic.

Keep in mind that all this only applies to REXX internal error codes. When trapping errors of any external environment (e.g. ISPF, DSNREXX, ISREDIT, SDSF etc.) you have no similar function.
I know of a separate solution for retrieving text associoated to SQL codes by calling a special DB2 utility. Tell me, if you need more details on this.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10210
Location: italy

PostPosted: Tue Oct 04, 2011 8:00 pm    Post subject: Reply to: What is the keyword to see error description in RE
Reply with quote

IMHO the errortext function is completely useless for the scenario the TS asked about

errortext displays the rexx messages relative to <syntax> errors found by the interpreter
so unless the script is coded with intensive SIGNAL ON conditions the script will be terminated before being able to handle them

her is the result of a simple script with error handling

Code:
 ****** ***************************** Top of Data ******************************
 000001 /* rexx */                                                             
 000002 signal on syntax name onsyntax                                         
 000003 do i = 1 to 99                                                         
 000004     say right(i,2) errortext(i)                                         
 000005 end                                                                     
 000006 signal oshit                                                           
 000007 exit                                                                   
 000008 onsyntax:                                                               
 000009 say what the heck                                                       
 000010 say sigl                                                               
 000011 say RC  errortext(RC)                                                   
 000012 exit                                                                   
 ****** **************************** Bottom of Data ****************************


and here is the output

Code:
  1                                                                             
  2                                                                             
  3 Program is unreadable                                                                                                                             
  4 Program interrupted                                                         
  5 Machine storage exhausted                                                   
  6 Unmatched "/*" or quote                                                     
  7 WHEN or OTHERWISE expected                                                 
  8 Unexpected THEN or ELSE                                                     
  9 Unexpected WHEN or OTHERWISE                                               
 10 Unexpected or unmatched END                                                 
 11 Control stack full                                                         
 12 Clause too long                                                             
 13 Invalid character in program                                               
 14 Incomplete DO/SELECT/IF                                                     
 15 Invalid hexadecimal or binary string                                       
 16 Label not found                                                             
 17 Unexpected PROCEDURE                                                       
 18 THEN expected                                                               
 19 String or symbol expected                                                   
 20 Symbol expected                                                             
 21 Invalid data on end of clause                                               
 22 Invalid character string                                                   
 23 Invalid SBCS/DBCS mixed string                                             
 24 Invalid TRACE request                                                       
 25 Invalid sub-keyword found                                                   
 26 Invalid whole number                                                                                                                             
 27 Invalid DO syntax                                                           
 28 Invalid LEAVE or ITERATE                                                   
 29 Environment name too long                                                   
 30 Name or string > 250 characters                                             
 31 Name starts with number or "."                                             
 32 Invalid use of stem                                                         
 33 Invalid expression result                                                   
 34 Logical value not 0 or 1                                                   
 35 Invalid expression                                                         
 36 Unmatched "(" in expression                                                 
 37 Unexpected "," or ")"                                                       
 38 Invalid template or pattern                                                 
 39 Evaluation stack overflow                                                   
 40 Incorrect call to routine                                                   
 41 Bad arithmetic conversion                                                   
 42 Arithmetic overflow/underflow                                               
 43 Routine not found                                                           
 44 Function did not return data                                               
 45 No data specified on function RETURN                                       
 46 Invalid variable reference                                                 
 47 Unexpected label                                                           
 48 Failure in system service                                                   
 49 Interpreter failure                                                         
 50
 ...
 99
 ***                                                                           

  WHAT THE HECK                                                                 
 6                                                                             
 16 Label not found                                                             
 ***             


I have written, quite a number of rexx script and quite complicated ones
only a handful of time I felt the need for a SIGNAL ON

the only SIGNAL useful to catch typing errors is the ON VALUE
but the only place where the RC has a meaning her is for the ON SYNTAX condition

Code:
 ****** ***************************** Top of Data ******************************
 000001 /* rexx */                                                             
 000002 signal on novalue  name onnovalue                                       
 000003 signal on syntax   name onsyntax                                       
 000004 a = 1                                                                   
 000005 b = 2                                                                   
 000006 x = a                                                                   
 000007 y = b                                                                   
 000008 z = c                                                                   
 000009 signal oshit                                                           
 000010 exit                                                                   
 000011 onnovalue:                                                             
 000012 say 'onnovalue  entered'                                               
 000013 say sigl                                                               
 000014 say RC  errortext(RC)                                                   
 000015 exit                                                                   
 000016 onsyntax:                                                               
 000017 say 'onsyntax entered'                                                 
 000018 say sigl                                                               
 000019 say RC  errortext(RC)                                                   
 000020 exit                                                                   
 ****** **************************** Bottom of Data ****************************


play around with it to see different behaviors
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 OO COBOL compile error Virendra Shambharkar COBOL Programming 3 Tue Jan 10, 2017 6:05 pm
This topic is locked: you cannot edit posts or make replies. Calling REXX code from ISPF panel sanchita dey TSO/ISPF 4 Mon Jan 02, 2017 5:13 pm
No new posts REXX DB2: Dynamic allocation of DB2.D... BHAS CLIST & REXX 3 Mon Dec 19, 2016 8:26 pm
No new posts find particular member name in PDS us... ravi243 CLIST & REXX 10 Mon Dec 19, 2016 6:44 pm
No new posts TWS EQQYCAIN - not sure how to get ap... mbenaud IBM Tools 0 Wed Dec 14, 2016 8:45 pm


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