Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hello all, I want to somehow pro

Status
Not open for further replies.

tbt102

Programmer
Jan 1, 2002
61
US
Hello all,

I want to somehow programmatically extract rules from my COBOL programs so I can load them to a database. The environment is COBOL LE / DB2 / CICS on an OS/390.

In addition I want to programmatically identify any copybook fields involved with each rule found. See example below.

I'm sure I can get this done by recompiling my programs with various options and scanning the output with REXX.


Questions
-----------
o Does anyone know of a tool that will do this for me?
o Would someone advise me on what compile option I
should use to get this done?
o Has anyone done something like this and would not object
to sharing the experience?

Thanks in advance for any help.

tbt102


Example
----------
WORKING STORAGE
01 WS-TEST-CASE PIC X(01) VALUE 'Y'
01 WS-OK PIC X(02) VALUE 'OK'
01 WS-NA PIC X(02) VALUE 'NA'

COPY CPYBOOKA
01 FIELD-A PIC X(01)
01 FIELD-B PIC X(02)


PROCEDURE DIVISION
IF FIELD-A = WS-TEST-CASE
MOVE WS-OK TO FIELD-B
ELSE
MOVE WS-NA TO FIELD-B
END-IF

Expected output
------------------
Rule Action
IF FIELD-A = WS-TEST-CASE MOVE WS-OK TO CPYBOOKA.FIELD-B
ELSE MOVE WS-NA TO CPYBOOKA.FIELD-B
 
Hi,

The qualifier you use in CPYBOOKA.FIELD-B is in COBOL:

FIELD-B IN CPYBOOKA

For the rest it looks ok.

Regards,

Crox
 
Corx,

'FIELD-B IN CPYBOOKA' is not in my compile listing. Do I need a particular compile option?

tbt102
 
Hi,

Sorry that I didn't make it clear.

If FIELD-B is unique in your source, you don't need a qualifier.

If it is part of something - not a copymember but part of some record description at say 01 level - you can qualify.

In the example there are two things:

1) there is some qualification like CPYBOOKA.FIELD-B

2) there is a description of a unique field FIELD-B.

According to 1) you want to qualify

According to 2) you don't need and even cannot qualify.

So identifier CPYBOOKA.FIELD-B can have the name FIELD-B.

That will probably work ok.

Regards,

Crox



 
Hi tbt,

I'm not sure I understand what you're looking for. If you need to know what copybook a given field referenced in the PD comes from, there's no way to discern that from the PD stmt.

You may be able to logically connect them using multiple passes in your REXX routine, by isolating PD referenced fields in the copybook expansions of the compiler listing.

You may want to try Someone there may know of some software that meets your needs.


Jack
 
Usually the copybook is not in the program.

The source code will read

COPY XXXXXX EXCLUDE

If you take the "EXCLUDE" off and recompile it will print the copybook.

It may be possible to compile just the copybook in the test system without catalogging using full map to get an idea how complex the files are. All you do is make up a program shell and compile just the copybook in working storage or where ever appropriate. A program could have lots of copybooks. VM MAY HAVE DD file definitions or a utility to read them while VSE may not.

If you talk to the system admin people they probably have a library routine that will print the copy book.

It may be possible to use a utility like File Aid to tell you the size of the data in the file.

The major problem is when you run into occurs or repeating groups which will not translate well into a table in a database. It the case of repeating groups you will need to split the files up into several tables. That is where the logic has to come into play. Numbers are probably stored differently in a DB also.

Maybe you should try a database utility and not a COBOL utility. A Utility will not do it all, it will require a little logic and planning to come up with a good DB model. Now is the time to make the improvements in how you look at the data. Other things can cause problems like redefines and multiple File Keys which will be needed as indexes for fast data access.

You are not going to get any utility to define the business rules. That is the job of the Analyst. There is no real magical solution. This is the time when a slight change in the business rules can save you money and time or many problems down the road. If you do not like my post feel free to point out your opinion or my errors.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top