Topic
  • No replies
SystemAdmin
SystemAdmin
196 Posts

Pinned topic File handling in C and C++ on mainframes

‏2010-07-21T03:08:12Z |

Hi,
I have developed a C and C++ programs on z/OS.The functionality of the program is to read from a file and display the contents on the console.The program has to accept the file name at run-time and inorder to achieve this I coded the below in my C program
File *fp;
fp=fopen("dd:INFILE","r"); and specified the DDNAME in the run jcl.When I run the program,the fopen operation fails and fp is set NULL indicating that the file cannot be opened.I am facing the same problem with C++ program too.
Looking forward to your help in resolving the issue.
Thanks and Regards,
Bhuvana.K

Updated on 2010-08-02T02:22:00Z at 2010-08-02T02:22:00Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    196 Posts

    Re: File handling in C and C++ on mainframes

    ‏2010-07-21T17:21:03Z  
    Please try FILE *fp; instead of File *fp;

    If you still have problems, please include the run jcl here, so I can take a closer look.
  • SystemAdmin
    SystemAdmin
    196 Posts

    Re: File handling in C and C++ on mainframes

    ‏2010-08-02T02:22:00Z  
    Please try FILE *fp; instead of File *fp;

    If you still have problems, please include the run jcl here, so I can take a closer look.

    Hi,
    Thanks for your suggestion.Actually,the problem was in the RUN JCL step definition.
    Regards,
    Bhuvana