mbpro with -p and input parameter

BCM

Member
I have a situation in which I want to quickly (and invisibly) connect to Progress and output a long character string to a text file. I wrote a succinct little program that can find the record and output the character string to the text file. The record is found based on the value of a single column. The program expects to receive an input parameter, LookupKey.

I have been trying the following command with no luck:
C:\dlc\wrk> ..\bin\mbpro -db databasename -p myprogram.p "123456" -N tcp -H dbHost -S 5005

myprogram.p
DEF input parameter LookupKey AS CHAR.
DEF VAR sOutFile AS CHAR NO-UNDO.
sOutFile = "CredRpt_Key_" + LookupKey + ".txt".
OUTPUT TO value(sOutFile).
FOR EACH CredReport WHERE CredReport.tblKey = LookupKey NO-LOCK:
PUT UNFORMATTED CredReport.RptText SKIP.
END.
OUTPUT CLOSE.

How can I send an input parameter to a program file executed via mbpro?
 

joey.jeremiah

ProgressTalk Moderator
Staff member
Code:
/* main.p */
 
define var pcKey as char no-undo.
pcKey = trim( session:parameter ). /* -param startup parameter */
 
output to value( "CredRpt_Key_" + pcKey + ".txt" ).
 
for each  CredReport
    where CredReport.tblKey = pcKey.
    no-lock:
 
    put unformatted
        CredReport.RptText
        skip.
 
end.
 
output close.
mbpro -p main.p -param "123456" -db ...

hth
 
Top