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

Sorting and Splitting


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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 Developer


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

PostPosted: Sat Jan 29, 2011 4:42 am
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

Moderator Emeritus


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

PostPosted: Sat Jan 29, 2011 10:23 am
Reply with quote

Hi Frank,

I believe this is very much like this other topic from last week:
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
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
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 Developer


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

PostPosted: Tue Feb 01, 2011 2:39 am
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
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 Developer


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

PostPosted: Wed Feb 02, 2011 2:50 am
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
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 Developer


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

PostPosted: Wed Feb 02, 2011 3:23 am
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
This topic is locked: you cannot edit posts or make replies. Automation need help in sorting the data DFSORT/ICETOOL 38
No new posts Splitting group records based on deta... DFSORT/ICETOOL 8
No new posts Splitting a file into multiple files ... DFSORT/ICETOOL 7
No new posts Sorting a record spanned over multipl... DFSORT/ICETOOL 13
No new posts Creating additional seqnum/Literal wh... DFSORT/ICETOOL 4
Search our Forums:

Back to Top