Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Masking one field in a file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Masking one field in a file
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

Moderator


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

PostPosted: Fri Sep 13, 2013 5:35 pm    Post subject:
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    Post subject: Reply to: Masinking Data
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    Post subject: Reply to: Masinking Data
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10288
Location: italy

PostPosted: Fri Sep 13, 2013 6:09 pm    Post subject: Reply to: Masinking Data
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Fri Sep 13, 2013 6:47 pm    Post subject: Reply to: Masinking Data
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Multiple VSAM files single output fil... Mohan Kothakota DFSORT/ICETOOL 11 Wed Aug 09, 2017 7:57 pm
This topic is locked: you cannot edit posts or make replies. rexx code to create a ps file Bharath Vikraman CLIST & REXX 4 Mon Aug 07, 2017 10:30 am
No new posts Split file based on comparsion to 2 f... Div Grad DFSORT/ICETOOL 3 Thu Jul 27, 2017 9:16 pm
No new posts Extra character appears in file when ... Balu5491 All Other Mainframe Topics 1 Wed Jul 26, 2017 2:39 pm
No new posts SSH - known_hosts file configuration vasanthz All Other Mainframe Topics 2 Wed Jul 26, 2017 2:10 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us