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

What is the keyword to see error description in REXX


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Oct 03, 2011 5:30 pm
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Oct 03, 2011 5:38 pm
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Oct 04, 2011 8:00 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Error when install DB2 DB2 2
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
Search our Forums:

Back to Top