View previous topic :: View next topic |
Author |
Message |
deepthij Beginner
Joined: 08 May 2009 Posts: 13 Topics: 6 Location: Bangalore
|
Posted: Mon May 11, 2009 2:12 am Post subject: Issue regarding opening file |
|
|
Hi All,
I have a requirement to read "file" from my application and written below code for the same. But, when this same "file" opened out side of my application in "Edit" mode then my application is throwing error and exiting.
Step1: Initializing __dyn_t structure.
__dyn_t ip;
dyninit(&ip);
Step2: Assigning values to __dyn_t structure.
ip.__status = __DISP_SHR;
ip.__normdisp = __DISP_KEEP;
ip.__dsname = dynfilename;
ip.__ddname = ddnameString
Step3: Calling dynalloc() function.
if (dynalloc(&ip) != 0) {
printf("\ndynalloc failed with error code %hX, info code%hX",
ip.__errcode, ip.__infocode);
}
Step4: calling fopen() to read file
if ((fp = fopen(FileName,"r")) == NULL) {
printf("DATASET %s COULD NOT BE OPENED",FileName);
}
When my file opened in "Edit" mode outside C application then If I run my application having above code then throwing below error.
Calling DYNALLOC (SVC99) for 'TIBR.PARMS.CARDLIB'
dynalloc failed with error code 210, info code0
** ERROR ** SETTING RETURN CODE=12
403 JEB4031S: DATASET 'TIBR.PARMS.CARDLIB' COULD NOT BE ALLOCATED to JEBPARM
Can any one help what can be done to avoid error in the given scenario? Please let me know if I need to post more details here.
Thanks in Advance. |
|
Back to top |
|
|
Bill Dennis Advanced
Joined: 03 Dec 2002 Posts: 579 Topics: 1 Location: Iowa, USA
|
Posted: Mon May 11, 2009 8:53 am Post subject: |
|
|
You can not avoid the error situation of the file being used by another application (ISPF EDIT) unless you deny edit access by all users except yourself.
Your application needs to detect the error and retry after some small interval. After some number of retries, you may choose to end your program as unsuccessful. _________________ Regards,
Bill Dennis
Disclaimer: My comments on this foorum are my own and do not represent the opinions or suggestions of any other person or business entity. |
|
Back to top |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Mon May 11, 2009 8:57 am Post subject: |
|
|
looks as if he was allocating/opening a PDS as a PO. _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
|
deepthij Beginner
Joined: 08 May 2009 Posts: 13 Topics: 6 Location: Bangalore
|
Posted: Tue May 12, 2009 2:08 am Post subject: |
|
|
Hi Dennis,
Yes we can do as per your suggestion as work around for the issue.
Could you suggest way to modify the code so that the client will not fail if someone attempts to edit the CARDLIB file.
The MVS client should only require read access and so it would be best if it could run successfully even if someone attempts to edit the CARDLIB file. |
|
Back to top |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Tue May 12, 2009 5:08 am Post subject: |
|
|
you are ALLOCating with DISP=(SHR,KEEP,)
try ALLOCating with DISP=SHR
or DISP=(SHR,,) _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
|
deepthij Beginner
Joined: 08 May 2009 Posts: 13 Topics: 6 Location: Bangalore
|
Posted: Tue May 12, 2009 5:14 am Post subject: |
|
|
Hi,
I have one question in MVS. If the file is already exist , is it required to use dynalloc() Function? |
|
Back to top |
|
|
deepthij Beginner
Joined: 08 May 2009 Posts: 13 Topics: 6 Location: Bangalore
|
Posted: Tue May 12, 2009 5:18 am Post subject: |
|
|
Hi Dennis,
In the above scenario the problem we are facing is even single person also not able to edit the file.We are getting error as:
Calling DYNALLOC (SVC99) for 'TIBR.PARMS.CARDLIB'
dynalloc failed with error code 210, info code0
** ERROR ** SETTING RETURN CODE=12
403 JEB4031S: DATASET 'TIBR.PARMS.CARDLIB' COULD NOT BE ALLOCATED to JEBPARM
Can you suggest what can be done to avoid this problem.
Thanks, |
|
Back to top |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Tue May 12, 2009 5:20 am Post subject: |
|
|
don't know anything about C,
but you can allocate an existing file for input or modification
or
you can allocate a non-existing file and your programs' output I/O will create it.
Bill will be along later today and give you particulars if you need more technical advice,
if you can't find it yourself in the documentation. _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
|
deepthij Beginner
Joined: 08 May 2009 Posts: 13 Topics: 6 Location: Bangalore
|
Posted: Tue May 12, 2009 5:31 am Post subject: |
|
|
Hi,
I am allocating file with DISP=SHR
Thanks,
Deepthi |
|
Back to top |
|
|
|
|