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 

Sorting the common records of input files of diffrent LRECL

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


Joined: 20 May 2003
Posts: 45
Topics: 15

PostPosted: Mon Dec 27, 2004 4:55 am    Post subject: Sorting the common records of input files of diffrent LRECL Reply with quote

Hi,

I have two input files,


I have to peroform the following operation

input-file1

Code:
111111111
222222222
333333333
444444444
555555555
666666666
777777777
888888888
999999999


input-file2

Code:
000000000
666666666
777777777
888888888
999999999


Wanted output(first nine which are common in both the files)=

Ouput

Code:
666666666
777777777
888888888
999999999


there is a additional condition here. Both the input file are of different LRECL.Also I need my ouput file having the data in input-file2.

can anyone help me.

Regards,
Rama_prayaga
Back to top
View user's profile Send private message Yahoo Messenger
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


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

PostPosted: Mon Dec 27, 2004 5:29 am    Post subject: Reply with quote

Rama Prayaga,

There are lot of similar questions in the SORT forum. Did u try giving a search on them.

http://www.mvsforums.com/helpboards/viewtopic.php?t=11&highlight=matching
http://www.mvsforums.com/helpboards/viewtopic.php?t=3121&highlight=matching

Anyway, take a look at the above links, and if you need anything more than what has been discussed already, please let us know.

You said that the input files are of different LRECL, but you never mentioned what LRECL they are. Kindly provide full information.

In the JCLs provided in the above links, all you need to do is to convert both input files to SAME LRECL. For example, you have two files of LRECL 120 and 200, then convert the file with smaller LRECL (120) to LRECL 200 as shown below.

Code:

  OUTREC FIELDS=(1,120,        *  COPY THE INPUT DATA IN 1 THRU 120 COLS *
                 200:X)        *   PAD SPACES AT THE END TILL COL 200  *


Thanks,
Phantom
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Mon Dec 27, 2004 10:27 am    Post subject: Reply with quote

Rama,

Below is a DFSORT/ICETOOL job that will do what you want. I assumed the following:
* Input file1 has RECFM=FB and LRECL=120 and input file2 has RECFM=FB and LRECL=200
* The "key" for matching is in positions 1-9.
* You do not have any duplicates within input file1 or within input file2.
If any of these assumptions are incorrect, the job would have to be changed appropriately.

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/120)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//CON DD DSN=...  input file2 (FB/200)
//    DD DSN=*.T1,VOL=REF=*.T1,DISP=(OLD,PASS)
//OUT DD DSN=...  output file (FB/200)
//TOOLIN DD *
* IN1->T1:  Pad IN1 records out to 200 bytes to match IN2 records.
  COPY FROM(IN1) TO(T1) USING(CTL1)
* IN2/T1->OUT:  Select the first dup from IN2 for records in
* IN2 and IN1 that match.  Keep only the first 9 matching records.
  SELECT FROM(CON) TO(OUT) ON(1,9,CH) FIRSTDUP USING(CTL2)
/*
//CTL1CNTL DD *
  OUTREC FIELDS=(1,120,200:X)
/*
//CTL2CNTL DD *
  OUTFIL FNAMES=OUT,ENDREC=9
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
gharisankar
Beginner


Joined: 10 Jul 2004
Posts: 19
Topics: 3
Location: C/O Platform - Mainframe

PostPosted: Mon Dec 27, 2004 2:09 pm    Post subject: Reply with quote

Hi Rama, I think you cannot concatenate the different LRECL file in SORT(If the file is FB). Phantom suggest the best way to perform this operation.
_________________
Regards
Hari Smile
Back to top
View user's profile Send private message
Rama_Prayaga
Beginner


Joined: 20 May 2003
Posts: 45
Topics: 15

PostPosted: Thu Dec 30, 2004 5:03 am    Post subject: Reply with quote

Hi Friends,

Thanks a lot for your help .I got it.

Hi Frank,

your assumption are correct .But I have one doubt .Will the records what I get will be in sorted order? I want my records to be in sorted order.

Thanks,
Rama Prayaga
Back to top
View user's profile Send private message Yahoo Messenger
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


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

PostPosted: Thu Dec 30, 2004 5:42 am    Post subject: Reply with quote

Rama,

Code:

SELECT FROM(CON) TO(OUT) ON(1,9,CH) FIRSTDUP USING(CTL2)


You don't have to worry. The output will be in SORTED order. SELECT command will sort the records in Ascending order of 1,9 as specified in the 'ON(1,9,CH)' parameter.

If you want to sort multiple fields you can repeat the ON parameter as shown below.

Code:

SELECT FROM(input) TO(output) ON(pos1, length1, format1) ON(pos2, length2, format2) ....


Hope this helps,

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: Thu Dec 30, 2004 10:02 am    Post subject: Reply with quote

Rama_Prayaga,


check this link which explains in detail about DFSORT/ICETOOL SELECT operator

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA00/6.11?DT=20031124143823

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Rama_Prayaga
Beginner


Joined: 20 May 2003
Posts: 45
Topics: 15

PostPosted: Thu Dec 30, 2004 10:59 am    Post subject: Reply with quote

Hi Phantom and Kolusu,

Thanks a lot for your support. I got it.


Regards,
Rama_Prayaga
Back to top
View user's profile Send private message Yahoo Messenger
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Dec 30, 2004 11:22 am    Post subject: Reply with quote

Quote:
Hi Frank,

your assumption are correct .But I have one doubt .Will the records what I get will be in sorted order? I want my records to be in sorted order.


Yes, as Phantom indicated, the SELECT operator of DFSORT's ICETOOL will sort the records ascending on the ON field(s).

If you're not familiar with DFSORT or DFSORT's ICETOOL, I'd suggest going through "DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online at:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CG00/CCONTENTS

You can access all of the DFSORT books and papers online at:

http://www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Rama_Prayaga
Beginner


Joined: 20 May 2003
Posts: 45
Topics: 15

PostPosted: Fri Jul 08, 2005 3:31 am    Post subject: Reply with quote

Hi Frank,

Thanks for your help.

Regadrs,
Rama Krishna Prayaga
Back to top
View user's profile Send private message Yahoo Messenger
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