Progress 4GL for each and select * from cust

Discussão em 'StackOverflow' iniciado por fdantas, Outubro 31, 2016.

  1. fdantas

    fdantas Administrator Moderador

    I often do the following progress 4GL code

    output to /OUTText.txt.
    def var dRow as char.
    dRow = "cmpid|CustNum|Cur".
    put unformatted dRow skip.
    for each Cust no-lock:
    dRow = subst("&1|&2|&3", Cust.CmpId, Cust.CustNum, Cust.Curr).
    put unformatted dRow skip.
    end.
    output close.


    in order to mimic

    select * from cust (in MS SQL)


    my question is is there a way to make this block of code, even closely resemblance "select *" using 4GL. Such that I don't have to type each column name and it will print all values in all columns. my thinking is. something like this.

    output to /OUTText.txt.
    def var dRow as char.
    dRow = "cmpid|CustNum|Cur".
    put unformatted dRow skip.
    for each Cust no-lock:
    if row = 1 then do:
    for each Column in Cust:
    **'PRINT THE COLUMN HEADER**
    end.
    end.
    else do:
    **'PRINT EACH CELL**
    end.
    end.
    output close.


    If there is such thing. then I don't have to keep explicit column name in dRow.

    Continue reading...

Compartilhe esta Página