Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 2086
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 Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm
No new posts Working with hex values in Filemanage... Emile Straker IBM Tools 0 Tue Sep 12, 2017 1:42 am
No new posts DB2 NULL Values display V S Amarendra Reddy DB2 3 Thu Sep 07, 2017 6:59 pm
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm
No new posts Default FTP options vasanthz All Other Mainframe Topics 2 Fri Aug 25, 2017 5:58 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us