View previous topic :: View next topic
|
Author |
Message |
Ramanan-R
New User
Joined: 21 Mar 2007 Posts: 66 Location: Chennai, Tamilnadu, India
|
|
|
|
Hi All
I have a file (LRECL = 80) with three fields as below
Field_1: 1,15
Field_2: 16,10
Field_3: 26,5
Requirement:
1. Remove Leading and Trailing Spaces between fields,
2. Delimit Fields with Pipe (|),
3. Preserve spaces between Field values...
Example:
Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
AAAA BB CCC DD EE FF |
Expected Output:
Code: |
AAAA BB|CCC DD|EE FF| |
Thanks in advance!
Regards,
Ramanan R |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Ramanan-R,
Which sort product do you use...? Your recent posts suggests that you have SyncSort. |
|
Back to top |
|
|
Ramanan-R
New User
Joined: 21 Mar 2007 Posts: 66 Location: Chennai, Tamilnadu, India
|
|
|
|
Hi Arun...
Yes, our shop has Syncsort...
If possible, please also advise DFSORT/ICETOOL solution.. Just for my reference
Regards,
Ramanan R |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
If possible, please also advise DFSORT/ICETOOL solution.. Just for my reference |
Here's a DFSORT job that will do what you asked for:
Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/80)
//SORTOUT DD DSN=... output file (FB/80)
//SYSIN DD *
OPTION COPY
INREC IFOUTLEN=80,
IFTHEN=(WHEN=INIT,
BUILD=(1,15,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'"',LENGTH=17),
16,10,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'"',LENGTH=12),
26,5,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'"',LENGTH=7))),
IFTHEN=(WHEN=INIT,
BUILD=(1,36,SQZ=(SHIFT=LEFT,MID=C'|',PAIR=QUOTE))),
IFTHEN=(WHEN=INIT,FINDREP=(IN=C'"',OUT=C''))
/*
|
|
|
Back to top |
|
|
Ramanan-R
New User
Joined: 21 Mar 2007 Posts: 66 Location: Chennai, Tamilnadu, India
|
|
|
|
Frank...
What to say!? I love you... |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
you must love old blokes |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Well, old blokes need love too. But I'm already spoken for (by my wife and four pet rats). |
|
Back to top |
|
|
|
|