View previous topic :: View next topic
|
Author |
Message |
kishpra
New User
Joined: 24 May 2010 Posts: 92 Location: Pune
|
|
|
|
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 |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
SYSDSN will also work for checking on the existance of a file. |
|
Back to top |
|
|
kishpra
New User
Joined: 24 May 2010 Posts: 92 Location: Pune
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
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 |
|
|
kishpra
New User
Joined: 24 May 2010 Posts: 92 Location: Pune
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
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
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 |
|
|
kishpra
New User
Joined: 24 May 2010 Posts: 92 Location: Pune
|
|
|
|
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 |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
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 |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
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 |
|
Back to top |
|
|
kishpra
New User
Joined: 24 May 2010 Posts: 92 Location: Pune
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
How did you get so hung up on "jcl error". . .
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 |
|
|
kishpra
New User
Joined: 24 May 2010 Posts: 92 Location: Pune
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10889 Location: italy
|
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
expat wrote: |
May I suggest that you read the REXX / TSO manuals for the EXIT statement. |
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
|