View previous topic :: View next topic
|
Author |
Message |
diwa_thilak
Active User
Joined: 13 Jul 2006 Posts: 205 Location: At my desk
|
|
|
|
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 |
|
|
diwa_thilak
Active User
Joined: 13 Jul 2006 Posts: 205 Location: At my desk
|
|
|
|
Hi,
Actually LRECL of Input file is 255 and i got these fields at different positions.
Output file LRECL 10. |
|
Back to top |
|
|
Gnanas N
Active Member
Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
|
|
|
|
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 |
|
|
shrivatsa Warnings : 1 Active User
Joined: 17 Mar 2006 Posts: 174 Location: Bangalore
|
|
|
|
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 |
|
|
Gnanas N
Active Member
Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
|
|
|
|
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 |
|
|
rajatbagga
Active User
Joined: 11 Mar 2007 Posts: 199 Location: india
|
|
|
|
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 |
|
|
diwa_thilak
Active User
Joined: 13 Jul 2006 Posts: 205 Location: At my desk
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
diwa_thilak
Active User
Joined: 13 Jul 2006 Posts: 205 Location: At my desk
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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:
Use [URL] BBCode for External Links |
|
Back to top |
|
|
diwa_thilak
Active User
Joined: 13 Jul 2006 Posts: 205 Location: At my desk
|
|
|
|
Frank,
That was an excellent explantion.
Thanks for your input. I will go through materials you have pointed to. |
|
Back to top |
|
|
diwa_thilak
Active User
Joined: 13 Jul 2006 Posts: 205 Location: At my desk
|
|
|
|
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 |
|
|
diwa_thilak
Active User
Joined: 13 Jul 2006 Posts: 205 Location: At my desk
|
|
|
|
Frank,
I got the result !!!!
Thanks for your wonderfull link..It helped me this time. |
|
Back to top |
|
|
|