Page 1 of 1

Sort file issue

PostPosted: Wed Jun 24, 2015 9:00 pm
by kavitasahu
Hi Team,
Could you please help me to create a sort JCL for the below requirement. I am using 1.12 level of SORT.

I have a file of fixed record length 280. My file structure is like below

1. Emp Number starts from column 8 of length 5.
2. Name start from column 13 of length 30.


As per the design file should contain A - Z, 0 - 9, /, -, ^, & only in the name field
Other then those characters are considered as invalid for downstream processing.

INPUT FILE:-
----+----1----+----2----+----3----+----4----+-
***************************** Top of Data ****
00002015-06-25                               
    00012322MRS NEHA PATIL2                   
    00045633MRS VIJETA PATOLE                 
    00078944MR KIRAN/PATIL1                   
    00011155MR PARESH-THOMBARE               
    00022266MR PRAVEEN@DAWAN                 
    00025677MR SUBHAS*YADAV2                 
99990000000006                               
**************************** Bottom of Data **


So I want to create 2 files:-

1. First file should contain only those records having characters other then listed above (A - Z, 0 - 9, /, -, ^, &).

E.g. It should contain 2 employee record as there are characters * and @ in their name.

OUTPUT FILE1:-

----+----1----+----2----+----3----+----4----+-
***************************** Top of Data ****
    00022266MR PRAVEEN@DAWAN 
    00025677MR SUBHAS*YADAV2       
**************************** Bottom of Data **


OUTPUT FILE2:-

2. Second file should contain all the records from the input file and it should replace all other characters (other then valid one mentioned above)
with spaces.

E.g. In the file for employee 22266 names should be changed from PRAVEEN@DAWAN to PRAVEEN DAWAN and for employee 25677 name should be changed from SUBHAS*YADAV2 to SUBHAS YADAV2

----+----1----+----2----+----3----+----4----+-
***************************** Top of Data ****
00002015-06-25                               
    00012322MRS NEHA PATIL2                   
    00045633MRS VIJETA PATOLE                 
    00078944MR KIRAN/PATIL1                   
    00011155MR PARESH-THOMBARE               
    00022266MR PRAVEEN DAWAN                 
    00025677MR SUBHAS YADAV2                 
99990000000006                               
**************************** Bottom of Data **

Re: Sort file issue

PostPosted: Wed Jun 24, 2015 9:05 pm
by NicC
Do you want the JCL required to execute a sort in batch (clearly described in the manual) or do you want the sort control cards?
What have you tried so far?

Re: Sort file issue

PostPosted: Thu Jun 25, 2015 1:02 pm
by kavitasahu
Hi Nic,
I am looking for sort control cards. I tried using SS but not getting desired output. Could you please help me to resolve the issue.

Re: Sort file issue

PostPosted: Thu Jun 25, 2015 3:09 pm
by NicC
Ok, so show us what you tried and what the result was and why it 'did not work'

Re: Sort file issue

PostPosted: Thu Jun 25, 2015 4:24 pm
by Magesh23586
Here is the code for you; you may need to add some more characters. For sample i have considered following as invalid character
~`!@#$%*()_+={[}]|\:;"'<,>.?
A757756545647CBDB4E757746646
19ACBBCCDDDEE0A0BF0AEFDCBEBF


//SORT010    EXEC PGM=SORT             
//SYSNAMES DD *                         
//SORTIN  DD *                         
00002015-06-25                         
    00012322MRS NEHA PATIL2             
    00045633MRS VIJETA PATOLE           
    00078944MR KIRAN/PATIL1             
    00011155MR PARESH-THOMBARE         
    00022266MR PRAVEEN@DAWAN           
    00025677MR SUBHAS*YADAV2           
99990000000006                         
//SORTOUT DD SYSOUT=*                   
//SYSOUT DD SYSOUT=*                   
//OUT1 DD SYSOUT=*                     
//SYSIN DD *                           
  OPTION COPY                           
  OUTFIL INCLUDE=(13,30,SS,EQ,X'A1',OR,
                 13,30,SS,EQ,X'79',OR, 
                 13,30,SS,EQ,X'7C',OR,   
                 13,30,SS,EQ,X'7B',OR,   
                 13,30,SS,EQ,X'5B',OR,   
                 13,30,SS,EQ,X'6C',OR,   
                 13,30,SS,EQ,X'4D',OR,   
                 13,30,SS,EQ,X'5D',OR,   
                 13,30,SS,EQ,X'6D',OR,   
                 13,30,SS,EQ,X'4E',OR,   
                 13,30,SS,EQ,X'7E',OR,   
                 13,30,SS,EQ,X'C0',OR,   
                 13,30,SS,EQ,X'BA',OR,   
                 13,30,SS,EQ,X'D0',OR,   
                 13,30,SS,EQ,X'BB',OR,   
                 13,30,SS,EQ,X'4F',OR,   
                 13,30,SS,EQ,X'E0',OR,   
                 13,30,SS,EQ,X'7A',OR,   
                 13,30,SS,EQ,X'5E',OR,   
                 13,30,SS,EQ,X'7F',OR,   
                 13,30,SS,EQ,X'7D',OR,   
                 13,30,SS,EQ,X'4C',OR,                                 
                 13,30,SS,EQ,X'6B',OR,                                 
                 13,30,SS,EQ,X'6E',OR,                                 
                 13,30,SS,EQ,X'4B',OR,                                 
                 13,30,SS,EQ,X'6F',OR,                                 
                 13,30,SS,EQ,X'5C')                                   
  OUTFIL FNAMES=OUT1,                                                 
         FINDREP=(IN=(X'A1',X'79',X'7C',X'7B',X'5B',X'6C',X'4D',X'5D',
                      X'6D',X'4E',X'7E',X'C0',X'BA',X'D0',X'BB',X'4F',
                      X'E0',X'7A',X'5E',X'7F',X'7D',X'4C',X'6B',X'6E',
                      X'4B',X'6F',X'5C'),OUT=C' ')                     
/*                                                                     


Thanks
Magesh

Re: Sort file issue

PostPosted: Sun Jun 28, 2015 11:22 am
by kavitasahu
I am able to to generate the output file1 using below JCL, but unable to create the output file2. As I am aware about the list of only valid character(as per design rqmt) other then those characters everything should be considered as invalid and should be replaced with spaces. Hence if anyone can help me to create JCL for output file2.

SORT FIELDS=COPY                                               
INREC IFTHEN=(WHEN=INIT,OVERLAY=(281:13,30)),                 
IFTHEN=(WHEN=INIT,FINDREP=(STARTPOS=281,OUT=C'',               
        IN=(C'A',C'B',C'C',C'D',C'E',C'F',C'G',C'H',C'I',     
            C'J',C'K',C'L',C'M',C'N',C'O',C'P',C'Q',C'R',     
            C'S',C'T',C'U',C'V',C'W',C'X',C'Y',C'Z',C'0',     
            C'1',C'2',C'3',C'4',C'5',C'6',C'7',C'8',C'9',     
            C'&',C'-',C'/',C'^')))                             
OUTFIL BUILD=(1,243),INCLUDE=(281,1,CH,NE,C' ')               

Re: Sort file issue

PostPosted: Thu Jul 02, 2015 3:22 pm
by kavitasahu
Thanks Magesh for your help. Its working as per my requirment.