MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Sort groups challenge

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Mainframe Challenge
View previous topic :: View next topic  
Author Message
Alain Benveniste
Beginner


Joined: 04 May 2003
Posts: 92
Topics: 4
Location: Paris, France

PostPosted: Fri Nov 25, 2005 5:35 pm    Post subject: Sort groups challenge Reply with quote

Hi all,

Here is a new sort challenge I think it has never been asked to solve. It
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Sat Nov 26, 2005 9:07 am    Post subject: Reply with quote

Alain Benveniste,

I did something similar in here

http://www.mvsforums.com/helpboards/viewtopic.php?p=16796#16796

However I cannot test it right now (Thanks Giving Holidays)

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Alain Benveniste
Beginner


Joined: 04 May 2003
Posts: 92
Topics: 4
Location: Paris, France

PostPosted: Sun Nov 27, 2005 11:55 am    Post subject: Reply with quote

Kolusu,

I believe we don't have the same products, so you could simply send me your logic.

Alain
Back to top
View user's profile Send private message
Alain Benveniste
Beginner


Joined: 04 May 2003
Posts: 92
Topics: 4
Location: Paris, France

PostPosted: Tue Nov 29, 2005 4:18 am    Post subject: Reply with quote

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
View user's profile Send private message
Alain Benveniste
Beginner


Joined: 04 May 2003
Posts: 92
Topics: 4
Location: Paris, France

PostPosted: Tue Nov 29, 2005 5:48 am    Post subject: Reply with quote

I just realized there is no reason to use IFTHEN feature... Embarassed
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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Mainframe Challenge All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group