Code Comments
Programming Forum and web based access to our favorite programming groups.This problem is driving us crazy. We have embedded SQL in our COBOL program. When the beginning of the PROCEDURE DIVISION looks like this: PROCEDURE DIVISION. EXEC SQL WHENEVER SQLWARNING CONTINUE END-EXEC. MAINLINE. The compiler will complain that MAINLINE is an unknown verb. When we comment out the EXEC SQL code before the paragraph name, it compiled fine. When we commented out the paragraph name, it compiled fine. When we insert any COBOL verb in between the EXEC SQL statement and MAINLINE paragraph, it compiles fine. Why is the compiler complaining when the EXEC SQL statement is followed by the MAILINE paragraph? I tried this in mainframe and it didn't have any problem with it. It's only with MICROFOCUS. Did anybody encounter this before? Can anybody here help us with this? By the way, here's the directive we are using: CASE ANS85 VSC2 OSVS NOTRUNC DEFFILETYPE"NT" DEFFILE OUTDD"$MYDIR\OUT.TXT" p(cobsql) csqlt=syb c2s verbose end-c -a -m p(cp) sy endp Can anybody help me? Thanks.
Post Follow-up to this message"LX-i" <lxi0007@netscape.net> wrote in message news:G860d.48168$5s3.38133@fe40.usenetserver.com... > kigs wrote: > Aha - another "pointy hair" problem. > Point him to this newsgroup. As is reiterated here over and over, one > person's experience doth not universal truth make. :) I was going to > suggest the same thing, but I saw 4 other people had suggested it already. > > (The problem, I'd bet, is in the precompiler; as such, they often are > unknowledgeable on the finer points of COBOL. Also, though, I'm not > sure it's standard to omit one paragraph name, then put another in.) > > -- > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~ > ~ / \ / ~ Live from Montgomery, AL! ~ > ~ / \/ o ~ ~ > ~ / /\ - | ~ LXi0007@Netscape.net ~ > ~ _____ / \ | ~ http://www.knology.net/~mopsmom/daniel ~ > ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ > ~ I do not read e-mail at the above address ~ > ~ Please see website if you wish to contact me privately ~ > ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ > ~ GEEKCODE 3.12 GCS/IT d s-:+ a C++ L++ E--- W++ N++ o? K- w$ ~ > ~ !O M-- V PS+ PE++ Y? !PGP t+ 5? X+ R* tv b+ DI++ D+ G- e ~ > ~ h---- r+++ z++++ ~ > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~ >
Post Follow-up to this messageint_21h@yahoo.com (kigs) wrote > This problem is driving us crazy. We have embedded SQL in our COBOL > program. When the beginning of the PROCEDURE DIVISION looks like > this: > > PROCEDURE DIVISION. > EXEC SQL WHENEVER SQLWARNING CONTINUE END-EXEC. > MAINLINE. > > The compiler will complain that MAINLINE is an unknown verb. What happens if you put a paragraph name before the EXEC ?
Post Follow-up to this messageOn 8 Sep 2004 19:32:44 -0700, int_21h@yahoo.com (kigs) wrote: >Thanks for the response guys. But even though putting the paragraph >name before the EXEC works fine, our PM wants the code to have the >EXEC SQL WHENEVER... statement first, then the paragraph name. He >claims that it worked on the other work site, and it should work here >as well. I know better than to argue. Try putting a period-space in front of MAINLINE.
Post Follow-up to this message> This problem is driving us crazy. We have embedded SQL in our COBOL > program. When the beginning of the PROCEDURE DIVISION looks like > this: > > PROCEDURE DIVISION. > EXEC SQL WHENEVER SQLWARNING CONTINUE END-EXEC. > MAINLINE. > > The compiler will complain that MAINLINE is an unknown verb. Doesn't the first "thing" after "PROCEDURE DIVISION" need to be a paragraph name? When the EXEC SQL is expanded, it's probably a bunch of MOVE and CALL statements without a paragraph name..... So try this.... PROCEDURE DIVISION. MAINLINE. EXEC SQL WHENEVER SQLWARNING CONTINUE END-EXEC. .. which should result in the same execution path... MCM
Post Follow-up to this messageOn 8 Sep 2004 03:16:14 -0700, int_21h@yahoo.com (kigs) wrote: >This problem is driving us crazy. We have embedded SQL in our COBOL >program. When the beginning of the PROCEDURE DIVISION looks like >this: > > PROCEDURE DIVISION. > EXEC SQL WHENEVER SQLWARNING CONTINUE END-EXEC. > MAINLINE. > >The compiler will complain that MAINLINE is an unknown verb. When we >comment out the EXEC SQL code before the paragraph name, it compiled >fine. When we commented out the paragraph name, it compiled fine. >When we insert any COBOL verb in between the EXEC SQL statement and >MAINLINE paragraph, it compiles fine. Why is the compiler complaining >when the EXEC SQL statement is followed by the MAILINE paragraph? I >tried this in mainframe and it didn't have any problem with it. It's >only with MICROFOCUS. Did anybody encounter this before? Can anybody >here help us with this? The culpret is the Pro*Cobol precompiler, not Micro Focus. Looking at the intermediate .cob file should reveal the answer. I'd first suspect a missing period or something else on the last line of generated code. Although Micro Focus doesn't require a paragraph name after the procedure division header, Pro*Cobol probably does. Try putting MAINLINE before the EXEC SQL.
Post Follow-up to this messageThanks for the response guys. But even though putting the paragraph name before the EXEC works fine, our PM wants the code to have the EXEC SQL WHENEVER... statement first, then the paragraph name. He claims that it worked on the other work site, and it should work here as well. I know better than to argue. I tried registering in microfocus.com but I don't have the our serial number, and I'm being asked for it.
Post Follow-up to this messageint_21h@yahoo.com (kigs) wrote: >Thanks for the response guys. But even though putting the paragraph >name before the EXEC works fine, our PM wants the code to have the >EXEC SQL WHENEVER... statement first, then the paragraph name. He >claims that it worked on the other work site, and it should work here >as well. I know better than to argue. COBOL requires each paragraph to have a name. Permitting an unnamed paragraph is an IBM extension[1]. If you insist on writing code that violates standards, you can reasonably expect to get bitten by occasional problems generated by that approach. -- Ron (user ron in domain spamblocked.com) [1] http://publib.boulder.ibm.com/infoc...ext. htm see the part "Procedure division"
Post Follow-up to this messageOn Thu, 09 Sep 2004 08:40:57 -0400, Ron <ron@address.below> wrote: > COBOL requires each paragraph to have a name. Permitting an >unnamed paragraph is an IBM extension[1]. If you insist on >writing code that violates standards, you can reasonably expect >to get bitten by occasional problems generated by that approach. The 2002 standard does not require a name on the first paragraph.
Post Follow-up to this messageRobert, To bad you cut out the context of my post - which was: > > The 2002 standard does not require a name on the first paragraph. You'll notice that your comment about the 2002 Standard was in reply to anot her comment about "writing code that violates standards" I'll stand by my response being responsive (in context) -- Bill Klein wmklein <at> ix.netcom.com "Robert Wagner" <robert@wagner.net.yourmammaharvests> wrote in message news:gvn1k09bt07p7iiv7dblkg07auil06uoik@ 4ax.com... > On Thu, 09 Sep 2004 18:26:10 GMT, "William M. Klein" > <wmklein@nospam.netcom.com> wrote: > > > The original posting didn't say the compiler was in > standard-conforming mode. In default mode, which is far more common, > existing compilers from IBM, Micro Focus and Realia don't require a > paragraph name after the procedure division header. I didn't try > Fujitsu. The manual says it is required except in this case: > > "In this implementation of COBOL, if all of the procedure division > statements are sequentially executed or in-line (using the xxx/END-xxx > structure), the names of sections and paragraphs in the PROCEDURE > DIVISION may be omitted. " > > Realia fails when there are no paragraph names. Putting one at the > bottom makes it happy. >
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.