IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Masking one field in a file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
suzeet

New User


Joined: 16 May 2005
Posts: 54

PostPosted: Fri Sep 13, 2013 1:50 pm
Reply with quote

Hi
I want to mask one field in a file as the example below

Code:

00000123456789
00012345678902
01234567891234

It will show up first 4 digits after 0 and last 4 digit as below
Code:

000001234*6789
0001234***8902
01234*****1234


The file is a fixed length of 80 and the field starts from column 1. The length of the field is 16.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Fri Sep 13, 2013 5:35 pm
Reply with quote

What would be the expected output when you have input like

Code:
00000012345678
01234012345678
Back to top
View user's profile Send private message
suzeet

New User


Joined: 16 May 2005
Posts: 54

PostPosted: Fri Sep 13, 2013 5:46 pm
Reply with quote

The Expected output would be
Code:

00000012345678
01234*****5678
Back to top
View user's profile Send private message
bodatrinadh

Active User


Joined: 05 Jan 2007
Posts: 101
Location: chennai (India)

PostPosted: Fri Sep 13, 2013 5:52 pm
Reply with quote

Hi Suzeet,

Check this code -

Code:

//STEP01   EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
00000123456789
00001234567890
00012345678902
00123456789021
01234567891234
1234567890XZCX
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *     
  INREC IFTHEN=(WHEN=(1,4,CH,EQ,C'1234'),OVERLAY=(5:C'*****')),
        IFTHEN=(WHEN=(2,4,CH,EQ,C'1234'),OVERLAY=(6:C'****')),
        IFTHEN=(WHEN=(3,4,CH,EQ,C'1234'),OVERLAY=(7:C'***')),
        IFTHEN=(WHEN=(4,4,CH,EQ,C'1234'),OVERLAY=(8:C'**')),
        IFTHEN=(WHEN=(5,4,CH,EQ,C'1234'),OVERLAY=(9:C'*'))
  SORT FIELDS=COPY


Output :-

Code:

00000123456789 
00001234*67890 
0001234**78902 
001234***89021 
01234****91234 
1234*****0XZCX 


Thanks
-3nadh
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Sep 13, 2013 6:09 pm
Reply with quote

the 123456789... are just place holders,

the trigger is/are the leading zeroe(s)

probably something along the lines of ...

Code:
//SYSIN    DD *     
  INREC IFTHEN=(WHEN=(1,5,CH,EQ,C'00000'),OVERLAY=(10:C'*')),
        IFTHEN=(WHEN=(1,4,CH,EQ,C'0000'),OVERLAY=(9:C'**')),
        IFTHEN=(WHEN=(1,3,CH,EQ,C'000'),OVERLAY=(8:C'***')),
        IFTHEN=(WHEN=(1,2,CH,EQ,C'00'),OVERLAY=(7:C'****')),
        IFTHEN=(WHEN=(1,1,CH,EQ,C'0'),OVERLAY=(6:C'*****'))
  SORT FIELDS=COPY


might fit better the requirement

warning, NOT TESTED, seems reasonable anyway
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Sep 13, 2013 6:47 pm
Reply with quote

I'd put

Code:
        IFTHEN=(WHEN=(1,6,CH,EQ,C'000000'),OVERLAY=(1:1,1)),


first, as a "just in case". No data will change (the data at position 1 will be placed at position 1) but all the other IFTHENs will be avoided.

Otherwise, for the short field, it looks fine to me. Of course, we may expect TS to come back admitting the it is 24 bytes long :-)
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top