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
 

 

Field wise count in ICETOOL or SORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
sudhakar_mainframe
Warnings : 1

New User


Joined: 29 Jun 2006
Posts: 25

PostPosted: Mon Sep 08, 2014 5:43 pm    Post subject: Field wise count in ICETOOL or SORT
Reply with quote

Hi all,

My requirement is to count the no of values in each field (column) and display in Count in bottom for each column.

Sample:
Code:
XXX XXX XXX XXX
YYY YYY     YYY   
ZZZ ZZZ ZZZ ZZZ
111         222 
---------------
  4   3   2   4
---------------


This count shows the no of values in each field or column (wont count the Spaces)

Thanks,
Venkata.

Code'd and de-mangled
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7235

PostPosted: Mon Sep 08, 2014 5:59 pm    Post subject: Reply to: Field wise count in ICETOOL or SORT
Reply with quote

On INREC, IFTHEN in WHEN=INIT to set a four-byte extension to zero. Four IFTHENs to test the field for non-blank and extend the record by one byte for each column with a value of one if non-blank.

Use OUTFIL reporting functions with REMOVECC, use TRAILER2 for some TOTs and BUILD to drop of the four excess bytes.
Back to top
View user's profile Send private message
sudhakar_mainframe
Warnings : 1

New User


Joined: 29 Jun 2006
Posts: 25

PostPosted: Tue Sep 09, 2014 12:44 pm    Post subject: Field wise count in ICETOOL or SORT
Reply with quote

Can you give sample code plz. urgent

Thanks,
Venkata.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7235

PostPosted: Tue Sep 09, 2014 1:19 pm    Post subject: Reply to: Field wise count in ICETOOL or SORT
Reply with quote

If you can type out a request like that, you can type out the code yourself. Really, which part was difficult? Probably the TRAILER2, so find examples of that (the manual, here, internet search).
Back to top
View user's profile Send private message
mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 268
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Tue Sep 09, 2014 2:28 pm    Post subject:
Reply with quote

Hi Bill,

Don't you think HIT=NEXT will also be needed on IFTHEN statements (in case of more than one overlay is required for same record)?
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7235

PostPosted: Tue Sep 09, 2014 4:52 pm    Post subject: Reply to: Field wise count in ICETOOL or SORT
Reply with quote

Yes, mistah kurtz, very good point.

I spent more time coding and de-mangling than thinking about it, because I half-suspect that the columns will turn out not to be fixed-position and that, along with the lines of dashes magically appearing, led me to expect a request for code, rather than hints :-)
Back to top
View user's profile Send private message
mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 268
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Tue Sep 09, 2014 6:22 pm    Post subject:
Reply with quote

Hi Sudhakar.

Please try something similar to the below code. First understand it and then modify it to get the required output.
Code:
  OPTION   COPY                                   
  INREC    IFTHEN=(WHEN=INIT,OVERLAY=(81:C'1111')),
           IFTHEN=(WHEN=(01,03,CH,EQ,C'   '),     
                   OVERLAY=(81:C'0'),HIT=NEXT),   
           IFTHEN=(WHEN=(05,03,CH,EQ,C'   '),     
                   OVERLAY=(82:C'0'),HIT=NEXT),   
           IFTHEN=(WHEN=(09,03,CH,EQ,C'   '),     
                   OVERLAY=(83:C'0'),HIT=NEXT),   
           IFTHEN=(WHEN=(13,03,CH,EQ,C'   '),     
                   OVERLAY=(84:C'0'))             
  OUTFIL   REMOVECC,BUILD=(1,80),                 
           TRAILER2=(1:TOT=(81,1,ZD,EDIT=(IIT)),   
                     5:TOT=(82,1,ZD,EDIT=(IIT)),   
                     9:TOT=(83,1,ZD,EDIT=(IIT)),   
                    13:TOT=(84,1,ZD,EDIT=(IIT)))   

And please don't pester for code. Nobody is going to help you that way even if someone wants to.
Back to top
View user's profile Send private message
sudhakar_mainframe
Warnings : 1

New User


Joined: 29 Jun 2006
Posts: 25

PostPosted: Tue Sep 09, 2014 6:43 pm    Post subject: Field wise count in ICETOOL or SORT
Reply with quote

thanks for the responses. Any how i already got the solution before this post. I derived the result in same way. (Used Build instead of OVERLAY)

Thanks,
Venkata.
Back to top
View user's profile Send private message
mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 268
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Tue Sep 09, 2014 7:22 pm    Post subject:
Reply with quote

Good for you!
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7235

PostPosted: Wed Sep 10, 2014 4:28 am    Post subject: Reply to: Field wise count in ICETOOL or SORT
Reply with quote

I've been passed this one, which is a very useful way to do it:

Code:
  OPTION COPY                                                   
  INREC OVERLAY=(51:C'0000',                                     
                 51:01,3,CHANGE=(1,C'   ',C'0'),NOMATCH=(C'1'),
                 52:05,3,CHANGE=(1,C'   ',C'0'),NOMATCH=(C'1'),
                 53:09,3,CHANGE=(1,C'   ',C'0'),NOMATCH=(C'1'),
                 54:13,3,CHANGE=(1,C'   ',C'0'),NOMATCH=(C'1'))


The OUTFIL would be the same.

It is well worth understanding, and CHANGE doesn't seem to get the use it deserves. Anyone want to have a go at explaining exactly what that single OVERLAY statement does?
Back to top
View user's profile Send private message
mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 268
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Wed Sep 10, 2014 12:06 pm    Post subject:
Reply with quote

This is really great! The single OVERLAY is by default populating the string '0000' in the 51st column and the subsequent CHANGE statements are looking up for spaces and setting the value to 1 if it does not find the match.

CHANGE syntax:
Code:
input field start position,input field length,CHANGE=(output field length,find value,set value if find a match),NOMATCH=(set value if does not match)


Thanks Bill for sharing this.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7235

PostPosted: Wed Sep 10, 2014 12:19 pm    Post subject: Reply to: Field wise count in ICETOOL or SORT
Reply with quote

Correct mistah kurtz.

All in one shot it:

Sets four bytes from position 51 to zero
In position 51, for one byte, it will change that value to zero where there are spaces at position 1,3 otherwise it will be "1" at that position
This is repeated for the remaining three byte groups and one-byte positions from 52 to 54.

Note that the OVERLAY allows re-use of a position whose value has already changed in the OVERLAY. You can't do that with BUILD (you can use CHANGE in BUILD, of course).
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
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 22 Tue Dec 06, 2016 8:04 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm


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