Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Sort-problem special sequence

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Sort-problem special sequence
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: 2150
Location: At my coffee table

PostPosted: Fri Aug 31, 2007 5:59 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Problem reading GTF trace output danik56 ABENDS & Debugging 7 Thu Mar 16, 2017 1:02 pm
No new posts Innovations in Your Mainframe Sort Arun Raj PC Guides & IT News 4 Wed Mar 15, 2017 10:38 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts SORT requirement sjiraga COBOL Programming 6 Thu Mar 09, 2017 9:11 pm
No new posts SORT to append Month and YEAR in MMYY... tisamf DFSORT/ICETOOL 1 Wed Mar 08, 2017 4:46 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us