Importing IBM i Duplicate Fields

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
jyoung
Posts: 643
Joined: Thu Jan 21, 2016 6:43 am
Location: Oklahoma City, OK USA

Importing IBM i Duplicate Fields

Post by jyoung » Sat Feb 16, 2019 3:31 am

This is my first experience with this type of situation and I would like to know more about how this works and if I am being setup for some issues.

We have a File on the IBM i that I previously imported that contains a Field named RPU that is a Decimal(15).
I just imported another File that has a Field named RPU that is a Signed(7,6).

Because of the type conflict LANSA created a RPU001 Field for the newly imported File.

On my local SQL Server Database, LANSA created the table with the RPU001 column and I reference the RPU001 Field in code.

My question is:
How does LANSA know that on my local database that the column is RPU001 but on the IBM the field is RPU? Or does it? Do I have to deal with this discrepancy manually?

Thanks,
Joe

User avatar
lawingo
Posts: 50
Joined: Fri Dec 04, 2015 6:41 am

Re: Importing IBM i Duplicate Fields

Post by lawingo » Sat Feb 16, 2019 5:01 am

Hey Joe,

In your code you will have to reference the "RPU001" field when referring to that file. When you update the file on the ibm it will update the "RPU" field correctly even though the field name is "RPU001". Since the file is an "OTHER" file, Lansa simply maps the field to the other field based on field attributes.

I run into this all the time on our system. It's a pain but thats the way it works.

For instance we have a file (OELROLT) that has a field named "INVNUM". I'ts been named over twice.

Code: Select all

Select Fields(*ALL) From_File(OELROLT) Where(#INVNUM002 = ' ') Io_Error(*NEXT) Val_Error(*NEXT)
When I select or update from (OELROLT) i have to used the "INVNUM002" and Lansa maps that field definition to the file that it refers to. If I use anything else then the code bombs.

I hope this helps

Best,
Chad
Sherrill Furntiure Company

jyoung
Posts: 643
Joined: Thu Jan 21, 2016 6:43 am
Location: Oklahoma City, OK USA

Re: Importing IBM i Duplicate Fields

Post by jyoung » Sat Feb 16, 2019 7:25 am

Hey Chad,
Good to know. I was concerned I was going to have to something odd, because I could not find any indication of how the field RPU001 gets mapped back to RPU on the iSeries. I guess this is something that LANSA just knows and not something we see.

Thanks for the help.
Joe

atostaine
Posts: 396
Joined: Wed Jan 20, 2016 7:38 am

Re: Importing IBM i Duplicate Fields

Post by atostaine » Tue Feb 19, 2019 7:52 am

Yeah it just works. You have to remember to use the 001 field. I wish we could name the field instead of 001 being added automatically. I would prefer a prefix based on the file name instead of an 001.

Art
Art Tostaine

Post Reply