On Fri, 30 Aug 2013 09:15:28 -0500, Mark Hammack wrote:

>I would like to be able to pass a string to the IBM C/C++ compiler to include 
>in a program.  I have tried every way I can think of to use the DEFINE() 
>compiler option but can't make it work.  This is what I would like to do:
>
>...
>//   EXEC PGM=CCNDRVR,PARM=('...DEFINE(MYSTRING=TEST)')
>...
>
>In the program -- 
>
>...
>
>#pragma comment(copyright, "This program was compiled on " __DATE__ " with the 
>" MYSTRING " option");
>
>...
>
>The compiler gets an error that it expected ")" but found "TEST" (it likes 
>__DATE__ just fine).  I have tried DEFINE(MYSTRING='"TEST"') (with the set of 
>quotes), using another macro:  
>
>#define test_string(option) #option
>
>but test_string(MYSTRING) generates "MYSTRING" not "TEST".
>
>----------------------------------------------------------------------

#define test_string(option) #option
#define redo_string(option) test_string(option)

for DEFINE(MYSTRING=TEST)
redo_string(MYSTRING) will generate "TEST"

Bill

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to