IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

rexx exec find copy book size in cobol program


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
BIBHU PRASANNA SINGH

New User


Joined: 09 Jun 2013
Posts: 2
Location: INDIA

PostPosted: Wed Jun 12, 2013 8:25 pm
Reply with quote

Can someone help me find a rexx exec to find the copybook length?
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Wed Jun 12, 2013 8:51 pm
Reply with quote

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
View user's profile Send private message
mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 316
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Wed Jun 12, 2013 9:43 pm
Reply with quote

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
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed Jun 12, 2013 10:11 pm
Reply with quote

Why not make use of tools like file manager or file aid or etc?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Jun 12, 2013 10:40 pm
Reply with quote

Why do you want to know the copybook length?
Back to top
View user's profile Send private message
BIBHU PRASANNA SINGH

New User


Joined: 09 Jun 2013
Posts: 2
Location: INDIA

PostPosted: Thu Jun 13, 2013 9:54 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Jun 13, 2013 10:07 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Jun 13, 2013 10:09 pm
Reply with quote

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
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Fri Jun 14, 2013 12:46 am
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Fri Jun 14, 2013 1:00 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Jun 14, 2013 1:01 am
Reply with quote

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
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Fri Jun 14, 2013 6:12 am
Reply with quote

Dick,

Sorry, blew right past that....
Back to top
View user's profile Send private message
mbizzle

New User


Joined: 06 May 2020
Posts: 7
Location: United States

PostPosted: Wed May 06, 2020 6:54 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Using API Gateway from CICS program CICS 0
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
Search our Forums:

Back to Top