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

EMPTY file check scenario


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Digvijay Singh

Active User


Joined: 20 Apr 2022
Posts: 138
Location: India

PostPosted: Fri Oct 28, 2022 3:16 pm
Reply with quote

Hi All,

My requirement I have two file and i want to check if either of the file has data i want to execute the 2nd step, How i can do it in 2 step?

Step1> Need to check two files and if any of the file has data step 2 shoud run
Step2>shoudd run if above any file has data.

Kindly suggest if any way to do it in two steps i am thinking of concatinating both file and see if output file has data or not ,please suggest.

Thanks
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1231
Location: Bamberg, Germany

PostPosted: Fri Oct 28, 2022 3:30 pm
Reply with quote

Use JCL IFTHEN to test for previous JCL CONDs and let step two run if conditions are met.
You will find more than one sample how to test for empty DSNs.
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 712
Location: Denmark

PostPosted: Fri Oct 28, 2022 5:35 pm
Reply with quote

And in case you don't know how to check for an empty dataset, here is one method using SORT (well ICETOOL to be precise):
Code:
//* COUNT .. EMPTY|NOTEMPTY -> RC 12 IF CONDITION IS MET
//C1    EXEC PGM=ICETOOL                                 
//TOOLMSG  DD SYSOUT=*                                   
//DFSMSG   DD SYSOUT=*                                   
//DD1      DD DISP=SHR,DSN=dataset                 
//TOOLIN   DD *                                         
  COUNT FROM(DD1) EMPTY                                 
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1231
Location: Bamberg, Germany

PostPosted: Fri Oct 28, 2022 5:39 pm
Reply with quote

Willy Jensen wrote:
And in case you don't know how to check for an empty dataset, here is one method using SORT (well ICETOOL to be precise):
Code:
//* COUNT .. EMPTY|NOTEMPTY -> RC 12 IF CONDITION IS MET
//C1    EXEC PGM=ICETOOL                                 
//TOOLMSG  DD SYSOUT=*                                   
//DFSMSG   DD SYSOUT=*                                   
//DD1      DD DISP=SHR,DSN=dataset                 
//TOOLIN   DD *                                         
  COUNT FROM(DD1) EMPTY                                 

Code:
//METHOD#1 EXEC PGM=IDCAMS <* RC4 | RC0             
//IDD      DD DISP=OLD,DSN=..     
//SYSPRINT DD SYSOUT=*                               
//SYSIN    DD *                                     
  PRINT IFILE(IDD) COUNT(1)                         
/*
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3048
Location: NYC,USA

PostPosted: Mon Oct 31, 2022 8:25 am
Reply with quote

Or NULLOFL=? 😊
ibmmainframes.com/about40021.html
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1231
Location: Bamberg, Germany

PostPosted: Mon Oct 31, 2022 11:38 am
Reply with quote

Rohit Umarjikar wrote:
Or NULLOFL=? 😊
ibmmainframes.com/about40021.html

Lines to code should be at a very minimal level for such a task.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3048
Location: NYC,USA

PostPosted: Mon Oct 31, 2022 4:33 pm
Reply with quote

Many ways to do get the same thing , 1-2 lines extra shouldn’t be a problem but at least one would know the way.

Setting up RC-12 may not be a good option as it may considered as abend in scheduling but up to RC - 4 is mostly acceptable code set up for any job but if not then TS needs to make that additional change to allow RC-4 acceptable in scheduling.
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
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
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
Search our Forums:

Back to Top