Page 2 of 2

Re: REXX tool to calculate total byte length of record layout

PostPosted: Thu Nov 11, 2010 5:04 pm
by NicC
And you also get OCCURS DEPENDING ON or REFER in PL/1. That really makes it difficult as the length is never known until the record is moved into storage.

I have a rexx exec that does this sort of thing for PL/1 structures - it is nearly 700 lines long including comments and error handling and it specifically disallows structures that use REFER or controlled storage specified as *.

Re: REXX tool to calculate total byte length of record layout

PostPosted: Thu Nov 11, 2010 6:55 pm
by prino
NicC wrote:And you also get OCCURS DEPENDING ON or REFER in PL/1. That really makes it difficult as the length is never known until the record is moved into storage.

I have a rexx exec that does this sort of thing for PL/1 structures - it is nearly 700 lines long including comments and error handling and it specifically disallows structures that use REFER or controlled storage specified as *.


Do you handle UNION's, and do you actually use the PL/I mapping rules?

My PL/I structure parser code is around 1,100 lines, doesn't handle UNION's, doesn't handle the more exotic stuff (like AREA's and ENTRY variables) and even UNAL BIT's are silently converted to ALIGNED. It also completely ignores the official PL/I mapping rules and simply assumes the structure as a whole is UNAL. You should be able to see it on 'that' system, member RAP00110.

Re: REXX tool to calculate total byte length of record layout

PostPosted: Thu Nov 11, 2010 7:08 pm
by NicC
Robert

It was based on PL/1 V2 which, I think, does not have UNION. It also does not handle LIKE plus lots of other stuff. Cannot remember what it does with UN/ALIGNED. It was more an exercise to fill time than to be a useful tool!

Re: REXX tool to calculate total byte length of record layout

PostPosted: Thu Nov 11, 2010 11:24 pm
by Akatsukami
Pedro wrote:I am not a Cobol user, but some language compilers have some information in their listings. I suggest you have a small program that uses that record layout and then examine the compiler listing. You might also read about the debugging options of the compiler which might give you more information.

Indeed, we have a tool (that I did not write; therefore I will not post any code, panels, etc. here) that tailors a skeleton consisting of a very simple PL/I program (basically just PROC, %INCLUDE, and END statements) to use the copybook in question and compiles it, thus getting the exact scalar and aggregate lengths that will actually be used in "real life" (or if it doesn't, it becomes Peter Elderon's problem, not mine :D ). I strongly urge the TS to consider a similar solution.