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
 

 

Splitting file into multiple files without duplicates

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
krupagk

New User


Joined: 07 Aug 2010
Posts: 13
Location: Hyderabad

PostPosted: Mon Dec 10, 2012 4:46 pm    Post subject: Splitting file into multiple files without duplicates
Reply with quote

Hi All,

I have wriiten a SORT depends on the requirement. Here iam mentioning small part of the sort

Code:
OUTFIL FILES=01,INCLUDE=(1,6,CH,EQ,C'540483',OR,         
                         1,8,CH,EQ,C'54355451',AND,     
                         731,10,CH,EQ,C'BLACK'),         
OUTREC=(1:1,730,743:743,117)
OUTFIL FILES=02,INCLUDE=(1,6,CH,EQ,C'543554',AND,     
                         1,8,CH,NE,C'54355467',AND,   
                         1,8,CH,NE,C'54355410',AND,   
                         731,10,CH,NE,C'BENE+',AND,   
                         731,10,CH,NE,C'STUDENT'),     
OUTREC=(1:1,730,743:743,117)
OUTFIL FILES=03
.
.
.
.
OUTFIL FILES=last


But few output files contains the same records as the record satisfied both condition. Can you please help me so that the same record will not present in more than one output file

Hope the requirement is clear

Regards

Code'd
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Mon Dec 10, 2012 5:03 pm    Post subject: Reply to: Splitting file into multiple files without duplica
Reply with quote

You have been here long enough to know to use the Code tags, so please do so in future.

Since we have no knowledge of your data, we can't be specific, but you have to ensure you have mutually-exclusive conditions in your case.

I don't understand what you are trying to achieve with your OUTREC, but then you've not shown the rest of your code.
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 988
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Mon Dec 10, 2012 5:31 pm    Post subject:
Reply with quote

If you know how many OUTFIL statements you will have, and assuming that all records will be output to one or other of the output files, you could use INREC IFTHEN BUILD processing to apply a suitable identifier to the records as selected (e.g. 01 - 99).
Then, in your OUTFIL processing, select records to be written to the output files based on that identifier.

Garry.
Back to top
View user's profile Send private message
krupagk

New User


Joined: 07 Aug 2010
Posts: 13
Location: Hyderabad

PostPosted: Mon Dec 10, 2012 6:29 pm    Post subject:
Reply with quote

Hi All,

I have total 22 out files. I have used OUTREC as to write only few fields in the out files instead of the complete input record.

I am explaning my requriement here with an example.

Input file:
--------------------------
Code:
AAAAAAAAAAAAAAAA
BBBBBBBBBBBBBBBB
CCCCCCCCCCCCCC
AAAAAABBBBBBBBBB
EEEEEEEEEEEEEEEEEE
DDDDDDEEEEEEEEEE
FFFFFFFFFFFFFFFFFFFFF

-------------------------

For the first SORT condition if the first two records are sorted then the remaining records(here in this case from 3rd record to 7th record)should only be the input for the second condition and so on

Hope you understand my requriment. Here is my complete SORT condition

Code:
SORT FIELDS=COPY                                   
OUTFIL FILES=01,INCLUDE=(1,6,CH,EQ,C'540483',OR,   
                         1,8,CH,EQ,C'54355451',AND,
                         731,10,CH,EQ,C'BLACK'),   
OUTREC=(1:1,730,743:743,117)                       
OUTFIL FILES=02,INCLUDE=(1,6,CH,EQ,C'543554',AND, 
                         1,8,CH,NE,C'54355467',AND,
                         1,8,CH,NE,C'54355410',AND,
                         731,10,CH,NE,C'BENE+',AND,
                         731,10,CH,NE,C'STUDENT'),
OUTREC=(1:1,730,743:743,117)                       
OUTFIL FILES=03,INCLUDE=(1,6,CH,EQ,C'546882'),     
OUTREC=(1:1,730,743:743,117)                       
OUTFIL FILES=04,INCLUDE=(1,8,CH,GE,C'54741147',AND,
                         1,8,CH,LE,C'54741199'),   
