norvell@csri.toronto.edu (Theodore Stevens Norvell) (07/26/89)
Perhaps this is not the right newsgroup, but if there is a Cobol group, we don't get it here. (0) Some languages (notably Pascal) allow non-local gotos. That is, gotos that jump out of the current procedure. Does Cobol? If so what is its semantics? For example does the following control structure have a well defined semantics when foo is true? a perform b through c. stop run. b perform d through e. c exit. d if foo then goto c. e exit. What if there is a goto e just before the stop run? Does control pass to c after e?!? By the way, I'm not interested so much in responses like ``Compiler x does y'', but rather ``Standard x mandates y'' or ``Standard x prohibits constructs like this because of rule y''. Of course de-facto standards are also of interest. (1) Is there a ``Harbison and Steele'' of Cobol. That is, a book that thoroughly explains what is and isn't in the language. (Harbison and Steele wrote an excellent book on C aimed at implementors and other people who want to know the details of the language definition. They don't shy away from the dark corners of the language.) The books I've seen get the most vauge, just when clarity is needed the most. All replies, other than those pointing out my syntax errors, are welcome.
diamond@csl.sony.co.jp (Norman Diamond) (07/27/89)
In article <1989Jul25.145219.22172@jarvis.csri.toronto.edu> norvell@csri.toronto.edu (Theodore Stevens Norvell) writes: > By the way, I'm not interested so much in responses like > ``Compiler x does y'', but rather ``Standard x mandates y'' or > ``Standard x prohibits constructs like this because of rule y''. Surely you'd have no problem buying a copy of the Cobol standard from the Canadian Standards Association. It's not as though you were dependant on the kindness of privileged persons to whom Global Engineering Documents condescends to sell a draft copy. -- -- Norman Diamond, Sony Computer Science Lab (diamond%csl.sony.jp@relay.cs.net) The above opinions are inherited by your machine's init process (pid 1), after being disowned and orphaned. However, if you see this at Waterloo or Anterior, then their administrators must have approved of these opinions.
alanf%smile@Sun.COM (Alan Fargusson) (07/28/89)
In article <1989Jul25.145219.22172@jarvis.csri.toronto.edu>, norvell@csri.toronto.edu (Theodore Stevens Norvell) writes: > Perhaps this is not the right newsgroup, but if there is a Cobol group, > we don't get it here. > > (0) Some languages (notably Pascal) allow non-local gotos. That is, gotos > that jump out of the current procedure. Does Cobol? If so what is > its semantics? For example does the following control structure have > a well defined semantics when foo is true? > > a > perform b through c. > stop run. > b > perform d through e. > c > exit. > d > if foo then goto c. > e > exit. > > What if there is a goto e just before the stop run? Does control > pass to c after e?!? > Cobol does not have procedures like Pascal. Basicly you can goto anywhere in the program. However, the standard is not specific enough about the side effects of the perform through. Many compilers will not do the right thing with the above program. They will tend to go into a loop, going back to 'c' and falling into 'd'. - - - - - - - - - - - - - - - - - - - - - Alan Fargusson Sun Microsystems alanf@sun.com ..!sun!alanf
juliar@hpcll17.HP.COM (Julia Rodriguez) (08/05/89)
norvell@csri.toronto.edu (Theodore Stevens Norvell) writes: > > (0) Some languages (notably Pascal) allow non-local gotos. That is, gotos > that jump out of the current procedure. Does Cobol? If so what is > its semantics? For example does the following control structure have > a well defined semantics when foo is true? There are two rules that apply here: 1) If the range of a PERFORM statement includes another PERFORM statement, the sequence of procedures associated with the included PERFORM must itself either be totally included in, or totally excluded from, the logical sequence referred to by the first PERFORM. The example you give below violates this rule. The result of the operation is therefore undefined, as the program is illegal. 2) The range of a PERFORM statement consists logicallof all those statments that are executed as a result of executing the PERFORM statement through execution of implicit transfer of control to the end of the PERFORM statement. The range includes all statement that are executed as the result of transfer of control by CALL, EXIT, GO TO and PERFORM statements in the range of the PERFORM statement. > > a > perform b through c. > stop run. > b > perform d through e. > c > exit. > d > if foo then goto c. > e > exit. > > > By the way, I'm not interested so much in responses like > ``Compiler x does y'', but rather ``Standard x mandates y'' or > ``Standard x prohibits constructs like this because of rule y''. > Of course de-facto standards are also of interest. > > (1) Is there a ``Harbison and Steele'' of Cobol. That is, a book that > thoroughly explains what is and isn't in the language. (Harbison > and Steele wrote an excellent book on C aimed at implementors and > other people who want to know the details of the language definition. > They don't shy away from the dark corners of the language.) The > books I've seen get the most vauge, just when clarity is needed the > most. > The last word on COBOL is the ANSI and ISO standard which are one and the same. The ANSI number is ANSI X3.23-1985 and the ISO number is ISO 1989-1985. The standard is published by the American National Standards Institute. The X3J4 COBOL committee is and ANSI accredited committee. Its tasks are to interpret the current standard and to develop new standards. I represent HP on the X3J4 committee. If you have questions re how to interpret the rules of the standard. Write to the X3J4 care of CBEMA. X3 Secretariat CBEMA 311 First Street, NW Suite 500 Washington, DC 20001-2178 COBOL Information Bulletins are published periodically. They contain the collection of all the interpretations of the standard since the last published CIB. I believe that you can order these from CBEMA as well. Hope this helps, Julia Rodriguez