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

help to sort file in group


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

New User


Joined: 11 Aug 2008
Posts: 6
Location: India

PostPosted: Fri Dec 31, 2010 2:05 pm
Reply with quote

Hi,
i have a file which is used to trigger letters. This file has set of 7 records for each policy. so the input file looks something like this
Code:
Rec Iden    Data
1               Letter details
2               Client details
3               Policy details
4               loan details
5               agent details
6               assignee details
7               other info


Here first column is record identifier followed by data which is different for each record.

Now i want to club the policy records(type 3) for the same client(rec type 2)
So if the data on record 2 is same with another set, then copy record 3 to this set and ignore all other records.

So if there are 2 sets for a client, then the output have 2 records of type 3 as shown below:

Code:
Rec Iden    Data
1               Letter details
2               Client details
3               Policy details
3               Policy details
4               loan details
5               agent details
6               assignee details
7               other info



- Archana
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sun Jan 02, 2011 12:45 am
Reply with quote

What is the RECFM and LRECL of the input file?

What is the starting position, length and format of each relevant field?

Please show a better example of the records in your input file and expected output including multiple sets of values with and without duplicates.
Back to top
View user's profile Send private message
Guest







PostPosted: Mon Jan 03, 2011 2:44 pm
Reply with quote

Hi,
Based on my understanding of your requirement I have made the following jcl:
Code:

//S1 EXEC PGM=SORT                                                 
//SYSOUT DD SYSOUT=*                                               
//SORTIN DD *                                                     
01 TYP                                                             
02 MAN                                                             
03 BOY                                                             
04 CAT                                                             
05 DOG                                                             
06 NEW                                                             
07 TRY                                                             
01 TYP                                                             
02 MAN                                                             
03 BOY                                                             
04 CAT                                                             
05 DOG                                                             
06 NEW                                                             
07 TRY                                                             
01 TYP                                                             
02 MAN                                                             
03 BOY                                                             
04 CAT                                                             
05 DOG                                                             
06 NEW                                                             
07 TRY                                                             
01 TYP                                                             
02 NAM                                                             
03 BOY                                                             
04 CAT                                                             
05 DOG                                                             
06 NEW                                                             
07 TRY                                                             
//SORTOUT DD DSN=TEMP.IBMTST,DISP=(,CATLG),                   
//          RECFM=FB                             
//SYSIN DD *                                                       
  INREC IFTHEN=(WHEN=GROUP,RECORDS=7,PUSH=(7:ID=3)),                 
        IFTHEN=(WHEN=INIT,OVERLAY=(10:C'001')),                     
        IFTHEN=(WHEN=(1,2,CH,EQ,C'02'),OVERLAY=(10:C'000'))         
  SORT FIELDS=(7,3,CH,A,10,3,CH,A,1,2,CH,A)                         
  OUTREC IFTHEN=(WHEN=GROUP,RECORDS=7,PUSH=(14:4,3))                 
  OUTFIL FNAMES=SORTOUT,BUILD=(1,17)                                 
/*                                                                   
//S2 EXEC PGM=SORT                                                   
//SYSOUT DD SYSOUT=*                                                 
//SORTIN DD DSN=TEMP.IBMTST,DISP=SHR                           
//SORTOUT DD SYSOUT=*                                               
//SYSIN DD *                                                         
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(18:SEQNUM,3,ZD,RESTART=(14,3))), 
        IFTHEN=(WHEN=GROUP,BEGIN=(18,3,CH,EQ,C'001'),PUSH=(21:ID=3)),
        IFTHEN=(WHEN=(1,2,SS,EQ,C'01,02,04,05,06,07'),               
        OVERLAY=(18:C'000'))                                         
  SORT FIELDS=(21,3,CH,A,1,2,CH,A,18,3,CH,A)                         
  SUM FIELDS=NONE                                                   
  OUTFIL FNAMES=SORTOUT,BUILD=(1,6)                                 
/*                                                                   
             


The above JCL can be modified based on the length of your input data.
Kindly let me know if the requirement is met.

I believe that a better and efficient solution for the same can be found if the exact requirement is shared.

Devil13
There is always a better solution
Back to top
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 Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top