OUTREC=(1:1,730,743:743,117)                       
OUTFIL FILES=05,INCLUDE=(1,6,CH,EQ,C'639010'),     
OUTREC=(1:1,730,743:743,117)                       
OUTFIL FILES=06,INCLUDE=((1,8,CH,EQ,C'67611017',OR,
                         1,8,CH,EQ,C'67611027',OR, 
                         1,8,CH,EQ,C'67611037',OR, 
                         1,8,CH,EQ,C'67611057',OR, 
                         1,8,CH,EQ,C'67611088',OR, 
                         1,8,CH,EQ,C'67611089'),AND,
                         731,10,CH,NE,C'BENE+',AND,
                         731,10,CH,NE,C'STUDENT'), 
OUTREC=(1:1,730,743:743,117)                       
OUTFIL FILES=07,INCLUDE=(1,6,CH,EQ,C'529923'),     
OUTREC=(1:1,730,743:743,117)                       
OUTFIL FILES=08,INCLUDE=(1,6,CH,EQ,C'627568',OR,   
                         1,6,CH,EQ,C'525471',OR,   
                         1,8,CH,EQ,C'52117177',OR, 
                         1,6,CH,EQ,C'424336'),     
OUTREC=(1:1,730,743:743,117)                       
OUTFIL FILES=09,INCLUDE=(1,6,CH,EQ,C'639202'),     
OUTREC=(1:1,730,743:743,117)                       
OUTFIL FILES=10,INCLUDE=(1,6,CH,EQ,C'553061'),     
OUTREC=(1:1,730,743:743,117)                       
OUTFIL FILES=11,INCLUDE=(1,6,CH,EQ,C'521171',AND,   
                         1,8,CH,NE,C'52117177'),   
OUTREC=(1:1,730,743:743,117)                       
OUTFIL FILES=12,INCLUDE=(1,8,CH,GE,C'54741100',AND,
                         1,8,CH,LE,C'54741146'),   
OUTREC=(1:1,730,743:743,117)                       
OUTFIL FILES=13,INCLUDE=((1,8,CH,EQ,C'67611047',OR,
                         1,8,CH,EQ,C'67611067',OR, 
                         1,8,CH,EQ,C'67611097'),AND,
                         731,10,CH,NE,C'STUDENT'), 
OUTREC=(1:1,730,743:743,117)                       
OUTFIL FILES=14,INCLUDE=(1,6,CH,EQ,C'676110',AND,   
                         731,10,CH,EQ,C'STUDENT'), 
OUTREC=(1:1,730,743:743,117)                       
OUTFIL FILES=15,INCLUDE=(1,6,CH,EQ,C'543554',AND,   
                         1,8,CH,NE,C'54355467',AND,
                         1,8,CH,NE,C'54355410',AND,
                         731,10,CH,EQ,C'STUDENT'), 
OUTREC=(1:1,730,743:743,117)                       
OUTFIL FILES=16,INCLUDE=(1,8,CH,EQ,C'67611077',AND,   
                         731,10,CH,NE,C'STUDENT'),   
OUTREC=(1:1,730,743:743,117)                         
OUTFIL FILES=17,INCLUDE=(1,8,CH,EQ,C'54355467',AND,   
                         731,10,CH,NE,C'STUDENT'),   
OUTREC=(1:1,730,743:743,117)                         
OUTFIL FILES=18,INCLUDE=(1,6,CH,EQ,C'543554',AND,     
                         1,8,CH,NE,C'54355467',AND,   
                         1,8,CH,NE,C'54355410',AND,   
                         731,10,CH,EQ,C'BENE+'),     
OUTREC=(1:1,730,743:743,117)                         
OUTFIL FILES=19,INCLUDE=((1,8,CH,EQ,C'67611017',OR,   
                         1,8,CH,EQ,C'67611027',OR,   
                         1,8,CH,EQ,C'67611037',OR,   
                         1,8,CH,EQ,C'67611057',OR,   
                         1,8,CH,EQ,C'67611088',OR,   
                         1,8,CH,EQ,C'67611089'),AND, 
                         731,10,CH,EQ,C'BENE+'),     
