View previous topic :: View next topic
|
Author |
Message |
suzeet
New User
Joined: 16 May 2005 Posts: 54
|
|
|
|
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 |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
What would be the expected output when you have input like
Code: |
00000012345678
01234012345678 |
|
|
Back to top |
|
|
suzeet
New User
Joined: 16 May 2005 Posts: 54
|
|
|
|
The Expected output would be
Code: |
00000012345678
01234*****5678
|
|
|
Back to top |
|
|
bodatrinadh
Active User
Joined: 05 Jan 2007 Posts: 101 Location: chennai (India)
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
|
|