IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

sorting of specific record type in a set of records


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
picus_mf
Warnings : 1

New User


Joined: 09 Jun 2006
Posts: 52

PostPosted: Thu Apr 14, 2011 8:07 pm
Reply with quote

I have policies A1, A2, A3 ,... with set of record types like shown below:
A1
RT - 1, 2,3,4,4,4,6
A2
RT - 1,2,3,4,4,4,4,4,6 ,etc

I would like to sort only record type 4 on some condition for each policy without disturbing other record types sequence. Can anyone pls let me know how this can be done?
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Apr 14, 2011 8:21 pm
Reply with quote

Please show more legitimate example...

Quote:

I would like to sort only record type 4 on some condition for each policy

Also please explain more on this.
what is the condition? where is the condition present? in A record or 4 type records on what key you wan to sort rec type 4 records?

What is SORT product you have now at your shop? Your old posts shows you have SYNCSORT.

What is record length\ record format of the file?
Back to top
View user's profile Send private message
picus_mf
Warnings : 1

New User


Joined: 09 Jun 2006
Posts: 52

PostPosted: Fri Apr 15, 2011 2:41 pm
Reply with quote

It is FB and 276 bytes.
REcord format looks something like this. At 41 position we have record type and I would like to sorr only record type '4' wrt to postion (43,6) and 48 postion :


Code:
17744A0808064109              12090701111 0 00   0  1 100701                 
17744A0808064109              12090701112WILLIAM J AFRYL AGENCY INC           
17744A0808064109              12090701113PO BOX 5366 ELGIN IL 60121-4153     
17744A0808064109              12090701114 8742 P000000100518100518000000685100
17744A0808064109              12090701114 8810 R000000090701090701000000528200
17744A0808064109              12090701114 8810 R000000090701090701000001676400
17744A0808064109              12090701114 8810 R000000090701090701000002165400
17744A0808064109              12090701114 8810 P000000090701090701000002174200
17744A0808064109              12090701114 8810 P000000091118091118000002808300
17744A0808064109              12090701114 8810 P000000100518100518000000685100
17744A0808064109              12090701114 9740 R000000090701090701000000000000
17744A0808064109              12090701114 9740 P000000090701090701000000000000
17744A0808064109              12090701114 9740 D000000091118091118000000000000
17744A0808064109              12090701114 9740 D000000100518100518000000000000
17744A0808064109              12090701114 9741 R000000090701090701000000000000
17744A0808064109              12090701114 9741 P000000090701090701000000000000
17744A0808064109              12090701114 9741 D000000091118091118000000000000
17744A0808064109              12090701114 9741 D000000100518100518000000000000

let me know if this gives u clarity

Edited to increase font and also use
Code:
[code] [/code]
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Apr 15, 2011 2:49 pm
Reply with quote

Quote:
let me know if this gives u clarity

If You had used a smaller font it would have been much more clear icon_evil.gif

the post has ben edited to use a readable font and the code tags
thank You to the good soul who beat me to it icon_biggrin.gif
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Apr 15, 2011 3:06 pm
Reply with quote

Quote:
let me know if this gives u clarity

Yes it does upto some extent but lot of pain to eyes even with the glasses.

You can use below step to ger required output.

as per example shown, record type is present at pos 28 and sort key is present at 6 bytes from 30

Code:

//STEP0100 EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD *                                                       
17744A0808064109 12090701111 0 00 0 1 100701                           
17744A0808064109 12090701112WILLIAM J AFRYL AGENCY INC                 
17744A0808064109 12090701113PO BOX 5366 ELGIN IL 60121-4153           
17744A0808064109 12090701114 8742 P000000100518100518000000685100     
17744A0808064109 12090701114 8810 R000000090701090701000000528200     
17744A0808064109 12090701114 8810 R000000090701090701000001676400     
17744A0808064109 12090701114 8810 R000000090701090701000002165400     
17744A0808064109 12090701114 8810 P000000090701090701000002174200     
17744A0808064109 12090701114 8810 P000000091118091118000002808300     
17744A0808064109 12090701114 8810 P000000100518100518000000685100     
17744A0808064109 12090701114 9740 R000000090701090701000000000000     
17744A0808064109 12090701114 9740 P000000090701090701000000000000     
17744A0808064109 12090701114 9740 D000000091118091118000000000000     
17744A0808064109 12090701114 9740 D000000100518100518000000000000     
17744A0808064109 12090701114 9741 R000000090701090701000000000000     
17744A0808064109 12090701114 9741 P000000090701090701000000000000     
17744A0808064109 12090701114 9741 D000000091118091118000000000000     
17744A0808064109 12090701114 9741 D000000100518100518000000000000     
//SORTOUT  DD SYSOUT=*                                               
//SYSIN    DD *                                                       
 INREC IFTHEN=(WHEN=(28,1,CH,EQ,C'4'),OVERLAY=(277:30,6))   
 SORT FIELDS=(28,1,CH,A,30,6,CH,A),EQUALS                             
 OUTFIL BUILD=(1,276)                                       
