MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

sas\c module

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
mrinalsolanki
Beginner


Joined: 02 May 2006
Posts: 56
Topics: 16

PostPosted: Fri May 05, 2006 8:59 am    Post subject: sas\c module Reply with quote

Hi All,

I have compiled and link edited the following code:

Code:
typedef int EXTF();                                         
#pragma linkage(EXTF,OS)                                     
char str(|80|);                                             
int c;                                                       
FILE *fopen(), *fp;                                         
scanf("%s",&str);                                           
EXTF *bpxwdyn=(EXTF *)fetch("BPXWDYN");                     
bpxwdyn("alloc file(TEST) da('"str"')shr reuse msg(2)");     
system("alloc file(TEST) da('a.b.c')shr reuse");*/           
fp = fopen( "TEST", "r");                                   
c=getc(fp);                                                 
while(c!=EOF)                                               
{                                                           
   putchar(c);                                               
   c=getc(fp);                                               
                                                             
}                                                           
fclose(fp);                                                 
system("tso: free file(TEST)");                             


The problem encounterd is as follows:
Code:

LSCX716 **** WARNING **** ERRNO = ESYS                                         
        Generated in   SYSTEM called from line     11 of     MAIN(MAIN)   , off
        Program ALLOC    was abnormally terminated with a system code of 66D. 
                                                                               
LSCX500 **** WARNING **** ERRNO = ENFOUND                                     
        Generated in    FOPEN called from line     12 of     MAIN(MAIN)   , off
        File not opened, ddname TEST     not defined.                         
Interrupted while: Opening file "TEST"                                         
                                                                               
LSCX316 **** WARNING **** ERRNO = ENOTOPEN                                     
        Generated in    FGETC called from line     13 of     MAIN(MAIN)   , off
        Attempt to use null FILE pointer.                                     
                                                                               
LSCX351 **** WARNING **** ERRNO = EUSAGE                                       
        Generated in   FCLOSE called from line     20 of     MAIN(MAIN)   , off
        File to be closed is not a valid open file.     

Can Somebody help me to get out of this?                     
                                                                               
LSCX718 **** WARNING **** ERRNO = EUSAGE                                       
        Generated in   SYSTEM called from line     21 of     MAIN(MAIN)   , off
        TSO environment not active, "system" command rejected.                 
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Fri May 05, 2006 9:29 am    Post subject: Reply with quote

mrinalsolanki,

Post all your related questions in 1 topic. You already have a topic with the same title.

You are not checking the Return code after BPXWDYN call. Check this link for the documentation of BPXWDYN.

http://www.mvsforums.com/helpboards/viewtopic.php?t=2520&highlight=bpxwdyn

Correct your code accordingly

Hope this helps..

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mrinalsolanki
Beginner


Joined: 02 May 2006
Posts: 56
Topics: 16

PostPosted: Mon May 08, 2006 2:16 am    Post subject: Reply with quote

hi kolusu,

First of all sorry for posting the same topic in different post.
Now actually i am new to mainframes that's why i wrongly said that the above code is compiled and linkedited.

Now the problem is that iam facing problem while compiling and link editing
and the problem is like this

Code:
11        1       FILE *fopen(), *fp;                                     
      12        1       scanf("%s",&str);                                       
      13        1       EXTF *bpxwdyn=(EXTF *)fetch("BPXWDYN");                 
                             |                                                 
LSCC109 Error in SYSIN at line 13 before column 10: invalid use of type name or
LSCC057 Error in SYSIN at line 13 before column 10: semi-colon expected         
                                                                               
      14        1       bpxwdyn("alloc file(TEST) da('"str"')shr reuse msg(2)");
                               |                                               
LSCC100 Warning in SYSIN at line 14 before column 12: no prototype declared for
LSCC016 Error in SYSIN at line 14 before column 38: invalid function argument   
                                                                               
      15           /*   system("alloc file(TEST) da('a.b.c')shr reuse");*/     
      16        1       fp = fopen( "TEST", "r");                               
      17        1       c=getc(fp);       



so please help to get out of this

Thanks'
Mrinal
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Mon May 08, 2006 4:44 am    Post subject: Reply with quote

mrinalsolanki,

Refer my above post for BPXWDYN documentation and there is an example for C

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mrinalsolanki
Beginner


Joined: 02 May 2006
Posts: 56
Topics: 16

PostPosted: Tue May 16, 2006 8:34 am    Post subject: Reply with quote

Hi kolusu,

As your given reference i tried to resolve my problem but i get the problem in linkediting for thr following code

