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

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


IBM Mainframe Forums -> IMS DB/DC
Post new topic   Reply to topic
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
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

Superior Member


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

PostPosted: Fri Apr 15, 2011 3:28 pm
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
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
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: 765
Location: Whitby, ON, Canada

PostPosted: Fri Apr 15, 2011 11:13 pm
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 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
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
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

Superior Member


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

PostPosted: Mon Apr 25, 2011 4:14 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> IMS DB/DC

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Error to read log with rexx CLIST & REXX 11
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top