I need to break a record into multiple records based upon conditions.
My input data looks like this
key1 key2 amt_a amt_b amt_c amt_d
1-10 11-20 21-30 31-40 41-50 51-60
=============================================
11 2 0 0 0 500
11 3 100 200 450 900
12 1 0 0 0 0
20 11 0 110 0 0
30 9 0 0 80 0
1-10 11-20 21-30 31-40 41-50 51-60
=============================================
11 2 0 0 0 500
11 3 100 200 450 900
12 1 0 0 0 0
20 11 0 110 0 0
30 9 0 0 80 0
I want my output in following format.
key1 key2 Amt code
11,2,500,d
11,3,100,a
11,3,200,b
11,3,450,c
11,3,900,d
20,11,110,b
30,9,80,c
11,2,500,d
11,3,100,a
11,3,200,b
11,3,450,c
11,3,900,d
20,11,110,b
30,9,80,c
I am trying to do the same in the jcl using sort with below logic but it does not works.
//SYSIN DD *
INREC IFTHEN=(WHEN=(21,10,ZD,GT,0),BUILD=(1,10,C',',11,10,C',',21,10,C',',C'A'),
IFTHEN=(WHEN=(31,10,ZD,GT,0),BUILD=(1,10,C',',11,10,C',',31,10,C',',C'B'),
IFTHEN=(WHEN=(41,10,ZD,GT,0),BUILD=(1,10,C',',11,10,C',',41,10,C',',C'C'),
IFTHEN=(WHEN=(51,10,ZD,GT,0),BUILD=(1,10,C',',11,10,C',',51,10,C',',C'D'))
OPTION COPY
INREC IFTHEN=(WHEN=(21,10,ZD,GT,0),BUILD=(1,10,C',',11,10,C',',21,10,C',',C'A'),
IFTHEN=(WHEN=(31,10,ZD,GT,0),BUILD=(1,10,C',',11,10,C',',31,10,C',',C'B'),
IFTHEN=(WHEN=(41,10,ZD,GT,0),BUILD=(1,10,C',',11,10,C',',41,10,C',',C'C'),
IFTHEN=(WHEN=(51,10,ZD,GT,0),BUILD=(1,10,C',',11,10,C',',51,10,C',',C'D'))
OPTION COPY
I do have the code to create multiple output files but I need only one file.
please advice