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
 

 

Sorting and Splitting

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

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Sat Jan 29, 2011 2:49 am    Post subject: Sorting and Splitting
Reply with quote

Hi All,

I have a following requirement
File 1 RECFM=FB, LRECL=3000 --> Not in sorted order
Key position 1 to 3 and 35 to 44


File-2 --> Sorted Order and unique records<Max No of records can be 5200>
Key
1 to 3 and 5 to 14

I need to copy data from file 1 while preserving the order.Each split should contain data for only 400 policies.There will always be match for file-2 in file-1.

Can we do this using sort?
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


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

PostPosted: Sat Jan 29, 2011 4:42 am    Post subject:
Reply with quote

I have no idea what you want to do from your description.

Is File-2 an input file or an output file? If File-2 is an input file, how is it used?

Are you splitting to multiple output files? If so, what is the maximum number? Or do you mean something else by "split" - what?

Please show an example of the records in each input file (relevant fields only) and what you expect for output. Explain the "rules" for getting from input to output. Give the starting position, length and format of each relevant field. Give the RECFM and LRECL of the input files. If file1 can have duplicates within it, show that in your example. If file2 can have duplicates within it, show that in your example.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sat Jan 29, 2011 10:23 am    Post subject: Reply to: Sorting and Splitting
Reply with quote

Hi Frank,

I believe this is very much like this other topic from last week:
http://ibmmainframes.com/viewtopic.php?p=259915&highlight=#259915

The data is different, but i believe the goal is the same. . .

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

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Mon Jan 31, 2011 5:24 am    Post subject: Reply to: Sorting and Splitting
Reply with quote

@Frank
My requirement is similar to this but not that much complicated.

File2 is input file and all the data are unique.It is a driver file.We can split that in 10 parts.
The remaining task is to match the records and preserve there order and report it to output splits.


//File1 DD DSN=file with 1300000 records.Having duplicates and unsorted.
//Driver1 DD DSN=400 keys< all unique>
//Split1 DD DSN=Data of the above 400 keys.

<Similar for other splits>

Key has 2 parts.

File1 has key at first 3 bytes and from position 35 to 10 bytes. RECFM=FB,LRECL=3000
File2 has key at first 3 bytes and from position 4 to 10 bytes.RECFM=FM,LRECL=80

Thanks.
Back to top
View user's profile Send private message
rgupta71

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Mon Jan 31, 2011 10:55 pm    Post subject:
Reply with quote

HI All,

I have written a sort with below sortin statement.

JOINKEYS F1=IN1,FIELDS=(4,10,A)
JOINKEYS F2=IN2,FIELDS=(41,10,A)
REFORMAT FIELDS=(F2:1,213)
OPTION COPY

The problem with the output is that it is sorted.I want to preserve the order in which they occurred in IN2.

THanks.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Tue Feb 01, 2011 2:39 am    Post subject:
Reply with quote

Use JNF2CNTL to add sequence numbers to the F2 records. Then in the main task (SYSIN), SORT by the joined records by the sequence numbers and remove the sequence numbers.
Back to top
View user's profile Send private message
rgupta71

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Tue Feb 01, 2011 8:21 pm    Post subject:
Reply with quote

Thanks Frank.
It worked but I was not able to remove the seqnum from the output file.

Code:

//SYSIN DD *                     
  JOINKEYS F1=IN1,FIELDS=(4,10,A) 
  JOINKEYS F2=IN2,FIELDS=(41,10,A)
  REFORMAT FIELDS=(F2:1,221)       
  SORT FIELDS=(214,8,ZD,A)         
/*                               
//JNF2CNTL DD *                   
  INREC OVERLAY=(214:SEQNUM,8,ZD) 
/*


Do I need to write one more step to remove the seqnum or can we do it in same step?

Thanks.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Wed Feb 02, 2011 2:50 am    Post subject:
Reply with quote

Same pass. Just use OUTREC or OUTFIL to remove the sequence numbers.

Code:

//SYSIN DD *
  JOINKEYS F1=IN1,FIELDS=(4,10,A)
  JOINKEYS F2=IN2,FIELDS=(41,10,A)
  REFORMAT FIELDS=(F2:1,221)
  SORT FIELDS=(214,8,ZD,A)
  OUTREC BUILD=(1,213)
/*
Back to top
View user's profile Send private message
rgupta71

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Wed Feb 02, 2011 3:06 am    Post subject:
Reply with quote

I was doing OUTFIL BUILD so I was getting an error.

Thanks Frank.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Wed Feb 02, 2011 3:23 am    Post subject:
Reply with quote

What error?

Code:

   OUTFIL BUILD=(1,213)


could be used instead of OUTREC.
Back to top
View user's profile Send private message
rgupta71

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Wed Feb 02, 2011 9:33 pm    Post subject:
Reply with quote

Hi,
I was using REFORMAT FIELDS=(F2:1,213) so it was giving an error.

Is there any way that we can also specify condition for File-2.For example if the character at 35th column is '2' then only perform the join else skip the record.

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

Senior Member


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

PostPosted: Wed Feb 02, 2011 10:25 pm    Post subject:
Reply with quote

rgupta71 wrote:
Hi,
I was using REFORMAT FIELDS=(F2:1,213) so it was giving an error.

Is there any way that we can also specify condition for File-2.For example if the character at 35th column is '2' then only perform the join else skip the record.

Thanks.


It would have saved a lot of your time as others time had you specified all the requirements in one go instead providing it in bits and pieces. To answer your question yes you can filter records with an INCLUDE condition

Change your JNF2CNTL to the following

Code:

//JNF2CNTL DD *                   
  INCLUDE COND=(35,1,CH,EQ,C'2')
  INREC OVERLAY=(214:SEQNUM,8,ZD)
/*
Back to top
View user's profile Send private message
rgupta71

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Wed Feb 02, 2011 10:36 pm    Post subject:
Reply with quote

Sorry icon_redface.gif , but this requirement was not there in the beginning.

Thanks everyone.
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 Efficient sorting chandracdac DFSORT/ICETOOL 5 Sat Oct 22, 2016 3:23 am
No new posts Stripping and Sorting of VB file G SRINIVASA RAO SYNCSORT 5 Wed Sep 14, 2016 1:34 pm
No new posts DFSORT sorting only specific records akodakka DFSORT/ICETOOL 4 Thu Aug 04, 2016 11:24 am
No new posts Query on Splitting up a file abdulrafi COBOL Programming 19 Wed Apr 20, 2016 3:26 pm
No new posts VB file sorting V S Amarendra Reddy DFSORT/ICETOOL 2 Fri Feb 26, 2016 8:29 pm


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