Replace a pattern in a record in dynamic position.



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

Replace a pattern in a record in dynamic position.

Postby DebaMF » Thu Nov 13, 2014 9:50 pm

I have a file with multiple records where a specific phrase/pattern need to find out replace with another set of specific text. Position of specific phrase/pattern in a record is not fixed. The file length is 50 bytes.

Input File:

MAINAK INCOME ANNUL AT RS 1000
JOHN INCOME MONTH AT RS 1340
MAXICANA INCOME DAILY AT RS 1568


The specific phrase/pattern is 'INCOME %%%%% AT RS', where '%%%%%' is variable but it will be always 5 bytes. Need to replace 'INCOME %%%%% AT RS' with 'INCOME DETAILS'.
In another way, wherever 'AT RS' is found, need to replace: the minus 6 bytes of 'AT RS' plus 'AT RS' with 'DETAILS'.

Output File:

MAINAK INCOME DETAILS 1000
JOHN INCOME DETAILS 1340
MAXICANA INCOME DETAILS 1568



It will be great help if anyone can please help me to build the SORT card (SYNCSORT) to achive this.

coded
DebaMF
 
Posts: 2
Joined: Thu Nov 13, 2014 9:28 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Replace a pattern in a record in dynamic position.

 

Re: Replace a pattern in a record in dynamic position.

Postby DebaMF » Fri Nov 14, 2014 11:31 am

Sorry, its my mistake. It should be 'ANNUL'

Corrected in original
DebaMF
 
Posts: 2
Joined: Thu Nov 13, 2014 9:28 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Replace a pattern in a record in dynamic position.

Postby BillyBoyo » Fri Nov 14, 2014 6:09 pm

PARSE. You need one PARSE field which finishes before "balnkINCOMEblank", with a fixed length of the logical maximum of that data. Second PARSE field just gets the next 18 bytes, then third gets the maximum logical length of that data.

The second PARSE field I'd check to see it has "blankATblankRSblank" if there is any possibility that the search string could appear in the data.

Then you put together the output you want, first PARSE field, litera, third PARSE field and SQZ the result. If you need multiple consecutive blanks in your output, you'll have a little more work as well.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post