Inserting non-executable HLASM statements into the generated source code

You can use the #pragma insert_asm directive to supply your own non-executable HLASM statements to the generated source code. The primary purpose of this directive is that you can use it to include the DSECT mapping macros that are required by your embedded assembly statements. The syntax is #pragma insert_asm("string").

The #pragma insert_asm directive causes the compiler to insert string at an appropriate place in the generated HLASM code. When you use multiple #pragma insert_asm directives, they are placed in the same order as they appear in your C source code.

Note: The #pragma insert_asm directive can be used with a _Pragma operator. If you use the _Pragma operator, you must put a slash ("/") character before the double quotation marks that surround the string literal. For example: _Pragma ("insert_asm(\"MYSTRING\")").

Example: Using the #pragma insert_asm directive to map specific DSECT information

Figure 1 uses the #pragma insert_asm directive to get the system CVTUSER field to address your specified CVT extension data. Because the CVTPTR and CVTUSER fields are defined in the CVT mapping macro, you can use the #pragma insert_asm directive to map specific DSECT information.
Figure 1. Code that supplies specific DSECT mapping macros
void foo() {
  void * user_cvt;
  __asm(" L 2,CVTPTR\n"
        " L 2,CVTUSER-CVT(2)\n"
        " ST 2,%0"
        :"m"(user_cvt)::"r2");
}
#pragma insert_asm(" CVT   DSECT=YES,LIST=NO")