Good afternoon, trying to build a report program with embedded SQL and it won't see my work variable in my statement, SQL0312 -not found or not usable. It is field @Comp (for Company) . I send in 20160401, 20160415, 'HLT', 'Test Company Name'.
( Side Note - I have already tried to post all the field names in the SQL statement, and the statement only goes to length 1021 in debug, it won't fit all the text.)
here is my code:
Any help would be appreciated. Thank you.
( Side Note - I have already tried to post all the field names in the SQL statement, and the statement only goes to length 1021 in debug, it won't fit all the text.)
here is my code:
HTML Code:
* D SQLRange S 50 D SQLStmt S 500 * * D @Cnt S 3 0 D @X S 3 0 D X S 3 0 D @Comp S 3a D @CName S 30a * * --------------------------------------------------------- D Main pr extpgm('PR3501A') D PRFromDate 8s 0 D PRToDate 8s 0 D PRCompany 3a D PRCompanyname 30a D Main pi D PIFromDate 8s 0 D PIToDate 8s 0 D PICompany 3a D PICompanyname 30a @Comp = PICompany ; PCompany = PICompany ; Pconame = PICompanyname; PFRDATE = %dec(%char(%date(PIFROMDATE:*iso):*mdy0):6:0); PTODATE = %dec(%char(%date(PITODATE:*iso):*mdy0):6:0); Write Header; /End-free * Declare the pointer C/Exec SQL C+ DECLARE HDRCSR SCROLL CURSOR FOR REFSTMT C/End-Exec * /Free SQLStmt = 'Select * + from PRCHGLOG where LCOCDE = :@Comp and + LCHGTYP <> ''APP'' and LCHGDT >= :PIFromDate and + LCHGDT <= :PITodate' + ' ORDER BY LPORT, LTIMESTAMP '; /End-free C/Exec SQL C+ PREPARE REFSTMT FROM :SQLStmt C/End-Exec * Open the pointer C/Exec SQL C+ OPEN HDRCSR C/End-exec ...............
Any help would be appreciated. Thank you.
Comment