I am beginner to COBOL and I am trying to learn the COBOL by my self.
I want to call a module so I can get a variable ”LOOK90-CODE ”from the copybook. I want to read the content of the table and check if ”LOOK90-CODE=50”, if true then I want to write the content of the table to a record.
I have declared a cursor for this table, but I don't know how to write this code using a variable from a copybook so that I can check the condition. Can someone please explain to me what to do. My code can print a report and I can fetch the content of the table.
Wel, I do not understand what you mean here. Presumably in you WORKINGSTORAGE you have a statement like COPY copybook-member? This tells the (pre)compiler to copy the code from the copybook into your source code before it compiles it as one unit.
[quote="NicC"][quote]”LOOK90-CODE ”from the copybook[/quote]
Wel, I do not understand what you mean here. Presumably in you WORKINGSTORAGE you have a statement like COPY copybook-member? This tells the (pre)compiler to copy the code from the copybook into your source code before it compiles it as one unit.[/quote]
[quote]
Thanks for your answer.
I have ”LOOK90-CODE ” in my copybook in theWORKINGSTORAGE. I want to write the table(the content of the cursor) to a record. Only when "LOOK90-CODE=50"
What I don't understand is how will my table know when "LOOK90-CODE=50" since the varable "LOOK90-CODE" only is in my copybook and not in my table. What are the connections between the two?
I think you should also forget about "COPYBOOK" - once compiled all the code is in one member per module - all copybook stff is inline. There is nothing special about copybook code except you can include the same code in many modules but only write it once.
NicC wrote:I think you should also forget about "COPYBOOK" - once compiled all the code is in one member per module - all copybook stff is inline. There is nothing special about copybook code except you can include the same code in many modules but only write it once.
Thanks so much for your answers.
I am learning COBOL by my own. Sometimes it feels like I lack some basic knowledge.
I have learned a lot of your answers.
As a beginner myself I have "COBOL for Dummies" sitting on my desk a good basic intro. It also came with free compilers for COBOL on windoze. It may now be out of print but second-hand copies may be available. I have not searched the web for COBOL tutorials but I know such things exist for C and SQL (because I use them!). There are other books on COBOL - Stern and Stern, Murach etc but may be expensive (if new). Free compilers are available on the web. The Open (now GNU) COBOL documentation is supposed to be pretty good. If all else fails - the IBM manuals (language reference and User guide) are freely available.