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
 

 

Record Count By specific Fields

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

Active User


Joined: 13 Jul 2006
Posts: 205
Location: At my desk

PostPosted: Tue Mar 18, 2008 6:10 pm    Post subject: Record Count By specific Fields
Reply with quote

Hi,

FIELD1 FIELD2 FIELD 3 FILED 4 FIELD 5
1/AN 4/AN 2/AN 1/AN 1/AN
1 3730 53 A 8
1 373A 53 A 8
1 373B 53 A 8
1 373C 53 A 8
1 373D 53 A 8
1 373E 53 A 8
1 373D 53 A 8

1 3730 53 A 9
1 373A 53 A 9
1 373B 53 A 9
1 373C 53 A 9
1 373D 53 A 9
1 373E 53 A 9
1 373D 53 A 9
1 3730 54 A 9
1 373A 54 A 9
1 373B 54 A 9
1 373C 54 A 9
1 373D 54 A 9
1 373E 54 A 9
1 373D 54 A 9

I expect the output of the following format

8 53 Count
9 53 count
9 54 count

Let me know how to proceed using DFSORT ?
Back to top
View user's profile Send private message

diwa_thilak

Active User


Joined: 13 Jul 2006
Posts: 205
Location: At my desk

PostPosted: Tue Mar 18, 2008 6:25 pm    Post subject:
Reply with quote

Hi,

Actually LRECL of Input file is 255 and i got these fields at different positions.

Output file LRECL 10.
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 788
Location: Chennai, India

PostPosted: Tue Mar 18, 2008 7:47 pm    Post subject:
Reply with quote

Diwakar,
Is it okay?
Code:
//SYSIN     DD *                           
   SORT FIELDS=(9,1,ZD,A,6,2,ZD,A)         
   SUM FIELDS=NONE                         
   OUTREC FIELDS=(1:9,1,3:6,2,6:C'COUNT')   
