Hi All,
I need your help again guys i have a indexed file here Called "CalledProgs", this file stored Program names now i am required to write a program that will loop through all these program names and search for program names stored in each.
Don't be confused these program names also contained different program names stored, i have written a code here below which i used to retrieve these names from an input file called Mainmenu.cbl. now i am required to continue with this code by means of reading this indexed file with was an output file when i was calling for the program names.
now i am tasked to read from each program name the program names written on it and Add to the same output file "CalledProgs".
i hope its clear, below is the program i used to retrieve these called program names that are in the output file.
PROCEDURE DIVISION.
*===================*
*----------------------------------------------------------------
DECLARATIVES.
io-error section.
use after error procedure on
sort-file
Main-out
Mainmenu-Input
Main-ProgCall.
END DECLARATIVES.
*----------------------------------------------------------------*
a100-Main.
*----------
open input MainMenu-Input.
open output Main-out.
open output Main-ProgCall.
if mmStatus > "02"
move "Open input error on Mainmenu" to cdmRecord
move mmStatus to cdmRecord
write cdmRecord.
move zeroes to countRec.
perform a100-read thru a100-exit.
go to a100-close.
a100-close.
*-----------
close
* Sort-file
Main-out
Mainmenu-Input
Main-ProgCall.
Sort Sort-file
ON ASCENDING KEY sortProgName
Using Main-out
giving Main-ProgCall.
a100-read.
*----------
move zeroes to CAll-COUNT.
move zeroes to QouteMM.
move zeroes to wsInvalidCall.
read Mainmenu-Input next at end go to a100-main.
if mmStatus > "02"
go to a100-close.
add 1 to countRec.
* Skip commented parts.
IF mmRecord(7:1)= "*"
go to a100-read.
* validate calls for menus
INSPECT mmRecord Tallying wsInvalidCall for all
wsMenu.
if wsInvalidCall >= 1
go to a100-read.
*//// THIS IS WHERE YOU WILL FIND THE PROG THAT HAS BEEN CALLED
INSPECT mmRecord TALLYING
CALL-COUNT FOR ALL " call ".
IF CALL-COUNT >= 1
PERFORM a100-Search
ELSE
go to a100-read.
a100-exit.
*-----------
exit.
a200-read.
*----------
read Main-out next at end go to a100-close.
if outStatus > "02"
go to a100-close.
a100-Search.
*------------
INSPECT mmRecord Tallying
QouteMM for all wsQoute.
if QouteMM >= 1
* Checking names in Double qoutes
Perform get-Progname
else
go to a100-read.
get-progname.
*--------------
* Retrieve program names and move to indexed file.
unstring mmRecord delimited by wsQoute
into wspart1,wspart2,wspart3.
move wspart2 to Pname.
* Converting all Programe names to Upper-case
call "c$toupper" using Pname
value length of Pname.
move Pname to outProgname.
move "MAINMENU" to outCallingProg.
write outRecord.
go to a100-read.
**==============================================================*
best regards
Zux