OpenCOBOL Forum Index OpenCOBOL
COBOL question: use of "through" in if/when/until... | Register To Post |
| Threaded | Oldest First | Previous Topic | Next Topic | Bottom |
| Poster | Thread |
|---|---|
| human | Posted on: 2008/7/19 1:58 |
Home away from home ![]() ![]() Joined: 2007/5/15 From: GERMANY Posts: 1416 |
Re: COBOL question: use of "through" in if/when/until... @aoirthoir: As I said there are different parts of myvar that need to be checked together. All in all I want to have nicer variants than evaluate all different versions, so I did
What I can think of now is to maybe replace the second evaluate (evaluate true) against I'd just searched for a nice way to evaluate different substrings of one string in multiple combinations but it seem like the only fine variant is the beginning code. The only thing that can maybe be solved is question two Quote: human wrote: |
| aoirthoir | Posted on: 2008/7/18 9:13 |
Home away from home ![]() ![]() Joined: 2007/4/16 From: Cleveland Ohio Posts: 321 |
Re: COBOL question: use of "through" in if/when/until... 1. The answer is yes:
EVALUATE myvar WHEN 1 Through 12 But as Roger said you still have to explain the actual problem you are trying to solve. Rather you're trying to explain one method you are using to solve the problem. |
| simrw | Posted on: 2008/7/18 8:42 |
Webmaster ![]() ![]() Joined: 2005/5/31 From: Bad Soden, Germany Posts: 791 |
Re: COBOL question: use of "through" in if/when/until... Sorry, but you have still not answered the question where and how the data is being interpreted.
This is really totally off-topic for the OC forum. This is a classic case of analysis. Roger |
| human | Posted on: 2008/7/18 8:19 |
Home away from home ![]() ![]() Joined: 2007/5/15 From: GERMANY Posts: 1416 |
Re: COBOL question: use of "through" in if/when/until... Myvar is just a text string of 12 chars. That evaluate is the main section of the program and just do performs of other sections(sometime an index is set before the perform) depending on the content of myvar and it's that big evaluate that seems a little bit ... weird.
Here are the detailed questions: 1. Concerning the "special cases" (2nd part of posted code): Is there any possibility for asking (if a = '01' through '12') without multiple 88 levels? It seems like: no. 2. Concerning the "different cases" (1st part of posted code): Is it faster/slower to have multiple 88er levels and do an evaluate true / when case1 / when case2 / ... than to do an evaluate myvar / when "string1" / when "string2"? PS: I'm not paid for thinking of how to rearrange such cobol structures, but I would like to have a better solution than the actual code (that you've indeed seen, only the names are a bit different and some other when / performs are did in the same way I have posted.) Maybe there are some other ideas but I think question 1 is solved. What about question 2? |
| aoirthoir | Posted on: 2008/7/18 7:27 |
Home away from home ![]() ![]() Joined: 2007/4/16 From: Cleveland Ohio Posts: 321 |
Re: COBOL question: use of "through" in if/when/until... If you have six hundred cases, is there any kind of commonality that you can reduce down?
eg. If I were trying to convert 1 to one, 2 to two etc..I could reduce that down. So as Roger said, if we understood the actual problem first, then perhaps a particular solution could be coded. What does myvar represent? |
| simrw | Posted on: 2008/7/18 7:25 |
Webmaster ![]() ![]() Joined: 2005/5/31 From: Bad Soden, Germany Posts: 791 |
Re: COBOL question: use of "through" in if/when/until... Nice :-)
But you still have not posted the actual case :-) This is most definitely an analysis/design problem. Start with a flow-chart. Then try to do a normal reduction on that. I repeat, this is not a Cobol problem. You would have the same decisions in any language. And no, we are not going to do your (maybe paid for) coding for you :-) Of course, for any project, I am available for hire :-) Roger |
| human | Posted on: 2008/7/18 6:31 |
Home away from home ![]() ![]() Joined: 2007/5/15 From: GERMANY Posts: 1416 |
Re: COBOL question: use of "through" in if/when/until... Thank you for your replies and thoughts. This is a small capture of the whole thing:
The things like that should be replaced for '01' or '02' or '03' or ... or '10' and for '12' or '13' or ... or '45' So putting different 88er vars (value '01' thru '12'...) for the different parts of myvar is indeed possible, but I'm not sure if this is kind of code would be easy readable and fast working code. I've event thought about putting the about 600 different "easy" cases as seen above to 88 vars and do evaluate true from the beginning. Would this be easier to read / would it work faster at all? I'm quite unsure what to do about the 30 special cases... |
| simrw | Posted on: 2008/7/18 5:44 |
Webmaster ![]() ![]() Joined: 2005/5/31 From: Bad Soden, Germany Posts: 791 |
Re: COBOL question: use of "through" in if/when/until... This looks like a analysis/design problem, not
a Cobol problem. Post exactly what you are trying to do. Some possibilities/hints - Look at the ALSO phrase within EVALUATE. Make your reference-modification variable. ie. mytext (mystart : mylength) and then EVALUATE on that. Use multiple 88 levels. Combining all the above should get you somewhere. Note, this is only based on what you posted. It might be more interesting to know where and how the contents of mytext are set. Roger |
| btiffin | Posted on: 2008/7/18 5:23 |
Home away from home ![]() ![]() Joined: 2008/6/7 From: CANADA Posts: 1196 |
Re: COBOL question: use of "through" in if/when/until... From what I've read about EVALUATE ALSO, I'll bet you could :)
It might have to include some placeholder truth code but EVALUATE seemed pretty powerful when I read about it yesterday. Not sure if there could be cascade case explosion with OR / AND logic, but I don't think so. And for complex subexpression you could I think. Again, not totally up on the capabilities. Cheers, Brian |
| human | Posted on: 2008/7/18 3:20 |
Home away from home ![]() ![]() Joined: 2007/5/15 From: GERMANY Posts: 1416 |
Re: COBOL question: use of "through" in if/when/until... Thanks for your reply!
Actually this code should be part of a BIGBIGBIG evaluate and I cannot put all the different parts of mytext in the evaluate clause. The compare of some parts of mytext are linked to other vars like |
| (1) 2 » | |
| Threaded | Oldest First | Previous Topic | Next Topic | Top |
| Register To Post | |







