Page 1 of 1

How to find string in string and place other position

PostPosted: Wed May 13, 2015 9:36 pm
by pgkkreddy1
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

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

PostPosted: Wed May 13, 2015 11:21 pm
by BillyBoyo
You need to paste the code from your emulator, otherwise we just chase your typos.

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

PostPosted: Wed May 13, 2015 11:31 pm
by Terry Heinze
And please use Code tags when pasting to preserve proper spacing. Use PostReply for Code tag usage.

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

PostPosted: Thu May 14, 2015 5:58 am
by NicC
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.

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

PostPosted: Thu May 14, 2015 10:13 am
by pgkkreddy1
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

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

PostPosted: Thu May 14, 2015 12:16 pm
by BillyBoyo
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.

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

PostPosted: Thu May 14, 2015 2:06 pm
by pgkkreddy1
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

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

PostPosted: Thu May 14, 2015 2:43 pm
by pgkkreddy1
Thanks very much.it is working fine.i ussd SS and build.

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

PostPosted: Thu May 14, 2015 3:08 pm
by NicC
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.

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

PostPosted: Thu May 14, 2015 3:54 pm
by pgkkreddy1
Sure Nic.Thanks once again.