Banco Unix X Aplicação em Windows

Discussão em 'Progress 4GL' iniciado por edu_felix, Agosto 15, 2014.

  1. jaisonantoniazzi

    jaisonantoniazzi Membro Ativo

    Não tenho todas as tabelas para avaliar, mas:
    Na linha

    FOR EACH transf_ped WHERE
    transf_ped.data_pedido >= TODAY - 30 AND
    transf_ped.lj-destino = lojas.lj-codigo AND
    transf_ped.transf_status = "T" NO-LOCK:
    Não há índice apropriado para esta pesquisa, além de ter função e somatória no where.

    Neste Find também há problema de índice pelo campo qtde_saldo estar em uso no where
    FIND FIRST transf_itens WHERE
    transf_itens.num_ped = transf_ped.num_ped AND
    transf_itens.pro_codigo = cadpro.pro_codigo AND
    transf_itens.qtde_saldo > 0 NO-LOCK NO-ERROR.
    IF NOT AVAIL transf_itens THEN NEXT.

    Neste for each

    FOR EACH transf_itens WHERE
    transf_itens.num_ped = transf_ped.num_ped AND
    transf_itens.pro_codigo = cadpro.pro_codigo AND
    transf_itens.qtde_saldo > 0 NO-LOCK:
    é o mesmo problema do find, falta de índice apropriado.

    Este Find não tem sentido em estar aqui, pois a tabela tab_embalagens não é usada.

    FIND TAB_embalagens WHERE
    TAB_embalagens.pro_codigo = transf_itens.pro_Codigo AND
    TAB_embalagens.embalagem_codigo = transf_itens.embalagem_codigo
    NO-LOCK NO-ERROR.

    Fora o problema de indentação do programa, não entendi por que há dois displays da mesma informação em frames diferentes no mesmo bloco, sugiro usar ETIME.

    Abraço.
  2. edu_felix

    edu_felix Sem Pontuação

    ok..vou verificar
  3. jaisonantoniazzi

    jaisonantoniazzi Membro Ativo

    Bom dia @edu_felix
    dê uma olhada neste tópico http://knowledgebase.progress.com/articles/Article/21100/

    Para compilar com xref veja "COMPILE statement" no help, conforme abaixo... E no arquivo gerado pelo Xref observe as linhas com SEARCH

    COMPILE { procedure-pathname | class-pathname | VALUE ( expression ) }
    [ ATTR-SPACE [ = logical-expression ] ]
    [ SAVE [ = logical-expression ]
    [ INTO { directory | VALUE ( expression ) } ]
    ]
    [ LISTING { listfile | VALUE ( expression ) }
    [ APPEND [ = logical-expression ]
    | PAGE-SIZE integer-expression
    | PAGE-WIDTH integer-expression
    ]
    ]
    [ XCODE expression ]
    [ XREF { xreffile | VALUE ( expression ) }
    [ APPEND [ = logical-expression ] ]
    ]
    [ XREF-XML { directory | filename |VALUE ( expression ) }
    ]
    [ STRING-XREF { sxreffile | VALUE ( expression ) }
    [ APPEND [ = logical-expression ] ]
    ]
    [ STREAM-IO [ = logical-expression ] ]
    [ LANGUAGES ( { language-list | VALUE ( expression ) } )
    [ TEXT-SEG-GROW = growth-factor ] ]
    [ DEBUG-LIST { debugfile | VALUE ( expression ) } ]
    [ PREPROCESS { preprocessfile | VALUE ( expression ) } ]
    [ NO-ERROR ]
    [ V6FRAME [ = logical-expression ]
    [ USE-REVVIDEO | USE-UNDERLINE ] ]
    [ MIN-SIZE [ = logical-expression ] ]
    [ GENERATE-MD5 [ = logical-expression ] ]


    Abraço.
  4. jaisonantoniazzi

    jaisonantoniazzi Membro Ativo

    Olhe só esta "forçada" que fiz no programa abaixo:

    FIND FIRST customer NO-LOCK
    WHERE customer.custnum = 10
    USE-INDEX NAME NO-ERROR.
    IF AVAIL customer THEN DO:
    DISP customer.NAME.

    FOR EACH order OF customer NO-LOCK
    USE-INDEX OrderDate:

    DISP order.ordernum order.orderdate order.custnum order.salesrep.

    FOR EACH orderline OF order NO-LOCK
    USE-INDEX OrderLineStatus:

    ACCUMULATE OrderLine.ExtendedPrice (TOTAL).

    END.

    DISP (ACCUM TOTAL OrderLine.ExtendedPrice).

    END.
    END.


    Ele gerou o xref com whole-index em todos os search, linhas 1, 7 e 12 do meu programa:

    C:\temp\testexref.p C:\temp\testexref.p 1 COMPILE C:\temp\testexref.p
    C:\temp\testexref.p C:\temp\testexref.p 1 CPINTERNAL ISO8859-1
    C:\temp\testexref.p C:\temp\testexref.p 1 CPSTREAM IBM850
    C:\temp\testexref.p C:\temp\testexref.p 1 STRING "Customer" 8 NONE UNTRANSLATABLE
    C:\temp\testexref.p C:\temp\testexref.p 1 ACCESS sports2000.Customer CustNum

    C:\temp\testexref.p C:\temp\testexref.p 1 SEARCH sports2000.Customer Name WHOLE-INDEX
    C:\temp\testexref.p C:\temp\testexref.p 4 REFERENCE sports2000.Customer
    C:\temp\testexref.p C:\temp\testexref.p 5 ACCESS sports2000.Customer Name
    C:\temp\testexref.p C:\temp\testexref.p 5 STRING "x(30)" 5 NONE TRANSLATABLE FORMAT
    C:\temp\testexref.p C:\temp\testexref.p 7 STRING "Order" 5 NONE UNTRANSLATABLE
    C:\temp\testexref.p C:\temp\testexref.p 7 ACCESS sports2000.Order CustNum
    C:\temp\testexref.p C:\temp\testexref.p 7 ACCESS sports2000.Customer CustNum

    C:\temp\testexref.p C:\temp\testexref.p 7 SEARCH sports2000.Order OrderDate WHOLE-INDEX
    C:\temp\testexref.p C:\temp\testexref.p 10 ACCESS sports2000.Order Ordernum
    C:\temp\testexref.p C:\temp\testexref.p 10 ACCESS sports2000.Order OrderDate
    C:\temp\testexref.p C:\temp\testexref.p 10 ACCESS sports2000.Order CustNum
    C:\temp\testexref.p C:\temp\testexref.p 10 ACCESS sports2000.Order SalesRep
    C:\temp\testexref.p C:\temp\testexref.p 10 STRING "zzzzzzzzz9" 10 NONE TRANSLATABLE FORMAT
    C:\temp\testexref.p C:\temp\testexref.p 10 STRING "99/99/99" 8 NONE TRANSLATABLE FORMAT
    C:\temp\testexref.p C:\temp\testexref.p 10 STRING ">>>>9" 5 NONE TRANSLATABLE FORMAT
    C:\temp\testexref.p C:\temp\testexref.p 10 STRING "x(4)" 4 NONE TRANSLATABLE FORMAT
    C:\temp\testexref.p C:\temp\testexref.p 12 STRING "OrderLine" 9 NONE UNTRANSLATABLE
    C:\temp\testexref.p C:\temp\testexref.p 12 ACCESS sports2000.OrderLine Ordernum
    C:\temp\testexref.p C:\temp\testexref.p 12 ACCESS sports2000.Order Ordernum

    C:\temp\testexref.p C:\temp\testexref.p 12 SEARCH sports2000.OrderLine OrderLineStatus WHOLE-INDEX
    C:\temp\testexref.p C:\temp\testexref.p 15 ACCESS sports2000.OrderLine ExtendedPrice
    C:\temp\testexref.p C:\temp\testexref.p 19 ACCESS sports2000.OrderLine ExtendedPrice
    C:\temp\testexref.p C:\temp\testexref.p 19 STRING "->>,>>9.99" 10 NONE TRANSLATABLE FORMAT
    C:\temp\testexref.p C:\temp\testexref.p 22 STRING "Name" 4 LEFT TRANSLATABLE
    C:\temp\testexref.p C:\temp\testexref.p 22 STRING "Name" 4 NONE UNTRANSLATABLE
    C:\temp\testexref.p C:\temp\testexref.p 22 STRING "--------------------------------" 32 NONE UNTRANSLATABLE
    C:\temp\testexref.p C:\temp\testexref.p 22 STRING "Order Num" 9 LEFT TRANSLATABLE
    C:\temp\testexref.p C:\temp\testexref.p 22 STRING "Ordered" 7 LEFT TRANSLATABLE
    C:\temp\testexref.p C:\temp\testexref.p 22 STRING "Cust Num" 8 LEFT TRANSLATABLE
    C:\temp\testexref.p C:\temp\testexref.p 22 STRING "Sales Rep" 9 LEFT TRANSLATABLE
    C:\temp\testexref.p C:\temp\testexref.p 22 STRING "TOTAL" 5 LEFT TRANSLATABLE
    C:\temp\testexref.p C:\temp\testexref.p 22 STRING "Ordernum" 8 NONE UNTRANSLATABLE
    C:\temp\testexref.p C:\temp\testexref.p 22 STRING "OrderDate" 9 NONE UNTRANSLATABLE
    C:\temp\testexref.p C:\temp\testexref.p 22 STRING "CustNum" 7 NONE UNTRANSLATABLE
    C:\temp\testexref.p C:\temp\testexref.p 22 STRING "SalesRep" 8 NONE UNTRANSLATABLE
    C:\temp\testexref.p C:\temp\testexref.p 22 STRING "---------------- ------------- --------- ---------- ----------------" 68 NONE UNTRANSLATABLE


    Sobre o whole-index http://knowledgebase.progress.com/articles/Article/15253/
  5. edu_felix

    edu_felix Sem Pontuação

    Valeu Jaison, consegui melhorar a performance.

    Obrigado

Compartilhe esta Página