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
 

 

To read a VSAM-KSDS (any alternative?) from IMS COBOL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> IMS DB/DC
View previous topic :: :: View next topic  
Author Message
Bartolomeo Vaieretti

New User


Joined: 09 Mar 2011
Posts: 6
Location: Germany

PostPosted: Fri Apr 15, 2011 2:56 pm    Post subject: To read a VSAM-KSDS (any alternative?) from IMS COBOL
Reply with quote

Hi,

I need to read a VSAM-KSDS file from my IMS program. The VSAM-KSDS is maintained by an external CICS application and also accessed by a batch process.

I read now in some posts that I can't access VSAM from IMS. But another post said that I could access VSAM from a BMP program. I'm new in IMS, and I don't know if my program could be BMP. May be this is an alternative.

My needs:
* I should start a transaction, with a parameter.
* With this parameter as key value, I should read the VSAM file.
* With the data from the VSAM file, I should call some subprograms (not from me but I got said that I can call them from each IMS mode, indistinct)
* I should put the results in a message queue which could be accessed later but another IMS program

Thats all. No interactive thing, but the input of transaction with parameter (even this could be maybe done by another program?).

Can I do all this from a BMP program, getting the parameter (calling CBLTDLI with GU function), calling my subprograms and then inserting the results in some messages to a message queue (CBLTDLI with ISRT)?

Thanks,

Bartolomeo
Back to top
View user's profile Send private message

Anuj Dhawan

Senior Member


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

PostPosted: Fri Apr 15, 2011 3:28 pm    Post subject:
Reply with quote

I'm not sure what is the question here. When you say
Quote:
I read now in some posts that I can't access VSAM from IMS.
- what exactly do yo mean? You write a COBOL program (you've used CBLTDLI, so I assume COBOL as language) -- some lines of COBOL code to read IMS and there will be seprate line of codes to read VSAM too -- so what exactly the question is?

BMP is an Information Management System (IMS) batch processing program that has access to online databases and message queues. BMPs run online, but like programs in a batch environment, they are started with job control language (JCL). So so far it sounds you can do this
Quote:
Can I do all this from a BMP program, getting the parameter (calling CBLTDLI with GU function), calling my subprograms and then inserting the results in some messages to a message queue (CBLTDLI with ISRT)?
Back to top
View user's profile Send private message
Bartolomeo Vaieretti

New User


Joined: 09 Mar 2011
Posts: 6
Location: Germany

PostPosted: Fri Apr 15, 2011 4:10 pm    Post subject:
Reply with quote

Hi Anuj,
First, thanks for your quick answer.
Sorry, I wrote maybe too much in one post. It's because I saw in other posts that many people start asking a single question and then, the others start asking them what they really want to do in order to maybe suggest any alternative. Then, I did it in advance, first reading other posts, then getting panic icon_eek.gif (because my plan to read VSAM seems to be gone, I wrongly assumed that IMS Cobol programs shouldn't have problems to do that), then writing what I wanted to do originally (reading VSAM), explaining why (the small detail of my need to read VSAM) and asking for help/suggestions/clarifications.
For example, recently now is clear for me that a BMP program needs to run from a JCL. I need to get the parameter following a transaction code from the IMS environment (maybe part of my confusions are because inside my mind I'm comparing with what I know from CICS). Knowing this now, I think BMP is out of what I need. It's supposed that whoever will use my program, will start it invoking any transaction.
Now, two concrete questions:
1) It's true that I can't read a VSAM-KSDS file from a COBOL-IMS transaction program?
2) Do I have any alternative file type to use? (I saw something about GSAM, I never used this type of files, but I need a file with key, to read the right record directly) - The target environment use IMS without the DB (they have another external DB, Adabas icon_sad.gif )
Thanks again,
Bartolomeo
Back to top
View user's profile Send private message
Sandy Zimmer

Active Member


Joined: 13 Jun 2007
Posts: 826
Location: Wilmington, DE

PostPosted: Fri Apr 15, 2011 10:20 pm    Post subject:
Reply with quote

1) yes - only IMS defined databases

2) vsam files are accessible from a BMP or DLI batch IMS program
You might consider triggering a job thru a message switch to trigger a job (PROC - JCL) thru CA-7 - or like - region
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 655
Location: Whitby, ON, Canada

PostPosted: Fri Apr 15, 2011 11:13 pm    Post subject:
Reply with quote

I think you can define your VSAM KSDS file as SHISAM and access it that way. I have never done it however. See http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=/com.ibm.ims9.doc.adb/dba613.htm
Back to top
View user's profile Send private message
Peter Nancollis

New User


Joined: 15 Mar 2011
Posts: 47
Location: UK

PostPosted: Sat Apr 16, 2011 5:29 am    Post subject:
Reply with quote

Why not
convert the VSAm to, say HIDAM
convert the batch prog to a BMP,
hook the CICS region via DBCTL
[OK the CICS code would have to change to use DLI to access ]
but everyone would share the data.
Back to top
View user's profile Send private message
Bartolomeo Vaieretti

New User


Joined: 09 Mar 2011
Posts: 6
Location: Germany

PostPosted: Wed Apr 20, 2011 9:01 pm    Post subject: It's working! :D
Reply with quote

Hi all,

First, thanks to all for the dedicated time. I was just ready to write from CICS in a SHIRAM db file, when my boss connected me with an ex worker of the company, and he gave me a totally different point.
He told me that it's possible to read VSAM from the MPP (online) region of IMS. What he told me is that, it's not possible to access VSAM file and have them under the commitment control, what is understandable after taking a look on the solution.
He told me that I should create (in my case, recreate) my VSAM files with SHAREOPTIONS(3,3), even if I'll only read from IMS. I didn't try other combination, like 3,2 (but I guess it should work). Anyway, with the default it's obvious that will not work.
Then, I added the access to the VSAM files in my COBOL program, as in any normal zOS COBOL: SELECT filename ASSIGN TO... bla bla bla. Then OPEN, READ, START, READ NEXT, CLOSE, etc.. And finally, I added the corresponding //filename DD DISP=SHR,DSN=data.set.name , and then, restarting the region.
Now, I have my COBOL program running in the MPP region and reading both VSAM files which I needed to read.
I just wanted to share the solution, because I didn't imagine that it could work and so simple.
Anyway guys, again, thanks. For sure next time I'll not be able to solve so simple the things and I'll need your appreciated help. icon_smile.gif

Greetings,

Bartolomeo
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


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

PostPosted: Mon Apr 25, 2011 4:14 pm    Post subject:
Reply with quote

Thanks for sharing the final solution,

have a good one.
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 -> IMS DB/DC All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Read two inputs and write into output... murali.andaluri DFSORT/ICETOOL 6 Wed Jul 26, 2017 7:35 pm
No new posts XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm
No new posts Dynamic output file creation in cobol... smileheal COBOL Programming 7 Thu Jun 15, 2017 10:53 pm
No new posts Search utility(3.14) using JCl and Cobol RKS3 COBOL Programming 12 Sat Jun 10, 2017 10:24 pm
No new posts COBOL DB2 program - zIIP eligible vasanthz COBOL Programming 7 Wed May 31, 2017 5:12 am


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