I would like my CL to run sql procedure.
Please see below it's a part of my code:
PGM PARM(&RRN)
DCL VAR(&RRN) TYPE(*CHAR) LEN(10)
DCL VAR(&RRN12) TYPE(*CHAR) LEN(12)
CHGVAR VAR(&RRN12) VALUE('''' *TCAT &RRN *TCAT '''')
STRQMQRY QMQRY(CWTOSTLIB/CWJRN) SETVAR(RRN &RRN12)
MONMSG QWM2701
ENDPGM
query looks like this:
SELECT * FROM qtemp/dspjrn WHERE JOCTRR = &RRN
variable from CL is *CHAR, it needs to be *char, otherwise SETVAR won't
work. unfortunatelly field JOCTRR is *DEC.
Ehen I start my program with some numeric parameter (for example CALL
TEST '34343') I get a Query error message '34343' is not a valid query
manager variable.
I think it's a *CHAR/*DEC field definitin.
Am I right? Can I somehow pass *dec variable to sql statement using
STRQMQRY command?
Regards,
Tomasz
[...]
The statement:
CHGVAR VAR(&RRN12) VALUE('''' *TCAT &RRN *TCAT '''')
make the value in quotes, so the select statement evaluete the where
condition as a string compare, you should change the statement without
quotes, like this:
CHGVAR VAR(&RRN12) VALUE(&RRN)
--
Dr.Ugo Gagliardelli,Modena,ItalyCertifiedUindoscrasherAñejoAlcoolInside
Spaccamaroni andate a cagare/Spammers not welcome/Spammers vão à merda
Spamers iros a la mierda/Spamers allez vous faire foutre/Spammers loop
schijten/Spammers macht Euch vom Acker/Spamerzy wypierdalac'
Always consider the SQL string that you are trying to create--should it have
ticks after you subsititue or not?
Since JOCTRR is numeric, the SQL string you are trying to create is
something like
SELECT * FROM qtemp/dspjrn WHERE JOCTRR = 1234567
Therefore &RRN value shouldn't have ticks.
Sam
"tomasz" <t...@nospam.com> wrote in message
news:eqa3o8$s92$1...@nemesis.news.tpi.pl...
Field Level Information
Data Field Buffer Buffer Field Column
Field Type Length Length Position Usage Heading
JOCTRR ZONED 10 0 10 97 Both COUNT/
RRN
Field text . . . . . . . . . . . . . . . : Count or relative
record number changed
What does ZONED means? I belive it's important in that case.
I've modified my CL like you suggested and it still doesn't work. I
belive that what DSPFFD shows is important in that issue.
Table DSPJRN is an output for DSPJRN command (QADSPJRN format).
Regrds,
Tomasz
Saml napisał(a):
dclvar &rrn *char 10
...
chgvar &rrn &JOCTRR
Tomasz
Dr.UgoGagliardelli napisał(a):