I have a requirement where in the flat file one of the records is having junk character.
My file structure is like below
1. Customer Number start from column 10 of length 10.
2. Customer Name start from column 20 of length 30.
----+----1----+----2----+----3----+----4----+----5----+----6----+----7
00002872641774MR AADESH SHRIVAS
00002713415786MR AJAY KHAN
00002813516868MR SAMáS ó MIRZA
00002136168774MR VIJAY SHAH
00002872641774MR AADESH SHRIVAS
00002713415786MR AJAY KHAN
00002813516868MR SAMáS ó MIRZA
00002136168774MR VIJAY SHAH
Problem area here is the Customer name field which is creating problem to the downstream system. As it can be seen that there is junk character in the
Field. So I want to create 2 file here:-
1. First file will have all records excluding problematic record. So it can be passed to downstream system for further processing. So it should contain
below data only:-
----+----1----+----2----+----3----+----4----+----5----+----6----+----7
00002872641774MR AADESH SHRIVAS
00002713415786MR AJAY KHAN
00002136168774MR VIJAY SHAH
00002872641774MR AADESH SHRIVAS
00002713415786MR AJAY KHAN
00002136168774MR VIJAY SHAH
2. Second file will have customer number only (which start from column 10 of length 10) which is having invalid character, so I can pass that
customer number back to business informing about the problem. So it should contain below data only:-
----+----1----+----2----+----3----+----4----+----5----+----6----+----7
2813516868
2813516868
Using below SORT JCL I am able to overlay those junk value with spaces, but that is not my requirement.
OPTION COPY
ALTSEQ CODE=(6B40,7F40,7DF0)
INREC IFTHEN=(WHEN=INIT,OVERLAY=(20:20,30,TRAN=ALTSEQ))
ALTSEQ CODE=(6B40,7F40,7DF0)
INREC IFTHEN=(WHEN=INIT,OVERLAY=(20:20,30,TRAN=ALTSEQ))
I hope my requirement is clear. Please help me to create SORT jcl for my above requirement and let me know if any other details are required.