Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

FIND and REPLACE

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
gayathrinag

New User


Joined: 16 Oct 2008
Posts: 37
Location: chennai

PostPosted: Wed May 18, 2011 12:23 pm    Post subject: FIND and REPLACE
Reply with quote

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
View user's profile Send private message

vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1445
Location: Azeroth

PostPosted: Wed May 18, 2011 12:36 pm    Post subject:
Reply with quote

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
View user's profile Send private message
gayathrinag

New User


Joined: 16 Oct 2008
Posts: 37
Location: chennai

PostPosted: Wed May 18, 2011 12:38 pm    Post subject:
Reply with quote

Hey Vasanth,

That worked fine.

Thanks icon_smile.gif
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1445
Location: Azeroth

PostPosted: Wed May 18, 2011 12:49 pm    Post subject:
Reply with quote

Glad to hear that it satisfies the requirement. icon_smile.gif
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed May 18, 2011 4:36 pm    Post subject:
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu May 19, 2011 1:36 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 988
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Thu May 19, 2011 1:46 pm    Post subject:
Reply with quote

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
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1445
Location: Azeroth

PostPosted: Thu May 19, 2011 1:57 pm    Post subject:
Reply with quote

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 icon_biggrin.gif
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu May 19, 2011 2:34 pm    Post subject:
Reply with quote

thx Vasanth.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu May 19, 2011 3:44 pm    Post subject:
Reply with quote

Quote:
Would INREC IFTHEN= with HIT=NEXT address this?


Garry .... HIT=NEXT is not required for WHEN=INIT clause ... icon_smile.gif
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu May 19, 2011 10:30 pm    Post subject:
Reply with quote

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. icon_smile.gif icon_cool.gif
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Fri May 20, 2011 4:30 am    Post subject:
Reply with quote

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. icon_lol.gif


Gerry
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri May 20, 2011 4:35 am    Post subject:
Reply with quote

Ah, Garry, not Gerry ... corrected.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri May 20, 2011 3:20 pm    Post subject:
Reply with quote

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. icon_lol.gif


Gerry

My apologies Gerry..
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to find the first monday of the w... abdulrafi COBOL Programming 10 Fri Nov 25, 2016 3:24 pm
No new posts Replace repeated JCL with looping REXX prino CLIST & REXX 3 Thu Oct 13, 2016 5:30 am
No new posts Find out a active PGM jpsager JCL & VSAM 10 Fri Oct 07, 2016 4:32 pm
No new posts How to find a CICS resource used in C... Arunkumar Chandrasekaran CICS 8 Thu Sep 29, 2016 1:45 pm
This topic is locked: you cannot edit posts or make replies. Sort card to replace text using cross... Susanta SYNCSORT 32 Tue Sep 13, 2016 4:17 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us