OUTREC=(1:1,730,743:743,117)                         
OUTFIL FILES=20,INCLUDE=(1,8,CH,EQ,C'54355451',AND, 
                         731,10,CH,EQ,C'SILVER'),   
OUTREC=(1:1,730,743:743,117)                         
OUTFIL FILES=21,INCLUDE=(1,8,CH,EQ,C'54355451',AND, 
                         731,10,CH,EQ,C'COLOR'),     
OUTREC=(1:1,730,743:743,117)                         
OUTFIL FILES=22,INCLUDE=(1,8,CH,EQ,C'54355410'),     
OUTREC=(1:1,730,743:743,117)                         


Regards
D

Code'd Again
Back to top
View user's profile Send private message
krupagk

New User


Joined: 07 Aug 2010
Posts: 13
Location: Hyderabad

PostPosted: Mon Dec 10, 2012 6:32 pm    Post subject:
Reply with quote

Sorry for not using the code.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Mon Dec 10, 2012 6:44 pm    Post subject: Reply to: Splitting file into multiple files without duplica
Reply with quote

Since I'd already Code'd your second, I choped out your re-coding.

You are excluding fields with OUTREC, but have you looked at your record-lengths?

You have to make your conditions mutually exclusive. I don't think anyone is going to do it for you, and they are unlikely to be able to do it how you actually want it to be, as only you know that.

If you can't narrow it down further, look at Garry's suggestion.

Once an IFTHEN has a "hit" on a record, IFTHEN processing stops. If you do all your conditions in IFTHEN, then you will get the effect of "it's already been selected" automatically. If you do this, document it.

Inside the IFTHENs you set a value to be selected for each OUTFIL (like 01, 02, etc to 22 or whatever). You have to remember to "chop off" the value afterwards, with BUILD for instance.
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 988
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Mon Dec 10, 2012 7:04 pm    Post subject:
Reply with quote

What I'm suggesting is along the lines....

Code:
INREC IFTHEN=(WHEN=(1,6,CH,EQ,C'540483',OR,
                       1,8,CH,EQ,C'54355451',AND,
                       731,10,CH,EQ,C'BLACK'),
                       BUILD=(1:1,730,743:743,117,880:C'01')),
                   IFTHEN=(WHEN=(1,6,CH,EQ,C'543554',AND,
                       1,8,CH,NE,C'54355467',AND,
                        1,8,CH,NE,C'54355410',AND,
                        731,10,CH,NE,C'BENE+',AND,
                        731,10,CH,NE,C'STUDENT'),
                        BUILD=(1:1,730,743:743,117,880:C'02')),
                        .
                        .
                        .

  OUTFIL FILES=01,INCLUDE COND=(880,2,CH,EQ,C'01').
        BUILD=(1,860)
  OUTFIL FILES=02,INCLUDE COND=(880,2,CH,EQ,C'02'),
         BUILD=(1.860)
    .
    .
    .

 


(I used 880 as an arbitrary position)
Back to top
View user's profile Send private message
krupagk

New User


Joined: 07 Aug 2010
Posts: 13
Location: Hyderabad

PostPosted: Mon Dec 10, 2012 7:30 pm    Post subject:
Reply with quote

Thanks Garry. I will use this logic
Back to top
View user's profile Send private message
krupagk

New User


Joined: 07 Aug 2010
Posts: 13
Location: Hyderabad

PostPosted: Mon Dec 10, 2012 8:59 pm    Post subject:
Reply with quote

Thanks a lot Garry and Bill. The new sort is working as expected icon_biggrin.gif
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 988
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Mon Dec 10, 2012 9:01 pm    Post subject:
Reply with quote

Thanks for letting us know - glad to have been of help.

Garry.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon Dec 10, 2012 10:30 pm    Post subject:
Reply with quote

Krupagk,

Looking at your control cards for the 22 files, I am not sure as to why you want to change them. I suggest you stick to your original sort card as they are optimal.

Adding an INREC with conditions will affect the performance as it now needs to perform the checks twice(once on the INREC and the second on OUTFIL)
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 High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts Updating the counters after eliminati... PANDU1 DFSORT/ICETOOL 12 Mon Nov 21, 2016 9:47 am
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


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