Page 1 of 1

Masking by Overlay

PostPosted: Tue Sep 18, 2012 5:03 pm
by vkumarg3
Hi all,

I have ip PS file with few sample records.

My task is to sort the file based on the name and scramble or mask the field.

Sort based on name i have done. But Scramble logic i dont know.Please help.

Scramble logic:

Every second byte of the name field is to be replaced with 'X'.

Example :

In input file name field is ABCDEFG means, scrambled file should be AXCXEXG.



In JCL i should implement this. Should OVERLAY command to be used? Thanks in advance.

Re: Masking by Overlay

PostPosted: Tue Sep 18, 2012 5:08 pm
by BillyBoyo
OVERLAY=(2:C'X',4:C'X',6:C'X'....


Change all the columns (those numbers followed by a colon) to be the positions you want "masked" in that way.

Re: Masking by Overlay

PostPosted: Tue Sep 18, 2012 6:06 pm
by NicC
JCL does not have an OVERLAY command - sort does though.

Re: Masking by Overlay

PostPosted: Fri Sep 21, 2012 12:07 pm
by vkumarg3
@ Billy and NicC : Thanks

I faced one issue in this.

I implemented this logic on Name field X(10).

Sample records are given below:
abc
abcdefgh

So my output file came like this
aXcX X X X
aXcXeXgX X.

X replacement should stop once name ends right. So i used IFTHEN= with overlay command.

Like

IFTHEN=(WHEN=(2,1,CH,NE,C' '),
          OVERLAY=(2:C'X'),HIT=NEXT),
      IFTHEN=(WHEN=(4,1,CH,NE,C' '),
          OVERLAY=(4:C'X'),HIT=NEXT),
      IFTHEN=(WHEN=(6,1,CH,NE,C' '),
          OVERLAY=(6:C'X'),HIT=NEXT),........

But it is like hard coding. Does anyother approach there to solve this?

Code'd and column positions - values before : - corrected to reflect postions in WHEN=s.

Re: Masking by Overlay

PostPosted: Fri Sep 21, 2012 12:30 pm
by BillyBoyo
FRED SPOON
RUPERT BREAKFAST
JIM BUTTER


FXEX XPXOX X X X
RXPXRX XRXAXFXSX
JXMXBXTXEX X X X


Some examples might help.

With the "blind" OVERLAY you get the above for my sample data.

If the data were constrained to being two separate elements, then a general-purpose programming language will probably be able to fix-up the first, as the "pattern" of trailing X and space.

However, getting the X between JIM and BUTTER would not be possible directly.

The approach you have now is probably a good one, considering that DFSort is not a gp programming language...