host command environment routine in REXX



IBM's Command List programming language & Restructured Extended Executor

host command environment routine in REXX

Postby macuko » Fri Jun 23, 2023 4:43 pm

Dear experienced mainframe programmers,

For the past couple of years I have been happy to use this site when I was looking for a solution to a mainframe related problem. This is the first time I am asking for help.

I have my own Host Command Environment (MYOWN) - added by program REXXCOMM - CBT830(E4350A4A) and I created a host command environment routine (MYPGM) in REXX (compiled and link-edited with stub CPPL) but I cannot use it in an EXEC in the following way (got 0C4 abend):
Address MYOWN "long parameter string"


If I use stub MVS instead of CPPL, no 0C4 but the parameter ("long parameter string") is not passed to the compiled REXX program at all. I finally tried all the stubs, but only for MVS I do not get 0C4 abend.

Am I correct that I cannot use REXX to create a host command environment routine? (Unfortunately, I do not have Assembler/Cobol experience...)

Thanks in advance!
macuko
 
Posts: 4
Joined: Fri Jun 23, 2023 2:35 pm
Has thanked: 1 time
Been thanked: 0 time

Re: host command environment routine in REXX

Postby Pedro » Sun Jun 25, 2023 9:52 am

The parameter list for a host command is described in Rexx Reference, section "Host command environment routine". As far as I can tell, the parameters do not map to any of those choices that are available as the stub for a compiled rexx program. I do not think you can do what you want to do.

But I question why you are trying to do that. Why do you need your own host command environment if you are not writing in assembler?

It seems like you can execute the program with:
1. compile and link with stub CPPL
2. Execute with
Address TSO "MYPGM long parameter string"



Details of host command environment routine parameters: https://www.ibm.com/docs/en/zos/2.1.0?t ... nt-routine
Pedro Vera

These users thanked the author Pedro for the post:
macuko (Sun Jun 25, 2023 2:55 pm)
User avatar
Pedro
 
Posts: 686
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 53 times

Re: host command environment routine in REXX

Postby macuko » Sun Jun 25, 2023 2:55 pm

Thanks for your answer, Pedro!

As far as I can tell, the parameters do not map to any of those choices that are available as the stub for a compiled rexx program.

I see, this is exactly what I expected... Thank you!

But I question why you are trying to do that. Why do you need your own host command environment if you are not writing in assembler?

Yes, good question. Long story short:
I have a REXX program that is used by clients who have a product that uses own host command environment. This product cannot be installed on my development system, but I want to "simulate" this host command environment in order to test my REXX program and simulate the actual running of the program during client demos. And I do not want to maintane 2 programs (the real program and the simulator). I would prefer to simulate the client environment on my own development system.

Here is my idea for a solution:
Create a "driver" program in Assembler which would do nothing but receive parameters from Address MYOWN instruction and it would pass the parameters unchanged to my simulator REXX program. Sounds easy, but not with 0 Assembler knowledge.
I tried searching on the internet but could not find a specific solution. I see IBM examples of how to call REXX from Assembler but first of all it would be nice to see a sample Assembler program that shows how to process the parameters according to the host command environment routine rules (you linked).

Address TSO "MYPGM long parameter string"

By the way, your suggested solution works fine. I use this in some other places when I only need to emulate a command, not a host command environment.
macuko
 
Posts: 4
Joined: Fri Jun 23, 2023 2:35 pm
Has thanked: 1 time
Been thanked: 0 time

Re: host command environment routine in REXX

Postby Pedro » Sun Jun 25, 2023 11:34 pm

I understand your desire to simulate the production environment. I am a strong proponent of scaffolding programs. When I was a developer at IBM, I wrote several thousand lines of scaffolding code to simulate the response from IMS operator commands. I used it to test my component before my peers' work was ready. This was also particularly useful to test rare error situations.

I agree that an assembler program would be best, but you have to consider what is feasible based on your skills. My suggestion is to have two lines of scaffolding. Consider the following example, where MYOWN is different in the production system vs. the test system:

MYOWN = 'MYOWN'
If MVSVAR('SYSNAME') = 'TESTSYS1' Then /*system name from parmlib*/
  MYOWN = 'TSO MYPGM'
 
...

Address MYOWN "long parameter string"


This might not work for a simple 'Address MYOWN' command to switch host environments.
Pedro Vera
User avatar
Pedro
 
Posts: 686
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 53 times

Re: host command environment routine in REXX

Postby macuko » Mon Jun 26, 2023 12:23 am

Wow. That is a brilliant solution. Simple, but great. I did not even think of that...
Thank you very much, Pedro!

Maybe later I will give it a try and ask in the Assembler topic if anyone has a sample code for processing the parameters of host commant environment routine.

But for now I am fine with this solution. Thanks again!
macuko
 
Posts: 4
Joined: Fri Jun 23, 2023 2:35 pm
Has thanked: 1 time
Been thanked: 0 time

Re: host command environment routine in REXX

Postby macuko » Tue Jun 27, 2023 8:24 pm

I tested it and unfortunately it does not work without "Interpret". But of course it can still be used. ;)
MYOWN = 'MYOWN'
If MVSVAR('SYSNAME') = 'TESTSYS1' Then /*system name from parmlib*/
  MYOWN = 'TSO MYPGM'
 
...

Interpret 'Address 'MYOWN '"long parameter string"'
macuko
 
Posts: 4
Joined: Fri Jun 23, 2023 2:35 pm
Has thanked: 1 time
Been thanked: 0 time


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post