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

Sorting of two files


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
nimisanand

New User


Joined: 22 Nov 2005
Posts: 24

PostPosted: Mon Apr 25, 2011 8:44 pm
Reply with quote

Hi,

I have two files. The content of the first file is as below.

Name Emp ID Dept

Tim 13333 Sales
John 14222 Marketing
Kim 12784 Administration
Johny 11344 Authorisation
Lilly 19345 Sales
Mary 78934 Finance

The second file has the Dept only

Dept

Authorisation
Finance
Sales

Only records which have department present in the second file needs to be written in the output file.

Output file

Name Emp ID Dept

Tim 13333 Sales
Johny 11344 Authorisation
Lilly 19345 Sales
Mary 78934 Finance

Please let me know if this could be done using DFSORT/ICETOOL.

Regards,
Nimi
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Mon Apr 25, 2011 8:58 pm
Reply with quote

It seems like after 6 years you would know to provide the LRECL and format for the files and the field positions and lengths for the fields.
Back to top
View user's profile Send private message
nimisanand

New User


Joined: 22 Nov 2005
Posts: 24

PostPosted: Mon Apr 25, 2011 9:19 pm
Reply with quote

Both files are FB format with both having LREC 80.

Record layout for the first file

Name X(20)
Emp-ID 9(10)
Department X(30)


Second file Layout
X(30)
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: Mon Apr 25, 2011 10:33 pm
Reply with quote

You can use a DFSORT JOINKEYS job like the following to do what you asked for:

Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD *
Tim                      13333Sales
John                     14222Marketing
Kim                      12784Administration
Johny                    11344Authorisation
Lilly                    19345Sales
Mary                     78934Finance
/*
//IN2 DD *
Dept
Authorisation
Finance
Sales
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  JOINKEYS F1=IN1,FIELDS=(31,30,A)
  JOINKEYS F2=IN2,FIELDS=(1,30,A)
  REFORMAT FIELDS=(F1:1,88)
  SORT FIELDS=(81,8,ZD,A)
  OUTREC BUILD=(1,80)
/*
//JNF1CNTL DD *
  INREC OVERLAY=(81:SEQNUM,8,ZD)
/*
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
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
This topic is locked: you cannot edit posts or make replies. Automation need help in sorting the data DFSORT/ICETOOL 38
Search our Forums:

Back to Top