IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Find Comments in cobol by user /system


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Biswajit D

New User


Joined: 17 Apr 2012
Posts: 50
Location: India

PostPosted: Fri May 24, 2013 3:04 pm
Reply with quote

Sample run (copied the example from www.csis.ul.ie/cobol/examples/Accept/Multiplier.htm):
Before
Code:
000000 IDENTIFICATION DIVISION.                                         
000000 PROGRAM-ID.  MULTIPLIER.                                         
000000 AUTHOR.  MICHAEL COUGHLAN.                                       
000000* EXAMPLE PROGRAM USING ACCEPT, DISPLAY AND MULTIPLY TO           
000000* GET TWO SINGLE DIGIT NUMBERS FROM THE USER AND MULTIPLY THEM TO
000000                                                                 
000000 DATA DIVISION.                                                   
000000                                                                 
000000 WORKING-STORAGE SECTION.                                         
000000 01  NUM1                                PIC 9  VALUE ZEROS.     
000000 01  NUM2                                PIC 9  VALUE ZEROS.     
000000 01  RESULT                              PIC 99 VALUE ZEROS.     
000000                                                                 
000000 PROCEDURE DIVISION.                                             
000000     DISPLAY "ENTER FIRST NUMBER  (1 DIGIT) : " WITH NO ADVANCING.
000000     ACCEPT NUM1.                                                 
000000     DISPLAY "ENTER SECOND NUMBER (1 DIGIT) : " WITH NO ADVANCING.
000000     ACCEPT NUM2.                                                 
000000     MULTIPLY Num1 BY Num2 GIVING Result.
000000     DISPLAY "Result is = ", Result.
000000     STOP RUN.
After
Code:
000000 IDENTIFICATION DIVISION.                                         
000000 PROGRAM-ID.  MULTIPLIER.                                         
000000 AUTHOR.  MICHAEL COUGHLAN.                                       
000000* EXAMPLE PROGRAM USING ACCEPT, DISPLAY AND MULTIPLY TO           
000000* GET TWO SINGLE DIGIT NUMBERS FROM THE USER AND MULTIPLY THEM TO
000000                                                                 
000000 DATA DIVISION.                                                   
000000                                                                 
000000 WORKING-STORAGE SECTION.                                         
000000*01  NUM1                                PIC 9  VALUE ZEROS.     
000000 01  NUM1                                PIC 99 VALUE ZEROS.     
000000*01  NUM2     PIC 9  VALUE ZEROS COMMENTING THIS LINE FOR TESTING
000000*01  NUM3                                PIC 9  VALUE ZEROS.     
000000 01  NUM4                                PIC 9  VALUE ZEROS.     
000000 01  OUTPUT-RES                          PIC 99 VALUE ZEROS.     
000000                                                                 
000000 PROCEDURE DIVISION.                                             
000000     DISPLAY "ENTER FIRST NUMBER  (1 DIGIT) : " WITH NO ADVANCING.
000000     ACCEPT NUM1.                                                 
000000     DISPLAY "ENTER SECOND NUMBER (1 DIGIT) : ".                 
000000     ACCEPT NUM4.                                                 
000000*    MULTIPLY NUM1 BY NUM4 GIVING OUTPUT-RES.                     
000000     DIVIDE NUM1 BY NUM4 GIVING OUTPUT-RES.                       
000000     DISPLAY "OUTPUT-RES OF DIFFERENCE IS = ", OUTPUT-RES.       
000000     STOP RUN.                                                     

Output
Code:
--------------------------------------------------------             
KINDLY REPHRASE THESE COMMENTS.                                       
--> *01  NUM1                                PIC 9  VALUE ZEROS.     
--> *01  NUM2     PIC 9  VALUE ZEROS COMMENTING THIS LINE FOR TESTING
--> *01  NUM3                                PIC 9  VALUE ZEROS.     
--> *    MULTIPLY NUM1 BY NUM4 GIVING OUTPUT-RES.                     
--------------------------------------------------------             

KINDLY REPHRASE THESE COMMENTS --> indicates that there is a cobol string in the comment which might be a commented cobol code.

Althought this is day 1 for this report (means lot can be improved), I am requesting you to please suggest any other approach to this. I was going through Backus-Naur Form for cobol and was wondering if implementing that can be acheived thru cobol/rexx/any other language?
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Sysplex System won't IPL at DR site I... All Other Mainframe Topics 2
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts To find whether record count are true... DFSORT/ICETOOL 6
Search our Forums:

Back to Top