Page 1 of 2

REXX tool to calculate total byte length of record layout

PostPosted: Thu Mar 04, 2010 10:24 am
by manjujacob13
Hi,

I am new to Rexx. I have a requirement to create REXX tool to calculate the total record legth of selected portion of layout. Can anyone please help me to do this.


Thanks,
Manju jacob

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

PostPosted: Thu Mar 04, 2010 10:50 am
by dick scherrer
Hello,

Can anyone please help me to do this.
Not from what you have posted. You need to much more clearly describe what you want to accomplish. . .

Show an example of what you "have" and what you want from what you have.

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

PostPosted: Thu Mar 04, 2010 12:36 pm
by manjujacob13
Hi Dick,

For eg: Following is record layout in COBOL

01 WS-EMPLOYE
05 WS-EMP-ID PIC X(8)
05 WS-NAME PIC X(15)
05 WS-DEPT PIC X(10)
05 WS-SALARY PIC S9(09) USAGE COMP
05 WS-ADDRESS
10 WS-STREET PIC X(10)
10 WS-DOORNO PIC 9(05)
10 WS-POST PIC X(10)

Here, I wanted to calcualte the total length (in byte) from WS-EMP-ID till WS-DOORNO without calculating manually.
i think, now the requirement is clear.

Thanks,
Manju Jacob

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

PostPosted: Thu Mar 04, 2010 1:04 pm
by expat
Have you also considered what if the COBOL source has REDEFINES in it

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

PostPosted: Thu Mar 04, 2010 1:51 pm
by manjujacob13
Yes...we need to consider redefine & occurs clause also.

Thanks,
Manju jacob

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

PostPosted: Fri Mar 05, 2010 12:50 am
by dick scherrer
Hello,

I am new to Rexx.
Here, I wanted to calcualte the total length (in byte) from WS-EMP-ID till WS-DOORNO without calculating manually.
i think, now the requirement is clear.


This is not really a task for someone new to rexx. It is actually not a task for most people who are rexx experts unless they are willing to re-create a major portion of the COBOL compiler. . .

If this is something you want running anytime soon, suggest you consider using the output from a compile and manipulating the lengths provided by the compiler to produce the result you want. . .

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

PostPosted: Fri Mar 05, 2010 1:52 pm
by expat
And the logic of the REXX would also have to take into consideration the different coding methods for defining the same thing

NN  NAME1     COMP-3   PIC 9(3)
NN  NAME2     COMP-3   PIC 999      
NN  NAME3              PIC 9(3)  USAGE COMP-3
NN  NAME3              PIC 999   USAGE COMP-3

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

PostPosted: Thu Mar 11, 2010 10:39 am
by Pedro
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.

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

PostPosted: Thu Nov 11, 2010 2:31 am
by stephenjacob1984
Manju Jacob,
Iam also facing the same isssue.Can you figure out my doubt regarding the same, if you have a willingness to help on the same topic, REXX tool to calculate total byte length of record layout.I have mailed detail to Your inbox, but its pending i think... Please help.
Regards,
Stephen Jacob.

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

PostPosted: Thu Nov 11, 2010 12:18 pm
by stevexff
Assuming that you want to be able to pass a copybook and have the 'tool' work out the lengths, then expat's solution is the one to go with. If you want to get even more clever, use the ADATA output from the compiler - this is specifically designed to be used by debugging and post-processing tools and saves you having to parse the listing file.