Page 1 of 1

Batch CALL USING Length

PostPosted: Fri Feb 27, 2009 11:13 pm
by brnase
I am writing a batch common I/O which will be called by multiple modules. Is there any way to check the length of the data passed with the USING from the main program in my batch common I/O? I have different requests that require different data structres, therefore differents lengths of data which can be passed to my batch common I/O. My ultimate goal here is to prevent storage overlays, so my group doesn't get paged in the middle of the night for some other group calling our I/O with the wrong length of data.

Re: Batch CALL USING Length

PostPosted: Sat Feb 28, 2009 1:33 am
by dick scherrer
Hello,

One way to deal with this is to define a work area larger than the largest record format you support in the common i/o module.

Re: Batch CALL USING Length

PostPosted: Sat Feb 28, 2009 2:26 am
by brnase
That's understandable. What my real issue is though, with different requests, I have a different combination of data structures. With each request, I would like to validate that the data length passed is the correct length that I'm looking for and want to utilize in my processing.

So say for example, I have datastructures A, B and C. 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.

How do I know if the length of the A and B was passed when request 1 occurs? Likewise, how do I know if the length of A, B and C was passed if request 4 occurs?

I want to stay away from adding a length field at the beginning of the data structure (as to NOT allow the calling program set the length of the data being passed), but rather, based on the request, I want to validate that the length of data passed to my common I/O is correct before I continue any other processing.

Essentially it's like checking the EIBCALEN in a CICS program against the length of the data struture we were expecting for that request before proceeding.

Re: Batch CALL USING Length

PostPosted: Mon Mar 02, 2009 8:24 am
by dick scherrer
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.