Hi All,
Could anyone tell me how to implement Dynamic Array concept in a cobol programming manner.
I know using OCCURS DEPENDING ON we can implement but I need an example program.
Please help me out in this issue.
Thanks in Adv,
Regards,
Reebahs.
BillyBoyo wrote:It is unusual that it is useful/necessary to store so many records in a Cobol table.
Usually, we design to avoid this happening.
So, setting aside for the moment that you have this as a solution, can you outline your processing for us? We will almost certainly be able to suggest other ways to do it. If we can't, we can make suggestions about how to implement huge tables.
Robert Sample wrote:sethurajan79, Google is your friend. Googling cobol occurs depending on returns 230,000 hits -- several of which on the first page are examples of using OCCURS DEPENDING ON. This is a HELP forum -- it is rare for actual code to be provided unless the person first posts the code they are having trouble with. Asking for code in the way you are doing is not a good thing -- responders on this forum are professionals and expect to be paid for delivering their work product (which is what you are asking for when you ask for code). Unless you're willing to pay for the code (typically rates run about 1000 US dollars or the equivalent in euros per day of coding), don't ask for code on this forum.
Find the Enterprise COBOL for z/OS Application Programming Reference manual for your release of COBOL and check out appendix B, which has the compiler limits. For example, a table cannot exceed 134,217,727 bytes (which is 128 MB minus one byte). It doesn't matter what you do, your table cannot exceed this size, period.
BillyBoyo wrote:In addition to Robert's points:
- You haven't, despite being asked at least twice, provided any information about what it is you want to achieve
- You have already been told how to aquire storage, using Language Environment HEAP storage
- Business solutions are not best served by deciding on a particular technical solution ahead of things and sticking to that come-what-may
It is unlikely that for you, or any other learner, making enormous Cobol tables is a good thing to do, or something that you will do frequently in your later career. When I started out, we had a much smaller limits to program size than there are today, and no direct support for acquiring extra storage (would have to be done via an Assembler sub-program), and the occasions where we considered techniques to do "big" things were rare and specialised.
To design your system/program you need to understand the business requirement and the data. You also have to take into account making your programs robust, understadable, flexible and maintainable.
You cannot just start with the idea "it'll be easy with everything in storage" and toss everything else away. It is a bad approach. By the time you have a task which requires "out of the ordinary" techniques, you will have at least several years experience, and perhaps many, and you would have ideas about how to do it yourself.
For a beginner, concentrate on writing good programs. The more time you spend on the design, the more open you keep your mind, the better the solution you arrive at will be. The program/system will be easier to understand, debug, test, prove, implement, support, amend and maintain - and it will serve the business requirement. All of these things are of the highest importance, and knowing how to make an enormous table just in case you genuinely need it in five years' time is of no importance.
If you were to describe to us what needs to be done, I am 99.99% certain that a huge table would not be the solution which best meets the above. If it happened to be so, I don't think it is a task for a beginner.
I'm not trying to say that the code is at all difficult, I'm saying that it is a bad solution. If the data is such that you cannot avoid a huge table, then I'm saying that the task is too complex itself (in that it is not open to a more usual solution) for a beginner.
"Business progamming" is very different from a university IT course. You are part of a team, and you do things the way everyone else does them. You do things the way the business requirment dictates, and according to the local "standards".
If you, or any other beginner, were to proceed with your expected solution don't be surprised if it is "bounced" at any sort of "code review" or even that Production Control or Production Support refuse to allow it to proceed.
So, no, I'm not going to show you how to do it. It is simple enough coding that you can achieve your aim through research. Other than a knowledge exercise, I hope you don't do it.
If you want some ideas about how to implement, let us know what you need to achieve, and the problems you are having envisaging how to do it.