Focal Point
Regarding Joining two files

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/8961081422

April 19, 2007, 10:27 AM
manash
Regarding Joining two files
In file 1 i have-
Rollno name day
------- ---- -----
111 aaa mon
111 aaa tue

FIle 2 contains-

Rollno comments
----- --------
111 present
111 absent

Both are flat files
So i hold it in format focus and then join

'join Rollno in file1 to all Rollno in file2'

but it is giving-
Rollno name day comments
------- ---- ---- --------
111 aaa mon present
111 aaa mon absent
111 aaa tue present
111 aaa tue absent

And if i dont use 'all' the it gives-
Rollno name day comments
------- ---- ---- --------
111 aaa mon present
111 aaa tue present

but i want it as-
Rollno name day comments
------- ---- ---- --------
111 aaa mon present
111 aaa tue absent

How do i make sure that the 1st record in file 1 joins to the corresponding 1st record in file 2,
and the 2nd record of file1 joins with the corresponding 2nd record with file 2 ?
Any suggestions?


FOCUS 7.1.1/ MF(OS/390)
April 19, 2007, 10:37 AM
GGSD
Manash,
First I am assuming that your files are sorted the way you need them i.e. each row having a corresponding row in the same position within the other table.
Before you hold in format focus and join the two files, you should create a define field for each file that is a unique row identifier (ROWNUM/I9 = ROWNUM + 1)
Then join on this new field.
That way you get a one to one join for each row.
Hope this is what you wanted to do....


WebFOCUS 760 HPUX - Using MRE, Report Caster, Dashboard and Self Service.
April 19, 2007, 10:39 AM
susannah
hmm. it seems you don't actually have a 'corresponding record', based on the key 'ROLLNO'
so you have to create a record number for each file and join on that record number.
Does that sound like what you want to do?




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
April 19, 2007, 10:41 AM
<Tim Howard_ABCBS>
You may try adding (defining) a line count field to each file:

File1-
Line# Rollno name day
----- ------ ---- ----
1 111 aaa mon
2 111 aaa tue

File2-
Line# Rollno comments
----- ------ --------
1 111 present
2 111 absent


Then join off of the line field:
join Line# in file1 to Line# in file2


This will only work if you have the same number of rows and each row number corresponds in both tables. Haven't tested, just a thought.