How to find string in string and place other position



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

How to find string in string and place other position

Postby pgkkreddy1 » Wed May 13, 2015 9:36 pm

Good evening!
I have field in file position 311 to 350.Field text may be wrong number(connection mode) or left voice(connection mode) or conversation with customer(connection mode) or
left message(connection mode)

i want to find the string (connection code) - with brackets in position 311 to 350 and place string in position 511 to 560.

I used below syntax but not working.

Sort fields=copy
inrec findrep=(in=c'(connection mode)',startpos=301,endpos=350,out=c'connection mode',startpos=511,endpos560)

Please help me out regarding this


Regards,
kk
pgkkreddy1
 
Posts: 24
Joined: Wed May 13, 2015 8:08 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to find string in string and place other position

Postby BillyBoyo » Wed May 13, 2015 11:21 pm

You need to paste the code from your emulator, otherwise we just chase your typos.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: How to find string in string and place other position

Postby Terry Heinze » Wed May 13, 2015 11:31 pm

And please use Code tags when pasting to preserve proper spacing. Use PostReply for Code tag usage.
.... Terry
Terry Heinze
 
Posts: 239
Joined: Wed Dec 04, 2013 11:08 pm
Location: Richfield, MN, USA
Has thanked: 12 times
Been thanked: 11 times

Re: How to find string in string and place other position

Postby NicC » Thu May 14, 2015 5:58 am

Not a JCL question but a sort question. I assume a DFSort question so moved to that part of the forum. If it is not DFSort please specify which sort prouct you are using.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: How to find string in string and place other position

Postby pgkkreddy1 » Thu May 14, 2015 10:13 am

Sorry to post in JCL.it is sort.
and sorry for the typos.Here is the syntax i used.

 //SYSIN    DD *                                                       
   SORT FIELDS=COPY                                                     
   OUTREC FINDREP=(IN=(C'(CONNECTION MADE)'),STARTPOS=301,ENDPOS=350,   
      (OUT=C'CONNECTION MODE'),STARTPOS=510,ENDPOS=560)                 
                                                                       
 //*   


i want to find the string in the string in the position 301 to 350 and place in the position 510 to 560.

String may be like this
 Conversation with Customer (connection made)
   Customer or Associate Hang Up (connection made)
   Left Message w/ Another Person (connection made)
   Left Voice Mail (connection made)
   Wrong Number (connection made)


Please help me out.

Code'd
pgkkreddy1
 
Posts: 24
Joined: Wed May 13, 2015 8:08 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to find string in string and place other position

Postby BillyBoyo » Thu May 14, 2015 12:16 pm

FINDREP changes in place. You can't make it do something different by extending the syntax yourself.

It is not clear exactly what you want to do. With a field-type of SS you can code an IF statement to know that your sub-string exists and then use a BUILD statement to generate a new record.

If that doesn't get it for you, you'll have to post a better explanation, including some sample input data and expected output.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: How to find string in string and place other position

Postby pgkkreddy1 » Thu May 14, 2015 2:06 pm

Thank you for reply.

Here is my input data. 301 postion to 350
Command ===>                                             
=COLS> ----+----1----+----2----+----3----+----4----+----5
****** ***************************** Top of Data ********
000001 Wrong Number (CONNECTION MADE)                   
000002 Conversation with Customer (connection made)     
000003 Left Message w/ Another Person (connection made) 
****** **************************** Bottom of Data ******


i want to find the (connection mode) in the position 301 to 350 and place in the position 510 to 560 position.

out put should be place in 510 to 560
Command ===>                                                  Scroll ===> CSR
=COLS> -5----+----6----+----7----+----8----+----9----+----0----+----1----+----2
****** ***************************** Top of Data ******************************
000001   2015-05-20704-555-5555          connection mode             
000002   2015-05-20704-555-5555          connection mode             
000003   2015-05-20704-555-5555          connection mode             
****** **************************** Bottom of Data ****************************


Please let me know if any more info required.

Regards,
kk

Coded - again
pgkkreddy1
 
Posts: 24
Joined: Wed May 13, 2015 8:08 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to find string in string and place other position

Postby pgkkreddy1 » Thu May 14, 2015 2:43 pm

Thanks very much.it is working fine.i ussd SS and build.
pgkkreddy1
 
Posts: 24
Joined: Wed May 13, 2015 8:08 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to find string in string and place other position

Postby NicC » Thu May 14, 2015 3:08 pm

Good to know that you have arrived at the solution but...please use the code tags when posting code, data, jcl and anything else that you find on your screen. Search the forum to find out how.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: How to find string in string and place other position

Postby pgkkreddy1 » Thu May 14, 2015 3:54 pm

Sure Nic.Thanks once again.
pgkkreddy1
 
Posts: 24
Joined: Wed May 13, 2015 8:08 pm
Has thanked: 0 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post