Looping logic in reading COBOL programs dump



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Looping logic in reading COBOL programs dump

Postby srikkanth.lovable » Thu Mar 31, 2011 12:10 am

Folks,

I have a different requirement in which the program should read an input file which consists of hundreds to COBOL programs ( DUMP ). The loop should be written in such a way that the one single iteration is until it finds next IDENTIFICATION DIVISION in the dump file.

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

Re: Looping logic in reading COBOL programs dump

Postby Robert Sample » Thu Mar 31, 2011 12:23 am

What if the program has ID DIVISION instead of IDENTIFICATION DIVISION?

And what do you mean by "single iteration"? I don't think you've defined the requirements nearly enough to do anything, much less pose the question on this forum.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Looping logic in reading COBOL programs dump

Postby srikkanth.lovable » Thu Mar 31, 2011 12:47 am

Thank you for response Robert.

I tell u . I need to read a dump file ( seris of cobol programs one after another ) and find corresponding prog id , copybooks and delgen in an output file.

For eg: C means copybook and D means DCLGEN
PROG1 COPY123 C
PROG1 DRCLAIMD D
PROG2 COPY345 C
PROG3 DRCLATT D
--------------
---------

Note: The copybook or dclgen in the dump file can start from any position from 8 and of any length ( 3 to 8 bytes)

Hope you got it.
srikkanth.lovable
 
Posts: 12
Joined: Wed Mar 16, 2011 12:34 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Looping logic in reading COBOL programs dump

Postby enrico-sorichetti » Thu Mar 31, 2011 1:25 am

where do You have issues, with the logic or with the coding ???

does not seem overly complicated ...
start reading
when You find a <identification division> save the program name
when You find a copy/include spit out the saved program name and the copybook name
keep reading
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: Looping logic in reading COBOL programs dump

Postby srikkanth.lovable » Thu Mar 31, 2011 2:51 am

I mean the code...
srikkanth.lovable
 
Posts: 12
Joined: Wed Mar 16, 2011 12:34 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Looping logic in reading COBOL programs dump

Postby BillyBoyo » Thu Mar 31, 2011 3:05 am

You are able to read a file and write to a new file? So that is the basic part of your program.

Then you need to decide how to identify, from all the records you have read, which ones you want to process.

So, think how you would find the IDENTIFICATION DIVISION. As Robert pointed out, remember that you don't have to spell IDENTIFICATION, you can shorten it to ID (I always did, it makes the program look so much neater).

Generally there is a place you would expect to find this starting (I'm not doing the whole job for you). When you identify it, follow enrico's advice.

You have now provided a little more information on your copybook or dclgen. When you identify them, again follow enrico's advice.

So, how to find them. You have mentioned UNSTRING. OK, you should be able to get it to work. Look it up in the manual. Try to understand it. Try some examples. Make sure you know how it is handling "leading space" - the space at the start of each line. Then transfer the code idea to your reading/writing program.

It'll be a very, very, basic thing. Is this a training task? Or does it have some deeper purpose?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post