Flow chart of Cobol program in dotNet
1. How to reposition the pointer
We are developing a program in dotNet to plot a flow chart for a COBOL program which is considered as the input file.
The idea is, the dot net program should plot the symbols according to the COBOL verb. For example when the program come across a verb, READ, it draws a parallelogram, when it come across a MOVE statement, it draws a rectangle, and when it come across an 'IF' or 'PERFORM UNTIL' it plots a decision box. We are able to plot the things properly when all the code is purely sequential.
Now the situation is we can have many paragraphs calling from the main paragraph. In this case code is not sequential. Here is an example.
Cobol code
------------------------------------------------------------
procedure division.
a000-main-para.
perform b000-accept-para.
perform c000-calculate-para.
perform d000-result-para.
stop run.
b000-accept-para.
display "enter the value of x and n".
accept ws-x-e.
accept ws-n.
c000-calculate-para.
move ws-x-e to ws-x.
perform c100-mult-term-para varying ws-i from 1 by 1
until ws-i > ws-n.
c100-mult-term-para.
compute ws-temp = ws-temp * ws-x / ws-i.
compute ws-result = ws-result + ws-temp.
d000-result-para.
display ws-result.
move ws-result to ws-result-e.
display ws-result-e.
-----------------------------------------------------
Question is, control first comes to the PERFORM
a000-main-para.
Then we can write the logic to find an equivalent term for b000-accept-para, and control goes to the actual b000-accept-para. We can plot everything mentioned in b000-accept-para. That is
display "enter the value of x and n".
accept ws-x-e.
accept ws-n.
But next, the control have to go back to the next perform in the main para. That is "perform c000-calculate-para". This is going back to position in the top. How we can do this reposition of the pointer in dotNET..?
Thanks
Soans
|