View previous topic :: View next topic
|
Author |
Message |
BIBHU PRASANNA SINGH
New User
Joined: 09 Jun 2013 Posts: 2 Location: INDIA
|
|
|
|
Can someone help me find a rexx exec to find the copybook length? |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
Doing so would require implementing a significant part of the compiler in Rexx. I recommend that instead you create a skeleton program that includes the copybook, compile it in the foreground, and then use Rexx (or another tool) to pare down the listing to what you want. |
|
Back to top |
|
|
mistah kurtz
Active User
Joined: 28 Jan 2012 Posts: 316 Location: Room: TREE(3). Hilbert's Hotel
|
|
|
|
The cobol copybook parser COBDFSYM would probably be useful for this.
This is a Rexx routine provided by IBM to generate SYMNAMES from cobol copybook.
You can refer to the SORTTRCK document to understand how to use it. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Why not make use of tools like file manager or file aid or etc? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Why do you want to know the copybook length? |
|
Back to top |
|
|
BIBHU PRASANNA SINGH
New User
Joined: 09 Jun 2013 Posts: 2 Location: INDIA
|
|
|
|
Actually what i meant was instead of using changeman's listing option or file manager or manually calculating the copybook, can't a rexx macro be designed so that we can know a particular copybook length ? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
If you want to put an absurd amount of effort into it, feel free (if your employer is happy with that).
You could put less effort into it, and have it not work all the time.
Or just pick it up from the compiler output, where the compiler has already done all the work, which is guaranteed to match what the compiler does (because it is the compiler) without you even having to write a line of code. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello and welcome to the forum,
Yes, this can be done in REXX, but there is NO reason to do so.
If you search within the forum, you should find multiple ways to get a "copybook" length.
You did Not answer Bill's question:
Why do you want to know the copybook length? |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Create a dummy COBOL program, add a COPY statement of the target copybook into WS, compile the program (using NOCOMPILE option) and you're done.
No muss, no fuss.... |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
I have a rexx program that can do this BUT ... it is highly tailored to do copybooks that fit a certain criteria so no OCCURS or REDEFINES are needed and the PIC has to start in a certain column. It gives incorrect results if the copybook has not been maintained according to the rules. Only took a day to write and test. Probably another day or two and I could extend it but I do not need to. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hi Bill,
Yup, this was suggested in the first reply to the topic.
Not sure why TS does not want to try this.
Also, if TS organization has CA-Easytrieve, there is a feature that will convert a COBOL definition to an Easytrieve definition, which shows the displacement/length of all of the fields.
?
d |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Dick,
Sorry, blew right past that.... |
|
Back to top |
|
|
mbizzle
New User
Joined: 06 May 2020 Posts: 7 Location: United States
|
|
|
|
I registered just so I could share this fix to COBDFSYM.
I had been using it for a few years now, and loved it and was sad when our upgrade from cobol compiler V4 to V6 bricked this program. Luckily, it was a fairly simple fix to update it.
Here are the fixes you need to make to allow it to be compatible with the V6 (and i assume V5) compilers.
I am posting this on a few forums so that others may find it that have the same issue.
change this line
parse var line 92 asmdef datatyp .
to
parse var line 87 asmdef datatyp .
and add this line
do until left(line,1) = '1'
call Put_line
parse pull line
if pos('End of Data Division Map',line)<> 0 then leave
end |
|
Back to top |
|
|
|