/*                                                           
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Apr 15, 2011 3:17 pm
Reply with quote

Many Thanks Enrico.. Since code tag was not there I missed layout..
Here is modified SYSIN...
Code:

//SYSIN    DD *                                                       
 INREC IFTHEN=(WHEN=(41,1,CH,EQ,C'4'),OVERLAY=(277:43,6))   
 SORT FIELDS=(41,1,CH,A,43,6,CH,A),EQUALS                             
 OUTFIL BUILD=(1,276)                                       
/*       
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Apr 15, 2011 3:35 pm
Reply with quote

Sambhaji ,
it wasn' t me who edited the post,
while I was writing my comments somebody else did it icon_biggrin.gif
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Apr 15, 2011 9:28 pm
Reply with quote

Sambhaji,

Why would you copy the field at 43 to 277 and then SORT on the field at 43? What does that accomplish? I guess you meant to SORT on the field at 277 like this:

Code:

 INREC IFTHEN=(WHEN=(41,1,CH,EQ,C'4'),OVERLAY=(277:43,6))   
 SORT FIELDS=(41,1,CH,A,277,6,CH,A),EQUALS                             
 OUTFIL BUILD=(1,276)           


Note that with the supplied input records, the following would actually work:

Code:

    OPTION EQUALS
    SORT FIELDS=(41,1,CH,A,43,6,CH,A)


The data would have to be more complicated for the solution to really require sorting on blanks at 277 for the fields that do not have '4' in 41.
For example, if there were two '1' records with values 222222 and 111111 at 43. The blanks in 277 and EQUALS would then keep those '1' records in their original order instead of sorting them by the key at 43.

Sometimes the supplied data is not good enough to determine if a solution will actually work or not.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Apr 15, 2011 9:35 pm
Reply with quote

Actually Yeah You got it right... Frank..

Also I was thinking of case if record type 1,2,3,6 has duplicates....
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Apr 15, 2011 9:44 pm
Reply with quote

Ah, you were thinking in the right direction then. I find its best to add test data that matches the situations I'm solving for when the original data doesn't cover those situations. That way, you know if your solution works for all of the situations you're trying to cover. Testing is certainly an "art".
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Apr 15, 2011 9:48 pm
Reply with quote

Quote:
That way, you know if your solution works for all of the situations you're trying to cover.

Hmm... Thats the reason I couldn't catch the change you notified... icon_sad.gif
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Apr 15, 2011 9:54 pm
Reply with quote

Right. One of the things I've learned in my 43 years as a developer is:

Bad test data = bad conclusions
Back to top
View user's profile Send private message
picus_mf
Warnings : 1

New User


Joined: 09 Jun 2006
Posts: 52

PostPosted: Mon Apr 18, 2011 3:58 pm
Reply with quote

Thnks for the reply..

Code:
INREC IFTHEN=(WHEN=(41,1,CH,EQ,C'4'),OVERLAY=(277:43,4))
SORT FIELDS=(41,1,CH,A,277,4,CH,A),EQUALS               
OUTFIL BUILD=(1,276)     


the above syntax isnt wrking for my requirement. Here it is disturbing record types 1,2,3 and 6 sequence. I want to keep this sequence intact and sort record type 4 based on some fields internally for a policy. I need to internally sort record type 5 on conditions which are not same as record type '4' conditions if a specific policy has record type '5' multiple occurnces along with record type '4'.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon Apr 18, 2011 4:59 pm
Reply with quote

Please show us example where it is not giving expected output.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 2
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
Search our Forums:

Back to Top