Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Opening VSAM file is giving ASRA Abend

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS
View previous topic :: :: View next topic  
Author Message
zanyzap4u

New User


Joined: 13 Dec 2008
Posts: 38
Location: Mexico City

PostPosted: Wed Jan 14, 2009 11:51 am    Post subject: Opening VSAM file is giving ASRA Abend
Reply with quote

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
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10327
Location: italy

PostPosted: Wed Jan 14, 2009 1:03 pm    Post subject: Reply to: Opening VSAM file is giving ASRA Abend
Reply with quote

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
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/Shelves/DFHASJ00
Back to top
View user's profile Send private message
satishk

New User


Joined: 20 Jul 2007
Posts: 7
Location: Hyderabad

PostPosted: Wed Jan 14, 2009 1:47 pm    Post subject:
Reply with quote

Hi Zan,

The link provided by me below is the reference for your query:-

http://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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8165
Location: East Dubuque, Illinois, USA

PostPosted: Wed Jan 14, 2009 5:52 pm    Post subject:
Reply with quote

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
View user's profile Send private message
zanyzap4u

New User


Joined: 13 Dec 2008
Posts: 38
Location: Mexico City

PostPosted: Thu Jan 15, 2009 4:44 pm    Post subject:
Reply with quote

I can understand what u are saying Robert.
I should try to access the VSAM through CICS. Am i right..!?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8165
Location: East Dubuque, Illinois, USA

PostPosted: Thu Jan 15, 2009 6:04 pm    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts ASP3 ABEND IN CICS Vedant CICS 0 Fri Oct 20, 2017 3:18 pm
No new posts opening a dataset after reading it fr... arunsoods DFSORT/ICETOOL 5 Wed Oct 04, 2017 3:54 pm
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts VSAM RLS Wait time blayek JCL & VSAM 2 Mon Oct 02, 2017 9:05 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us