View previous topic :: View next topic
|
Author |
Message |
Nachal
New User
Joined: 04 Jul 2007 Posts: 3 Location: Chennai
|
|
|
|
Hi,
I have a Fields that needs to be passed while executing the REXX. However i want set a default values to those arguments. If am not passing while executing it needs to take the Default value.
For Eg,
I have testproduction field which should always be prod. When am testing it I should overwrite it with Test. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello and welcome to the forum,
Suggest you establish some default values n your code and then compare what has been entered at runtime. When nothing is entered, use the initial values that were established previously.
Possibly there is something i do not understand. . . |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
Something like that:
Code: |
/* REXX */
ARG ARG1 ARG2
IF ARG1 ='' THEN
ARG1 = 'Default'
EXIT |
O. |
|
Back to top |
|
|
Nachal
New User
Joined: 04 Jul 2007 Posts: 3 Location: Chennai
|
|
|
|
Thanks for the solution and Sorry for the late reply..
To make it more clear...
In Clist i have a code like this
PROC 0 TRACE(N) TSPR(P) FSYS(SYSPFOC)
For trace and TSPR we have a default value.
When am executing the clist i ll give it as
ex 'clist..' 'tspr(t)'
if i want to overwrite the default value of tspr.
Whats the logic i need to use in REXX for the same? |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
Not really much logic, just use the PARSE instruction looking through your parms for the right keyword. And if the keyword is not found, the variable is set to nulls:
Quote: |
parse upper arg . 'TSPR(' tspr ')' .
If tspr = '' Then
tspr= 'P' |
Read the Rexx Reference manual for information about how to use PARSE. |
|
Back to top |
|
|
MBabu
Active User
Joined: 03 Aug 2008 Posts: 400 Location: Mumbai
|
|
|
|
Use the power of Rexx's Parse instruction.
These solutions aren't as smart as CLIST processing (IKJPARSE) because you can't use keyword abbreviations, but either one will give you your defaults and let you give parms in any order. If you need lower case values, remove the "upper" from the parse but always pass in upper case keywords.
Code: |
Parse Upper value arg(1) "TRACE(N) TSPR(P) FSYS(SYSPFOC)" ,
With "TRACE(" Trace ")" 1 "TSPR(" tspr ")" 1 "FSYS(" fsys ")"
Say "Trace:" Trace
Say "TSPR:" tspr
Say "FSYS:" fsys |
or alternatively a slightly more readable version of the same thing:
Code: |
Parse upper Arg inparms
parseParms = inparms "TRACE(N) TSPR(P) FSYS(SYSPFOC)"
Parse value parseParms With "TRACE(" Trace ")"
Parse value parseParms With "TSPR(" tspr ")"
Parse value parseParms With "FSYS(" fsys ")"
Say "Trace:" Trace
Say "TSPR:" tspr
Say "FSYS:" fsys |
|
|
Back to top |
|
|
|