View previous topic :: View next topic
|
Author |
Message |
gayathrinag
New User
Joined: 16 Oct 2008 Posts: 37 Location: chennai
|
|
|
|
Hi,
I have the below requirement.
Input
10||20|||||20
11||20
Output should be
10|SPACES|20|SPACES|SPACES|SPACES|SPACES|20
11|SPACES|20
Wherever it find the || symbols i need to replace with |SPACES|. I have tried FINDREP command.
OPTION COPY
INREC IFTHEN=(WHEN=INIT,
FINDREP=(IN=C'|||',OUT=C'|SPACES|SPACES|')),
IFTHEN=(WHEN=INIT,
FINDREP=(IN=C'||',OUT=C'|SPACES|'))
The above sort card works for the below input.
10||20||||20
11||20
If i have 10||20|||||20 this sort card is not working as expected. Any could help me this.
Thanks |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
Hello you could try,
Code: |
OPTION COPY
INREC FINDREP=(IN=C'||',OUT=C'|SPACES|')
OUTREC FINDREP=(IN=C'||',OUT=C'|SPACES|') |
Works for the example shown above,
Partially tested.
Hope it helps. |
|
Back to top |
|
|
gayathrinag
New User
Joined: 16 Oct 2008 Posts: 37 Location: chennai
|
|
|
|
Hey Vasanth,
That worked fine.
Thanks |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
Glad to hear that it satisfies the requirement. |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Or..
Code: |
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=INIT,
FINDREP=(IN=C'||',OUT=C'|SPACES|',OVERRUN=TRUNC)),
IFTHEN=(WHEN=INIT,
FINDREP=(IN=C'||',OUT=C'|SPACES|',OVERRUN=TRUNC))
/*
|
|
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
sorry, on vacation this week and do not have access to mainframe.
question:
if it requires 2 IFTHEN's ....for 10||20|||||20
would you need additional for 10||20||||||20 |
|
Back to top |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
|
|
|
|
Quote: |
question:
if it requires 2 IFTHEN's ....for 10||20|||||20
would you need additional for 10||20||||||20
|
Would INREC IFTHEN= with HIT=NEXT address this?
Garry. |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
Hello,
Quote: |
would you need additional for 10||20||||||20 |
Code: |
INREC FINDREP=(IN=C'||',OUT=C'|SPACES|')
OUTREC FINDREP=(IN=C'||',OUT=C'|SPACES|')
&
INREC IFTHEN=(WHEN=INIT,
FINDREP=(IN=C'||',OUT=C'|SPACES|',OVERRUN=TRUNC)),
IFTHEN=(WHEN=INIT,
FINDREP=(IN=C'||',OUT=C'|SPACES|',OVERRUN=TRUNC)) |
Both work fine for any number of ||'s
DFSORT should be called more as DFSMART |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
thx Vasanth. |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Quote: |
Would INREC IFTHEN= with HIT=NEXT address this?
|
Garry .... HIT=NEXT is not required for WHEN=INIT clause ... |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
HIT=NEXT is not required for WHEN=INIT clause |
Right. HIT=NEXT is used for WHEN=INIT and WHEN=GROUP automatically (that is, the clause is always processed). WHEN=INIT and WHEN=GROUP clauses must precede any other clauses.
Quote: |
DFSORT should be called more as DFSMART |
What a nice thing to say. |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
Quote: |
Gerry .... HIT=NEXT is not required for WHEN=INIT clause ...
|
This reminds me of home, the wife blames me for things I haven't even uttered.
Gerry |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Ah, Garry, not Gerry ... corrected. |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
gcicchet wrote: |
Hi,
Quote: |
Gerry .... HIT=NEXT is not required for WHEN=INIT clause ...
|
This reminds me of home, the wife blames me for things I haven't even uttered.
Gerry |
My apologies Gerry.. |
|
Back to top |
|
|
|