Masking some fields in a dataset using JCL

In this Mainframe Forum - You can post your queries on JCL, OS/390 JCL, MVS JCL, z/OS JCL, JES2 & JES3

Moderators: Frank Yaeger, DikDude, Moderator Group

Post Reply
schalka
Member
Posts: 2
Joined: Tue Oct 11, 2011 2:35 pm
Location: Mumbai

Masking some fields in a dataset using JCL

Post by schalka » Tue Oct 11, 2011 10:33 pm

Hi,

My requirement is to mask some fields of a dataset (FB).

I/P dataset

Code: Select all

BOHsystemdate - Header record
D010000000001Name1Name200001Address1
D010000000002Name3Name400002Address2
D010000000003Name5Name600003Address3
EOHcount - Trailer Record
O/p should be

Code: Select all

BOHsystemdate - Header record
D010000000001**********00001********
D010000000002**********00002********
D010000000003**********00003********
EOHcount-Trailer Record
As above in the example, some fields should be masked with*.

Can anyone help me on this.

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Tue Oct 11, 2011 10:40 pm

you will need to provide
record length for input and output file
how to identify which records are to have fields masked
position within identified records that are to be masked and rules for determining
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Tue Oct 11, 2011 10:55 pm

Schalka,

You can use a DFSORT job like the following:

Code: Select all

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
BOHsystemdate - Header record
D010000000001Name1Name200001Address1
D010000000002Name3Name400002Address2
D010000000003Name5Name600003Address3
EOHcount - Trailer Record
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  OPTION COPY
  INREC IFTHEN=(WHEN=(1,1,CH,EQ,C'D'),
    OVERLAY=(14:10C'*',29:8C'*'))
/*
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

schalka
Member
Posts: 2
Joined: Tue Oct 11, 2011 2:35 pm
Location: Mumbai

Post by schalka » Tue Oct 18, 2011 2:55 pm

Thanks a lot Frank. Your solution is working for me.
I was doing it in 3 SORT steps, splitting Header/Trailer and details records in 2 files in first step then Masking in second step and finally Merging, and was looking for a single step solution.

Thanks !! :)

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others