IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Sort-problem special sequence


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
adoerner

New User


Joined: 25 Apr 2007
Posts: 11
Location: Germany

PostPosted: Fri Aug 31, 2007 5:47 pm
Reply with quote

Hello !

Sorry, I don't know to describe the problem in the subject.

The input-File is:
AAAAA 1 BBBBB
AAAAA 1 BBBBB
AAAAA 1 BBBBB
AAAAA 2 BBBBB
AAAAA 2 BBBBB
AAAAA 2 BBBBB

I want to get this sort-result:
AAAAA 1 BBBBB
AAAAA 2 BBBBB
AAAAA 1 BBBBB
AAAAA 2 BBBBB
AAAAA 1 BBBBB
AAAAA 2 BBBBB

Is this possible ?
Greetings
Axel
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Fri Aug 31, 2007 5:59 pm
Reply with quote

If you could tag the 1s with a seqnum starting at 1 and incrementing by 2 and tag the 2s with a seqnum starting at 2 and incrementing by 2, then sorting on the seqnum would put them in the seq you want....
I wonder if the IFTHEN will allow that?
Back to top
View user's profile Send private message
ParagChouguley

Active User


Joined: 03 Feb 2007
Posts: 175
Location: PUNE(INDIA)

PostPosted: Fri Aug 31, 2007 6:11 pm
Reply with quote

Code:

//S1      EXEC PGM=ICETOOL                 
//TOOLMSG DD SYSOUT=*                       
//DFSMSG  DD SYSOUT=*                       
//IN1     DD *                             
AAAAA 1 BBBBB                               
AAAAA 1 BBBBB                               
AAAAA 1 BBBBB                               
AAAAA 2 BBBBB                               
AAAAA 2 BBBBB                               
AAAAA 2 BBBBB                               
/*                                         
//*                                         
//OUT1    DD SYSOUT=*                       
//*                                                   
//TEMP1   DD DSN=&&TEMP1,DISP=(MOD,PASS),             
//      DSORG=PS,RECFM=FB                             
//TOOLIN  DD *                                         
    COPY FROM(IN1) TO(TEMP1) USING(SRT1)               
    SORT FROM(TEMP1) TO(OUT1) USING(SRT2)             
/*                                                     
//*                                                   
//SRT1CNTL DD *                                       
    OPTION COPY                                       
    OUTREC IFTHEN=(WHEN=(7,1,CH,EQ,C'1'),             
                   BUILD=(SEQNUM,10,ZD,1,13)),         
           IFTHEN=(WHEN=(7,1,CH,EQ,C'2'),             
                   BUILD=(SEQNUM,10,ZD,1,13))         
/*                                                     
//SRT2CNTL DD *                               
    SORT FIELDS=(1,10,ZD,A,17,1,CH,A)         
    OUTREC FIELDS=(11,13)                     
/*                                             


Output :
Code:

AAAAA 1 BBBBB   
AAAAA 2 BBBBB   
AAAAA 1 BBBBB   
AAAAA 2 BBBBB   
AAAAA 1 BBBBB   
AAAAA 2 BBBBB   


--Parag
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Fri Aug 31, 2007 7:39 pm
Reply with quote

adoerner
Here is a DFSORT JCL that does what's needed in a single pass!
Code:
//S1    EXEC  PGM=ICEMAN                                               
//SYSOUT    DD  SYSOUT=*                                               
//SORTIN DD *                                                           
AAAAA 1 BBBBB                                                           
AAAAA 1 BBBBB                                                           
AAAAA 1 BBBBB                                                           
AAAAA 2 BBBBB                                                           
AAAAA 2 BBBBB                                                           
AAAAA 2 BBBBB                                                           
/*                                                                     
//SORTOUT DD SYSOUT=*                                                   
//SYSIN    DD    *                                                     
  INREC  IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD,RESTART=(7,1)))     
  SORT FIELDS=(1,5,CH,A,81,8,ZD,A),EQUALS               
  OUTREC BUILD=(1,80)                                                 
/*                                                                     
Back to top
View user's profile Send private message
adoerner

New User


Joined: 25 Apr 2007
Posts: 11
Location: Germany

PostPosted: Mon Sep 03, 2007 11:38 am
Reply with quote

It works great !
Thank you very much!
Greetings
Axel
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
Search our Forums:

Back to Top