View previous topic :: View next topic
|
Author |
Message |
juares castro
New User
Joined: 04 May 2012 Posts: 34 Location: Brazil
|
|
|
|
Hi everyone!
I have 2 questions about Find and Replace commands in Syncsort:
1. what is the Syncsort version that supports FINDREP command?
2. Could we replace a value/string with a specified column in a record? I mean, in INOUT parameter we could use like this:
... FINDREP=(INOUT=(C'AB',25,2)) <= I know you know "25,2" is the position in record
Thanks in advance. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
To Overlay a particular position you could just use OVERLAY with INREC |
|
Back to top |
|
|
juares castro
New User
Joined: 04 May 2012 Posts: 34 Location: Brazil
|
|
|
|
Hi Pandora!
My question is about not knowing where the string is. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
I am sorry , Can you explain with an example? |
|
Back to top |
|
|
Abid Hasan
New User
Joined: 25 Mar 2013 Posts: 88 Location: India
|
|
|
|
Hello Juares,
For the first query, see if this link is of any help.
From the DFSORT manual, I donot see the positional replace functionality in FINDREP. I donot have SYNCSORT to confirm on this.
Though what you're trying to achieve can be done using PARSE/BUILD, as BUILD allows the user to play around with the data. Bit of code might be required to identify all the 'AB' combinations though. |
|
Back to top |
|
|
juares castro
New User
Joined: 04 May 2012 Posts: 34 Location: Brazil
|
|
|
|
Hi Pandora!
I am trying do this:
Code: |
//STEP10 EXEC PGM=SYNCSORT,REGION=7M
//SORTIN DD *
123AA999912BB
AA123888813CC
BB123456714DD
1AA23888813FF
//SORTOUT DD ...
//SYSIN DD *
SORT FIELDS=COPY
OUTREC IFTHEN=(WHEN=INIT,
FINDREP=(INOUT=(C'AA',12,2)))
//SYSOUT DD SYSOUT=*
//*
//
GIVING THIS:
123BB999912BB
CC123888813CC
BB123456714DD
1FF23888813FF |
Wherever we have "AA" change to content of position 12 with 2 bytes. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Why on earth would you think that sufficiently common a requirement to have FINDREP support it?
Is your sample data representative? You're not going to turn around later and say "of course it can contain embedded blanks"? |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3076 Location: NYC,USA
|
|
|
|
See if you can twick this solution to fit your need.
Very much theoretical but try finding the offset of 'AA' using the shared link and then make a BUILD and replace the found offset with 12,2 |
|
Back to top |
|
|
juares castro
New User
Joined: 04 May 2012 Posts: 34 Location: Brazil
|
|
|
|
Thanks Rohit! |
|
Back to top |
|
|
juares castro
New User
Joined: 04 May 2012 Posts: 34 Location: Brazil
|
|
|
|
Thanks Abid! |
|
Back to top |
|
|
|