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 

SORT

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
k_kishore_g
Beginner


Joined: 11 Aug 2003
Posts: 4
Topics: 1

PostPosted: Mon Aug 11, 2003 6:34 am    Post subject: SORT Reply with quote

I have two files with key as Account Number. I have only A/c numbers in one file and all the infomation related to that A/c number in another file. By comparing the two files i want to extract the whole A/c information by using the SORT command thru JCL.

can any one help me for the same.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12380
Topics: 75
Location: San Jose

PostPosted: Mon Aug 11, 2003 9:23 am    Post subject: Reply with quote

Kishore,

couple of questions before I post the solution .


1. what is the LRECL,RECFM of the 2 files.
2. what is the position,format of the account number.
3. Do any of the files contain duplicates? (especially the account info file)
4. Last but not least what sort product does your shop have ( DFSORT , syncsort)
5. Is easytrieve an option??


Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
k_kishore_g
Beginner


Joined: 11 Aug 2003
Posts: 4
Topics: 1

PostPosted: Mon Aug 11, 2003 9:59 am    Post subject: Reply with quote

Hi Kolusu,

pls find the requirements below

LRECL = 100 ,RECFM : FB
Position = 6 to 14; Format=Numeric
No Duplicates
We have DFSORT
Back to top
View user's profile Send private message
k_kishore_g
Beginner


Joined: 11 Aug 2003
Posts: 4
Topics: 1

PostPosted: Mon Aug 11, 2003 10:29 am    Post subject: Reply with quote

Hi,

Let me explain with an example

File 1

MANOJ123456ABC (key is from position 6 to 11)
RAMIO345678DEF
ASHOK545489ERT
GOVIN444678YTU

File 2
AB545489 (key is from position 3 to 8 )
BG345678

Now i need to read file 2 , match it with file 1 based on key and extract only the key matching records from file 1.

So the o/p shud be

ASHOK545489ERT
RAMIO345678DEF

Can we achieve this with dfsort?? We have ezetrieve with us, but is there any way out through dfsort?

Please let me know

Thanks,
Kishore
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 Aug 11, 2003 11:06 am    Post subject: Reply with quote

Kishore,

You can do what you want with the following DFSORT job:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN2 DD DSN=...    input file2
//TEMP2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//CONCT DD DSN=...  input file1
//      DD DSN=*.TEMP2,VOL=REF=*.TEMP2,DISP=(OLD,PASS)
//OUT DD DSN=...  output file
//TOOLIN DD *
* Put key from file2 in same positions as in file1
  COPY FROM(IN2) TO(TEMP2) USING(CTL2)
* Get each file record with a matching key in file2
  SELECT FROM(CONCT) TO(OUT) ON(6,6,CH) FIRSTDUP
/*
//CTL2CNTL DD *
  OUTREC FIELDS=(6:3,6,100:X)
/*


For your example, the output will be:

Code:

RAMIO345678DEF 
ASHOK545489ERT 


If you need the output records sorted by positions 1-5, you can add another SORT operator to do that. Let me know if you need me to show you how.
_________________
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
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12380
Topics: 75
Location: San Jose

PostPosted: Mon Aug 11, 2003 11:11 am    Post subject: Reply with quote

Kishore,
The following DFSORT/ICETOOL Jcl will give you the desired results.A brief explanation of the job.

we first take your file2 which just has the account # and reformat to the length of file1 while placing the key(account # ) in position 6 and write it out to temp file T1.

Now we concatenate your file1 with the T1 and select only duplicates.Any matching record from file2 will be a duplicate and we are only taking the FIRSTDUP which will come from file1 as file1 is first in the concatenation.


Code:

//STEP0100 EXEC PGM=ICETOOL                                           
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//IN1      DD DSN=YOUR FILE2 WITH JUST ACCOUNT #,
//            DISP=SHR             
//T1       DD DSN=&T1,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE),UNIT=SYSDA   
//CON      DD DSN=YOUR FILE1 WITH ACCOUNT INFO,
//            DISP=SHR             
//         DD DSN=&T1,DISP=OLD,VOL=REF=*.T1                             
//TOOLIN   DD *                                                         
  COPY FROM(IN1) TO(T1) USING(CTL1)                                     
  SELECT FROM(CON) TO(OUT) ON(6,6,CH) FIRSTDUP                         
//CTL1CNTL DD *                                                         
  OUTREC FIELDS=(5X,3,8,100:X)                                           
//OUT      DD DSN=YOUR OUTPUT WITH MATCHING ACCOUNT INFO RECORDS,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(X,Y),RLSE)
//DFSPARM  DD *                                                         
  OPTION EQUALS                                                         
/*   


Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12380
Topics: 75
Location: San Jose

PostPosted: Mon Aug 11, 2003 11:13 am    Post subject: Reply with quote

ooops I was a bit late.

Frank we both think alike 8). Did you miss OPTION EQUALS??
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Mon Aug 11, 2003 12:31 pm    Post subject: Reply with quote

Kolusu,

Wow, it isn't often that I beat you in posting (by all of 5 minutes this time). Usually, by the time I see the question here on the West Coast (US), you've already answered it. Being newly married must be slowing you down (it doesn't affect old married people like me). Laughing

OPTION EQUALS isn't needed - SELECT sets it automatically.
_________________
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
k_kishore_g
Beginner


Joined: 11 Aug 2003
Posts: 4
Topics: 1

PostPosted: Mon Aug 11, 2003 11:17 pm    Post subject: Reply with quote

Hi Frank Yaeger & Kolusu,

Thanx for your JCL's. I'll try with these and let u know about the status.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) 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