View previous topic :: View next topic
|
Author |
Message |
Joyce
New User
Joined: 15 Aug 2013 Posts: 8 Location: China
|
|
|
|
I have a REXX which will call DB2 COBOL program A and it could be executed successfully. I didn't specify any DB2 parms (SSID and PLAN) in the REXX. I just specified those DB2 related libraries in the JCL JOBLIB.
The only execution clause in REXX is:
ADDRESS LINKPGM "XXXXXXXX AAAA BBBB"
XXXXXXXX is the DB2 COBOL program
AAAA is the first parm
BBBB is the second parm
Now I want to use this REXX to call another DB2 COBOL program B. I thought this would be easy. But I got SQL return code -991.
I don't know why it doesn't work for program B. I'm not sure if it's because below difference between program A and program B:
Program A use 'DECLARE', 'OPEN', 'FETCH', 'CLOSE' to read DB2 tables.
Program B directly use 'SELECT' to read DB2 tables.
Is there anyone who knows how to write the REXX to call program B?
I searched existing topics and tried. But all failed.
I'm thinking maybe I should specify the SSID and PLAN in JCL SYSTSIN or in REXX. But I have no idea how to do it.
Could anyone help me? Thank you! |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Hi Joyce,
Can you paste the Rexx code which was successful and which was not?
Also,What are you trying to achieve by that?
When you have JCL to do the same thing. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
I suspect that ALL your SQ: stuff must be either in the called (COBOL) program or in the calling (Rexx) program not split across the two. Did you do the connect, declare, open cursor in the Rexx program? If so, how did you pass the cursor to the COBOL program? |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
In your "Program A", do you have calls to special routines (like DSNRLI) ?
Quote: |
The only execution clause in REXX is:
ADDRESS LINKPGM "XXXXXXXX AAAA BBBB"
XXXXXXXX is the DB2 COBOL program
AAAA is the first parm
BBBB is the second parm |
Because of this, I would say "Program A" is using RRSAF to connect to DB2.
Meanwhile, "Program B" returns -991 which means it should run under the DSN stub. Which means "Program B" is using CAF to connect to DB2.
Try using the following commands:
Code: |
Queue "RUN PROGRAM(Program B) PARM('"YourParm"') ",
"PLAN(YourPlan) LIB("YourLib")"
Queue "END"
"DSN SYSTEM("YourDB2Name")" |
|
|
Back to top |
|
|
Joyce
New User
Joined: 15 Aug 2013 Posts: 8 Location: China
|
|
|
|
Pandora-Box wrote: |
Hi Joyce,
Can you paste the Rexx code which was successful and which was not?
Also,What are you trying to achieve by that?
When you have JCL to do the same thing. |
Hi Pandora-Box,
I cannot access TSO now.
There is only one 'useful' clause in the successful REXX. Others are 'SAY' clause or 'AAAA=ABCD' (initialize)clause. The 'useful' clause is:
ADDRESS LINKPGM "XXXXXXXX AAAA BBBB"
XXXXXXXX is the DB2 COBOL program
AAAA is the first parm for XXXXXXXX
BBBB is the second parm for XXXXXXXX
Actually XXXXXXXX is a DB2 COBOL sub-routine program. In our production, it will be called by a main DB2 COBOL program. In production, the main program will pass parm AAAA and BBBB to XXXXXXXX and XXXXXXXX will return the required information in AAAA and BBBB to the main.
I found the result of main program is incorrect. But I'm not sure where is issue from. I don't have the right to prepare a temp CM PKG for testing as I'm working in a QA team. Else, I would add some 'DISPLAY' clause to do it.
I used the existing REXX program for several times with different sub-routine programs. It works fine. When I use it for different sub-routine program, I just replace XXXXXXXX, AAAA and BBBB (no change for JCL).
But now, it return SQL return code -991 and joblog message shows it occurs in the SQL SELECT clause in the sub-routine program B.
For my JCL, I only add those DB2 environment libraries in the JOBLIB.
I'm thinking if there is someway in JCL or REXX to tell which SSID and PLAN should be used.
Thank you
Joyce |
|
Back to top |
|
|
Joyce
New User
Joined: 15 Aug 2013 Posts: 8 Location: China
|
|
|
|
Nic Clouston wrote: |
I suspect that ALL your SQ: stuff must be either in the called (COBOL) program or in the calling (Rexx) program not split across the two. Did you do the connect, declare, open cursor in the Rexx program? If so, how did you pass the cursor to the COBOL program? |
Hi Clouston,
There is no SQL clause in my REXX.
There is only one 'useful' clause in the successful REXX. Others are 'SAY' clause or 'AAAA=ABCD' (initialize) clause. The 'useful' clause is:
ADDRESS LINKPGM "XXXXXXXX AAAA BBBB"
XXXXXXXX is the DB2 COBOL program
AAAA is the first parm for XXXXXXXX
BBBB is the second parm for XXXXXXXX
Only the DB2 COBOL program has the SQL clause. The DB2 COBOL program is a sub-routine program and it is called by DB2 COBOL main program in production. |
|
Back to top |
|
|
Joyce
New User
Joined: 15 Aug 2013 Posts: 8 Location: China
|
|
|
|
Marso wrote: |
In your "Program A", do you have calls to special routines (like DSNRLI) ?
Quote: |
The only execution clause in REXX is:
ADDRESS LINKPGM "XXXXXXXX AAAA BBBB"
XXXXXXXX is the DB2 COBOL program
AAAA is the first parm
BBBB is the second parm |
Because of this, I would say "Program A" is using RRSAF to connect to DB2.
Meanwhile, "Program B" returns -991 which means it should run under the DSN stub. Which means "Program B" is using CAF to connect to DB2.
Try using the following commands:
Code: |
Queue "RUN PROGRAM(Program B) PARM('"YourParm"') ",
"PLAN(YourPlan) LIB("YourLib")"
Queue "END"
"DSN SYSTEM("YourDB2Name")" |
|
Hi Marso,
In my REXX, there is no calls to any special routines.
There is only one 'useful' clause in the REXX. Others are 'SAY' clause or 'AAAA=ABCD' (initialize) clause. The 'useful' clause is:
ADDRESS LINKPGM "XXXXXXXX AAAA BBBB"
XXXXXXXX is the DB2 COBOL program
AAAA is the first parm for XXXXXXXX
BBBB is the second parm for XXXXXXXX
So, it is using RRSAF to connect to DB2.
I cannot access TSO now. I'll try it tomorrow and then post my result here. Thank you! |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
Quote: |
Which means "Program B" is using CAF to connect to DB2. |
I beg to disagree, whatever the reason IT IS NOT CAF in se
I have a couple of REXX functions using CAF
- My own implementation of REXX SQL interface -
and they work nicely |
|
Back to top |
|
|
Joyce
New User
Joined: 15 Aug 2013 Posts: 8 Location: China
|
|
|
|
Marso wrote: |
In your "Program A", do you have calls to special routines (like DSNRLI) ?
Quote: |
The only execution clause in REXX is:
ADDRESS LINKPGM "XXXXXXXX AAAA BBBB"
XXXXXXXX is the DB2 COBOL program
AAAA is the first parm
BBBB is the second parm |
Because of this, I would say "Program A" is using RRSAF to connect to DB2.
Meanwhile, "Program B" returns -991 which means it should run under the DSN stub. Which means "Program B" is using CAF to connect to DB2.
Try using the following commands:
Code: |
Queue "RUN PROGRAM(Program B) PARM('"YourParm"') ",
"PLAN(YourPlan) LIB("YourLib")"
Queue "END"
"DSN SYSTEM("YourDB2Name")" |
|
Hi Marso,
I tried but it doesn't work. Error message is:
'DSNE960E PARAMETER STRING EXCEEDS ALLOWABLE LIMIT OF 100 (DECIMAL) CHARACTERS'
For program B, it has two parms. The first parm AAAA is 3795 chars in length. The second parm BBBB is 8 chars in length.
Thank you
Joyce |
|
Back to top |
|
|
Joyce
New User
Joined: 15 Aug 2013 Posts: 8 Location: China
|
|
|
|
enrico-sorichetti wrote: |
Quote: |
Which means "Program B" is using CAF to connect to DB2. |
I beg to disagree, whatever the reason IT IS NOT CAF in se
I have a couple of REXX functions using CAF
- My own implementation of REXX SQL interface -
and they work nicely |
Hi Sorichetti,
Do you have any sample REXX and JCL on this?
Thank you
Joyce |
|
Back to top |
|
|
don.leahy
Active Member
Joined: 06 Jul 2010 Posts: 765 Location: Whitby, ON, Canada
|
|
|
|
Enrico: I believe that the reason that the messages and codes description of the -991 SQLCODE mentions CAF is that, in the absence of any other information about the connection, DB2 will attempt to use CAF as the default.
The -991 occurs because DB2 is trying to use CAF but the program has not been properly set up for CAF execution. (Either the STEPLIB is incorrect, or the program was not linked with the CAF flavour of DSNHLI).
So, as you mentioned, CAF is not the problem. The TS needs to look at the program to figure out what connection type it has been set up for, and then make sure that the execution time requirements are met. |
|
Back to top |
|
|
Joyce
New User
Joined: 15 Aug 2013 Posts: 8 Location: China
|
|
|
|
Dear All,
I found a way to call program B.
As I mentioned before, program B is a sub-routine program. It is called by main-program and let's call it program C.
At the beginning of program C, it will call another sub-routine program D to 'CONNECT' DB2.
So I added below execution clause in my REXX:
ADDRESS LINKPGM "YYYYYYYY CCCC"
YYYYYYYY is the sub-routine program D
CCCC is the parm
Now my REXX reads as below and it works for program B:
ADDRESS LINKPGM "YYYYYYYY CCCC"
ADDRESS LINKPGM "XXXXXXXX AAAA BBBB"
Thank you all! |
|
Back to top |
|
|
|