Hello,
I want to validate that the length of data passed to my common I/O is correct
Keep in mind that what is passed is an address rather than the data. The called module "works on" the original data in the calling programs.
A is always required for any request. A and B are required for requests 1 and 2. A, B and C are required for requests 3 and 4. A and C are required for requests 5 and 6.
You might consider adding a "type" to the calling list and always name 3 fields from the calling program (unused fields could be only 1 byte as they wouldn't be used anyway). You might also consider having multiple entries into the called module.
I don't believe you need to work with thelength in the called module as simple testing should identify any mis-matches in what the caller provides verus what the called module expects. This is not something that will change dynamically at run time, so once the interface is tested for that caller, it should be consistent.
The calling programs and the called module(s) will (should) use a common copybook for each of the data structures.