|
View previous topic :: View next topic
|
| Author |
Message |
Puspojit
New User
Joined: 10 Mar 2008 Posts: 34 Location: Pune
|
|
|
|
I have a file as below
| Code: |
DON BRADMAN ,AUSTRALIA ,101,CAPTAIN AUS
SACHIN TENDULKAR ,INDIA ,99 ,CAPTAIN IND
|
Need to convert the file to below format and send across to users
| Code: |
DON BRADMAN,AUSTRALIA,101,CAPTAIN AUS
SACHIN TENDULKAR,INDIA,99,CAPTAIN IND
|
I used FINDREP and changed x'4040' To x'' which solved the problem to an extent (and then changing single space and comma to just a comma). However whenever there are two spaces within a column, like in example above(CAPTAIN AUS), the logic breaks.
Is there any way we can achieve this through SORT ?
Please advise.
[/quote] |
|
| Back to top |
|
 |
magesh23586
Active User

Joined: 06 Jul 2009 Posts: 213 Location: Chennai
|
|
|
|
May be this will work.
| Code: |
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=INIT,
FINDREP=(INOUT=(C' ,',C',',
C' ,',C',',
C' ,',C',',
C' ,',C',',
C' ,',C',',
C' ,',C',',
C' ,',C',',
C' ,',C',',
C' ,',C',',
C' ,',C',',
C' ,',C',',
C' ,',C',',
C' ,',C',',
C' ,',C',',
C' ,',C',',
C' ,',C',')))
|
|
|
| Back to top |
|
 |
mistah kurtz
Active User
Joined: 28 Jan 2012 Posts: 316 Location: Room: TREE(3). Hilbert's Hotel
|
|
|
|
Try this sort card. See if it works for you. I don't have DFSORT, tested it on syncsort assuming both input/output are fb/80.
Input:
| Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
DON BRADMAN ,AUSTRALIA ,101,CAPTAIN AUS
SACHIN TENDULKAR ,INDIA ,99 ,CAPTAIN IND |
Sort Card
| Code: |
OPTION COPY
INREC IFOUTLEN=80,
IFTHEN=(WHEN=INIT,
BUILD=(1,21,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'"',LENGTH=23),
23,17,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'"',LENGTH=19),
41,03,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'"',LENGTH=06),
45,15,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'"',LENGTH=17))),
IFTHEN=(WHEN=INIT,
BUILD=(1,65,SQZ=(SHIFT=LEFT,MID=C',',PAIR=QUOTE))),
IFTHEN=(WHEN=INIT,FINDREP=(IN=C'"',OUT=C'')) |
Output:
| Code: |
DON BRADMAN,AUSTRALIA,101,CAPTAIN AUS
SACHIN TENDULKAR,INDIA,99,CAPTAIN IND |
|
|
| Back to top |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3109 Location: NYC,USA
|
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|