Add a string depending on pattern



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

Add a string depending on pattern

Postby Prasanna G » Mon Jul 05, 2021 8:48 am

Hi

I have a file with RECFM=FB, LRECL=26. The sample records are below.


ACCWTBT-DBACC001-X2ACCXRH-
ACCWTBT-DBACC001-X3ACCCRE-
ACCWTBT-DBACC001-X3ACCCRF-
ACCWTBT-DBACC001-X4ACCCRF-
ADPWTBT-DBADP001-TSADPCIP-
ADPWTBT-DBADP001-TSADPPNA-
ADPWTBT-DBADP001-X1ADPPNA-
AECWTBT-DBAECPRD-TSAECACB-
AECWTBT-DBAECPRD-TSAECCDC-
AECWTBT-DBAECPRD-TSAECCDS-
AECWTBT-DBAECPRD-TSAECCRF-
 


I have to look at the first seven bytes of the input file and then add a string at the end of the record after 26 bytes. In this example, lets say I need to add RWACC001 for the first 4 records as they have ACCWTBT as the first 7 bytes. Then the first 7 bytes changes to ADPWTBT. Hence the value at 27 position from 5th record has to be added as RWADP001 till 7th record. After that the value to be added is RWACE001. Can someone help me with a sort card for the same?

Expected output

ACCWTBT-DBACC001-X2ACCXRH-RWACC001
ACCWTBT-DBACC001-X3ACCCRE-RWACC001
ACCWTBT-DBACC001-X3ACCCRF-RWACC001
ACCWTBT-DBACC001-X4ACCCRF-RWACC001
ADPWTBT-DBADP001-TSADPCIP-RWADP001
ADPWTBT-DBADP001-TSADPPNA-RWADP001
ADPWTBT-DBADP001-X1ADPPNA-RWADP001
AECWTBT-DBAECPRD-TSAECACB-RWAEC001
AECWTBT-DBAECPRD-TSAECCDC-RWAEC001
AECWTBT-DBAECPRD-TSAECCDS-RWAEC001
AECWTBT-DBAECPRD-TSAECCRF-RWAEC001
 


Thanks
Prasanna G.
User avatar
Prasanna G
 
Posts: 65
Joined: Tue Apr 12, 2011 9:49 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Add a string depending on pattern

Postby Prasanna G » Mon Jul 05, 2021 11:07 am

Please ignore the post
User avatar
Prasanna G
 
Posts: 65
Joined: Tue Apr 12, 2011 9:49 pm
Has thanked: 1 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post