Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

'Probably' found under the heading REXX for Dummies, but here goes

Status
Not open for further replies.

AGOST003

Programmer
Jul 29, 2008
2
US
After purusing The Friendly Manuals, reading boards, and searching our system, I give up.. well almost :=)

Anyway, being a db2 dba and having minimal rexx coding exposure I'm faced with a need to learn as I burn in an effort to convert rexx/db2 access via a third-party to generic rexx.

I've created an exec that will be used to do standard db2 commands ie display util(*), term util(*), eitc. Got it working fine, but in an effort to try to built a better mousetrap (my mistake!), I decided to pull a verification piece of the code out that could be useful for other execs and for ease of maintenance.

Excepts of code are:
...
<from calling exec>
call 'CHKSSID' argSSID
if ValidInput = 'n' then do
say 'ssid: ' argSSID ' is invalid'
return
end
<from called exec>
CHKssid: arg argSSID

call CheckValidSSID /* validate ssid */
if ValidInput = 'n' then do
say 'ssid: ' argSSID ' is invalid'
return
end

EXIT

CheckValidSSID:
/*!!!*/
ValidInput = 'y'
select
when argSSID = 'DSN' then NOP
when argSSID = 'DB2O' then NOP
when argSSID = 'DB2P' then NOP
when argSSID = 'DB2Q' then NOP
when argSSID = 'DB2T' then NOP
when argSSID = 'DB2V' then NOP
when argSSID = ' ' then do
ValidInput = 'n'
end
otherwise do
ValidInput = 'n'
end
end

return

The call works fine, but passing the result back is not, nor has various attempts been fruitful. Any assistance is greatly appreciated.







 
Boy, have you ever stepped into a minefield...

I will go through extraordinary effort to avoid calling an external function. Do you have the charter to rewrite any of this? If so, you're OK, because you can use the queue to communicate with the subroutine:
Code:
CheckValidSSID: 
   arg argSSID
   ...
   push validinput
exit
then in the caller:
Code:
address TSO "NEWSTACK"
call CheckValidSSID( someSSID )
pull validinput
address TSO "DELSTACK"
The trick is that the caller establishes a protected stack before calling a subrtn that will load something onto that stack. The beauty of such a solution is that it is adaptible to a wide range of problems, such as when the subrtn has to return many rows.

Frank Clarke
--Now officially with no one I can vote for in '08...
 
Frank,
Thanks you for your valued imput. Your suggestion works like a charm. You be a gig-nus!
BTW I like your tag line and couldn't agree more. As Jesse Ventura, I'm writing in: "NONE of the above'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top