Parsing COBOL program



Parsing COBOL program

Postby srikkanth.lovable » Mon Mar 28, 2011 2:03 pm

Friends,

Could you please help me in writing a code snippet of the below requirement:

The COBOL program need to read an Input file ( Input file contains a COBOL program) and output file should write the following

Program_id Copybook/ DCLGEN


For Example :
INPUT FILE CONTAINS :

IDENTIFICATION DIVISION.
PROGRAM ID. SAMPLE01.
---------------------
--------------
COPY <XYZ123>
COPY <ABC123>
--------
----


EXEC SQL
INCLUDE <PQRST>
END-SQL

---------
-------


OUTPUT SHOULD BE

OUTPUT

PROGRAM-ID COPYBOOK
SAMPLE01 XYZ123
SAMPLE01 ABC123
SAMPLE01 PQRST

Please advice.
srikkanth.lovable
 
Posts: 12
Joined: Wed Mar 16, 2011 12:34 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Parsing COBOL program

Postby enrico-sorichetti » Mon Mar 28, 2011 3:17 pm

cobol might not be the best language for source program <parsing>
also no need to reinvent the wheel
check the ISPF application "member parts list" ( option 4.12 or 5.12 )
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 3003
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: Parsing COBOL program

Postby BillyBoyo » Mon Mar 28, 2011 3:58 pm

Do you need this for an interview?

Is it a Cobol learnign exercise? If so, there is a Cobol forum. What thoughts do you have about it yourself? Write out in your language for yourself what you think you'd need to do. Then think about how you might do that in Cobol. Then if there is something which you don't understand/doesn't work, come back and explain. You might find helpful bits and pieces if you search the Cobol forum.

If not an exercise in Cobol, take note of enrico's comments.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times


Return to Interview Questions

 


  • Related topics
    Replies
    Views
    Last post