View previous topic :: View next topic
|
Author |
Message |
bvarun.
New User
Joined: 05 Jul 2013 Posts: 34 Location: India
|
|
|
|
Hi all,
Thanks for providing support for all MF Queries.Now i would like to know about sort using ICETOOL.
I have a PS file RECFM=FB,LRECL=172. file has many company reports within itself.
Each company report has 3 header and no trailer.
In the first company report, in the first header, we have first sort field 'company id' (numeric field) and in the same row we have the second sort field 'date'. In second and third header no sort fields. after third header, records for the first company starts with first field is numeric field. after all records for the first company, then first header for the second company starts. and so on.
this is how reports for all company is written in that file.
Here i have a doubt in ICETOOL, can i sort the file within each company in the below order ?
1. company id
2. date
3. records of that company
i.e.,each company will be first sorted on company id and then date and then records for that company in ascending.
i know i can sort it in COBOL using SORT keyword.
i am little confused on sort using icetool. Can we sort it for the above criteria using DATASORT . If so please let me know
please findd the attachment.
Regards,
BV |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
What is the release level of sort that you are using, please run the JCL provided below and post the sresults including the message codes.
RECFM is
LRECL is
Key fields are where, howlong, which format
Code: |
//SORT01 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SORTIN DD *
RECORD
/*
//SYSIN DD *
SORT FIELDS=COPY
|
|
|
Back to top |
|
|
bvarun.
New User
Joined: 05 Jul 2013 Posts: 34 Location: India
|
|
|
|
expat,
we use DFSORT V1R12
RECFM=FB,
LRECL=172.
Order of key fields on which file has to be sorted
1. company id - 7,7,ZD
2. date - 72,8,ZD
3. records of that company - 1,2,ZD
i have attached file layout for your reference within this post. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Assuming that the posted screenshot is accurate you can use INREC IFTHEN
UNTESTED CODE - just a suggestion
Code: |
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,4,CH,EQ,C'COMP'),
PUSH=(173:7,7,180:72,8))
SORT FIELDS=(173,15,CH,A,1,2,CH,A)
|
You will have to search the forum / manuals on how to chop the addition fields off as I am a bit busy at the moment to go looking, probably OUTFIL OUTREC= |
|
Back to top |
|
|
bvarun.
New User
Joined: 05 Jul 2013 Posts: 34 Location: India
|
|
|
|
expat,
Thank you very much for your prompt response..
i will let you know on the updates |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
bvarun
Please learn to use the code tags rather than using attachments, as
a) Not evryone will be able to open some attachments
b) Not everybody will want to open some attachments
Using attachments just cuts down on the numbers of those able or willing to help. |
|
Back to top |
|
|
bvarun.
New User
Joined: 05 Jul 2013 Posts: 34 Location: India
|
|
|
|
I tried ... clicking Img button and url of the screenshot and again img button
but in vain.. |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
bvarun. wrote: |
I tried ... clicking Img button and url of the screenshot and again img button
but in vain.. |
Do not use the "Img" button, but the "Code" button. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Why do you think you need to use ICETOOL?
DATASORT works where there is a file-header or file-trailer (or both) on a file. I think you have a different situation.
If you know how to get your answer using the COBOL SORT verb, then you can do the same thing with DFSORT.
expat has given you a good start. The format of your date is not "natural" for sorting, and lines two and three of each group will confuse things as they have different data than the numerics you want to sort on for the detail lines.
If you are still stuck, show us how you'd do it in COBOL and we can assist in applying that with SORT Control Cards. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
expat, you were too harsh on yourself. If it had been in the Code tags, we could at least have seen it easily... I've deepsixed it :-) |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
expat wrote: |
Assuming that the posted screenshot is accurate you can use INREC IFTHEN
UNTESTED CODE - just a suggestion
Code: |
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,4,CH,EQ,C'COMP'),
PUSH=(173:7,7,180:72,8))
SORT FIELDS=(173,15,CH,A,1,2,CH,A)
|
You will have to search the forum / manuals on how to chop the addition fields off as I am a bit busy at the moment to go looking, probably OUTFIL OUTREC= |
Expat you got it almost right. OP's header records had(CO,FI and PR) in postions 1 and 2 and your detail records have numeric data. So you should be ok as characters get sorted first and then numeric data. But if they have different values then you may need to sequence the group records and preserve the first 3 as is.
btw this is similar to the smart DFSORT trick "Sort detail records between headers and trailers" which can be found here
www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000094 |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Is sorting the data going in to the report possible?
If not, use expat's suggestion, swapping the date into "sort" order (76,4,74,2,72,2).
Take note of what Kolusu said. If your first three lines are always like that, then there will be no harm in sorting on 1,2, as the letters will always come before numbers, and the letters are in order. If you can have different text per heading in those first three lines, then there is a little more to do.
To "cut the record down" again, after the SORT
Code: |
OUTREC BUILD=(1,172) |
|
|
Back to top |
|
|
bvarun.
New User
Joined: 05 Jul 2013 Posts: 34 Location: India
|
|
|
|
Thanks for patronage.
However today morning i was so irritated that client requested for the layout change.
But im going to try myself on this format to get it sorted. |
|
Back to top |
|
|
|