View previous topic :: View next topic
|
Author |
Message |
airan1981
New User
Joined: 11 Nov 2008 Posts: 6 Location: Bentonville, AR US
|
|
|
|
Hi,
I have a requirement where REXX calls a COBOL program and COBOL programs INTURNS calls COBOL.
I am able to call the COBOL program from REXX but the COBOL program which is called from REXX calls another COBOL program give me message "MODULE NOT FOUND" while making the call.
I used the LIBDEF command to define the LOADLIBs where my COBOL program is present.
DOes any body has idea how to resolve the issue?
I searched over the GOOGLE and found that i need to define my LOADLIB thru TSOLIB but this works in TSO/E ready environment. I don't know how to invoke it. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
What environment are you executing in?
The LIBDEF only works for ISPF service calls. If you require an ISPF environment then perhaps you can call the second cobol program through SELECT PGM( ).
If you run in a batch job, add your loadlib to the STEPLIB concatenation. |
|
Back to top |
|
|
airan1981
New User
Joined: 11 Nov 2008 Posts: 6 Location: Bentonville, AR US
|
|
|
|
I am running in the iSPF environment. Thats why, i can not add the loadLIB of COBOL program called from the COBOL program via REXX. How can i use SELECT PGM() in REXX. Can you give me some example. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
Try using the TSO CALL command instead of SELECT PGM.
Read the rexx reference manual for Address TSO and the TSO Commands Reference for the CALL command syntax. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Suggest you ask a co-worker.
There are many qualified people on that system. . . |
|
Back to top |
|
|
airan1981
New User
Joined: 11 Nov 2008 Posts: 6 Location: Bentonville, AR US
|
|
|
|
My cobol program is able to call the seocnd cobol program via REXX (Thru CALL and SELECT CMD()). But, I can not receive back the return value in the REXX. I can pass the PARM thru TSO CALL but i dont know how to receive it back.
When i display the variable which is being passed from the REXX to cobol gives me the same string passed after the call also. I tried to find out, if there is any problem with the cobol and Its working fine.
I think i need to do something additional to receive the return value back in my REXX. |
|
Back to top |
|
|
airan1981
New User
Joined: 11 Nov 2008 Posts: 6 Location: Bentonville, AR US
|
|
|
|
The SELECT PGM() also gives the same problem like "MODULE NOT FOUND" SELECT CMD and TSO CALL is working fine but I am not able to receive back the result in the REXX. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
RC is a built-in variable that has the last return code.
Code: |
/* REXX */
ADDRESS TSO
"CALL 'SYS1.LINKLIB(ISPQRY)'"
SAY 'Return Code='RC |
|
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
You may want to change your COBOL program to use ISPF's VGET and VPUT services to share variables with the rexx program. |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
You know, your original post never mentioned that you wanted to call a COBOL program and then return results back to your calling REXX code. I've never done that process, so I don't know how exactly it would be done from within a TSO or ISPF address space. In a regular REXX exec running in batch (PGM=IRXJCL) you can use the ADDRESS LINKMVS command to do what you want. Since you're running these from within the ISPF address space, have you tried just using ISPF shared variables (i.e. using VPUT and VGET services) as a means of passing data back and forth? |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
I had a similar experience.
I used the LINKPGM command to make the call, but it may not change what is required to receive a return value.
What I found was that the length of the LINKAGE section passed from the REXX is all that would be received regardless of what was defined in the COBOL program.
For example if I passed twenty bytes of data from REXX, I would only receive twenty bytes back even though the COBOL was returning forty bytes.
To remedy this I used the following:
LINKAGE = LEFT(LINKAGE,39,' ')||'0'
Forcing a non-space in the 40th position established the length I needed.
I was now able to receive all forty bytes from my COBOL.
This was my experience, I hope it works for you. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
Back to top |
|
|
|