View previous topic :: View next topic
|
Author |
Message |
zanyzap4u
New User
Joined: 13 Dec 2008 Posts: 38 Location: Mexico City
|
|
|
|
I am trying to open a vsam ksds cluster from a C- CICS program.
Code: |
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <string.h>
#include <//'XXXXXX.XXX.COPY(VSAMAP1)'>
struct data_struct
{
char unique_key<:8:>;
char data<:72:>;
}buf1;
main()
{
FILE *KSDSfile;
char *key;
int w_retcd;
int l_retcd;
int r_retcd;
KSDSfile = fopen("DD:KSDSCLUS", "rb+,type=record");
printf("fopen() returned 0X%.8x\n",KSDSfile);
if (KSDSfile==NULL)
exit;
printf("calling fopen(\"dd:ksdsclus\",\"rb+,type=record\");\n");
EXEC CICS
SEND MAP("vsamap1");
EXEC CICS RECEIVE
MAP("vsamap1");
memcpy(key,vsamap1.vsamap1i.inputi,8);
l_retcd = flocate(KSDSfile, key, 8, __KEY_EQ);
printf("flocate() returned %d\n",l_retcd);
if (l_retcd !=0)
exit;
r_retcd = fread(&buf1, 1, sizeof(buf1), KSDSfile);
printf("fread() returned %d\n",r_retcd);
printf("\n\ndata:%s\n\n",buf1.data);
memcpy(vsamap1.vsamap1o.datao,buf1.data,72);
EXEC CICS
SEND MAP("vsamap1");
EXEC CICS
RETURN;
fclose(KSDSfile);
return(0);
}
|
When we are running the transaction it is giving this error :
Code: |
DFHAC2206 11:28:32 CICSB1 Transaction BM30 failed with abend ASRA. Updates to local recoverable resources backed out. |
I have defined the VSAM correctly in the FCT, with recsize,keylenth and share op.
I guess it is not taking the DD name(logical file name) or maybe there is some problem while defining.
I tried searching the forum, but i didnot find anything helpful.
Because very few of them have done it with C program.
Kindly Help. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Code: |
KSDSfile = fopen("DD:KSDSCLUS", "rb+,type=record"); |
Quote: |
I am trying to open a vsam ksds cluster from a C- CICS program. |
we can see that, but You can not do it
You can get all the help You need in the cics manuals
it would be wiser, before proceeding to the programming
to get a better grasp of the overall cics architecture
for the whole manual set
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/Shelves/DFHASJ00 |
|
Back to top |
|
|
satishk
New User
Joined: 20 Jul 2007 Posts: 7 Location: Hyderabad
|
|
|
|
Hi Zan,
The link provided by me below is the reference for your query:-
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/Shelves/DFHASJ00
The code written by you is wrong. You cannot define a KSDS file in this manner while openinig a VSAM file.
KSDSfile = fopen("DD:KSDSCLUS", "rb+,type=record");
Have case study for this KSDS in the link provided by me. Henceforth, if u still find your query is unresolved. mail to me.....we will look into the matter.....
--
satishk |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
This is not a C problem. This is a problem with your understanding of CICS. No program running in CICS should ever attempt to directly open a file, read a file, write a file, or close a file. The CICS API has commands to do all these things and more; not following the API and attempting to do things on your like this has been known to cause the entire CICS region to come down. |
|
Back to top |
|
|
zanyzap4u
New User
Joined: 13 Dec 2008 Posts: 38 Location: Mexico City
|
|
|
|
I can understand what u are saying Robert.
I should try to access the VSAM through CICS. Am i right..!? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Quote: |
I should try to access the VSAM through CICS. Am i right..!?
|
EXEC CICS READ is what you want to use -- CICS manages the open and close so you don't have to worry about it. There's a link to manuals at the top of this page and there's CICS Programming Reference that gives the possible commands. |
|
Back to top |
|
|
|