Manshadi
New User
Joined: 31 Aug 2005 Posts: 82
|
|
|
|
Hi,
Is there any way to pass variable to a query during batch job?
SET TRANDATE=39090
SET ACCTNO=%%%%%%0019110001
Then I have an SQL select statement for my extract that uses the variables above.
//SYSIN DD *
SELECT ACCT_NO,TRAN_DATE,JRNL_NO,TRAN_TYPE,VAR_AREA
FROM U1BANCS.GECT WHERE
INST_NO = '003' AND
ACCT_NO LIKE ACCTNO AND
TRAN_DATE = TRANDATE AND
(TRAN_TYPE = 1 OR TRAN_TYPE = 20)
ORDER BY INST_NO ASC,
ACCT_NO ASC ,
TRAN_TYPE ASC,
TRAN_DATE DESC,
REC_NO ASC
;
But when I run the job, I get an error. Is there a way to use the variables declared in the job?
Thanks & Regards,
Manshadi |
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
No, you cannot do this the way you are trying.
You could have a bit of code that would use the variables as PARM fields and generate the proper sql statements writing them into a file.
Then you could use concatenation to collect the first constant bit of sql, the generated acct_no/tran_date predicates, and the last bit of constant sql. |
|