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

Need help in counting Input file is of 4096 length


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

New User


Joined: 13 Jun 2004
Posts: 85

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

I need a help in counting,

Input file is of 4096 length but i need counts based on 3 variables,

X => Size 8
Y => Size 12
Z => Size 1


Code:

Data in that file will be like,

x              y                z
aaaaaa   111111         @ ....
aaaaaa   111111         @ ...
aaaaaa   111111         @ ....
aaaaaa   111111         $ ....
aaaaaa   111111         * ...
aaaaaa   222222         @ ...
aaaaaa   222222         % ...
aaaaaa   222222         $ ....
bbbbbb   111111         % ....
bbbbbb   111111         % ...
........................................
........................................


O/p should have counts like below,

aaaaaa   111111         @ = 3
aaaaaa   111111         $ = 1
aaaaaa   111111         * = 1
aaaaaa   222222         @ = 1
aaaaaa   222222         % = 1
aaaaaa   222222         $ = 1
bbbbbb   111111         % = 2
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

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

It should be easy for you, you have the right sort.....

Basicly sort on the field you want to count and, after defining an additional input field of 001, sum on that field.
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:47 pm
Reply with quote

Hi William,

Can you put some code over here for better understanding?
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

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

I couldn't, but you could...If you know Icetool, you must be using DFsort, and therefore have the manual, and therefore can do it.

Baring that, look back for previous posts, Frank has been making sort jump through hoops and all has been revealed......
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:43 pm
Reply with quote

Meetsrk,

You can use a DFSORT job like the following to do what you want.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/4096)
//SORTOUT DD DSN=...  output file (FB/25)
//SYSIN    DD    *
  SORT FIELDS=(1,21,BI,A)                             
  OUTFIL REMOVECC,NODETAIL,                           
    OUTREC=(1,21,25:X),                               
    SECTIONS=(1,21,                                   
      TRAILER3=(1,21,X,'=',X,COUNT=(M11,LENGTH=1)))   
/*


SORTOUT will have the following:

Code:

aaaaaa  111111      $ = 1 
aaaaaa  111111      * = 1 
aaaaaa  111111      @ = 3 
aaaaaa  222222      $ = 1 
aaaaaa  222222      % = 1 
aaaaaa  222222      @ = 1 
bbbbbb  111111      % = 2 


Note that the records are in the correct sorted order (e.g. $, *, %, @). The output you show is not sorted correctly. If you want the output in some nonstandard sorted order, tell me what order you want the $, *, % and @ characters in and I'll show you how to change the job.
Back to top
View user's profile Send private message
meetsrk

New User


Joined: 13 Jun 2004
Posts: 85

PostPosted: Tue Feb 20, 2007 5:03 pm
Reply with quote

Frank,

Can you pls explain the code on how it works?

Code:

  SORT FIELDS=(1,21,BI,A)                             
  OUTFIL REMOVECC,NODETAIL,                           
    OUTREC=(1,21,25:X),                               
    SECTIONS=(1,21,                                   
      TRAILER3=(1,21,X,'=',X,COUNT=(M11,LENGTH=1))) 
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: Tue Feb 20, 2007 9:13 pm
Reply with quote

Meetsrk,

We sort on positions 1-21 to get the records in order.

We use REMOVECC to suppress ANSI carriage control characters.

We use NODETAIL to suppress the detail records (we only want the TRAILER3 records).

We use OUTREC to get positions 1-21 followed by 4 blanks to pad the records out to the 25 bytes we need for the trailer records.

We use SECTIONS, TRAILER3 and COUNT to display positions 1-21 and the count each time the value in positions 1-21 changes.

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

Use [URL] BBCode for External Links
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

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
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
Search our Forums:

Back to Top