IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to set Default values to ARG variables


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Nachal

New User


Joined: 04 Jul 2007
Posts: 3
Location: Chennai

PostPosted: Fri Dec 19, 2008 11:24 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Dec 19, 2008 11:35 am
Reply with quote

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
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Fri Dec 19, 2008 11:35 am
Reply with quote

Something like that:
Code:
/* REXX */
ARG ARG1 ARG2
 
IF ARG1 ='' THEN
  ARG1 = 'Default'

EXIT


O.
Back to top
View user's profile Send private message
Nachal

New User


Joined: 04 Jul 2007
Posts: 3
Location: Chennai

PostPosted: Fri Dec 26, 2008 5:26 pm
Reply with quote

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
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Fri Dec 26, 2008 10:26 pm
Reply with quote

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
View user's profile Send private message
MBabu

Active User


Joined: 03 Aug 2008
Posts: 400
Location: Mumbai

PostPosted: Fri Dec 26, 2008 11:38 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
No new posts Running a Job with the Default User ID JCL & VSAM 2
No new posts Change Default Scroll Setting TSO/ISPF 1
Search our Forums:

Back to Top