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 

ALTSEQ

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Wed Oct 03, 2007 12:32 pm    Post subject: ALTSEQ Reply with quote

A colleague came up with this problem: a file is having a new record type added. Record types 1 to 9 are already used so the powers-that-be have decreed that the new record type is to be A. All very well so far. However, type 1 is the file header and type 9 is the trailer so the record has to be sorted between these 2 values. I fact it has to be sorted between 6 and 7 (6 < A < 7). ALTSEQ we thought! So I played....

trying this...

Code:
 
//SORTIN    DD *         
1 header                 
7 Record 4               
6 Record 6               
A Record 3               
4 Record 7               
A Record 2               
A Record 1               
6 Record 4               
7 Record 1               
9 trailer 6               
//SORTOUT   DD SYSOUT=* 
//SYSIN     DD *         
  SORT FIELDS=(1,1,AQ,A)
  ALTSEQ CODE=(C1F7)     
/*                       


gives this...

Code:
 
1 header   
4 Record 7
6 Record 6
6 Record 4
A Record 3
A Record 2
A Record 1
7 Record 4
7 Record 1
9 trailer 6

OK so far - field 1 is in the correct sequence.

Now sort field 3 within field 1...

Code:

//SORTIN    DD *                 
1 header                           
7 Record 4                         
6 Record 6                         
A Record 3                         
4 Record 7                         
A Record 2                         
A Record 1                         
6 Record 4                         
7 Record 1                         
9 trailer 6                       
//SORTOUT   DD SYSOUT=*           
//SYSIN     DD *                 
  SORT FIELDS=(1,1,AQ,A,10,1,ZD,A)
  ALTSEQ CODE=(C1F7)             
/* 


we get...

Code:

1 header   
4 Record 7
6 Record 4
6 Record 6
A Record 1
7 Record 1
A Record 2
A Record 3
7 Record 4
9 trailer 6

A & 7 are treated as equals but I want 7 > A > 6

What is wanted is this...
Code:
 
1 header   
4 Record 7
6 Record 6
6 Record 4
A Record 1 
A Record 2
A Record 3
7 Record 1
7 Record 4
9 trailer 6


Now, ideally, we only want the ALTSEQ to apply to the first field so that:

Code:
A Record 2 Another


sorts before

Code:
A Record 2 6aces


Is it possible? I looked at the Pgmers Guide, Tricks, Beyond the Basics, User guide and did a search on ALTSEQ in this forum and nothing SEEMED to say 'Yes'.
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Oct 03, 2007 12:50 pm    Post subject: Reply with quote

Quote:
Is it possible?


Sure. You just have to think outside the box a bit. I believe this DFSORT job will give you what you want:

Code:

//S1    EXEC  PGM=ICEMAN                           
//SYSOUT    DD  SYSOUT=*                           
//SORTIN DD *                                       
1 header                                           
7 Record 4                                         
6 Record 6                                         
A Record 3                                         
4 Record 7                                         
A Record 2                                         
A Record 2 6aces                                   
A Record 1                                         
A Record 2 Another                                 
6 Record 4                                         
7 Record 1                                         
9 trailer 6                                       
/* 
//SORTOUT   DD SYSOUT=*                             
//SYSIN     DD *   
  OPTION NOCHALT                                 
  SORT FIELDS=(1,1,AQ,A,10,1,ZD,A,12,10,CH,A)       
  ALTSEQ CODE=(C1F7,F7F8,F8F9,F9FA)                 
/*                                                   


SORTOUT would have:

Code:

1 header           
4 Record 7         
6 Record 4         
6 Record 6         
A Record 1         
A Record 2         
A Record 2 Another 
A Record 2 6aces   
A Record 3         
7 Record 1         
7 Record 4         
9 trailer 6           


Is that what you want?

Note: NOCHALT is DFSORT's shipped default, but you can specify it just in case it was changed by your System Programmer. It will ensure that ALTSEQ is used for AQ, but not for CH.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Wed Oct 03, 2007 12:54 pm    Post subject: Reply with quote

Thanks, Frank. I admit I am not very good at thinking outside boxes, although I did wonder if I would have to expand the alternate table. Just didn't wonder hard enough!
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
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 -> Utilities 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