|
View previous topic :: View next topic
|
| Author |
Message |
Roy Ware
New User
Joined: 19 Sep 2013 Posts: 14 Location: USA
|
|
|
|
Got a difficult one here - and yes, I did RTFM.
I have a file that is sorted on numeric values:
| Code: |
SORT FIELDS=(077,06,PD,A,
001,03,CH,A,
006,26,CH,A,
165,01,CH,A,
166,01,CH,A)
OMIT COND=(145,06,CH,EQ,C'Driver',
OR,145,06,CH,EQ,C'VehUse',
OR,145,06,CH,EQ,C'Form ')
OPTION SIZE=E70000000,EQUALS
|
The problem is that the source (over which I have no control) has the text fields - column 145, length of 6 - out of "order". "Proper" file order is:
Policy
Party
Coverage
Vehicle
Location
Discount
Instead, the source file has these scattered about in no particular order.
Does SYNCSORT (the product I'm stuck with, so don't suggest anything else!) allow some sort of user macro that can let me get these in the right order? If so, how? |
|
| Back to top |
|
 |
Roy Ware
New User
Joined: 19 Sep 2013 Posts: 14 Location: USA
|
|
|
|
| Yes, I've looked at ALTSEQ and it doesn't seem to fit the bill. I wish this was DB2! |
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10902 Location: italy
|
|
|
|
use IFTHEN to add somewhere in Your record a numeric sequence number
something along the lines of
| Code: |
INREC IFTHEN=(WHEN=(145,8,CH,EQ,C'Policy '),OVERLAY=(somewhere:C'01')),
IFTHEN=(WHEN=(145,8,CH,EQ,C'Party '),OVERLAY=(somewhere:C'02')),
IFTHEN=(WHEN=(145,8,CH,EQ,C'Coverage'),OVERLAY=(somewhere:C'03')),
IFTHEN=(WHEN=(145,8,CH,EQ,C'Vehicle '),OVERLAY=(somewhere:C'04')),
IFTHEN=(WHEN=(145,8,CH,EQ,C'Location'),OVERLAY=(somewhere:C'05')),
IFTHEN=(WHEN=(145,8,CH,EQ,C'Discount'),OVERLAY=(somewhere:C'06')), |
just a sketch to give You the idea |
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2276 Location: USA
|
|
|
|
| Roy Ware wrote: |
| Yes, I've looked at ALTSEQ and it doesn't seem to fit the bill. I wish this was DB2! |
1) ALTSEQ is related to the sequence of used characters, not words!...
2) DB2 has nothing to do with this issue, too. |
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2276 Location: USA
|
|
|
|
| enrico-sorichetti wrote: |
use IFTHEN to add somewhere in Your record a numeric sequence number
something along the lines of
| Code: |
INREC IFTHEN=(WHEN=(145,8,CH,EQ,C'Policy '),OVERLAY=(somewhere:C'01')),
IFTHEN=(WHEN=(145,8,CH,EQ,C'Party '),OVERLAY=(somewhere:C'02')),
IFTHEN=(WHEN=(145,8,CH,EQ,C'Coverage'),OVERLAY=(somewhere:C'03')),
IFTHEN=(WHEN=(145,8,CH,EQ,C'Vehicle '),OVERLAY=(somewhere:C'04')),
IFTHEN=(WHEN=(145,8,CH,EQ,C'Location'),OVERLAY=(somewhere:C'05')),
IFTHEN=(WHEN=(145,8,CH,EQ,C'Discount'),OVERLAY=(somewhere:C'06')), |
just a sketch to give You the idea |
Since we don't know if any OVERLAY is allowed within the record, it would be safer to append new value at the end:
| Code: |
| ...WHEN=(...),BUILD=(1,167,C'1'),... assign '1'-'6' in proper order |
Also don't forget to add this new field to SORT field list:
| Code: |
| SORT FIELDS=(167,1,CH,A,..............) |
|
|
| Back to top |
|
 |
Roy Ware
New User
Joined: 19 Sep 2013 Posts: 14 Location: USA
|
|
|
|
It's a 2000 byte record with nothing at the end, so I overlaid the last 2 bytes with the sequence number - worked like a charm.
I mentioned DB2 because it has a lovely statement (Case?) I used to use to order things like this.
Thanks for all the help folks!
 |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|