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

unknown function or variable in expression



I am having problems getting a routine coded correctly.
I am trying to print a partial date value (mm/dd), but if the date is
null then the date to be printed would be based on another date.
I have coded this is various ways, at times I have gotten the 1301
error (forward ref not perm in sel list bind vars).
I'd really appreciate anyone's help.



Begin-Procedure Get-Refit
Begin-Select
r.mp_rft_strt_dt,
r.mp_rft_cmpltn_dt
      do Get-Job-Data
    from tt_uicrft r
End-Select
End-Procedure

Begin-Procedure Get-Job-Data
Begin-Select
j.mt_jcn_nr,
convert(char(5), j.mt_schdld_job_cmpltn_dt,1) &jcn_eday,
j.mt_rltv_job_strt_cd                         &rltv_cd

     if isnull($jcn_eday) = 1 AND $rltv_cd = 'A'
        convert(char(5),
                dateadd(dd,(j.mt_rltv_job_cmpltn_da - 1),
                           &r.mp_rft_start_dt),1) &jcn-eday,
     end-if
     if isnull($jcn_eday) = 1 AND $rltv_cd = 'B'
        convert(char(5),
                dateadd(dd, -(j.mt_rltv_job_cmpltn_da),
                              &r.mp_rft_start_dt),1) &jcn-eday,
     end-if
     show ' comp ' $jcn_eday
     from tt_job j
    where j.key_field = &u.key_field

End-Select
End-Procedure