IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

EXAMPLE FOR A REXX program calling a COBOL/DB2 program


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Mahesh P

New User


Joined: 16 Jan 2012
Posts: 7
Location: India

PostPosted: Mon Jan 16, 2012 1:24 pm
Reply with quote

Hi,

Could you please let me know how to call a Cobol/DB2 sub-program from a REXX exec. I am not sure how to

1. Pass the Plan and the DB2 subsystem to the sub-program.

There are other parameters to be passed to the sub-program and received too. So, I need to somehow call a Cobol/DB2 sub-program

1. and pass the correct PLAN and DB2 subsystem parms
2. Also pass certain input parms and recieve the output.

Could you please help? I did a search in the forum. But could not locate any sample or any direction.

Regards,
Mahesh
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Mon Jan 16, 2012 3:27 pm
Reply with quote

is it an existing program ?
Back to top
View user's profile Send private message
Mahesh P

New User


Joined: 16 Jan 2012
Posts: 7
Location: India

PostPosted: Mon Jan 16, 2012 3:31 pm
Reply with quote

yes, this is an existing program Enrico. Need to test it as an independent entity. Passing parms and receiving the result without coding a new applicaton as a whole.
Back to top
View user's profile Send private message
Mahesh P

New User


Joined: 16 Jan 2012
Posts: 7
Location: India

PostPosted: Mon Jan 16, 2012 3:41 pm
Reply with quote

Hi,

I tried using the CALL subfunction using the below command. This gives me return code of 0.

DB2PARM='DB2=DSN1,PLAN=ABCDEFG'
TRACE I
ADDRESS TSO "CALL 'XXXXX.YYYYY.ZZZZZ(PGMNAM)' 'DB2PARM'"
SAY RC

But, I do not know
1. whether it got executed
2. how to pass rest of the parms
3. I can base it on the value in the return parms.

Please let me know how to use this properly. or should I use some other function like LINKPGM, LINKMVS etc?

Regards,
Mahesh
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Mon Jan 16, 2012 5:37 pm
Reply with quote

Try:
Code:
Queue "RUN PROGRAM(progname) PARM('p1 p2') PLAN(planname) LIB(proglib)"
Queue "END"                                                   
Address TSO "DSN SYSTEM(DB2Name)"
Back to top
View user's profile Send private message
Mahesh P

New User


Joined: 16 Jan 2012
Posts: 7
Location: India

PostPosted: Tue Jan 17, 2012 3:15 pm
Reply with quote

icon_sad.gif I have been trying this from morning, but when I execute the ADDRESS TSO "DSN SYSTEM (DSN1)" command, it gives me the error COMMAND DSN NOT FOUND and gives me a return code of -3. Could you please let me know why?

Regards,
Mahesh
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Tue Jan 17, 2012 3:31 pm
Reply with quote

are you using the proper JCL class?
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6248
Location: Mumbai, India

PostPosted: Tue Jan 17, 2012 3:53 pm
Reply with quote

You are giving very less information, with that, suggest you spend some time with these links, possibly you get a go:

ibmmainframes.com/about38247.html
www.sk-consulting.de/db2manuals/DB2%20V9%20Application_Programming&SQL_Guide_dsnapk13.pdf (search for REXX)
ibmmainframes.com/about31758.html
Back to top
View user's profile Send private message
Mahesh P

New User


Joined: 16 Jan 2012
Posts: 7
Location: India

PostPosted: Tue Jan 17, 2012 4:04 pm
Reply with quote

Hi gylbharat - I am trying to run this using the EXec command from 3.4. I am not using jcls. I know where my DSN command is in. But I need to know how to allocate the PDS in th REXX code so that it understands where to search for the DSN command.

Is that the issue? if yes, how do I solve it?

Regards,
Mahesh
Back to top
View user's profile Send private message
Mahesh P

New User


Joined: 16 Jan 2012
Posts: 7
Location: India

PostPosted: Tue Jan 17, 2012 4:15 pm
Reply with quote

Sorry if I have been too ambiguous. My requirements are

1. Run an already existing Cobol/Db2 subprogram from my REXX exec - online (Using 3.4, execute it using the Ex command).
2. I need to know how to pass parms to it and also to pass the PLAN name.
3. the routine does return some values for the REXX to process
4. currenly I am trying to execute it using ADDRESS TSO "DSN SYSTEM(DSN1)" command (as per an above post), but when executing it gives me the error - COMMAND DSN not found. I need the REXX to search in a particular library to find this. but not sure how to specify the library. I know the library name.

Please help.

regards,
Mahesh
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6248
Location: Mumbai, India

PostPosted: Tue Jan 17, 2012 4:51 pm
Reply with quote

How about
Code:
Address TSO "CALL 'some.loadlib(YourPgm)' "
or using LINKMVS as
Code:
* REXX */
Address LINKMVS "YourPgm PARAMETERS"
Back to top
View user's profile Send private message
Mahesh P

New User


Joined: 16 Jan 2012
Posts: 7
Location: India

PostPosted: Tue Jan 17, 2012 4:54 pm
Reply with quote

Hello Anuj - thanks for the reply. but I need to specifically know how to pass my PLAN and the DB2 subsystem name to this sub-program?
I have to pass this and also pass parms and recieve them back

Regards,
Mahesh
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1787
Location: Bloomington, IL

PostPosted: Thu Jan 19, 2012 12:38 am
Reply with quote

Mahesh P wrote:
icon_sad.gif I have been trying this from morning, but when I execute the ADDRESS TSO "DSN SYSTEM (DSN1)" command, it gives me the error COMMAND DSN NOT FOUND and gives me a return code of -3. Could you please let me know why?

Regards,
Mahesh

Copy and paste the trace from your exec into this thread, being sure to use the Code tags.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Does anyone know rexx for VSE CLIST & REXX 3
No new posts COBOL sorting, with input GDG base COBOL Programming 7
No new posts TSO ALLOC In REXX Needs Improvement JCL & VSAM 3
No new posts Need help with ADABAS query (COBOL-AD... All Other Mainframe Topics 0
No new posts REXX/CMS How to place command console... CLIST & REXX 4
Search our Forums:

Back to Top