Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
Posted: Sun Jul 01, 2007 5:04 am Post subject:
Code:
/* Rexx */
/* A demonstration of arguments */
/* Note: Only 1 external argument can be passed */
Say 'There are 'Arg()' argument(s) to this exec'
Say 'Arguments(s):' Arg(1)
Arg a1 a2 a3 junk
Say 'The argument was parsed as follows:'
Say 'Variable a1 contains: 'a1
Say 'Variable a2 contains: 'a2
Say 'Variable a3 contains: 'a3
Say 'Variable junk contains: 'junk
Say
Say 'Calling sub-routine with a1-3:'
Call subrout a1, a3, a2
Exit
subrout: Procedure
Arg s1, s2, s3
Say Arg() 'arguments were passed to the subroutine'
Say 'They are:'
Say ' s1: 's1
Say ' s2: 's2
Say ' s3: 's3
Return
Run this and you will see there is 1 argument passed into the exec and 3 to the subroutines. It does not matter if the external arguments are split by commas or not - I get
Code:
'There are 1 argument(s) to this exec
However, thers is nothing to stop you parsing that argument to split it up into its constituent parts as I did in the example but if you do not then arg(1) is the whole argument.
I grant that it is probably being picky but I put it here 'just in case' not as a big thing to get around. _________________ Utility and Program control cards are NOT, repeat NOT, JCL.
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
Posted: Sun Jul 01, 2007 5:16 am Post subject:
Alternative solution:
Use an ISPF panel for the user to input the 3 names. VER will ensure that the names are in correct datasetname format (but will not verify that they exist) and will not allow the exec to continue until all 3 names have been entered. _________________ Utility and Program control cards are NOT, repeat NOT, JCL.
All times are GMT - 5 Hours Goto page Previous1, 2
Page 2 of 2
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum