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
 

 

Finding whether file is empty or not - with few restrictions

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
raam_kumar

New User


Joined: 25 Apr 2007
Posts: 44
Location: chennai, India

PostPosted: Wed May 14, 2008 7:40 pm    Post subject: Finding whether file is empty or not - with few restrictions
Reply with quote

Hi
i have a ps file, which will contain three type of records
1) Header record (with code AAA)
2) Data record (With code DAT)
3) Trailer record(with code BBB)

the requirement is, if there are no DAT records (data records) i have to report the file as empty file. is there a way to achieve this in sort.
Back to top
View user's profile Send private message

CICS Guy

Senior Member


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

PostPosted: Wed May 14, 2008 8:14 pm    Post subject:
Reply with quote

Take a look at "Set RC=12 or RC=4 if file is empty, has more than n records, etc" in Smart DFSORT Tricks
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed May 14, 2008 9:25 pm    Post subject:
Reply with quote

Quote:
i have to report the file as empty file.


What to you mean by "report the file as empty file"?

If you want a RC=12 when the file is empty or RC=0 when it isn't empty, you can use this DFSORT/ICETOOL job:

Code:
//S1    EXEC  PGM=ICETOOL               
//TOOLMSG DD SYSOUT=*                   
//DFSMSG  DD SYSOUT=*                   
//IN DD DSN=....  input file                         
//TOOLIN DD *                           
COUNT FROM(IN) EMPTY USING(CTL1)         
//CTL1CNTL DD *                         
  INCLUDE COND=(1,3,CH,EQ,C'DAT')       
/*


If you want a RC=4 instead of a RC=12, add RC4 to the COUNT operator.
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: Wed May 14, 2008 9:52 pm    Post subject:
Reply with quote

Hello,

I believe the issue is when there are header and/or trailer records, but no data records.

The file is "logically" empty even though it has hdr/trlr records.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed May 14, 2008 9:58 pm    Post subject:
Reply with quote

Yes, the INCLUDE for 'DAT' takes care of that. It only includes data records, not the header and trailer records, so the test for EMPTY is done against just the data records.
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


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