View previous topic :: View next topic
|
Author |
Message |
raghavmcs
Active User
Joined: 14 Jul 2005 Posts: 105
|
|
|
|
Dear Experts,
Is there any way to find out the following
I have a program source library which is having only cobol and easytrieve programs in it.
Now i just quickly want to get a count and list of how many of them are cobol and how many are Easytrieve?
I have the some algorithm with me which is as follows
a)Searching on column 8 inside the source library(PDS) if in the next 8 position identification is written its almost safe to conclude that its a cobol program.In this way I can get the Cobol program name .
b)Then we can compare this file with the total number of programs in file to get the Easytrieve programs.
now how to do it in REXX I do not have much clue:-(
Thanks |
|
Back to top |
|
|
jobin thomas
New User
Joined: 19 Aug 2008 Posts: 15 Location: Bangalore
|
|
|
|
Your algorithms sounds fine!
Rexx implementation:-
Code: |
/* rexx */
cobol_pgm_count = 0
easytrieve_count = 0
total_pgm_count = 0
pds = 'CJ1P.AIS.SOURCE' /* your pds here */
/* 1. Get the list of members in a pds */
x = outtrap(mbrs.)
"listds '"pds"' members"
total_pgm_count = mbrs.0 - 6
/* 2. read each member and check whether it's a COBOL pgm or not */
do i = 7 to mbrs.0
call get_count
end
/* 3. Display results */
easytrieve_count = total_pgm_count - cobol_pgm_count
Say "Total Members : " total_pgm_count
Say "COBOL Source : " cobol_pgm_count
Say "EasyTrieve PGM : " easytrieve_count
exit
/* Subroutine to read the member and check if cobol */
/* Assumption: Reading just the first line of COBOL program
to check whether it got "IDENTIFICATION DIVISION" */
get_count:
mem = strip(mbrs.i)
pdsmem = "'"||pds || "("||mem||")"||"'"
"alloc da("pdsmem") f(mylist1) shr reuse"
"execio 1 diskr mylist1(stem inlist1. finis"
"free dd(mylist1)"
if pos("IDENTIFICATION", inlist1.1) > 0 &,
pos("DIVISION", inlist1.1) > 0 then
cobol_pgm_count = cobol_pgm_count + 1
else nop
return |
|
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Jobin,
'ID DIVISION' is also acceptable syntax. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
There is also no requirement that the id/identification division statement be the first line of code in the source member. . . Compiler directives and comments are also sometimes found at the beginning of a module. |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
|
|
|
|
To further complicate matters, remember that in COBOL, whenever one space is allowed, more than one is also allowed. |
|
Back to top |
|
|
jobin thomas
New User
Joined: 19 Aug 2008 Posts: 15 Location: Bangalore
|
|
|
|
Thanks guys for your inputs!
It's all dependent upon the coding pattern followed (ie.., if any coding standards are followed). |
|
Back to top |
|
|
raghavmcs
Active User
Joined: 14 Jul 2005 Posts: 105
|
|
|
|
Thanks Jobin for the implementation.
Thanks a lot |
|
Back to top |
|
|
|