Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

EXAMPLE FOR A REXX program calling a COBOL/DB2 program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: EXAMPLE FOR A REXX program calling a COBOL/DB2 program
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Mon Jan 16, 2012 3:27 pm    Post subject: Reply to: EXAMPLE FOR A REXX program calling a COBOL/DB2 pro
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    Post subject:
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    Post subject:
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: 1219
Location: Israel

PostPosted: Mon Jan 16, 2012 5:37 pm    Post subject: Reply to: EXAMPLE FOR A REXX program calling a COBOL/DB2 pro
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    Post subject: Reply to: EXAMPLE FOR A REXX program calling a COBOL/DB2 pro
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    Post subject:
Reply with quote

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

Senior Member


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

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

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

http://ibmmainframes.com/about38247.html
http://www.sk-consulting.de/db2manuals/DB2%20V9%20Application_Programming&SQL_Guide_dsnapk13.pdf (search for REXX)
http://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    Post subject:
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    Post subject:
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

Senior Member


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

PostPosted: Tue Jan 17, 2012 4:51 pm    Post subject:
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    Post subject:
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: 1738
Location: Bloomington, IL

PostPosted: Thu Jan 19, 2012 12:38 am    Post subject: Re: Reply to: EXAMPLE FOR A REXX program calling a COBOL/DB2
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts I can not compile my program PL1 V3.R... Miguel Fernandez PL/I & Assembler 13 Tue Dec 06, 2016 8:30 pm
No new posts IMS BMP program causes 878 system abend Artemk IMS DB/DC 7 Tue Nov 22, 2016 8:26 pm
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us