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

Expand COBOL copybooks and DCLGEN


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Mike 1304

New User


Joined: 15 Oct 2011
Posts: 46
Location: Germany

PostPosted: Sun May 26, 2013 10:54 pm
Reply with quote

Hi,

does somebody know a tool to expand copybooks and dclgen in the same way the Compiler does, but without the real compile?

I want to get the expanded source code to do a scan for rule compliance.

Mike
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: Mon May 27, 2013 12:32 am
Reply with quote

Not sure about the DCLGEN processing, but

Programming Guide wrote:
When MDECK(NOCOMPILE) is in effect, compilation is terminated after library processing has completed and the expanded source program file has been written. The compiler does no further syntax checking or code generation regardless of the settings of the COMPILE, DECK, and OBJECT compiler options.


The next possibility would be:

Quote:
Use NOCOMPILE without any suboption to request a syntax check (only diagnostics produced, no object code). If you use NOCOMPILE without any suboption, several compiler options will have no effect because no object code will be produced, for example: DECK, LIST, OBJECT, OFFSET, OPTIMIZE, SSRANGE, and TEST.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Mon May 27, 2013 3:42 pm
Reply with quote

Do you've IBM File-Manager available?
Back to top
View user's profile Send private message
Mike 1304

New User


Joined: 15 Oct 2011
Posts: 46
Location: Germany

PostPosted: Mon May 27, 2013 5:32 pm
Reply with quote

yes, why?
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Mon May 27, 2013 5:54 pm
Reply with quote

Have you tried PGM=ISRLEMX ?

see publib.boulder.ibm.com/infocenter/zos/v1r11/index.jsp?topic=/com.ibm.zos.r11.f54pc00/ispzpc8041.htm

Garry.
Back to top
View user's profile Send private message
Mike 1304

New User


Joined: 15 Oct 2011
Posts: 46
Location: Germany

PostPosted: Mon May 27, 2013 6:09 pm
Reply with quote

Hi Garry,

thanks for your answer!

As far as I understood, ISRLEMX only supports COPY and not EXEC SQL INCLUDE.
It also supports only up to 8 concatinations of datasets (I need much more).

So I think the IGYCRCTL with PARM MDECK(NOCOMPILE),SQL is the better choice for me.

Thanks to all,
Mike
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: Mon May 27, 2013 6:26 pm
Reply with quote

If the production listings are computer-readlable, you could look at using those.

I don't think ISRLEMX will do any "REPLACING".

It's an "interesting" audit requirement. Are they unhappy about the abilities of your change-management system to produce correct source at any given point in time? After all, doing a "re-expansion" is going to rely on that anyway.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


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

PostPosted: Mon May 27, 2013 6:29 pm
Reply with quote

Should the requirement be achieved without REXX ?
Back to top
View user's profile Send private message
Mike 1304

New User


Joined: 15 Oct 2011
Posts: 46
Location: Germany

PostPosted: Mon May 27, 2013 6:41 pm
Reply with quote

I have no compile listing to get this information.

The reason why I want to expand the native source with copybooks and includes is, that I want to scan the expanded source code against rules e.g.
- only one GOBACK per program
- "IF" should be ended with "END-IF"
- avoid dots to end structures
- avoid "GO TO"
- remove unused copybooks
- avoid type conversion for numeric operations
etc.
Back to top
View user's profile Send private message
Mike 1304

New User


Joined: 15 Oct 2011
Posts: 46
Location: Germany

PostPosted: Mon May 27, 2013 6:47 pm
Reply with quote

Pandora-Box wrote:
Should the requirement be achieved without REXX ?


REXX of course is an alternative, but nested COPY->INCLUDE->COPY->INCLUDE and nested COPY REPLACING could be a bit complex.
So I prefer to use an existing solution if available and performant.

I'll test with the compiler...
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: Mon May 27, 2013 7:37 pm
Reply with quote

I'd only use the compiler. It is the only guarantee that the output is the same.

I'd even now consider the full compile, having seen what you have to do, and work from the listings. They will have done much that would aid you.

- only one GOBACK per program

The VBREF will produce a count of these.

- "IF" should be ended with "END-IF"

Assuming this is "conditional-construct should be terminated with scope-delimiter", the "level" marker the compiler puts on the listing will tell where a construct ends. You can also take note of the program-indentation as a warning.

- avoid dots to end structures

Same will cover this.

- avoid "GO TO"

There will be a count. There is also a "compiler-information-byte" with a bit which tells you if used (object/load).

- remove unused copybooks

OPT(FULL) will identify all unused 01/77-level data-structures. Also the XREF, on its own, or embedded in the DMAP.

