I have a source code and need to split the source code file in to 2 files.
1 containg all the records from the source code until procedure division and the other has to contain all the records after procedure division.
From the first file need to extarct the program name and from the second file i need to extarct all the paragraph names and write the PGM name as the first record and the paragraph names following it in to single file.
I have some more modification to the same requirement.kindly help me in resolving this.
The requirement is as below.
I have a source code pgm as an I/P.
In one o/P file the entire source code has to be modified by introducing display statements of the paragraph name in to the source code after the start of each paragraph.
In other o/P file, have to extract the PGM name and all the paragraph names from the source PGM.
For eg:
Source code:
Id division
program-id PGMNAM
.
Data division
.
working storage
.
Procedure division
.
.
Main-Para
..
Initialize-para
..
sub-routine-para
O/P File 1:
Id division
program-id PGMNAM
.
Data division
.
working storage
.
Procedure division
.
.
Main-Para
Display 'MAIN-PARA'
..
Initialize-para
DISPLAY 'INITIALIZE-PARA'
..
sub-routine-para
DISPLAY 'SUB-ROUTINE-PARA'
The resolution which I have is completing the requirement in 3 steps
Step 1:
splitting the source I/P file in to 2 ( file 1 all the statements before PROCEDURE division and file 2 statements after PROCEDURE DIVISION) and getting the PGM name and Paragraphs name (as you suggested that it can be done with out splitting the file).
Step 2:
Introducing display statements in the splitted second file by using '/' operator.
Step 3:
Merging the file 1 from step 1 and output file of step 3.