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
 

 

Need help in counting Input file is of 4096 length

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Need help in counting Input file is of 4096 length
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: 3158
Location: Tucson AZ

PostPosted: Mon Nov 20, 2006 8:41 pm    Post subject:
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    Post subject:
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: 3158
Location: Tucson AZ

PostPosted: Mon Nov 20, 2006 8:54 pm    Post subject:
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 Moderator


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

PostPosted: Mon Nov 20, 2006 9:43 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Tue Feb 20, 2007 9:13 pm    Post subject:
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:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
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
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm


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