QAD - Check the type of location - Progress 4gl

Take locations from Excel, fetch its type and generate new Excel with type

DEFINE VARIABLE m_flepath AS CHARACTER FORMAT "x(40)" NO-UNDO .
DEFINE VARIABLE m_fleout AS CHARACTER FORMAT "x(40)" NO-UNDO .
DEFINE TEMP-TABLE tt_temp
    FIELD tt_loc AS CHARACTER .

FORM
    m_flepath LABEL "File path " WITH FRAME a.

REPEAT:
    m_fleout = "" .
    EMPTY TEMP-TABLE tt_temp .
    UPDATE m_flepath WITH FRAME a .
    m_fleout = SUBSTRING ( m_flepath , 1 , R-INDEX ( m_flepath , ".") - 1   ).
    m_fleout = m_fleout + "log" + ".xls" .

    INPUT  FROM value(m_flepath) .
    REPEAT:
        CREATE tt_temp.
        IMPORT DELIMITER "," tt_temp.
    END.
    INPUT CLOSE.

    FOR EACH tt_temp WHERE trim(tt_loc) = "" NO-LOCK  :
        DELETE tt_temp .
    END.  /* for each */
    DO ON ERROR UNDO, RETRY :
        OUTPUT TO value(m_fleout).
        FOR EACH tt_temp NO-LOCK :
            FIND FIRST loc_mstr WHERE loc_loc = tt_loc NO-LOCK NO-ERROR.
            IF AVAIL loc_mstr THEN
            DO:
                PUT UNFORMATTED
                    loc_loc    "~011"
                    loc_type   "~011" SKIP.            
            END. /*if avail loc_mstr */
        END.  /*for each */
        OUTPUT CLOSE.
    END. /*DO*/
    MESSAGE "Procedure complete " .
END. /*repeat*/




Comments

Popular posts from this blog

Progress 4GL interview questions for QAD technology

QAD interview questions for SE and Eb2 version

Use of API in QAD EE