buildop String concatenation

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
UPS
Premium Member
Premium Member
Posts: 56
Joined: Tue Oct 10, 2006 12:18 pm
Location: New Jersey

buildop String concatenation

Post by UPS »

Hi,
We have a buildop to do the following: It gets the unique 2-byte values from the string field with the same key.

Example
Input:
rec# key string (20 byte value)
1 KEY1 aa
2 KEY1 abaa
.
.
10000 KEY1 xxaaab
10001 KEY2 yy

Expected Output:
KEY1 aaabxx
KEY2 yy

Current logic in the buildop:

Code: Select all

if (KEY_IN != holdkey.c_str())
{
    if (firstrec == false)
    {
       KEY_OUT = holdkey.c_str();
       FBL_AC_NR_OUT = holdacnr.c_str();
       for (mymapit = mymap.begin(); mymapit != mymap.end(); ++mymapit)
         {
            MSG_CD_OUT = mymapit->first.c_str();
         }
       transferAndWriteRecord(0);
       mymap.clear();
    }
    else
      firstrec = false;
    
    holdkey = KEY_IN.data();
    holdacnr = FBL_AC_NR_IN.data();
}

for (int x=0; x < 20; x+=2)
{
   holdmsg = MSG_CD_IN.substring(x,2);
   if (holdmsg != "  ")
      mymap[holdmsg] ++;
}
Output that we are getting from the above buildop:
KEY1 xx
KEY2 yy

Can someone pls. tell us how to get the expected output?

Thanks
-- fbr
Post Reply