Yep, that was the problem. Thanks for all the replies. I knew I was missing something really simple.
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Mark Murphy/STAR BASE Consulting Inc.
Sent: Thursday, June 25, 2015 3:07 PM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: RE: declare cursor problem.
The quotes are your problem. The field actually contains CMDQRY, and you are looking for 'CMDQRY' including the quotes. That obviously doesn't match because C is different from '. You don't need to include quotes in the value of a host variable, the precompiler knows it is a character variable, and any quotes in the field are included in the comparison.
Mark Murphy
STAR BASE Consulting, Inc.
mmurphy@xxxxxxxxxxxxxxx
-----"Smith, Mike" <Mike_Smith@xxxxxxxxxxxxxxxx> wrote: -----
To: "RPG programming on the IBM i (AS/400 and iSeries)" <rpg400-l@xxxxxxxxxxxx>
From: "Smith, Mike" <Mike_Smith@xxxxxxxxxxxxxxxx>
Date: 06/25/2015 02:41PM
Subject: RE: declare cursor problem.
It has single quotes around CMDQRY so when displaying via debug I see ''CMDQRY' '
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Monnier, Gary
Sent: Thursday, June 25, 2015 2:24 PM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: RE: declare cursor problem.
Maybe the quotes in your variable :autllist? Does it contain 'CMDQRY' or CMDQRY?
Thanks,
Gary Monnier
IT Software Engineer CSM, CSPO
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Smith, Mike
Sent: Thursday, June 25, 2015 11:07 AM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: RE: declare cursor problem.
If I change my code to be hardcoded it works
EXEC SQL
Declare OLDCURS Cursor for
Select OANAME,OAUSR,OAOBJA, OAOPR,OAOMGT,OAEXS,
OAREAD,OAADD,OAUPD,OADLT
From AUTLDETLM
where oaname not in ('CMDQRY') ;
I'm missing something really obvious I think.
Mike
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Birgitta Hauser
Sent: Thursday, June 25, 2015 10:23 AM
To: 'RPG programming on the IBM i (AS/400 and iSeries)'
Subject: AW: declare cursor problem.
Where do you close your cursor?
An already opened cursor cannot be opened for a second time.
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok) "What is worse than training your staff and losing them? Not training them and keeping them!"
-----Ursprüngliche Nachricht-----
Von: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im Auftrag von Smith, Mike
Gesendet: Thursday, 25.6 2015 16:05
An: RPG programming on the IBM i / System i (rpg400-l@xxxxxxxxxxxx)
Betreff: declare cursor problem.
I'm sure I'm missing something really simple here, but I just can't see it.
I'm trying to compare authorization lists(last quarter to current)
I'm doing a DSPAUTL in Cl
SO Auth List Last quarter has CMDQRY.
Auth List current I have removed CMDQRY
I want to identify that CMDQRY has been removed. Which works, but I also
want to exclude CMDQRY when simply looking line by line for changes.
Basically trying to prevent it showing up as a change in user as well as being removed.
code snippet.
EXEC SQL
Declare OLDCURS Cursor for
Select OANAME,OAUSR,OAOBJA, OAOPR,OAOMGT,OAEXS,
OAREAD,OAADD,OAUPD,OADLT
From AUTLDETLM
where OANAME not in(:autllist);
Exec Sql
Open OLDCURS ;
Exec Sql
Fetch OLDCURS into :OANAME, :OAUSR,:OAOBJA,:OAOPR,
:OAOMGT, :OAEXS, :OAREAD,:OAADD,:OAUPD,:OADLT;
Dow SQLSTATE = '00000' ;
When I run the program, autllist contains 'CMDQRY'. But still picks up in the fetch.
If if copy the select to STRSQL it works correctly and 'CMDQRY' doesn't show up.
The file AUTLDETLM only exists in my test library.
It seems to be ignoring the where clause.
Anybody see what I might be missing.
Mike
NOTICE: This message, including any attachment, is intended as a confidential and privileged communication. If you have received this message in error, or are not the named recipient(s), please immediately notify the sender and delete this message.
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.
NOTICE: This message, including any attachment, is intended as a confidential and privileged communication. If you have received this message in error, or are not the named recipient(s), please immediately notify the sender and delete this message.
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.
NOTICE: This message, including any attachment, is intended as a confidential and privileged communication. If you have received this message in error, or are not the named recipient(s), please immediately notify the sender and delete this message.
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.
NOTICE: This message, including any attachment, is intended as a confidential and privileged communication. If you have received this message in error, or are not the named recipient(s), please immediately notify the sender and delete this message.
As an Amazon Associate we earn from qualifying purchases.