View previous topic :: View next topic |
Author |
Message |
mrinalsolanki Beginner
Joined: 02 May 2006 Posts: 56 Topics: 16
|
Posted: Fri May 05, 2006 8:59 am Post subject: sas\c module |
|
|
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 |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
|
|
Back to top |
|
|
mrinalsolanki Beginner
Joined: 02 May 2006 Posts: 56 Topics: 16
|
Posted: Mon May 08, 2006 2:16 am Post subject: |
|
|
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 |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
|
Posted: Mon May 08, 2006 4:44 am Post subject: |
|
|
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 |
|
|
mrinalsolanki Beginner
Joined: 02 May 2006 Posts: 56 Topics: 16
|
Posted: Tue May 16, 2006 8:34 am Post subject: |
|
|
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 |
|
|
DaveyC Moderator
Joined: 02 Dec 2002 Posts: 151 Topics: 3 Location: Perth, Western Australia
|
Posted: Tue May 30, 2006 1:13 am Post subject: |
|
|
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 |
|
|
mrinalsolanki Beginner
Joined: 02 May 2006 Posts: 56 Topics: 16
|
Posted: Wed May 31, 2006 2:32 am Post subject: |
|
|
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 |
|
|
DaveyC Moderator
Joined: 02 Dec 2002 Posts: 151 Topics: 3 Location: Perth, Western Australia
|
Posted: Thu Jun 01, 2006 6:56 am Post subject: |
|
|
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 |
|
|
|
|