- avoid type conversion for numeric operations

Not sure what you mean by this one. If you mean "more than one conversion of the same data" this is the most complex requirement, as things may be "conditional". At the end of the day, the LIST output will show you it is happening, but how would you completely avoid it anyway?
Back to top
View user's profile Send private message
Mike 1304

New User


Joined: 15 Oct 2011
Posts: 46
Location: Germany

PostPosted: Mon May 27, 2013 7:48 pm
Reply with quote

Sorry Bill,

there is a misunderstanding, I didn't describe my intention detailed enough:

I want to use a professional scanner, i do not want to code the rule checks by myself.
But the professional scanner needs the expanded source code as input, it is not able to resolve COPY or INCLUDE statements.

And I agree with you the compiler will be the safest way.

In addition I read about differences DB2-Precompiler and DB2 Coprocessor.
INCLUDE containing a COPY..REPLACING is treated different

So I think I have to use the DB2-Preprocessor and than the compiler, because we do it in this way in our company.

I hope performance is ok.
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: Mon May 27, 2013 8:00 pm
Reply with quote

OK, got it.

I'd expect performance to beat any other way of doing it, even if the other ways were guaranteed accurate.

Of course, a scrillion programs will take some time :-)

You might want to look at the possibility of compiling more than one at once and splitting the output vs one-at-a-time. I've no idea at all which would be best, but might be worth looking :-)
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue May 28, 2013 3:51 pm
Reply with quote

Mike 1304 wrote:
yes, why?
Because file Manager provides an internal version of the COBOL compiler and this can be of your use - if I understood 'your requirement'.

This compiler is installed into FMN.SFMNMOD1, if your-shop has installed File Manager into the default libraries, with load modules named FMN9xxxx. While working with File-Manger - this 'internal version of the COBOL compiler' can get preference to a supported COBOL compiler available at your shop OR can be saver when a supported COBOL compiler is not available to File Manager. But the File Manager COBOL compiler is a reduced-function compiler and cannot be used to generate executable COBOL programs; however, for your case this sounds suitable.

Keeping that in mind - please try an "online experiment" - create a copybook, having an intentional error, and use "13 Copybook View and Print" option of IBM file manager -- and follow the instructions shown on the screen - it'll show you the compile listing. You can generate a batch Job also.

Hope this helps.
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: Tue May 28, 2013 9:35 pm
Reply with quote

Hello,

Once upon a time there was a product called MetaCOBOL (originally from ADR and then CA). I believe it may now be included in the CHORUS product.

Several places i worked used this to enforce COBOL coding standards.
Back to top
View user's profile Send private message
haimzeevi

New User


Joined: 01 Mar 2010
Posts: 27
Location: Israel

PostPosted: Thu May 30, 2013 5:40 pm
Reply with quote

Hi Mike,
1. I understand you are located in Germany; in our workshop, in Israel, we use a German product named "CC Auditor", by "CC GmbH 2008".
This product is tailored in Endeavor, so during every compile it issues the syntax-checks you've mentioned. Of course, you can set the rules for checks.
You can isshue a check from any editor's command-line, while editting the source-code, as well.
Their website is www.cc-gmbh.de/en/cc-products/cc-auditor

2. Following Bill's post, you can add, easily, a DB2-preprocessor step, prior to the Cobol step, and have the DCLGENs expanded in the source.

3. If you use Expediter / Intertest / any other debugger, you can access the expanded source-code, generated in a previos compile ("Symbolic files"), copy it to your own files, and scan it.
Good luck.
Back to top
View user's profile Send private message
Mike 1304

New User


Joined: 15 Oct 2011
Posts: 46
Location: Germany

PostPosted: Fri May 31, 2013 11:21 am
Reply with quote

Hi haimzeevi

I also want o use CC Auditor, but not on every compile during the day!

I want to scan the code at night only one time for every during the day changed program.

Because CC Auditor offers no function to expand the code (COPY/SQL INCLUDE) I will try to do it using DB2-Precompile and Compile.

Thanks,
Mike
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri May 31, 2013 5:30 pm
Reply with quote

/Start PERSONAL OPINION/

one of the problems with auditing programs is the timing.
if you audit the program after compile at night,
that means the programmer can/could promote the module to production during the day.
Have fun trying to get a new promotion authorized
that will only modify the source in order to comply with 'rules' but not alter object functionality
for a production program.

Either employ the audit program in the sites compile/bind/linkedit JCL
so that if the 'code' exceeds the 'rules',
the job fails
otherwise you will get into pissing contests with managers who have deadlines.


/End PERSONAL OPINION/
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 Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top