Code:
#include<stdio>                                                     
 #include<stdlib>                                                   
 main()                                                               
 {                                                                     
      typedef int EXTF();                                             
      int fetch(char *);                                               
      #pragma linkage(EXTF,OS)                                         
      EXTF *bpxwdyn;                                                   
      int  rc;                                                         
      bpxwdyn=(EXTF *)fetch("BPXWDYN");                               
      rc=bpxwdyn("alloc fi(sysin) da('NIIT53.PRACTICE.C(BPX)') shr"); 
      printf("%d",rc);                                                 
      rc=bpxwdyn("alloc fi(sysin) da('NIIT53.PRXXXICE.C(BPX)') shr"); 
      printf("%d",rc);                                                 
 }                                                                     

[
Code:
code]********************************* TOP OF DATA **********************************
1                                                                               
 SAS Institute 370 C Linkage Editor Preprocessor Release 5.50C                 
 Copyright(c) 1992 by SAS Institute Inc. All Rights Reserved.                   
  INCLUDE OBJECT(BPX)                                                           
  ENTRY   MAIN                                                                 
 LSCL700 Note: ENTRY control statement not processed by CLINK, passed on to link
  NAME    BPX(R)                                                               
 LSCL102 Warning: Can't open file during autocall: ddn:SYSLIB(FETCH)           
                                                                               
  END CLINK PREPROCESSING (rc=4)                                               
1z/OS V1 R3 BINDER     07:50:53 TUESDAY MAY 16, 2006                           
 BATCH EMULATOR  JOB(NIIT53B ) STEP(BPX     ) PGM= IEWL                         
 IEW2278I B352 INVOCATION PARAMETERS - RENT,LIST,XREF,MAP                       
                                                                               

Code:
IEW2322I 1220  1    ENTRY   MAIN                                               
IEW2322I 1220  2    NAME    BPX(R)                                             
IEW2456E 9207 SYMBOL FETCH UNRESOLVED.  MEMBER COULD NOT BE INCLUDED FROM THE  DESIGNATED CALL LIBRARY.   
[/code]
Back to top
View user's profile Send private message
DaveyC
Moderator


Joined: 02 Dec 2002
Posts: 151
Topics: 3
Location: Perth, Western Australia

PostPosted: Tue May 30, 2006 1:13 am    Post subject: Reply with quote

fetch() is an IBM extension to the C language that comes with LE. SAS/C provide a similar function called loadm(). Check your documentation.
_________________
Dave Crayford
Back to top
View user's profile Send private message Send e-mail
mrinalsolanki
Beginner


Joined: 02 May 2006
Posts: 56
Topics: 16

PostPosted: Wed May 31, 2006 2:32 am    Post subject: Reply with quote

Hi dave,

As per you suggestions i have made changes in code and succesfully compile and link edited it. But at run time it is giving error the code and error are as follows:

Modified code

Code:
#include<stdio>                                                       
 #include<stdlib>                                                     
 main()                                                                 
 {                                                                       
      typedef int EXTF();                                               
      int loadm(char *);                                                 
      #pragma linkage(EXTF,OS)                                           
      EXTF *bpxwdyn;                                                     
      int  rc;                                                           
      bpxwdyn=(EXTF *)loadm("BPXWDYN");                                 
      rc=bpxwdyn("alloc fi(sysi1) da('NIIT53.PRACTICE.C(BPX)') shr reuse"
      printf("%d",rc);                                                   
      rc=bpxwdyn("alloc fi(sysi2) da('NIIT53.PRXXXICE.C(BPX)') shr reuse"
      printf("%d",rc);                                                   
 }                                                                       


Error :The return code is 4
Code:
********************************* TOP OF DATA **********************************
1LSCX041 **** ERROR ****                                                       
         ABEND occurred in    LOADM called from line    10 of     MAIN(MAIN)   ,
         Program terminated by operating system. ABEND code = S0C4             
 Calling trace:                                                                 
     Function        Line    Offset    Context                                 
    LOADM(L$CDLDR)   ----    00009E                                             
     MAIN(MAIN)        10    000052                                             
******************************** BOTTOM OF DATA ********************************
Back to top
View user's profile Send private message
DaveyC
Moderator


Joined: 02 Dec 2002
Posts: 151
Topics: 3
Location: Perth, Western Australia

PostPosted: Thu Jun 01, 2006 6:56 am    Post subject: Reply with quote

The function signiture for loadm is incorrect. I suggest you include the correct header file and read the documentation regarding loadm. You can download the manuals from SAS website.
_________________
Dave Crayford
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group