View previous topic :: View next topic
|
Author |
Message |
Mike 1304
New User
Joined: 15 Oct 2011 Posts: 46 Location: Germany
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
Do you've IBM File-Manager available? |
|
Back to top |
|
|
Mike 1304
New User
Joined: 15 Oct 2011 Posts: 46 Location: Germany
|
|
|
|
yes, why? |
|
Back to top |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1205 Location: Dublin, Ireland
|
|
Back to top |
|
|
Mike 1304
New User
Joined: 15 Oct 2011 Posts: 46 Location: Germany
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Should the requirement be achieved without REXX ? |
|
Back to top |
|
|
Mike 1304
New User
Joined: 15 Oct 2011 Posts: 46 Location: Germany
|
|
|
|
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 |
|
|
Mike 1304
New User
Joined: 15 Oct 2011 Posts: 46 Location: Germany
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Mike 1304
New User
Joined: 15 Oct 2011 Posts: 46 Location: Germany
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
haimzeevi
New User
Joined: 01 Mar 2010 Posts: 27 Location: Israel
|
|
|
|
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 |
|
|
Mike 1304
New User
Joined: 15 Oct 2011 Posts: 46 Location: Germany
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
/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 |
|
|
|