× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



There's CPYFRMQRYF. I haven't looked to see if OPNQRYF generates a message if the selection is zilch.

I no longer use OPNQRYF. I've created a command that executes an SQL statement with REXX. If my selection is empty then I'll get back (should) the message SQL0100.

Eg :

CHGVAR VAR(&WSEL) VALUE( '+
INSERT INTO MYFILE +
SELECT * FROM MYOTHERFILE +
WHERE MYZONE = ' *CAT &MYCLVAR *CAT ' AND +
MYOTHERZONE = ''N'' +
ORDER BY KEYZONE DESC +
FETCH FIRST ROW ONLY')

* . This does a STRREXPRC that runs the SQL. */
STRREXPRC &WSEL

* .Traitement erreur. SQL0100 = no record found. */
MONMSG MSGID(SQL0000) EXEC(DO)
RCVMSG MSGTYPE(*EXCP) MSGID(&MSGID)
IF ( &MSGID *EQ 'SQL0100' ) RTNSUBR RTNVAL(0)
ELSE RTNSUBR RTNVAL(-1)

ENDDO



Here's the REXX code :
PARSE ARG iSql
RC=0

ADDRESS EXECSQL,
EXECSQL 'SET OPTION COMMIT = *NONE'

ADDRESS EXECSQL,
EXECSQL iSql

IF RC <> 0 THEN DO
MSGID = "SQL"RIGHT(STRIP(ABS(SQLCODE)),4,'0')
'SNDPGMMSG MSGID(&MSGID) MSGF(QSQLMSG) MSGDTA(&SQLERRMC) MSGTYPE(*ESCAPE)
END






-----Message d'origine-----
De : rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] De la part de Brown, Stephen GRNRC
Envoyé : mardi 14 octobre 2008 13:25
À : rpg400-l@xxxxxxxxxxxx
Objet : OPNQRYF question.


Can anyone tell me if you can use an OPNQRYF statement in conjunction with a RTVMBRD command to see if the selection has actually selected anything ? I know there are other ways to do this in terms of RPG but I would like to keep this all within the CL processing if possible.


Thanks Stevie




------------------------------------------------------------------------------
CONFIDENTIALITY NOTICE: If you have received this email in error, please immediately notify the sender by e-mail at the address shown. This email transmission may contain confidential information. This information is intended only for the use of the individual(s) or entity to whom it is intended even if addressed incorrectly. Please delete it from your files if you are not the intended recipient. Thank you for your compliance. Copyright 2008 CIGNA ==============================================================================
--
This is the RPG programming on the AS400 / 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.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.