Assistance on Masking



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

Assistance on Masking

Postby samurai007 » Fri May 07, 2010 7:38 pm

Hi,

I am in a situation where i need to mask some data.

Say, input data is like
000001 ABCDEF____NEW______DAY
000002 GHIJ______DEVELOPT__NIGHT
000003 KLMNO____OLD_______EVENING
000004 PQRSTUVW_MEDIUM___MORNING
000005 XYZ_______SAFE______AFTERNOON

Output required is like
000001 AXXXXX____NYY_______DTT
000002 GXXX______DYYYYYYY__NTTTT
000003 KXXXX_____OYY_______ETTTTTT
000004 PXXXXXXX__MYYYYY____MTTTTTT
000005 XXX_______SYYY______ATTTTTTTT

[I have added dashes here to get the correct alignment of data. The file is FB and LRECL is 30. There are 3 fields of length 10 each in the file. The numbers at the beginning are only line numbers].


That is, other than the first letter of each field, all the other characters need to be changed to a pre-decided character, here 'X', 'Y' and 'T'. I tried using ALTSEQ and succeeded. However, the trouble is am able to use just one ALTSEQ. Is there any way i can use multiple ALTSEQ, one to replace each field ?? Or what is the other way of doing this ??

I would be glad if you can assist me on this.

Thanks,
Sam.
samurai007
 
Posts: 22
Joined: Mon Jul 20, 2009 10:42 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Assistance on Masking

 

Re: Assistance on Masking

Postby CICS Guy » Fri May 07, 2010 8:01 pm

samurai007 wrote:I have added dashes here to get the correct alignment of data.
More work than it's worth, and it's still sloppy...
Say, input data is like
000001 ABCDEF____NEW______DAY
000002 GHIJ______DEVELOPT__NIGHT
000003 KLMNO____OLD_______EVENING
000004 PQRSTUVW_MEDIUM___MORNING
000005 XYZ_______SAFE______AFTERNOON

Output required is like
000001 AXXXXX____NYY_______DTT
000002 GXXX______DYYYYYYY__NTTTT
000003 KXXXX_____OYY_______ETTTTTT
000004 PXXXXXXX__MYYYYY____MTTTTTT
000005 XXX_______SYYY______ATTTTTTTT
Why didn't you just wrap 'code' around it and save yourself the time?
Say, input data is like
000001 ABCDEF    NEW      DAY     
000002 GHIJ      DEVELOPT NIGHT   
000003 KLMNO     OLD      EVENING 
000004 PQRSTUVW  MEDIUM   MORNING 
000005 XYZ       SAFE     AFTERNOON

Output required is like
000001 AXXXXX    NYY      DTT     
000002 GXXX      DYYYYYYY NTTTT   
000003 KXXXX     OYY      ETTTTTT 
000004 PXXXXXXX  MYYYYY   MTTTTTT 
000005 XXX       SYYY     ATTTTTTTT
CICS Guy
 
Posts: 255
Joined: Wed Jun 20, 2007 4:08 am
Has thanked: 0 time
Been thanked: 0 time

Re: Assistance on Masking

Postby Frank Yaeger » Fri May 07, 2010 10:21 pm

Sam,

Which characters are you trying to replace? Is it any non-blank, or just A-Z, or something else?
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times

Re: Assistance on Masking

Postby samurai007 » Mon May 10, 2010 11:04 am

@ CICS Guy
Why didn't you just wrap 'code' around it and save yourself the time?


I didnt know this. Will use it going forward. Thanks.
But this was not the problem to which i needed a solution.

@ Frank
Which characters are you trying to replace? Is it any non-blank, or just A-Z, or something else?


For every field, we have a character between [A-Z] assigned to it.
Suppose a field, NAME, has the value as 'FRANK' and if the character assigned to it is 'S', i would like the field to appear as 'FSSSS' in my output file.
Suppose a field, COUNTRY, has the value as 'AMERICA' and if the character assigned to it is 'M', i would like the field to appear as 'AMMMMMM' in my output file.

In essence, other than the first letter of each field, all the other non-blank letters in the field have to be replaced with the pre-defined character. This pre-defined character varies from field to field, say, for NAME it is 'S', for COUNTRY it is 'M' and so on.
Now if you can compare this with the data I gave you initially, i believe you would get a fair idea of how each field would appear at the output.

Using an OVERLAY in the OUTREC replaces ALL the letters in the field, including blanks, with the pre-defined character. I would like the blanks to remain unchanged.
Using ALTSEQ allows me to replace the contents of the entire file with only one character. I would want to replace each field with its corresponding pre-defined character.


Let me know if this is sufficient explanation.

Thanks,
Sam.
samurai007
 
Posts: 22
Joined: Mon Jul 20, 2009 10:42 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Assistance on Masking

Postby Frank Yaeger » Mon May 10, 2010 11:32 pm

You can use a DFSORT job like the following to do what you asked for:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD *
XA,'A'
XB,'B'
XC,'C'
XD,'D'
XE,'E'
XF,'F'
XG,'G'
XH,'H'
XI,'I'
XJ,'J'
XK,'K'
XL,'L'
XM,'M'
XN,'N'
XO,'O'
XP,'P'
XQ,'Q'
XR,'R'
XS,'S'
XT,'T'
XU,'U'
XV,'V'
XW,'W'
XX,'X'
XY,'Y'
XZ,'Z'
//SORTIN DD DSN=...  input file (FB/30)
//SORTOUT DD DSN=...  output file (FB/30)
//SYSIN DD *
  OPTION COPY
  INREC IFTHEN=(WHEN=INIT,
    FINDREP=(STARTPOS=2,ENDPOS=10,OUT=C'X',
     IN=(XA,XB,XC,XD,XE,XF,XG,XH,XI,XJ,XK,XL,XM,XN,XO,XP,XQ,
         XR,XS,XT,XU,XV,XW,XX,XY,XZ))),
  IFTHEN=(WHEN=INIT,
    FINDREP=(STARTPOS=12,ENDPOS=20,OUT=C'Y',
     IN=(XA,XB,XC,XD,XE,XF,XG,XH,XI,XJ,XK,XL,XM,XN,XO,XP,XQ,
         XR,XS,XT,XU,XV,XW,XX,XY,XZ))),
  IFTHEN=(WHEN=INIT,
    FINDREP=(STARTPOS=22,ENDPOS=30,OUT=C'T',
     IN=(XA,XB,XC,XD,XE,XF,XG,XH,XI,XJ,XK,XL,XM,XN,XO,XP,XQ,
         XR,XS,XT,XU,XV,XW,XX,XY,XZ)))
/*
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post