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

Check if file is empty and pass returncode=20


IBM Mainframe Forums -> JCL & VSAM
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic :: View next topic  
Author Message
snehasai

New User


Joined: 14 Nov 2008
Posts: 23
Location: bangalore

PostPosted: Mon Apr 27, 2009 2:21 pm
Reply with quote

Hi,
can anyone help me out in writing JCL for checking the input file is empty or not.

If file is empty then returncode should be 20 so that my next processing steps should be stopped and Rc=20 is making my job abend.

I have tried using RC=04 for following jcl which worked if input file is empty but i need RC=20 instead of RC=4

//STEP001 EXEC PGM=SORT,PARM='NULLOUT=RC4'
//SORTIN DD DSN=inputfile,
//* DISP=SHR
//SORTOUT DD DUMMY
//SYSIN DD *
SORT FIELDS=COPY
//*
//SYSOUT DD SYSOUT=*
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Mon Apr 27, 2009 2:23 pm
Reply with quote

Oh well, I think you may find that either SORT or IDCAMS will only set a RC up to a value of 16
Back to top
View user's profile Send private message
Gousiya Mulla

New User


Joined: 02 Jun 2008
Posts: 87
Location: Bangalore

PostPosted: Mon Apr 27, 2009 2:48 pm
Reply with quote

Try using SELCOPY ..!
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Mon Apr 27, 2009 2:50 pm
Reply with quote

Gousiya Mulla wrote:
Try using SELCOPY ..!

And if SELCOPY is unavailable at the site in question ?
Back to top
View user's profile Send private message
Gousiya Mulla

New User


Joined: 02 Jun 2008
Posts: 87
Location: Bangalore

PostPosted: Mon Apr 27, 2009 2:55 pm
Reply with quote

Quote:
And if SELCOPY is unavailable at the site in question ?


Sorry , not sure about the other options .
Back to top
View user's profile Send private message
snehasai

New User


Joined: 14 Nov 2008
Posts: 23
Location: bangalore

PostPosted: Mon Apr 27, 2009 2:56 pm
Reply with quote

I have no option other than using SORT.

Or another option may be 1st step wud be checking the file empty or not
step1:IF empty RC=4 else RC=0 it will provide
step2: The next processing steps should have Rc=20 if 1st step RC=4 so that it hits abend in our system

How to to this what is the condition to be specified for further steps so depending on File to process the follwing steps or not.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Apr 27, 2009 3:00 pm
Reply with quote

Just curious - waiting for my coffee to cool down a bit
there is some psychics behind testing for 20 and not wanting to test for 4
- sigmund might go crazy with some people way of thinking icon_biggrin.gif
Back to top
View user's profile Send private message
neelesht

New User


Joined: 24 Jul 2006
Posts: 99
Location: Los Angeles

PostPosted: Tue Apr 28, 2009 3:59 am
Reply with quote

Enrico,

If I am not wrong, Sowjanya wants to assign RC=20 and not RC=04 because in one of the later steps she wants to abend the JCL if file was empty and she can not abend it with RC=04 since any step can have RC=04 but none can have RC=20.

Hope I am not confusing. icon_smile.gif

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

Global Moderator


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

PostPosted: Tue Apr 28, 2009 4:27 am
Reply with quote

Neelesh,

how can she 'ABEND' the JCL?

in the later step she can very simply COND on the step
(the one she wants a RC-20)
for 04 and not execute the step. Or use an IF/THEN/ELSE.
Back to top
View user's profile Send private message
dneufarth

Active User


Joined: 27 Apr 2005
Posts: 419
Location: Inside the SPEW (Southwest Ohio, USA)

PostPosted: Tue Apr 28, 2009 4:45 am
Reply with quote

Perhaps an in house pgm that invokes abend macro.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue Apr 28, 2009 5:48 am
Reply with quote

Hello,

If the utilities that can set an rc for an "empty" file cannot be used as written/documented, one can always write their "own code" to generate any valid rc. . .

If it rather nonsense to not use a particular rc because it is "not the one we want" - especially when that particular step issuing an "04" is different from any other step and might be tested individually.

I expect Neelesh has understood exactly why the request is made and all it shows is there is a certain amount of laziness (or lack of understanding about how jcl can use the rc) about. . .

Suggest the rc be used as implemented or a bit of code be written to do exactly what is wanted. . . icon_neutral.gif
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Tue Apr 28, 2009 6:37 am
Reply with quote

neelesht wrote:
Sowjanya wants to assign RC=20 and not RC=04 because in one of the later steps she wants to abend the JCL if file was empty and she can not abend it with RC=04 since any step can have RC=04 but none can have RC=20.
Sowjanya may want what he/she wants, but without writing some code his/her limits are limited to 0, 4 & 16....
Look at NULLOUT and NULLOFL
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue Apr 28, 2009 11:18 am
Reply with quote

Quote:
since any step can have RC=04 but none can have RC=20

How do you know this. I have seen plenty of programs issue return codes 20 and above.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Apr 28, 2009 2:15 pm
Reply with quote

Quote:
how can she 'ABEND' the JCL?


Quote:
Perhaps an in house pgm that invokes abend macro.


sorry, was being a stickler for definitions.

it would be the JOB that abends,
JCL does not abend,
JCL is either accepted by JES or not.
Back to top
View user's profile Send private message
aishwarya_20

New User


Joined: 19 Nov 2008
Posts: 57
Location: pune

PostPosted: Tue Apr 28, 2009 2:22 pm
Reply with quote

This topic has already been discussed. Please check below link.

ibmmainframes.com/viewtopic.php?t=11350


You can use IDCAMS
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Apr 28, 2009 2:30 pm
Reply with quote

let' s stop all this please!

1) how to find if a dataset is empty has been discussed too many times
and belongs to
www.ibmmainframes.com/viewtopic.php?t=20820

2) how to set a return code to 20...
no utility will let You do it,
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies. View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top