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
 

 

Error Handling in REXX

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

New User


Joined: 24 May 2010
Posts: 86
Location: Pune

PostPosted: Wed Mar 02, 2011 6:19 pm    Post subject: Error Handling in REXX
Reply with quote

I want to incorporate the below conditions in my REXX program -

1) I am preparing the skeleton jcl using some files as below -

"ISPEXEC LIBDEF ISPSLIB DATASET ID('ITA.REXX.TEMP.F')"
"ISPEXEC LIBDEF ISPFILE DATASET ID('TEST.TEMPNEW')"

"ALLOC DA('TEST.TEMPGHI') F(INPUT) SHR REUSE"
"EXECIO * DISKR INPUT (STEM LINES. FINIS)"

I want to check whether file 'TEST.TEMPGHI' is present or not .Also if present ,want to check whether it is blank before procedding further.


2) Also when reading in the below loop -

DO I = 1 TO LINES.0
PARSE VAR LINES.I VAR1 VAR2

I want to check whether VAR2 is blank or not


In both above cases,what is the appropriate error handling method.


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

superk

Moderator Team Head


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

PostPosted: Wed Mar 02, 2011 6:50 pm    Post subject: Re: Error Handling in REXX
Reply with quote

This is REALLY basic stuff ... anyway ...

kishpra wrote:

I want to check whether file 'TEST.TEMPGHI' is present or not .


LISTDSI ought to work.

kishpra wrote:

Also if present ,want to check whether it is blank before procedding further.


I'm not sure what you mean by "blank", but if you read the dataset as you showed:

"EXECIO * DISKR INPUT (STEM LINES. FINIS)"

then you can interrogate the value of LINES.0 for the number of records read.

kishpra wrote:

I want to check whether VAR2 is blank or not


A LENGTH check should work.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Mar 02, 2011 7:11 pm    Post subject:
Reply with quote

SYSDSN will also work for checking on the existance of a file.
Back to top
View user's profile Send private message
kishpra

New User


Joined: 24 May 2010
Posts: 86
Location: Pune

PostPosted: Thu Mar 03, 2011 6:05 pm    Post subject: Reply to: Error Handling in REXX
Reply with quote

Thanks for the reply.


If i am submitting a REXX program using JCL ,if by using LISTDSI I get the return code as 16 i.e. file is not available.It should give some JCL error with some return code.

How to process that ?


Thanks!
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Thu Mar 03, 2011 6:15 pm    Post subject:
Reply with quote

JCL ERROR and a non zero return code are two completely different animals.

Which do you require ?

Terminology is oh so important in the IT world. Please take the time to learn it.
Back to top
View user's profile Send private message
kishpra

New User


Joined: 24 May 2010
Posts: 86
Location: Pune

PostPosted: Thu Mar 03, 2011 6:16 pm    Post subject: Reply to: Error Handling in REXX
Reply with quote

If my LISTDSI retun code is non-zero in the REXX program,i want the JCL to fail with some return code.



Thanks!
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Thu Mar 03, 2011 6:21 pm    Post subject:
Reply with quote

Please read my previous comment again, and again, and again until you understand it thoroughly. Let's face it, if YOU don't know what you are on about, how are we supposed to icon_rolleyes.gif
If the JCL fails, then a JCL ERROR will occur, if a non zero return code is issued then the JCL will be deemed to have be successful.

May I suggest that you read the REXX / TSO manuals for the EXIT statement.
Back to top
View user's profile Send private message
kishpra

New User


Joined: 24 May 2010
Posts: 86
Location: Pune

PostPosted: Thu Mar 03, 2011 6:24 pm    Post subject: Reply to: Error Handling in REXX
Reply with quote

Apologies!


Failing of JCL with return code means the JCL error.So that means If

LISTDSI issues return code as 16,JCL should fail with some JCL error.




Thnaks!
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Thu Mar 03, 2011 6:29 pm    Post subject:
Reply with quote

If you put a DD for dataset ITA.REXX.TEMP.F in your JCL then you will get a JCL error and the step will never get executed.

You would not need the listdsi in your rexx program.

Just an alternative.

