What is the best "trick" to pass stem from external routine?



IBM's Command List programming language & Restructured Extended Executor

What is the best "trick" to pass stem from external routine?

Postby oldnick » Fri Jul 16, 2010 1:00 pm

Hey,

I was wondering if any of you rexx "veterans" know the best "trick" to pass a stem from an external routine to a "main" program ?

The RETURN can pass 1 stem value but not the full stem.

I didn't find anything about this in the rexx IBM reference pdf nor in the thing you always call the "fine manual".

I have contemplated ideas either using the data stack, VPUT/VGET , reading/writing the stem, making a string out of the stem and rebuild the stem, or transfering the stem contents 1 by 1 with a function.

But I have no idea what the best optimal way would be, I only have 2 months rexx programming experience so I though I would try to ask first.

Also, I'm not allowed to install any libraries or anything. My internship master is in vacation so I can't ask him either.

So, the question is, do you have an optimal, "good practice" trick to pass full stem variables from an external routine to a "main" program ?
oldnick
 
Posts: 19
Joined: Wed Apr 21, 2010 1:09 pm
Has thanked: 0 time
Been thanked: 0 time

Re: What is the best "trick" to pass stem from external routine?

Postby expat » Fri Jul 16, 2010 2:23 pm

I usually use a temporary dataset for larger amounts of data
The main routine is ........................
/* REXX *** RETRIEVE DATA VIA DATASET FROM EXTERNAL ROUTINE          */
                                                                       
"FREE  FI(TEMP01)"                                                     
"ALLOC FI(TEMP01) NEW TRACKS SPACE(3 3) RECFM(V B) LRECL(300)"         
                                                                       
CALL TESTCAL0                                                         
                                                                       
"EXECIO * DISKR TEMP01 ( STEM TESTI. FINIS"                           
"FREE  FI(TEMP01)"


The external is ............................
/* REXX *** WRITE TO EXTERNAL DATASET                                */
DO AA = 1 TO 100                                                       
  OUTPT = "TEST DATA LINE "RIGHT(AA,3,'0')                             
  QUEUE OUTPT                                                           
END                                                                     
"EXECIO" QUEUED() "DISKW TEMP01 ( FINIS"
expat
 
Posts: 459
Joined: Sat Jun 09, 2007 3:21 pm
Has thanked: 0 time
Been thanked: 8 times

Re: What is the best "trick" to pass stem from external routine?

Postby oldnick » Fri Jul 16, 2010 5:03 pm

Sounds good thanks, I'll try this
oldnick
 
Posts: 19
Joined: Wed Apr 21, 2010 1:09 pm
Has thanked: 0 time
Been thanked: 0 time

Re: What is the best "trick" to pass stem from external routine?

Postby oldnick » Fri Jul 16, 2010 5:41 pm

This works ! thank you very much :)
I post it so it may help others who search one day.

/* REXX *** RETRIEVE DATA VIA DATASET FROM EXTERNAL ROUTINE          */
                                                                       
/*"FREE  FI(TEMP01)" makes error  */
                                                 
"ALLOC FI(TEMP01) NEW TRACKS SPACE(3 3) RECFM(V B) LRECL(300)"         
                                                                       
CALL TEST02                                                           
                                                                       
"EXECIO * DISKR TEMP01 ( STEM TESTI. FINIS"                           
"FREE  FI(TEMP01)"     
                                               
say hke.0
say hke.1                                                             
say hke.2                                                             
exit                                                                   


/* REXX *** WRITE TO EXTERNAL DATASET                                */
  hke.0 = 2                                                             
  hke.1 = "first"                                                       
  hke.2 = "second"                                                     
  do i=1 to hke.0                                                       
  outpt = hke.i                                                         
  QUEUE outpt                                                           
  end                                                                   
"EXECIO" QUEUED() "DISKW TEMP01 ( FINIS"                                 



Just one last question,
I tried first with QUEUE hke. but this didn't work
So I did a loop (do i=1 to hke.0 ; outpt = hke.i ; QUEUE outpt )

Is there a way to do it with hke. instead of the loop ? maybe I put it wrong ?

If not well it works with the loop so thanks anyway :)
oldnick
 
Posts: 19
Joined: Wed Apr 21, 2010 1:09 pm
Has thanked: 0 time
Been thanked: 0 time

Re: What is the best "trick" to pass stem from external routine?

Postby oldnick » Fri Jul 16, 2010 5:44 pm

oops

STEM TESTI. FINIS" is wrong, I meant STEM hke. FINIS" in the first code area

no edit button ?
oldnick
 
Posts: 19
Joined: Wed Apr 21, 2010 1:09 pm
Has thanked: 0 time
Been thanked: 0 time


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post