Count and write occurences



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

Count and write occurences

Postby ranga_subham » Sat Sep 19, 2009 2:07 am

Hi, Input file is FB and LRECL is 80 only.

Input File:
----+----1----+----2----+----3----+----4
    1A1ZJ57763A 101
49D70FAIFE0   A 201
    1F2ZJ57B606 101
XKFX3HP0IBB   6 201
    1O2ZJ57B496 101
BBJL9KG7K34   6 201
    1X2ZJ57B486 101
BBJL9KG7K34   6 201
    1B1ZJ57763A 101
49D70FAIFE0   A 201
    1C1TJ57763A 101
S9D70FAIFE0   A 201
    1D2ZJ57V606 101
TKFX3HP0IBB   6 201


Output: I want to count the total number of records for each variety of value appearing at 14th position and write like below:
STATS:
TOTAL NUMBER OF RECS FOR TYPE '0': 00002
TOTAL NUMBER OF RECS FOR TYPE '3': 00003
TOTAL NUMBER OF RECS FOR TYPE '8': 00001
TOTAL NUMBER OF RECS FOR TYPE '9': 00001


Note: The values appearing at 14th position range from '0' to '9'.

Please help.

Thanks.
ranga_subham
 
Posts: 279
Joined: Fri Jul 18, 2008 7:46 pm
Has thanked: 0 time
Been thanked: 1 time

Re: Count and write occurences

Postby dick scherrer » Sat Sep 19, 2009 2:42 am

Hello,

What about the records with spaces in 14th position?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Count and write occurences

Postby ranga_subham » Sat Sep 19, 2009 9:20 am

Hi,

That situation never arises.....

Thx.
ranga_subham
 
Posts: 279
Joined: Fri Jul 18, 2008 7:46 pm
Has thanked: 0 time
Been thanked: 1 time

Re: Count and write occurences

Postby dick scherrer » Mon Sep 21, 2009 2:33 am

Hello,

I'm proabaly just having a really bad day. . .

The posted sample data has a space in pos 14 of all of the alternating records :?
All of the records with "201" in pos 17-19 have a space in pos 14. . .
Don't they?

As i mentioned, i am probably just missing something . . .
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Count and write occurences

Postby lal » Mon Sep 21, 2009 10:48 am

Hi,
The following code should give you the desired results...
As Dick Scherrer says there are indeed spaces in 14th column

//SYSIN    DD *                                                     
  SORT FIELDS=(14,1,CH,A)                                           
  OUTFIL REMOVECC,NODETAIL,                                         
  SECTIONS=(14,1,                                                   
  TRAILER3=(1:'TOTAL NUMBER OF RECS FOR TYPE ','''',14,1,'''',':', 
            COUNT))                                                 
//*                                                                 


Thanks,
lal
lal
 
Posts: 24
Joined: Thu Aug 13, 2009 10:06 pm
Has thanked: 0 time
Been thanked: 0 time


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post