Help with subroutine, can't find fault on calling it.

Posted by OctavioOlguin on 09-Jan-2016 10:00

greetings you all!!!

I have this issue, getting me nuts.

I have a routine that makes the following call.


ON DEFAULT-ACTION OF BROWSE-12 IN FRAME DEFAULT-FRAME /* Paqs. Rechazados */
    DO:
        IF AVAILABLE brCasoPaquete THEN
        DO:
            FILE-INFO:FILE-NAME = "procs\suc\sSuc03002.r".
            IF FILE-INFO:FULL-PATHNAME = ? THEN
            DO:
                MESSAGE "No se encontró: sSuc03002.r"
                    VIEW-AS ALERT-BOX ERROR.
            END.
            
            RUN procs\suc\sSuc03002.w
                (brCasoPaquete.Control#, brCasoPaquete.Nivel, brCasoPaquete.ProdNombre,
                brCasoPaquete.Sucursal, pUsuario, brCasoPaquete.PesoEtiqueta, brCasoPaquete.PesoLlegada, brCasoPaquete.StatusEtiqueta) .

        END.
        CATCH myApp AS Progress.Lang.AppError :
            MESSAGE "Error (Lang.AppError): " myApp:GETmessage(1)
                VIEW-AS ALERT-BOX.
        END CATCH.
        CATCH mySys AS Progress.Lang.SysError :
            MESSAGE "Error (Lang.SysError): " mySys:GETmessage(1)
                VIEW-AS ALERT-BOX.
        END CATCH.
    END.

The problems is I can debug it step by step, but on test runtime it simply crashes with no error message at all,

checked dababases dependencies: ok,   file exist: ok, sending lots of messages box at runtime: done, just the call gets error,

I did try with no-error on the run, checked for thrown events, to no avail.

How could I see the error?

i'm desperado

Thanks.

All Replies

Posted by OctavioOlguin on 09-Jan-2016 10:06

Got it!!!!

just put a

OUTPUT TO c:\tap\temp\t1.txt.

before the calling, and there is the culprit... It breaks for a database connection not present... but this procedure is designed (should be) to be run with out db connected, just it should be calling appserver...

Posted by OctavioOlguin on 09-Jan-2016 10:24

Just can't figure out how can I get this out of the way...

&ANALYZE-SUSPEND _VERSION-NUMBER UIB_v9r12 GUI
&ANALYZE-RESUME
/* Connected Databases 
          dwh              PROGRESS
*/
&Scoped-define WINDOW-NAME CURRENT-WINDOW
&Scoped-define FRAME-NAME Dialog-Frame


/* Temp-Table and Buffer definitions                                    */
DEFINE TEMP-TABLE scrCasoPaqDetalle NO-UNDO LIKE CasoPaqDetalle.



&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Dialog-Frame 
/*-----------------------------------------------------------------------

Defiining the temp-table like some other table, binds the database to the program?

I must have several programa with out this problem... checked internal references to fields from that dataybase, but it seems that not field is referenced...

How should I handle the issue?

The same program that makes the call has the same definition, but it runs with out connection to database...

so it seems the problem come with some operation to a fild from database.. but no evidence of that...

So squared to the first problem...  Totally lost.

Posted by Thomas Mercer-Hursh on 09-Jan-2016 10:37

Naturally, if one defines something LIKE a database table or column, one has a binding to the database.  Often this binding is unnecessary and it is one of the reasons I dislike LIKE, no matter how easy it may be.

Posted by GregHiggins on 09-Jan-2016 10:53

I really don't like this code. (Though don't take offense, I really don't like most code.)

ON DEFAULT-ACTION OF BROWSE-12 IN FRAME DEFAULT-FRAME /* Paqs. Rechazados */

   DO:

       IF AVAILABLE brCasoPaquete THEN DO  on error undo, throw on quit undo, throw on stop undo, throw:

           FILE-INFO:FILE-NAME = "procs\suc\sSuc03002.r".

           IF FILE-INFO:FULL-PATHNAME gt "" THEN  RUN procs\suc\sSuc03002.w (brCasoPaquete.Control#,

                                                                                                    brCasoPaquete.Nivel, brCasoPaquete.ProdNombre,

                                                                                                    brCasoPaquete.Sucursal, pUsuario,

                                                                                                    brCasoPaquete.PesoEtiqueta, brCasoPaquete.PesoLlegada,

                                                                                                    brCasoPaquete.StatusEtiqueta) .

           else undo, throw new AppError ( "No se encontró: sSuc03002.r" ).

           CATCH myApp AS Progress.Lang.AppError :

              MESSAGE "Error (Lang.AppError): " myApp:GETmessage(1)

                  VIEW-AS ALERT-BOX.

           END CATCH.

           CATCH mySys AS Progress.Lang.SysError :

               MESSAGE "Error (Lang.SysError): " mySys:GETmessage(1)

                   VIEW-AS ALERT-BOX.

            END CATCH.

       END /* if available ... */.

   END /* on default ... */.

Posted by OctavioOlguin on 09-Jan-2016 11:04

Thanks!!!  I'll check ths out, !!!!

You just improved a lot my knowledge.!!!

Posted by OctavioOlguin on 09-Jan-2016 11:20

Just one problem....

It throws compile error (14131)  about THROW:

THROW may be specified only on the ON ERROR phrase. (14131)

so I changed to

DO ON ERROR UNDO, THROW

           ON QUIT UNDO, LEAVE

           ON STOP UNDO, LEAVE:

You think is best?

Also had to prepend Progress.Lang. to the undo, throw new AppError("...  I guess is some missconfiguration on my propath?

Thanks!!!

Posted by ske on 09-Jan-2016 12:37

> Naturally, if one defines something LIKE a database table or column, one has a binding to the database.

That's a bit oversimplified. LIKE requires the database to be connected when compiling, but the resulting r-code can run perfectly fine without the database if it doesn't access the database in any other way.

Many times though, the LIKE'd definitions may include such further references, e.g in VALIDATE expressions, and then it will not run without the database.

Posted by OctavioOlguin on 09-Jan-2016 13:37

Indeed...

I wondered why some other screens with the same config ran ok, but this particular one, won't...

After reducing lots of instructions, I found the culprit_   a CAN-DO("F,C,R") that sould have being : CAN-DO("F,C,R", vFlag)

This thread is closed