1

I will be rewriting an old Inventory Transaction program written in RPGLE. It's a really old program that doesn't use subfile capabilities, but writes the data to an array and has output specs specified within the program. It is all GOTO logic. In addition, it doesn't use logical conditions (If/Endif), but it has the old code where it sets indicators on/off and then the subsequent lines have the indicator identified on the left side for each operation code.

So, my question...

The current program uses a multiple format logical file, consisting of four different files: an inventory transaction file for sales orders, an inventory transaction file for purchase orders, an inventory transaction file for purchase orders, and an inventory transaction file for adjustments. The key fields are: ItemNumber, Warehouse, TransactionDate, UniqueIdentifier, TransactionType.

I'm told we should get away from this type of logic and use SQL instead, but I'm not sure what the best method would be. There are other non-common fields in each file so I don't seem to be able to use a UNION with multiple selects. The records need to be displayed in date order.

Is there a general best practice for this kind of thing?

Michael G
  • 11
  • 1
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Nov 04 '21 at 08:58

1 Answers1

0

UNION is the best SQL solution...

Just use CAST() or one of it's cousins to convert numeric to character when the non-common fields don't have the same type.

Additionally, if you're loading a subfile, you'd have to convert numeric to character anyway; since the subfile only supports a single record format.

Charles
  • 21,637
  • 1
  • 20
  • 44