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

Need to check count of file records and abend if >10.


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

New User


Joined: 08 Nov 2006
Posts: 15

PostPosted: Fri Nov 17, 2006 2:29 am
Reply with quote

Hi,

I want to check the number of records count in file and if count is more than 10 then needs to return abend.

How could we attend this thru JCL, Do not want to write prog.

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

Active User


Joined: 05 Oct 2005
Posts: 308
Location: Vizag / US

PostPosted: Fri Nov 17, 2006 2:34 am
Reply with quote

hi ,

search in the same forum itself, u can get a jcl for counting records.
u can just abend the program if the count reaches more than 10.
this can be acheived thru fileaid.
Back to top
View user's profile Send private message
meetsrk

New User


Joined: 13 Jun 2004
Posts: 85

PostPosted: Mon Nov 20, 2006 8:32 pm
Reply with quote

The below code with abend with RC=12 when count > 10 in the input file

Code:

//STEP02   EXEC PGM=ICETOOL,COND=(0,NE)               
//TOOLMSG  DD SYSOUT=*                                 
//DFSMSG   DD SYSOUT=*                                 
//IN       DD DSN=G<input file>,DISP=SHR     
//TOOLIN   DD *                                       
 COUNT FROM(IN) LOWER(10)                           
/*
                                                 
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Mon Nov 20, 2006 9:54 pm
Reply with quote

Actually, LOWER(10) will pass back RC=12 when count < 10 and RC=0 when count >= 10. It will NOT abend.

Here's a DFSORT/ICETOOL job that will pass back RC=12 when count > 10 and RC=0 when count <= 10.

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//IN DD DSN=...  input file
//TOOLIN   DD *
COUNT FROM(IN) HIGHER(10)
/*


For more information on this, see the "Set RC=12 or RC=4 if file is empty, has more than n records, etc" Smart DFSORT Trick at:

www.ibm.com/servers/storage/support/software/sort/mvs/tricks/
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 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 To get the count of rows for every 1 ... DB2 3
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top