MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
Alain Benveniste Beginner Joined: 04 May 2003 Posts: 92 Topics: 4 Location: Paris, France
Posted: Fri Nov 25, 2005 5:35 pm Post subject: Sort groups challenge
Hi all,
Here is a new sort challenge I think it has never been asked to solve. It
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Back to top
Alain Benveniste Beginner Joined: 04 May 2003 Posts: 92 Topics: 4 Location: Paris, France
Posted: Sun Nov 27, 2005 11:55 am Post subject:
Kolusu,
I believe we don't have the same products, so you could simply send me your logic.
Alain
Back to top
Alain Benveniste Beginner Joined: 04 May 2003 Posts: 92 Topics: 4 Location: Paris, France
Posted: Tue Nov 29, 2005 4:18 am Post subject:
Here is the logic
Code:
Fields A B C
--------------
A-1 01 01 00
A-3 02 02 00
A-2 03 03 00
B-1 04 01 03
C-1 05 01 04
C-3 06 02 04
C-2 07 03 04
C-4 08 04 04
D-1 09 01 08
A-2 10 01 09
A-1 11 02 09
B-3 12 01 11
B-1 13 02 11
B-2 14 03 11
Code:
//STEP0001 EXEC PGM=ICETOOL
//DFSMSG DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//TOOLIN DD *
SORT FROM(IN) TO(OUTX) USING(ICE0)
/*
//IN DD *
A-1
A-3
A-2
B-1
C-1
C-3
C-2
C-4
D-1
A-2
A-1
B-3
B-1
B-2
/*
//OUTX DD SYSOUT=*
//ICE0CNTL DD *
INREC IFTHEN=(WHEN=INIT,
* Creation of field A
OVERLAY=(81:SEQNUM,5,ZD,
* Creation of field B
86:SEQNUM,5,ZD,RESTART=(1,1),
* Creation of field C
81:81,5,ZD,SUB,86,5,ZD,M11,LENGTH=5))
SORT FIELDS=(81,5,ZD,A,3,1,ZD,A)
OUTREC BUILD=(1,80)
/*
Alain
Back to top
Alain Benveniste Beginner Joined: 04 May 2003 Posts: 92 Topics: 4 Location: Paris, France
Posted: Tue Nov 29, 2005 5:48 am Post subject:
I just realized there is no reason to use IFTHEN feature... Code:
//ICE0CNTL DD *
INREC OVERLAY=(81:SEQNUM,5,ZD,
86:SEQNUM,5,ZD,RESTART=(1,1),
81:81,5,ZD,SUB,86,5,ZD,M11,LENGTH=5)
SORT FIELDS=(81,5,ZD,A,3,1,ZD,A)
OUTREC BUILD=(1,80)
/*
Alain
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