The following DFSORT JCL will give you the desired results. The trick here
is to join the file to itself which results in a cartesian join. example.
You have 8 records as sample in here, a cartesian join on the key would
result in (8 X 8 = 64 records).
Out of the 64 records you don't want the records which are a match to
themselves, so you need to eliminate them and you are left with 56
records. ie every record is matched with 7 other records.
Once you have the cartesian join, use the operator RESIZE to combine all
the 7 records per key into a single record. Once you created a long record
we then have the option of picking the values as needed.
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//INA DD *
PARA_1 VAR_1 A
PARA_1 VAR_1 TEST1
PARA_1 VAR_2 B
PARA_1 VAR_2 TEST2
PARA_1 VAR_3 C
PARA_1 VAR_3 TEST3
PARA_1 VAR_4 D
PARA_1 VAR_4 TEST4
//INB DD *
PARA_1 VAR_1 A
PARA_1 VAR_1 TEST1
PARA_1 VAR_2 B
PARA_1 VAR_2 TEST2
PARA_1 VAR_3 C
PARA_1 VAR_3 TEST3
PARA_1 VAR_4 D
PARA_1 VAR_4 TEST4
//T1 DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(25,25),RLSE)
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY JKFROM TO(T1) USING(CTL1)
RESIZE FROM(T1) TO(OUT) TOLEN(1120) USING(CTL2)
//*
//CTL1CNTL DD *
JOINKEYS F1=INA,FIELDS=(1,10,A),SORTED,NOSEQCK
JOINKEYS F2=INB,FIELDS=(1,10,A),SORTED,NOSEQCK
REFORMAT FIELDS=(F1:1,80,F2:1,80)
OMIT COND=(1,80,CH,EQ,81,80,CH)
INREC IFOUTLEN=160,
IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,80),PUSH=(161:SEQ=3)),
IFTHEN=(WHEN=(161,3,ZD,GT,1),OVERLAY=(01:80X))
//*
//CTL2CNTL DD *
OUTFIL FNAMES=OUT,
BUILD=(0001,80,261,60,581,60,901,60,60X,/,
0001,80,101,60,421,60,741,60,1061,60)
//*
Kolusu
DFSORT Development
IBM Corporation
IBM Mainframe Discussion List <[email protected]> wrote on
02/14/2014 10:29:35 PM:
> From: adarsh khanna <[email protected]>
> To: [email protected],
> Date: 02/14/2014 10:31 PM
> Subject: Need help on SORT solution
> Sent by: IBM Mainframe Discussion List <[email protected]>
>
> Hi,
>
> We have a requirement to generate all possible combinations of below
> input and need help to achieve it using SORT.
>
>
> Para_1Var_1A
> Para_1Var_1Test
> Para_1Var_2B
> Para_1Var_2Test
> Para_1Var_3C
> Para_1Var_3Test
> Para_1Var_4D
> Para_1Var_4Test
>
> Expected output is all combinations of each Var*
> Var* should be of 10 bytes (if text is less than 10 bytes, padd it
> with spaces)
> A, B, C, Text... should be of 60 bytes (if text is less than 60
> bytes, padd it with spaces)
>
> Output:
>
>
> Para_1Var_1...(Total 10 bytes)..A (Total 60
bytes)...Var_2....B...Var_3...C
> Para_1Var_1...(Total 10 bytes)..Test (Total 60
bytes)...Var_2....B...Var_3...C
> Para_1Var_1...(Total 10 bytes)..Test (Total 60
> bytes)...Var_2....Test...Var_3...C
> ......
>
> Thanks
> Adarsh
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to [email protected] with the message: INFO IBM-MAIN
>
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN