[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: Dynamic table names in MVS/DB2



This worked for me:


  LET $tb1 = 'PS_PERSONAL_DATA'
  LET $tb2 = 'PS_EMPLOYMENT'
  LET $tb3 = 'PS_JOB'

begin-SELECT
A.EMPLID
B.EMPL_RCD#
C.EFFDT

  let $C_Effdt = &C.Effdt

FROM  \$tb1\ A,
      \$tb2\ B,
      \$tb3\ C
WHERE A.PER_STATUS = 'E'


Keep in mind that for some reason, SQR doesn't always recognize
selected columns properly.  In the program I tested (a version of
PER099), I had to replace C.Effdt used in another SELECT with $C_Effdt
to avoid a SQL Error of 180 (invalid date/time).



===============================================




---Sonia Reed <sonja@CAPITALNET.COM> wrote:
>
> I have tried to use \$DynamicTableName\ in MVS/DB2 (which is
> [$DynamicTableName] elsewhere).  Since I need to join more than one
> table, I have to use something like:
>
> let $DynamicTableName = 'TABLE_NAME,'
>
> The select statement actually gets only 'TABLE_NAME' - without the
> comma, which kills my select statement.
>
> Does anyone knows the remedy for this problem
>
> Thanks.
>

_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com