Consultor Eletrônico



Kbase P99151: How to use the -param with a list of entries?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   9/15/2007
Status: Unverified

GOAL:

How to use the -param Session Parameter with a list of entries?

GOAL:

Session Parameter -param and entry list

GOAL:

Using the -param parameter to refer to a list of values

GOAL:

Passing a single character string with -param

GOAL:

Passing a parameter containing spaces with -param

GOAL:

Converting the character parameter to another datatype with -param

FIX:

This Solution describes how to pass parameters to Progress from the command line to a 4GL program.
This technique can be used to pass parameters to a Progress application that needs to behave differently based on some few parameters, or batch programs that needs parameters.

The -param parameter can be used to pass a character string to a Progress session.
The SESSION:PARAMETER attribute can be used to access this character string.

This character string can be converted to another data type or parser as required by the application.


NOTE:
The -param parameter is also used to specify one or more files to load into the Procedure Editor buffers when loading Progress.
Therefore, if the -param value does not correspond to a file or you do not want the Procedure Editor to load, you can use the QUIT statement so the program will finish without opening the Procedure Editor.

The -param parameter can be used with any Progress client, examples:
- prowin32 -p pp.p -param test
- _progres -p pp.p -param test
- pro -p pp.p -param test
- mpro -p pp.p -param test
- bpro -p pp.p -param test
- mbpro -p pp.p -param test

Example of usages:

1) Passing a single character string:

- prowin32 -p pp.p -param test

- Test program (pp1.p)
DISPLAY "The parameter is:" SKIP SESSION:PARAMETER FORMAT "X(70)".
PAUSE.
QUIT.

2) Passing a parameter containing spaces:

- prowin32 -p pp1.p -param "test abc"

- Test program (pp.p)
DISPLAY "The parameter is:" SKIP SESSION:PARAMETER FORMAT "X(70)".
PAUSE.
QUIT.

3) Converting the character parameter to another datatype

- prowin32 -p pp1.p -param 1024

- Test program (pp.p)
DISPLAY "The result of the parameter + 70 is:" SKIP
INTEGER(SESSION:PARAMETER) + 70.
PAUSE.
QUIT.

4) Using the -param parameter to refer to a list of values

- prowin32 -p pp1.p -param abc,xyz,123,789

- Test program (pp.p)
DEF VAR c AS CHAR.
DEF VAR i AS INT.

c = SESSION:PARAMETER.
DISPLAY "The parameter is:" SKIP
c FORMAT "X(70)" SKIP
"The number of entries is:" NUM-ENTRIES(c).
REPEAT i = 1 TO NUM-ENTRIES(c):
DISPLAY "Entry: " I " is " ENTRY(I, c).
END.
PAUSE.
QUIT.