|
|
| Author |
Message |
XOpen
New User
Joined: 19 Mar 2008 Posts: 24 Location: Russia
|
|
|
|
Now a real question: As we know, REXX can't pass stem to external REXX function, but at the same time we have EXECIO that can get it.
How do they do it ? Is there any TSO service for that ? (asm?) |
|
| Back to top |
|
 |
References
|
Posted: Fri Mar 21, 2008 6:06 pm Post subject: Re: pass STEM to compiled programs |
 |
|
|
 |
enrico-sorichetti
Global Moderator
Joined: 14 Mar 2007 Posts: 2655 Location: italy
|
|
|
|
EXECIO is quite resource consuming for such a task
reading and writing an external dataset at every call .. brrrrr
what do You mean by compiled programs...
REXX compiled or external functions written in assembler or a supported HLL ?
from an organizational point of view is a bad habit to call
rexx written external commands...
because of
1 - library setup,
usually the best way to distribute rexx aplications is to make them self contained
2 - performance issues
3 -as You already noticed some drawbacks in parameters passing
assuming that You have the rexx compiler available the best thing from any point of view is to expose the stems
an %include the subroutines/functions at rexx compile time
in the other thread I had proposed some external functions, but |
|
| Back to top |
|
 |
XOpen
New User
Joined: 19 Mar 2008 Posts: 24 Location: Russia
|
|
|
|
| No. I am interested in the way. I would like to write my own program(not necessary on REXX) and call it from REXX and pass stem to it. Then I will decide, does it fit or not. (Again it's not about passing stem from REXX to REXX) |
|
| Back to top |
|
 |
pauly_william
New User
Joined: 15 Oct 2007 Posts: 10 Location: Canada
|
|
|
|
I've been able to pass a stem variable values between diff REXX functions by looping through and queueing the values to the data stack, then looping through the data stack and extracting the values. I did this for a function to grab all the dataset names that had the pattern "JAN97, JAN01, JAN07, etc" and then QUEUE them in the data stack in decending order then loop them out of the data stack using Do Queued()...PARSE PULL. Too easy!
| Code: |
Gen_OptionBox:
Address TSO 'NEWSTACK'
q = 1
Call OPSUBYY /* Ext. sub that uses TSO LISTCAT to gen drop-down box*/
Do Queued()
Parse Pull vYYYY.q
q = q + 1
End
Address TSO 'DELSTACK'
If q > 1 then vYYYY.0 = q - 1
Else q = 1
Return |
| Code: |
/* Rexx **/
/* Function: generate year list for dropdown box, Queue to stack. */
X = OUTTRAP("lst.")
Address TSO "LISTCAT LEVEL(SOME.DATASET.LOG)"
X = OUTTRAP("OFF")
Y9min = 99
Y0min = 00
Y0max = 00
Do i = 1 to lst.0
parse var lst.i . . dsname .
parse var dsname . "." . "." . "." dsnmth
i = i + 1
If DATATYPE(substr(dsnmth,4,1)) ¬= "NUM" Then iterate
If substr(dsnmth,4,1) = "9" Then /* Y2k */
Do
YYtemp = substr(dsnmth,4,2)
If YYtemp < Y9min Then Y9min = YYtemp /* bubble sort */
End /* If Do */
Else
Do
YYtemp = substr(dsnmth,4,2)
If YYtemp > Y0max Then Y0max = YYtemp /* bubble sort */
else
If YYtemp < Y0min Then Y0min = YYtemp
End /* Else Do */
End i /* end i loop */
If Y9min ¬= '00' Then
Do
YYmin = Y9min
YYmax = Right(Y0max,2,'0')
end /* If Do */
Else
Do
YYmin = Right(Y0min,2,'0')
YYmax = Right(Y0max,2,'0')
End /* else Do */
If substr(YYmin,1,1) ¬= "9" Then /* if year in Y2K start count down */
Do
YYdiff = YYmax - YYmin
Do i = 1 to YYdiff + 1
Queue '20'||YYmax
YYmax = Right(YYmax - 1,2,'0')
End i /* end i loop */
End /* if Do */
Else Do /* start count down but factor in '90s*/
YYdiff = YYmax
Do i = 1 to YYdiff + 1
Queue '20'||YYmax
YYmax = Right(YYmax - 1,2,'0')
End i /* end i loop */
YYmax = 99
If YYmin < 99 Then
Do
YYdiff = 99 - YYmin
Do i = 1 to YYdiff + 1
Queue '19'||YYmax
YYmax = YYmax - 1
End i /* end loop */
End /* If Do */
Else
Queue '1999'
End /* Else do */ |
I honestly don't know if this the ideal way...but that being said the performance seems to be fine accomplishing what I need. |
|
| Back to top |
|
 |
pauly_william
New User
Joined: 15 Oct 2007 Posts: 10 Location: Canada
|
|
|
|
| XOpen wrote: |
| (Again it's not about passing stem from REXX to REXX) |
Did read the question entirely....DOH! lol |
|
| Back to top |
|
 |
|
|
|