ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Generated SQL has control break

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Generated SQL has control break

    Here's (part of) the source code:
    PHP Code:
         IFBKREFI
         I                                          BKI5CD        L2
         I                                          BKI6CD        L2
         I
         C     BLKEY         KLIST
         C                   KFLD                    AdminID
         C                   KFLD                    ExchType
         C                   KFLD                    BKI5CD
         C                   KFLD                    BKI6CD
         C
         C
    *   1st recorddrop all records from new file
         C                   
    If        First = *blanks
         C
    /EXEC SQL
         C
    +  Delete from CURRENCY
         C
    /END-EXEC
         C
         C
    /EXEC SQL COMMIT
         C
    /END-EXEC
         C                   
    Eval      First 'X'
         
    C                   EndIf 
    Here's the compiler listing:

    PHP Code:
    000521 C                   If        First = *blanks                              
    000522 C
    *EXEC SQL                                                                 
    000523 C
    *  Delete from CURRENCY                                                   
    000524 C
    *END-EXEC                                                                 
    000522 CL                  Z
    -ADD     1             SQLER6                         
    ======> aa                                                                        
    *RNF5001 20 a      000522  Control-Level entry is not validdefaults to previous 
                               control level
    .                                         
    000522 CL                  CALL      SQLROUTE                                     
    ======> aa                                                                        
    *RNF5001 20 a      000522  Control-Level entry is not validdefaults to previous 
                               control level
    .                                         
    000522 CL                  PARM                    SQLCA                          
    ======> aa                                                                        
    *RNF5001 20 a      000522  Control-Level entry is not validdefaults to previous 
                               control level
    .                                         
    000525 C 
    So.... what's with the control level "L " in the generated source ?

    I moved the SQL inside a subr, and compiled ok - but I shouldn't have to.

  • #2
    Re: Generated SQL has control break

    It heard us making fun of the Control Break & MR indicators as well as the GOTO and CAB opcodes. Be careful .. you just might see a GOTO statement show up in your next compile.

    Comment


    • #3
      Re: Generated SQL has control break

      Ok, I haven't used CAB ever, and I haven't used MR in a couple of decades. But in the right place (such as reading an entire file by key), I will use Primary files and (gasp) maybe even a level break.

      Advantages: 1. Runs a micro-second faster 2. Saves lines of code (LOC is lower!) 3. Confuses the hell out of former Java programmers and RPG newbies.

      In fact, I've been known to use a GOTO/TAG. Used carefully (I see both on the same page), they can acually be less confusing that multiple imbedded DO loops.

      Wait a minute ..... I have to go flip a burger.

      Comment


      • #4
        Re: Generated SQL has control break

        let me know if you need anyone to skate around your diner and deliver those hamburgers ..... I think I may be available soon

        I use the primary all the time but havnt used the level breaks in a while.
        All my answers were extracted from the "Big Dummy's Guide to the As400"
        and I take no responsibility for any of them.

        www.code400.com

        Comment


        • #5
          Re: Generated SQL has control break

          Just getting ready for when RPG is dead! I read an article in an old Information Week magazine where John Dvorak stated RPG and COBOL were already dead programming languages becuase they wouldn't run under Windows 3.1 or DOS !

          So... I'll be ready.

          Still ..... I don't like my (new) SQL causing problems wit the (old) level breaks. Interesting part is this pgm compiled no problem under V5R3, but fails under V5R4. Hmm ....

          Comment


          • #6
            Re: Generated SQL has control break

            It's a conspiracy I tell ya!!

            Has to have something to do with looking for WMD's I'm sure!

            Comment

            Working...
            X