Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple Way Of Mapping

Status
Not open for further replies.

jmanj

Programmer
May 20, 2003
298
0
0
US
Here's another beginner's question.

I have to map a payment file (2 input and 1 output). The 2 input files are a header file and a detail file. The common identifier between the two files is a field called PAYID.

If the detail file is my primary input file, what function do I use to get to the header file using PAYID as sort of a key?

Thanks for any help.

note: both files are flat sequential files. There is no problem
coverting them into a .csv file.

jmanj
 
I'm not sure I undersand completely, but if it's only one record you want you could use LOOKUP(). If you want more, use EXTRACT().
 
You can also use searchup & searchdown function if your file from which you will be searching is sorted by PAYID.



Regards,
Vibhav1008
 
Okay I followed your advice and the output is not what I'm looking for. To better understand the problem here's the scenario :

Input 1 :
123,11111
124,22222
125,33333

Input 2:

123,JIM
124,JOHN
125,JAY

Here's what I want(output) using the first 3 as key to match
input 1 and input 2:

123 JIM 11111
124 JOHN 22222
125 JAY 33333

Instead the output is this:

123 JIM 11111
124 JOHN 00000
125 JAY 00000
123 JIM 00000
124 JOHN 22222
125 JAY 00000
123 JIM 00000
124 JOHN 00000
125 JAY 33333

What gives?? Why the output multiplied?

Any help is verry much appreciated.

Regards

jmanj
 
Your rule is testing every combination. Try posting your rule and we'll try to correct it.
 
If you are using a functional map, you can get duplicates if more that one of the input arguments has a range of more than 1:1.

So, in the case of functional map F_Map(Headers, Details)

If there are multiple instances of both the "Headers" and "Details" arguments you will get duplicates asthe map will run once for each instance of both arguments.

You need to pass one Header at a time.

If it is a simple map you can zip it up and post it on

This forum allows attachments.
 
I think I got it!! Thanks to all of you guys.. I'm an old world programmer and always works on files, records and fields. I always assumed that in order to get a match, I would have to match key field from one record(file) to another. I guess I really need to understand how the flow of files and records are being read by Mercator.

Here's what I did to get the correct result. Instead of
doing... F_Map(Headers, Details), I changed it to

F_Map(Headers, LOOKUP(SSN:Headers,key:Headers=key:Details)

jmanj
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top