Ignore me if you will.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Thu Mar 03, 2011 7:07 pm    Post subject:
Reply with quote

I said:
Quote:
If you put a DD for dataset ITA.REXX.TEMP.F in your JCL then you will get a JCL error and the step will never get executed.



I meant dataset: 'TEST.TEMPGHI'
If this dataset does not exist, the JCL get a JCL error (that is what you want correct?).

I think JCL errors are never a good idea however.

On a side note: Everyone here is helping with your syntax without regard to the soundness of your design.

I think you would benifit from giving the 'big picture' of what you are trying to accomplish.

There are many years of experience here that would help you in that regard.

Ignore me if you will.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Thu Mar 03, 2011 7:24 pm    Post subject:
Reply with quote

Dave,

I believe that the OP wants to issue a non zero RC if the dataset specified does not exist. Based on the RC issued by this step the OP can determine what actions to take in the remainder of the job.

Unfortunately to me, this is just another case of the OP NOT understanding the correct terminology.

From my view, the OP understands that a non zero RC is a JCL ERROR or failure, which we both know is not the case.

I did try to educate the OP ................ but until the OP understands and uses the correct terminology then both the OP and responders are probably wasting their time icon_cry.gif
Back to top
View user's profile Send private message
kishpra

New User


Joined: 24 May 2010
Posts: 86
Location: Pune

PostPosted: Mon Mar 07, 2011 10:20 am    Post subject: Reply to: Error Handling in REXX
Reply with quote

Thanks for the reply.


I have many a things to check for 'TEST.TEMPGHI' dataset as below -

1) Existence of the file.As the file is coming from different system as an input to REXX program and so not specified in the jcl.

Expected Result - if the above file is not present,JCL should fail with JCL error

2) I have to check if that file is blank or not.

Expected Result - JCL should fail with JCL error and write something in the spool

3) Need to check whether the account number is valid or not.If invalid JCL should fail with JCL error.


Thanks!
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Mar 07, 2011 10:47 am    Post subject:
Reply with quote

Hello,

How did you get so hung up on "jcl error". . . icon_confused.gif

It makes no sense to try to force a jcl error when some incorrect condition is encouneterd. . .

1 - when the file does not exist, write a message to the spool and terminate with some return code or force an abend.
2 - when the file does is empty, write a message to the spool and terminate with some return code or force an abend (possibly the same as for 1).
3 - when the file contains an invalid account number, write a message to the spool and terminate with some return code or force an abend (probably not the same as 1 or 2).
Back to top
View user's profile Send private message
kishpra

New User


Joined: 24 May 2010
Posts: 86
Location: Pune

PostPosted: Mon Mar 07, 2011 11:08 am    Post subject: Reply to: Error Handling in REXX
Reply with quote

Thanks Dick,


I need the same thing as you suggested.In all the cases,I am writing error message to the spool.But I don't know,how to terminate with some return code in REXX.



Appreciate your help!
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Mon Mar 07, 2011 11:46 am    Post subject: Reply to: Error Handling in REXX
Reply with quote

what about reading the manual about the RETURN and EXIT statements
and IKJEFT01 IKJEFT1B difference
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/Shelves/IKJ4BK90
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Mon Mar 07, 2011 4:31 pm    Post subject:
Reply with quote

expat wrote:
May I suggest that you read the REXX / TSO manuals for the EXIT statement.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Mar 07, 2011 8:08 pm    Post subject:
Reply with quote

Hello,

In addition to reading the manual, you might also search in this Clict & REXX part of the forum. I believe there are previous topics that will help.
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 S922 Error yuvan ABENDS & Debugging 3 Fri Dec 02, 2016 6:58 pm
No new posts Invoke Webservice Fails with DFHPI100... divated CICS 2 Thu Nov 24, 2016 5:57 pm
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
This topic is locked: you cannot edit posts or make replies. Rexx to create GDG by scanning JJ result krish.deepu CLIST & REXX 5 Tue Oct 25, 2016 5:32 pm
No new posts Error during restore rename archanamuthukrishnan All Other Mainframe Topics 2 Fri Oct 14, 2016 3:30 pm


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