Arjon M. Policar
Member
Greetings Everyone! I am using progress 11.3. I want to use a procedure that has parameter and returns a specific value, but I don't know how. Can someone teach me? I'm looking forward for your responses. Thank you.
DEFINE TEMP-TABLE pass-table
FIELD pass_contact AS CHARACTER FORMAT "X(20)"
FIELD pass_country AS CHARACTER FORMAT "X(20)"
FIELD pass_balance AS DECIMAL
FIELD pass_discount AS INTEGER
.
DEFINE VARIABLE ip-order AS CHARACTER NO-UNDO.
DEFINE VARIABLE ip-amt AS DECIMAL NO-UNDO.
DO:
FOR EACH Customer WHERE Customer.Cust-Num < 30:
CREATE pass-table.
ASSIGN
pass_contact = customer.contact
pass_country = customer.country
pass_balance = customer.balance
pass_discount = customer.discount
.
END.
RUN catch-t-t.p (INPUT TABLE pass-table, INPUT ip-order, OUTPUT ip-amt).
MESSAGE ip-order ip-amt
VIEW-AS ALERT-BOX INFO BUTTONS OK.
END.
/********** catch-t-t.p **********/
DEFINE TEMP-TABLE catch-table
FIELD catch_contact AS CHARACTER FORMAT "X(20)"
FIELD catch_country AS CHARACTER FORMAT "X(20)"
FIELD catch_balance AS DECIMAL
FIELD catch_discount AS INTEGER FORMAT "-z9%"
.
DEFINE INPUT PARAMETER TABLE FOR catch-table.
DEFINE INPUT PARAMETER vOrder AS CHAR.
DEFINE OUTPUT PARAMETER vAmt AS DEC.
FOR EACH catch-table NO-LOCK.
DISPLAY catch-table.
END.
ASSIGN
vOrder = "TST-001"
vAmt = 50.
Code:procedure x: define input parameter p1 as character no-undo. define output parameter p2 as character no-undo. p2 = p1. return. end. define variable c as character no-undo. run x ( input "abc", output c ). display c.
Thank you philippoommen1Code:DEFINE TEMP-TABLE pass-table FIELD pass_contact AS CHARACTER FORMAT "X(20)" FIELD pass_country AS CHARACTER FORMAT "X(20)" FIELD pass_balance AS DECIMAL FIELD pass_discount AS INTEGER . DEFINE VARIABLE ip-order AS CHARACTER NO-UNDO. DEFINE VARIABLE ip-amt AS DECIMAL NO-UNDO. DO: FOR EACH Customer WHERE Customer.Cust-Num < 30: CREATE pass-table. ASSIGN pass_contact = customer.contact pass_country = customer.country pass_balance = customer.balance pass_discount = customer.discount . END. RUN catch-t-t.p (INPUT TABLE pass-table, INPUT ip-order, OUTPUT ip-amt). MESSAGE ip-order ip-amt VIEW-AS ALERT-BOX INFO BUTTONS OK. END. /********** catch-t-t.p **********/ DEFINE TEMP-TABLE catch-table FIELD catch_contact AS CHARACTER FORMAT "X(20)" FIELD catch_country AS CHARACTER FORMAT "X(20)" FIELD catch_balance AS DECIMAL FIELD catch_discount AS INTEGER FORMAT "-z9%" . DEFINE INPUT PARAMETER TABLE FOR catch-table. DEFINE INPUT PARAMETER vOrder AS CHAR. DEFINE OUTPUT PARAMETER vAmt AS DEC. FOR EACH catch-table NO-LOCK. DISPLAY catch-table. END. ASSIGN vOrder = "TST-001" vAmt = 50.