MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
ldushkin Beginner Joined: 05 Apr 2006 Posts: 56 Topics: 20
Posted: Sat Apr 08, 2006 7:08 am Post subject: We have input flat file and we need count all records and el
Need help in the sort.
We have input flat file and we need count all records and eliminate duplicate.
input:
Code:
AAAAAAHEADER 052006
xxxxxxxxxx xxxxxxx xxxxx xxxxxxxxxx xxxxH1111xxxxxxxxxx
xxxxxxxxxx xxxxxxx xxxxx xxxxxxxxxx xxxxH1111xxxxxxxxxx
xxxxxxxxxx xxxxxxx xxxxx xxxxxxxxxx xxxxH2222xxxxxxxxxx
xxxxxxxxxx xxxxxxx xxxxx xxxxxxxxxx xxxxH2222xxxxxxxxxx
xxxxxxxxxx xxxxxxx xxxxx xxxxxxxxxx xxxxH3333xxxxxxxxxx
xxxxxxxxxx xxxxxxx xxxxx xxxxxxxxxx xxxxH3333xxxxxxxxxx
Expected output:
Code:
AAAAAAHEADER 052006
TOTAL RECORDS: 164
H1111 H2222 H3333
H.... H.... H....
Now I have 2 steps in my sort and copy all records, but i need only header, total records from input and field from 47 position 5 bites
step1:
Code:
SORT FIELDS=(47,5,CH,A)
OUTFIL FNAMES=SORTOUT,
TRAILER1=(2/,2:'TOTAL RECORDS: ',COUNT)
step2
Code:
SORT FIELDS=(47,5,CH,A)
SUM FIELDS=NONE
OUTFIL FNAMES=SORTOUT,
OUTREC=(10:47,5,
225:X)
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12367 Topics: 75 Location: San Jose
Posted: Sat Apr 08, 2006 8:02 am Post subject:
ldushkin ,
Counting records and eliminating duplicates is very easy however in your output you showed the detailed records arranged horizontally instead of vertically
Code:
H1111 H2222 H3333
H.... H.... H....
Did you really wanted that ? If so how many vertical records should be a part of 1 horizontal record? Here you showed 3.
Kolusu _________________ Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
www.linkedin.com/in/kolusu
Back to top
ldushkin Beginner Joined: 05 Apr 2006 Posts: 56 Topics: 20
Posted: Sat Apr 08, 2006 10:12 am Post subject:
Thanks a lot for your quick response. Yes I need 3 or 4 horizontal records.
It should be like this
AAAAAAHEADER 052006
H0540 H0564 H5419
H5422 R9943 S5960
TOTAL RECORDS: 959
Also I need, if it possible, name of input DSN. Because this report will be copy to Exel
file-name count-records number
input file 959 H0540, H0564, H5419,
H5422, R9943, S5960
I appreciate all your help
Lenny
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12367 Topics: 75 Location: San Jose
Posted: Mon Apr 10, 2006 7:49 am Post subject:
ldushkin,
Sort products do not have the ability to print the filename. you will need atleast 3 passes to acheive the desired results.
To get 1 header and count of the records you can use the following sysin cards.
Code:
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL REMOVECC,NODETAIL,
HEADER1=(1,80),
TRAILER1=('TOTAL RECORDS: ',COUNT)
/*
Check this link for arranging 3 records in a horizontal rows.
http://mvsforums.com/helpboards/viewtopic.php?t=3289
However I suggest that you use easytrieve the achieve the desired results and everything can be done in just 1 pass of the data.
Hope this helps...
Cheers
Kolusu _________________ Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
www.linkedin.com/in/kolusu
Back to top
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum