CA SOLVE

Tech Tip: '&' as character, not as prefix for Variables

  • 1.  Tech Tip: '&' as character, not as prefix for Variables

    Posted 03-23-2018 09:29 AM

    It happens that you want to use the Ampersand '&' as a character and not as a prefix for variable names. For example you want to put a line like this into a variable:

    //SYSLIN   DD  DSN=&&OBJECT,DISP=(OLD,DELETE)

     

    This can easily be done by using these two lines:

    &DSN = &CONCAT & & OBJECT                         
    &Q = &STR //SYSLIN   DD  DSN=&DSN,DISP=(OLD,DELETE)

     

    Variable &DSN is filled with the three character which are concatenated by &CONCAT: '&', '&' and 'OBJECT'. Thus, &DSN is filled with the string &&OBJECT.