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 card needed for the below query

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


Joined: 15 Feb 2003
Posts: 15
Topics: 11

PostPosted: Thu Jun 07, 2007 10:52 pm    Post subject: Sort card needed for the below query Reply with quote

Hi,

I have a flat file which looks likes the below.
Code:

Accnt#  Service  Option  Qty
1234     001        001      1
1234     001        002      2
2345     001        001      1
3456     001        001      1
3456     001        002      2
3456     001        003      3

Case 1. Output file should have all the record which has more than one option to it. So it should be like this.
Code:

1234     001        001      1
1234     001        002      2
3456     001        001      1
3456     001        002      2
3456     001        003      3

And it should produce a new recod which would have number of unique accounts in the newly created output file.

Case 2. Output file should have accounts which has qty > 1. The file should also have record which tell total number of records in the generated file.

Case3. I have two files but with different data. Key to both the file is Accnt#. Is there any way to get all the records that are in file 1 as well as in file2 using DFSORT/ICETOOL . If so please provide the sort card.

Thanks in advance.
Vikram.
_________________
Vikram
Back to top
View user's profile Send private message
krisprems
Beginner


Joined: 13 Dec 2006
Posts: 101
Topics: 4
Location: india

PostPosted: Fri Jun 08, 2007 1:35 am    Post subject: Reply with quote

vikramdr

Solution for your 1st request:
Code:
//*******************************************************               
//GETMATCH EXEC PGM=ICETOOL                                             
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//IN       DD *                                                         
1234 001 001 1                                                         
1234 001 002 2                                                         
2345 001 001 1                                                         
3456 001 001 1                                                         
3456 001 002 2                                                         
3456 001 003 3                                                         
/*                                                                     
//OUT      DD DSN=&&SORT1,DISP=(MOD,PASS),SPACE=(TRK,(5,5)),UNIT=SYSDA 
//TOOLIN   DD *                                                         
  SELECT FROM(IN) TO(OUT) ON(1,4,CH)  HIGHER(1)                         
/*                                                                     
//*                                                                     
//STEP2    EXEC PGM=ICEMAN                                             
//SYSOUT   DD SYSOUT=*                                                 
//SYSPRINT DD SYSOUT=*                                                 
//SORTIN   DD DSN=&&SORT1,DISP=(MOD,DELETE,DELETE)                     
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
           OPTION COPY                                                 
           OUTFIL REMOVECC,                                             
           TRAILER1=(COUNT=(M11,LENGTH=8))                             
/*                                                                     


Sortout contains:
Code:
1234 001 001 1
1234 001 002 2
3456 001 001 1
3456 001 002 2
3456 001 003 3
00000005     

_________________
cHEERs
krisprems
Back to top
View user's profile Send private message
krisprems
Beginner


Joined: 13 Dec 2006
Posts: 101
Topics: 4
Location: india

PostPosted: Fri Jun 08, 2007 1:41 am    Post subject: Reply with quote

vikramdr

Just confirm if the 2nd case takes the i/p from the case 1 or not?
_________________
cHEERs
krisprems
Back to top
View user's profile Send private message
krisprems
Beginner


Joined: 13 Dec 2006
Posts: 101
Topics: 4
Location: india

PostPosted: Fri Jun 08, 2007 1:45 am    Post subject: Reply with quote

for case3:
check this topic "Create files with matching and non-matching records" in Smart DFSORT Trick at:
http://www.ibm.com/servers/storage/support/software/sort/mvs/tricks/
_________________
cHEERs
krisprems
Back to top
View user's profile Send private message
vikramdr
Beginner


Joined: 15 Feb 2003
Posts: 15
Topics: 11

PostPosted: Fri Jun 08, 2007 2:01 am    Post subject: Reply with quote

Input for case 2 is also the input to case1.
_________________
Vikram
Back to top
View user's profile Send private message
krisprems
Beginner


Joined: 13 Dec 2006
Posts: 101
Topics: 4
Location: india

PostPosted: Fri Jun 08, 2007 2:29 am    Post subject: Reply with quote

vikirum
For the 1st case is the record count correct ?
Or should it be 3?

For Case 2:
Code:
//STEP1    EXEC PGM=ICEMAN                                             
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD *                                                         
1234 001 001 1                                                         
1234 001 002 2                                                         
2345 001 001 1                                                         
3456 001 001 1                                                         
3456 001 002 2                                                         
3456 001 003 3                                                         
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
           OPTION COPY                                                 
           INCLUDE COND=(14,1,CH,GT,C'1')                               
           OUTFIL REMOVECC,                                             
           TRAILER1=(COUNT=(M11,LENGTH=8))                             
/*                                                                     


Sortout contains
Code:
1234 001 002 2
3456 001 002 2
3456 001 003 3
00000003       

_________________
cHEERs
krisprems
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Fri Jun 08, 2007 9:32 am    Post subject: Reply with quote

krisperms,

Quote:

For the 1st case is the record count correct ?
Or should it be 3?


OP wanted to have a count of unique accounts. So, it should be 3 and not 5.

Thanks,
Phantom
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Jun 08, 2007 1:53 pm    Post subject: Reply with quote

vikramdr,

You already got the solutions for case#2 and case #3. here is the solution for case #1

Case:1

Code:

//STEP0100 EXEC PGM=ICETOOL                             
//TOOLMSG  DD SYSOUT=*                                 
//DFSMSG   DD SYSOUT=*                                 
//IN       DD *                                         
1234     001        001      1                         
1234     001        002      2                         
2345     001        001      1                         
3456     001        001      1                         
3456     001        002      2                         
3456     001        003      3                         
//OUT      DD SYSOUT=*                                 
//TOOLIN   DD *                                         
  SELECT FROM(IN) TO(OUT) ON(1,4,CH) ALLDUPS USING(CTL1)
//CTL1CNTL DD *                                         
  OUTREC IFTHEN=(WHEN=INIT,                             
        OVERLAY=(81:SEQNUM,8,ZD,RESTART=(1,4))),       
         IFTHEN=(WHEN=(81,8,ZD,GT,1),                   
        OVERLAY=(81:8C'0'))                             
  OUTFIL IFOUTLEN=80,REMOVECC,                         
  TRAILER1=(TOT=(81,8,ZD,M11,LENGTH=8))                 
/*



Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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