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

How to count records in JCL based on some condition.


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ShobhitVerma10april

New User


Joined: 28 Jun 2014
Posts: 21
Location: INDIA

PostPosted: Tue Jul 01, 2014 6:41 pm
Reply with quote

Hi Bill ,

I gave this sort card as you said :

SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,93,10,986X)),
IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,14),PUSH=(15:ID=10))
OUTFIL REMOVECC,NODETAIL,
SECTIONS=(1,15,
TRAILER3=(1,15,X,COUNT=(M11,LENGTH(10))))


But it is not working.

Could you please correct it .
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Jul 01, 2014 6:49 pm
Reply with quote

I have no clue of what is not working because you've failed to mention that.
Back to top
View user's profile Send private message
ShobhitVerma10april

New User


Joined: 28 Jun 2014
Posts: 21
Location: INDIA

PostPosted: Tue Jul 01, 2014 7:09 pm
Reply with quote

HI Bill ,
Sorry for inconvenience

Here is the details :

INPUT :
ABC 12 A0
ABC 12 A0
ABC 12 A0
ABC 12 B0
GHT 13 B0
GHT 13 B0
GHT 13 C0
GHT 13 B0
UIO 12 C0
UIO 12 C0
UIO 12 D0


OUTPUT :

ABCA00 00003
ABCB00 00001
GHTB00 00002
GHTC00 00001
GHTB00 00001
UIOC00 00002
UIOD00 00001


SORT CARD :

SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,BUILD=(1,3,8,2,75X)),
IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,5),PUSH=(6:ID=5))
OUTFIL REMOVECC,NODETAIL,
SECTIONS=(1,6,
TRAILER3=(1,6,X,COUNT=(M11,LENGTH(5))))

In this , if you see GHTB0 should come 3 times but here it is coming as two occurrence 2 and 1 .
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Tue Jul 01, 2014 7:27 pm
Reply with quote

Please use Code tags for readability.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


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

PostPosted: Tue Jul 01, 2014 8:10 pm
Reply with quote

Hi,

From the second post of Bill I see that, He asked for data to be in order record to record and you said it is sorted, then why did in the above example it is not sorted based on 1st and 3rd field?

Code:
ABC 12 A0
ABC 12 A0
ABC 12 A0
ABC 12 B0
GHT 13 B0
GHT 13 B0
GHT 13 C0
GHT 13 B0
UIO 12 C0
UIO 12 C0
UIO 12 D0
Back to top
View user's profile Send private message
ShobhitVerma10april

New User


Joined: 28 Jun 2014
Posts: 21
Location: INDIA

PostPosted: Wed Jul 02, 2014 2:50 pm
Reply with quote

Hi Bill ,

I used following syntax but its is giving me an error at OMIT

SORT FIELDS=(1,1000,CH,A)
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,93,10,986X)),
IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,14),PUSH=(15:ID=5)),
IFTHEN=(WHEN=INIT,OMIT=(17,5,ZD,LE,400)) OUTFIL REMOVECC,NODETAIL,
SECTIONS=(1,15,
TRAILER3=(1,15,X,COUNT=(M11,LENGTH(5))))

Can you please correct it .
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Jul 02, 2014 2:53 pm
Reply with quote

No, you are making things up. How can I correct stuff if you just make up your own syntax?

Also, what about Rohit's question? Can't do anything til you answer that.
Back to top
View user's profile Send private message
ShobhitVerma10april

New User


Joined: 28 Jun 2014
Posts: 21
Location: INDIA

PostPosted: Wed Jul 02, 2014 3:00 pm
Reply with quote

Yes , that i corrected and sorted the records as you see in the card . And that issue is resolved.

Now i have to remove those records which are having count greater than 100 or anything . How can i implement it in the same card .
Back to top
View user's profile Send private message
ShobhitVerma10april

New User


Joined: 28 Jun 2014
Posts: 21
Location: INDIA

PostPosted: Wed Jul 02, 2014 4:56 pm
Reply with quote

It worked with below sort card :

SORT FIELDS=(1,1000,CH,A)
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,93,10,986X)),
IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,14),PUSH=(15:ID=5))
OMIT COND=(17,5,ZD,LE,00400)
OUTFIL REMOVECC,NODETAIL,
SECTIONS=(1,15,
TRAILER3=(1,15,X,COUNT=(M11,LENGTH(5))))

Thanks Everyone!!!
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 -> DFSORT/ICETOOL Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 0
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top