/*               
Back to top
View user's profile Send private message
shrivatsa
Warnings : 1

Active User


Joined: 17 Mar 2006
Posts: 171
Location: Bangalore

PostPosted: Tue Mar 18, 2008 8:20 pm    Post subject: Reply to: Record Count By specific Fields
Reply with quote

gnanas,

Code:
   
    //SYSIN DD *
        SORT FIELDS=(9,1,ZD,A,6,2,ZD,A)
        SUM FIELDS=NONE
        OUTREC FIELDS=(1:13,1,4:8,2,8:C'COUNT')
    /*


The above should be coded as per the requirement.
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 788
Location: Chennai, India

PostPosted: Tue Mar 18, 2008 8:29 pm    Post subject:
Reply with quote

Sorry, I assumed input as
Code:
1373053A8
1373A53A8
1373B53A8
1373C53A8
1373D53A8

since Diwakar has given the line
Quote:
1/AN 4/AN 2/AN 1/AN 1/AN


Is this okay?
Code:
//SYSIN     DD *                             
   SORT FIELDS=(13,1,ZD,A,8,2,ZD,A)         
   SUM FIELDS=NONE                           
   OUTREC FIELDS=(1:13,1,3:8,2,6:C'COUNT')   
/*                                           


Add info on this?
Back to top
View user's profile Send private message
rajatbagga

Active User


Joined: 11 Mar 2007
Posts: 188
Location: india

PostPosted: Tue Mar 18, 2008 8:47 pm    Post subject:
Reply with quote

Well i think by COUNT he(Diwakar) means the number of records...

i.e

8 53 7
9 53 7
9 54 7

Let me know if i am wrong. Actually was waiting for Diwakar's replay...
Back to top
View user's profile Send private message
diwa_thilak

Active User


Joined: 13 Jul 2006
Posts: 205
Location: At my desk

PostPosted: Tue Mar 18, 2008 9:27 pm    Post subject: Reply to: Record Count By specific Fields
Reply with quote

Friends,

The file has already been sorted based on the field 5.

My output should be in below format

Field 5 Field 3 Count for the combination of these two fields
9 53 3
9 54 3.

Also i beleive if you use SUMFIELDS = None will delete the duplicates, and you wont be able to get the count for the records.

Correct me if i am wrong.
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 Mar 18, 2008 9:51 pm    Post subject:
Reply with quote

Assuming your input records are already in the required sorted order by field5 and field3 as shown in your example, you can use a DFSORT job like the following to do what you asked for:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
1373053A8
1373A53A8
1373B53A8
1373C53A8
1373D53A8
1373E53A8
1373D53A8
1373053A9
1373A53A9
1373B53A9
1373C53A9
1373D53A9
1373E53A9
1373D53A9
1373054A9
1373A54A9
1373B54A9
1373C54A9
1373D54A9
1373E54A9
1373D54A9
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  INREC BUILD=(1:9,1,9:6,2,22:X)
  SORT FIELDS=COPY
  OUTFIL REMOVECC,NODETAIL,
    SECTIONS=(1,10,
      TRAILER3=(1,10,18:COUNT=(EDIT=(IIIIT))))
/*


If your records are not in sorted order, replace SORT FIELDS=COPY with:

Code:

  SORT FIELDS=(1,10,CH,A)


For the example shown, SORTOUT will have:

Code:

8       53           7   
9       53           7   
9       54           7   
Back to top
View user's profile Send private message
diwa_thilak

Active User


Joined: 13 Jul 2006
Posts: 205
Location: At my desk

PostPosted: Tue Mar 18, 2008 10:07 pm    Post subject:
Reply with quote

Frank,

Thanks for your input.

Can you explain me the significance of the below two lines.

Code:
SECTIONS=(1,10,
      TRAILER3=(1,10,18:COUNT=(EDIT=(IIIIT))))
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 Mar 18, 2008 10:12 pm    Post subject:
Reply with quote

Code:

SECTIONS=(1,10,
      TRAILER3=(1,10,18:COUNT=(EDIT=(IIIIT))))


SECTIONS=(1,10 - does a section break whenever the value in positions 1-10 changes. You will have three sections for 8 and 53, 9 and 53 and 9 and 54.

TRAILER3 - creates a trailer record for each section.
1,10 - includes input positions 1-10 in the trailer record.
18:COUNT=(EDIT=(IIIIT)) - includes the count of the number of records in the section in the trailer record starting at position 18. The EDIT mask displays the count as 5 digits with leading zeros suppressed.

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
diwa_thilak

Active User


Joined: 13 Jul 2006
Posts: 205
Location: At my desk

PostPosted: Tue Mar 18, 2008 10:34 pm    Post subject:
Reply with quote

Frank,

That was an excellent explantion.

Thanks for your input. I will go through materials you have pointed to.
Back to top
View user's profile Send private message
diwa_thilak

Active User


Joined: 13 Jul 2006
Posts: 205
Location: At my desk

PostPosted: Thu Apr 03, 2008 8:26 pm    Post subject: Reply to: Record Count By specific Fields
Reply with quote

Frank,

I am trying out a small variation of the above code.

The input data set is of LRECL 10 and the data is as follows.

11798N N3
11799N N3
11804N N3
10206NNL1
10229NNL1
10109NNL3
10138NNL3
11633NNN1
11634NNN1
11633YNN1
11634YNN1

The data is in sorted order based on position 1,6,7,8,9.

I am expecting an output which is of the following format.

Data from Pos1 Pos6 Pos7 Pos8 Pos 9 Count (for each combination)
1 N N 3 3
1 N N L 1 3

Can you guide me in setting up the trailer clause for the above scneario.
Back to top
View user's profile Send private message
diwa_thilak

Active User


Joined: 13 Jul 2006
Posts: 205
Location: At my desk

PostPosted: Thu Apr 03, 2008 8:37 pm    Post subject:
Reply with quote

Frank,

I got the result !!!!

Thanks for your wonderfull link..It helped me this time.
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 Record Not found in AlX but record re... mukun264 COBOL Programming 5 Fri Mar 24, 2017 9:28 am
No new posts Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts Display FTP Session Count within TSO Yolanda Harvey TSO/ISPF 3 Fri Mar 10, 2017 10:31 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts DFSORT MUL FIELDS tspr52 DFSORT/ICETOOL 16 Fri Mar 03, 2017 11:53 pm


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