|
View previous topic :: View next topic
|
| Author |
Message |
picus_mf Warnings : 1 New User
Joined: 09 Jun 2006 Posts: 52
|
|
|
|
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 |
|
 |
Escapa
Senior Member

Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
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 |
|
 |
picus_mf Warnings : 1 New User
Joined: 09 Jun 2006 Posts: 52
|
|
|
|
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
|
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10903 Location: italy
|
|
|
|
| Quote: |
| let me know if this gives u clarity |
If You had used a smaller font it would have been much more clear
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  |
|
| Back to top |
|
 |
Escapa
Senior Member

Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
| 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 |
|
 |
Escapa
Senior Member

Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
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 |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10903 Location: italy
|
|
|
|
Sambhaji ,
it wasn' t me who edited the post,
while I was writing my comments somebody else did it  |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
 |
Escapa
Senior Member

Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
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 |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
| 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 |
|
 |
Escapa
Senior Member

Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
| 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...  |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Right. One of the things I've learned in my 43 years as a developer is:
Bad test data = bad conclusions |
|
| Back to top |
|
 |
picus_mf Warnings : 1 New User
Joined: 09 Jun 2006 Posts: 52
|
|
|
|
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 |
|
 |
Escapa
Senior Member

Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
| Please show us example where it is not giving expected output. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|