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
 

 

Multiple sort fields within multiple reports within a file

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

New User


Joined: 05 Jul 2013
Posts: 34
Location: India

PostPosted: Mon Jul 08, 2013 12:21 pm    Post subject: Multiple sort fields within multiple reports within a file
Reply with quote

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
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Mon Jul 08, 2013 1:37 pm    Post subject:
Reply with quote

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
View user's profile Send private message
bvarun.

New User


Joined: 05 Jul 2013
Posts: 34
Location: India

PostPosted: Mon Jul 08, 2013 1:50 pm    Post subject:
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Mon Jul 08, 2013 2:43 pm    Post subject:
Reply with quote

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
View user's profile Send private message
bvarun.

New User


Joined: 05 Jul 2013
Posts: 34
Location: India

PostPosted: Mon Jul 08, 2013 2:49 pm    Post subject:
Reply with quote

expat,

Thank you very much for your prompt response..

i will let you know on the updates
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Mon Jul 08, 2013 3:05 pm    Post subject:
Reply with quote

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
View user's profile Send private message
bvarun.

New User


Joined: 05 Jul 2013
Posts: 34
Location: India

PostPosted: Mon Jul 08, 2013 3:16 pm    Post subject:
Reply with quote

I tried ... clicking Img button and url of the screenshot and again img button

but in vain..
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Mon Jul 08, 2013 3:35 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7233

PostPosted: Mon Jul 08, 2013 4:49 pm    Post subject: Reply to: Multiple sort fields within multiple reports withi
Reply with quote

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
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7233

PostPosted: Mon Jul 08, 2013 5:57 pm    Post subject: Reply to: Multiple sort fields within multiple reports withi
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon Jul 08, 2013 9:48 pm    Post subject:
Reply with quote

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

http://www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000094
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7233

PostPosted: Tue Jul 09, 2013 12:29 am    Post subject: Reply to: Multiple sort fields within multiple reports withi
Reply with quote

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
View user's profile Send private message
bvarun.

New User


Joined: 05 Jul 2013
Posts: 34
Location: India

PostPosted: Tue Jul 09, 2013 8:56 am    Post subject:
Reply with quote

Thanks for patronage.

However today morning i was so irritated icon_evil.gif that client requested for the layout change.

But im going to try myself icon_rolleyes.gif on this format to get it sorted.
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 Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


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