Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to set Default values to ARG variables

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
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    Post subject: How to set Default values to ARG variables
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

Site Director


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

PostPosted: Fri Dec 19, 2008 11:35 am    Post subject:
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: 2360
Location: Israel

PostPosted: Fri Dec 19, 2008 11:35 am    Post subject:
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    Post subject: Reply to: How to set Default values to ARG variables
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

Senior Member


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

PostPosted: Fri Dec 26, 2008 10:26 pm    Post subject: Reply to: How to set Default values to ARG variables
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: 401
Location: Mumbai

PostPosted: Fri Dec 26, 2008 11:38 pm    Post subject: Reply to: How to set Default values to ARG variables
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    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts Overlaying one set of charater values... Kevin Lindsley SYNCSORT 7 Sat Nov 05, 2016 3:21 am
No new posts Low values Results from VARCHAR FORMAT balaji81_k DB2 10 Thu Oct 20, 2016 1:18 am
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us