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
 

 

Syncsort - Count Records by Type

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Michael Angelo Pagala

New User


Joined: 02 Mar 2007
Posts: 34
Location: somewhere in the middle

PostPosted: Fri Oct 15, 2010 5:30 pm    Post subject: Syncsort - Count Records by Type
Reply with quote

Hi Guys,

I have a file which has some data I need to count.

Example.
Input File:
000A
000A
000B
000A
000C

Output File:
A Recs: 03
B Recs: 01
C Recs: 01

I know how to count the records and put them into a file but in different files. I only want a single output file for this.

Code:
   SORT FIELDS=COPY                             
    OUTFIL FILES=01,                             
           INCLUDE=(4,1,CH,EQ,C'A'),             
           REMOVECC,NODETAIL,                   
           TRAILER1=('A RECS:',COUNT=(EDIT=(TT)))


btw we are using SYNCSORT FOR Z/OS 1.3.2.1R
Back to top
View user's profile Send private message

daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Fri Oct 15, 2010 6:13 pm    Post subject:
Reply with quote

Quote:

I need a guide or hint to start with so I won't waste more time and resources in finding the correct answer if there is one.

Michael,

What you want to do can be done (in more than one way).

If you spend your time trying (start with what you have), you are not wasting it. Even if it was not possible, the experience you gain, and the effort you expell makes it worth while.

I may get a dozen or more failed attempts with syncsort before I get it to work.

Thomas Edison had hundreds of failed experiments for something that was not possible for each successful patent.

With regard to wasted resources, in my opinion, the computer sitting idle, instead of helping you with your experiment is the wasted resource, not the other way around.
Back to top
View user's profile Send private message
Michael Angelo Pagala

New User


Joined: 02 Mar 2007
Posts: 34
Location: somewhere in the middle

PostPosted: Fri Oct 15, 2010 6:25 pm    Post subject:
Reply with quote

thanks for the insight dave

I am trying some other methods but I just want to achieve this in a single step.

also, I can only run this on the company's machine and just can't experiment all day because I have some other things to do.

I am not that proficient with SORT (esp new functions), so I just need some guide on how to do it the simplest way.

thanks again
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Fri Oct 15, 2010 6:40 pm    Post subject:
Reply with quote

Quote:

also, I can only run this on the company's machine and just can't experiment all day because I have some other things to do.

Me too.
Back to top
View user's profile Send private message
Michael Angelo Pagala

New User


Joined: 02 Mar 2007
Posts: 34
Location: somewhere in the middle

PostPosted: Fri Oct 15, 2010 6:48 pm    Post subject:
Reply with quote

any other informative comments? icon_lol.gif
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Oct 15, 2010 7:39 pm    Post subject:
Reply with quote

Hello,

Which release of Syncsort is being used?
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Fri Oct 15, 2010 8:32 pm    Post subject:
Reply with quote

Michael,

With the sort card, you show - you'll get
Code:
A RECS:03       
in output and not
Code:
A Recs: 03
B Recs: 01
C Recs: 01


And 'am not sure about this:
Quote:
I know how to count the records and put them into a file but in different files. I only want a single output file for this.
Does the quoted text mean, you want the output like:

Code:
000A
000A
000B
000A
000C
A Recs: 03
B Recs: 01
C Recs: 01
Please explain.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Oct 15, 2010 8:44 pm    Post subject:
Reply with quote

Hi Anuj,

Michael wants the counts of the different "types" all in one output.

He knows how to get a single count in a trailer and does not want to create 3 sets of trailer code. . .
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2161
Location: @my desk

PostPosted: Fri Oct 15, 2010 10:55 pm    Post subject:
Reply with quote

Michael,

You're almost there. Changing your card as below might help(Untested).
Code:
  SORT FIELDS=(4,1,CH,A)                             
  OUTFIL REMOVECC,NODETAIL,SECTIONS=(4,1,                   
         TRAILER3=(4,1,' RECS:',COUNT=(EDIT=(TT))))
Remember, the output will be routed to SORTOUT as opposed to your job which writes into SORTOF01
Back to top
View user's profile Send private message
Michael Angelo Pagala

New User


Joined: 02 Mar 2007
Posts: 34
Location: somewhere in the middle

PostPosted: Sun Oct 17, 2010 9:10 am    Post subject:
Reply with quote

thank you dick and arun for your assistance.

I will try the sort card above once I get back to the office. I'll try to understand the SECTION parameter on the manual I asked from Ms. Alissa..

but seeing the sort card..is it correct to assume that the SECTION somewhat groups similar string of char based on the sort fields?

again thanks guys
Back to top
View user's profile Send private message
Michael Angelo Pagala

New User


Joined: 02 Mar 2007
Posts: 34
Location: somewhere in the middle

PostPosted: Wed Oct 20, 2010 1:34 pm    Post subject:
Reply with quote

I made a quick test and the sort card is giving me the expected output.

Thank you Arun.


Another question...if my input varies a little bit..like the position fields of the type/value needed to be counted are not the same for all the records

e.g.
Input File:
000A
000A
XXXX000B
000A
XXXX000C

Output File:
A Recs: 03
B Recs: 01
C Recs: 01

Can this still be achieved by a single step?

thanks!
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Oct 20, 2010 7:31 pm    Post subject:
Reply with quote

Hello,

Quote:
if my input varies a little bit..
This additional requirement is more than a "little bit". . . It basically negates the working solution. . . icon_sad.gif

Post any additional "requirement info" now so no one wastes time on a solution that won't be used.

What are the rules for finding the "keys". If there are no rules, it probably cannot be done. . .
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Wed Oct 20, 2010 7:39 pm    Post subject: Reply to: Syncsort - Count Records by Type
Reply with quote

the approach has beed discussed a few times
using the BUILD IFTHEN constructs build an auxiliary field
carry on the grouping on that field and as per current approach
when writing the final result just ignore the auxiliary field

for example
if the record is 80 bytes build the auxiliary field at position 81 for the relevant number of bytes

searching the forums for BUILD IFTHEN will give quite a few examples
on how to proceed
Back to top
View user's profile Send private message
Michael Angelo Pagala

New User


Joined: 02 Mar 2007
Posts: 34
Location: somewhere in the middle

PostPosted: Thu Oct 21, 2010 10:45 am    Post subject:
Reply with quote

yes I was aware of that dick and I apologize for that..I will probably do enrico's suggestion.

thanks again guys..you have been so helpful!
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts Syncsort - Hard coded Value in output PORYES SYNCSORT 1 Thu Nov 03, 2016 9:23 am
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


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