Johnny,
I'm trying to find out if something has changed between z/OS 1.9 and
z/OS 1.11. However, in the z/OS code I've been writing, the asm construct
needs two underscores in front. (__asm) From your code below, it looks like
it is treating the _asm as a function call. Try adding an underscore to the
front of your _asm code.
An example of the __asm statement performing a QSAM GET can be found below.
__asm(" LR 1,%1\n" /* Load the DCB address in Reg1 */
" LA 5,%2\n" /* put address of qsam_EOF in r5 */
" GET (1)\n" /* Issue GET macro */
" ST 1,%0" : /* Store buff ptr from reg1 */
"=m"(loc_buff) : /* Output buffer return pointer */
"r"(in), /* Input DCB address */
"m"(loc_qsam_EOF) : /* EOF indicator */
"r1","r5"); /* Regs 1,5 used */
Other posts in this thread wonder about the : : : syntax for the
__asm statement. Between the first and second colon: can be found the
output fields. Between the second and third colon are the input fields. And
the last set are the clobbered registers. (Ones that are changed by the
assembler code so that the compiler can make sure not to rely on their
contents after the inline assembler.
My two favorite books for Metal C are "Metal C Programming Guide and
Reference" z/OS 1.13 manual at:
http://publibfi.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/CCRUG150/CCONTENTS?DT=20120802212435
and the "XL C/C++ Language Reference" z/OS 1.13 manual at:
http://publibfi.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/CBCLR1B0/CONTENTS?SHELF=&DT=20110613040946
Thanks,
Andrew Wilt
z/SW Team Lead
China Systems and Technology Lab (CSTL) Beijing
IBM Mainframe Discussion List <[email protected]> wrote on
10/28/2012 12:39:34 AM:
> From:
>
> Johnny Luo <[email protected]>
>
> To:
>
> [email protected]
>
> Date:
>
> 10/28/2012 12:41 AM
>
> Subject:
>
> Weird Metal C problem
>
> Hi, List,
>
> After upgrading from z/OS 1.9 to z/OS 1.11, all our metal c programs
just
> won't pass the compilation process.
>
> Take a simple test program for example:
>
> #include <metal.h>
> #include <string.h>
> void main()
> {
> _asm(" here we are " );
> }
>
> It does pass the compilation, but the generated asm code is different
from
> before:
>
> 56 * _asm(" here we are " );
> 57 LR 14,11
> 58 OILH 14,X'8000'
> 59 L 15,=V(@ASM)
> 60 LA 1,76(,13)
> 61 ST 14,76(,13)
> 62 MVC 8(4,13),#NAB_1
> 63 BASR 14,15
>
> I remember clearly that in z/OS 1.9 "here we are" will be generated
as-is
> in the asm souce code.
>
> Ok, let's add the ":":
>
> #include <metal.h>
> #include <string.h>
> void main()
> {
> _asm(" here we are " : : : );
> }
>
> Then the compilation failed:
>
> 5 1 | _asm(" here we are " : : : );
> ===========> .......................a.................................
> *=ERROR===========> a - CCN3276 Syntax error: possible missing ')'?
>
>
> Actually all our programs which use ':' in _asm code encounter the same
> 'missing ')' ' error.
>
> And those programs work well in the past.
>
> My search parm is :
>
> NOSEARCH,SOURCE,SEARCH(/usr/include/metal/)
>
> It seems to me that metal c compiler suddenly goes crazy...
>
> Any hint?
>
> Thanks.
>
>
>
>
> Best Regards,
> Johnny Luo
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to [email protected] with the message: INFO IBM-MAIN
>
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN