Aren't comments in column 7?  (Sequence 1-6 Continuation/comment column
7)

 
Frank M. Ramaekers Jr.
 
 
-----Original Message-----
From: The IBM z/VM Operating System [mailto:ib...@listserv.uark.edu] On
Behalf Of Dale R. Smith
Sent: Wednesday, July 07, 2010 12:52 PM
To: IBMVM@LISTSERV.UARK.EDU
Subject: Re: Sample REXX using XEDIT

On Wed, 7 Jul 2010 16:50:29 +0300, Sergio Lima <sergiovm...@hotmail.com>

wrote:

>Hello List,
>
>We need, do here a REXX that will READ a lot of COBOL Programs.
>
>So, must, locate all "CALL" Statements, and think use XEDIT for this.
>
>Someone know, if have a place, or a documentation, for us get a sample 
program?
>
>Thanks
>
>Sergio Lima Costa

Here is a quick and dirty Exec that I just wrote that will be close to 
what you want.  Note that ir will find references to "CALL" that may be
in 
a DISPLAY command as well as the "CALL" instruction.  Here is the Exec:

/*--------------------------------------------------------------------*/
/*                            COBCALL EXEC                            */
/* Scan COBOL Programs and Extract records containing the word "CALL".*/
/*--------------------------------------------------------------------*/
COBCALL:                                                                
   Address COMMAND                                                      
   Parse Source . ctype ename etype emode .                             
   cobcall = ename 'DATA A'                                             
   Arg fm .                                                             
   If fm = '' Then                                                      
      Do                                                                
         Say 'No Filemode Specified.  A Filemode is Required.'          
         Exit 4                                                         
      End                                                               
   'CMDCALL ESTATE * COBOL' fm                                          
   If rc \= 0 Then Exit rc                                              
   'PIPE COMMAND LISTFILE * COBOL' fm '(NOHEADER ISODATE'||,            
      '|CHANGE 68 / /0/|SPECS 1-17 1 W8-9 19|STEM PGM.'                 
   If rc \= 0 Then Exit rc                                              
   'ERASE' cobcall                                                      
   If rc \= 0 & rc \= 28 Then Exit rc                                   
   totcnt = 0                                                           
   Do n = 1 to pgm.0                                                    
      Parse Var pgm.n fn ft date time .                                 
      'PIPE (NAME COBCALL ENDCHAR ?)',                                  
         '| <' fn ft fm,                   /* Read COBOL Program */     
         '| SPECS RECNO 1.6 7-72 8',       /* Record Number, Record */  
         '| NLOCATE 8 /*/',                /* Skip Comments */          
         '| LOCATE ANYCASE 8-* / CALL /',  /* Look for CALL Commands */ 
         '| SPECS /'pgm.n'/ 1 1-* NW',     /* Add File info */          
         '| C: COUNT LINES',               /* Count Records */          
         '| >>' cobcall,                   /* Write to file */          
      '? C:',                                                           
         '| STRLITERAL APPEND /0/',        /* Just in Case */           
         '| VAR RECCNT',                   /* Record Count */           
      '' /* End COBCALL */                                              
      totcnt = totcnt + reccnt                                          
   End /* Do n = 1 to pgm.0 */                                          
   'ESTATE' cobcall                                                     
   If rc \= 0 Then                                                      
      Do                                                                
         Say 'No "CALL" Statements Found in COBOL Programs on',         
             'Filemode' fm'.'                                           
         Exit 12                                                        
      End                                                               
   Say totcnt '"CALL" Statements Found in COBOL Programs on',           
       'Filemode' fm'.'                                                 
   'XEDIT' cobcall '(NOCLEAR'                                           
   Exit rc                                                              

Here is a small sample of output from COBOL Programs on my A-Disk:

IMSMAIN  COBOL    1987-12-03 16:59:18     31      CALL 'IMSSUB'.
IMSMAIN2 COBOL    1987-12-03 16:46:15     31      CALL 'IMSSUB2'.
SQLINIT  COBOL    2009-04-30 11:36:52      4      CALL 'DSNHADDR' USING 
SQL-CODEPTR OF SQL-PLIST12 SQLCA.
SQLINIT  COBOL    2009-04-30 11:36:52      5      DISPLAY 'After DB2
Call  
1 ' SQL-INIT-FLAG
SQLINIT  COBOL    2009-04-30 11:36:52      6      CALL 'DSNHADDR' USING 
SQL-CODEPTR OF SQL-PLIST13 SQLCA.
SQLINIT  COBOL    2009-04-30 11:36:52      7      DISPLAY 'After DB2
Call  
2 ' SQL-INIT-FLAG

Notice the DISPLAY statements.  The Exec makes a lot of assumptions, so 
any changes are left as an exercise to the reader!  :-)>

-- 
Dale R. 
Smith                                                                

_____________________________________________________
This message contains information which is privileged and confidential and is 
solely for the use of the
intended recipient. If you are not the intended recipient, be aware that any 
review, disclosure,
copying, distribution, or use of the contents of this message is strictly 
prohibited. If you have
received this in error, please destroy it immediately and notify us at 
privacy...@ailife.com.

Reply via email to