MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
Shankarganesh_gopal Beginner Joined: 24 May 2005 Posts: 36 Topics: 20 Location: chennai
Posted: Wed Oct 11, 2006 12:19 am Post subject: Spliting the Record into 3
Hi all,
I have a requirement.
Assume the below mentioned is my Input file content.
01 XXXXXXX1 YYYYYYYYYYY 2 20061110101010
01 XXXXXXX1 YYYYYYYYYYY 2 20061110101011
01 XXXXXXX1 YYYYYYYYYYY 2 20061110101012
02 XXXXXXX2 YYYYYYYYYYY 2 20061110101013
02 XXXXXXX2 YYYYYYYYYYY 2 20061110101014
02 XXXXXXX2 YYYYYYYYYYY 2 20061110101015
03 XXXXXXX3 YYYYYYYYYYY 2 20061110101016
03 XXXXXXX3 YYYYYYYYYYY 2 20061110101017
03 XXXXXXX3 YYYYYYYYYYY 2 20061110101018
Now I need to write all records that has 01 into file1, 02 into file2, 03 into file3 in the format given below.
File1.
1,XXXXXXX1
15,YYYYYYYYYYY
7461,2[20061110101010
1,XXXXXXX1
15,YYYYYYYYYYY
7461,2[20061110101011
1,XXXXXXX1
15,YYYYYYYYYYY
7461,2[20061110101012
File2.
1,XXXXXXX2
15,YYYYYYYYYYY
7461,2[20061110101013
1,XXXXXXX2
15,YYYYYYYYYYY
7461,2[20061110101014
1,XXXXXXX2
15,YYYYYYYYYYY
7461,2[20061110101015
File3.
1,XXXXXXX3
15,YYYYYYYYYYY
7461,2[20061110101016
1,XXXXXXX3
15,YYYYYYYYYYY
7461,2[20061110101017
1,XXXXXXX3
15,YYYYYYYYYYY
7461,2[20061110101018
I tought of doing this in Program. But, if there is a way to accompolish this task thru Sort, It will be more helpful to me.
Thanks in advance.
Shankar.
Back to top
gnanasekar80 Beginner Joined: 11 Oct 2006 Posts: 3 Topics: 1
Posted: Wed Oct 11, 2006 12:37 am Post subject: ans
hi,
Below is the SORT jcl for your requirement...
//SORTOF01 DD DSN=DFC2.VENR07.GLOB.FFB.SFILE4,
//SORTOF02 DD DSN=DFC2.VENR07.GLOB.FFB.SFILE5,
//SORTOF03 DD DSN=DFC2.VENR07.GLOB.FFB.SFILE6,
.
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FILES=01(u can give DD names here),INCLUDE=(11,1,CH,EQ,C'1')
OUTFIL FILES=02,INCLUDE=(11,1,CH,EQ,C'2')
OUTFIL FILES=03,INCLUDE=(11,1,CH,EQ,C'3')
/*
Back to top
Shankarganesh_gopal Beginner Joined: 24 May 2005 Posts: 36 Topics: 20 Location: chennai
Posted: Wed Oct 11, 2006 2:01 am Post subject:
This will only copy all records that has '1' in 11th position. But I also need to split the record into 3 parts as I have mentioned above.
Back to top
shekar123 Advanced Joined: 22 Jul 2005 Posts: 528 Topics: 90 Location: Bangalore India
Posted: Wed Oct 11, 2006 4:22 am Post subject:
Shankarganesh_gopal,
try this
Code:
//STEP010 EXEC PGM=SORT
//SORTIN DD *
01 XXXXXXX1 YYYYYYYYYYY 2 20061110101010
01 XXXXXXX1 YYYYYYYYYYY 2 20061110101011
01 XXXXXXX1 YYYYYYYYYYY 2 20061110101012
02 XXXXXXX2 YYYYYYYYYYY 2 20061110101013
02 XXXXXXX2 YYYYYYYYYYY 2 20061110101014
02 XXXXXXX2 YYYYYYYYYYY 2 20061110101015
03 XXXXXXX3 YYYYYYYYYYY 2 20061110101016
03 XXXXXXX3 YYYYYYYYYYY 2 20061110101017
03 XXXXXXX3 YYYYYYYYYYY 2 20061110101018
/*
//SYPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//FILE1 DD SYSOUT=*
//FILE2 DD SYSOUT=*
//FILE3 DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FNAMES=FILE1,INCLUDE=(2,1,CH,EQ,C'1'),
OUTREC=(2,1,C',',4,8,/,
C'15',C',',13,11,/,
C'7461',C',2[',27,14,80:X)
OUTFIL FNAMES=FILE2,INCLUDE=(2,1,CH,EQ,C'2'),
OUTREC=(2,1,C',',4,8,/,
C'15',C',',13,11,/,
C'7461',C',2[',27,14,80:X)
OUTFIL FNAMES=FILE3,INCLUDE=(2,1,CH,EQ,C'3'),
OUTREC=(2,1,C',',4,8,/,
C'15',C',',13,11,/,
C'7461',C',2[',27,14,80:X)
/*
//
FILE1
Code:
1,XXXXXXX1
15,YYYYYYYYYYY
7461,2[20061110101010
1,XXXXXXX1
15,YYYYYYYYYYY
7461,2[20061110101011
1,XXXXXXX1
15,YYYYYYYYYYY
7461,2[20061110101012
FILE2
Code:
2,XXXXXXX2
15,YYYYYYYYYYY
7461,2[20061110101013
2,XXXXXXX2
15,YYYYYYYYYYY
7461,2[20061110101014
2,XXXXXXX2
15,YYYYYYYYYYY
7461,2[20061110101015
FILE3
Code:
3,XXXXXXX3
15,YYYYYYYYYYY
7461,2[20061110101016
3,XXXXXXX3
15,YYYYYYYYYYY
7461,2[20061110101017
3,XXXXXXX3
15,YYYYYYYYYYY
7461,2[20061110101018
_________________ Shekar
Grow Technically
Back to top
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum