QMQRY ERROR

820 pts.
Tags:
AS/400
IBM iSeries
PGM
QMQRY
Hi,
I am new to this technology. I coded some CL program with QMQRY. every thing goes well. Object has created. If I run manually using STRQMQRY. I can view my expected result. If I run Through a CL program , I was facing some error. Please go through the be-lowed program & its corresponding error. Kindy let me know the reason & resolution for this error.
0001.00 PGM                                                          
0002.00              DCL        VAR(&SELECT_Q) TYPE(*CHAR) +         
0003.00                           LEN(10) VALUE('SELECT')            
0004.00              DCL        VAR(&FIELDS_Q) TYPE(*CHAR) +         
0005.00                           LEN(100) +                         
0006.00                           VALUE('COLUMN_NAME,TABLE_NAME,LE+  
0007.00                           NGTH,DATA_TYPE')                   
0008.00              DCL        VAR(&FROM_Q) TYPE(*CHAR) LEN(10) +   
0009.00                           VALUE('FROM')                      
0010.00              DCL        VAR(&TABLE_Q) TYPE(*CHAR) LEN(20) +  
0011.00                           VALUE('SYSCOLUMNS')                
0012.00              DCL        VAR(&WHERE_Q) TYPE(*CHAR) LEN(10) +  
0013.00                           VALUE('WHERE')                     
0014.00              DCL        VAR(&COMP_Q) TYPE(*CHAR) LEN(16) +   
0015.00                           VALUE('TABLE_OWNER=')              
0016.00              DCL        VAR(&VALUE_Q) TYPE(*CHAR) LEN(10) +  
0017.00                           VALUE('MENTIS')                    
0018.00              MONMSG     MSGID(CPF0000) EXEC(GOTO +           
0019.00                           CMDLBL(ERROR))                     
 0020.00              STRQMQRY   QMQRY(MENTIS2/FILE1QM1) +            
0021.00                           SETVAR((SELECT &SELECT_Q) +        
0022.00                           (FIELDS &FIELDS_Q) (FROM +         
0023.00                           &FROM_Q) (TABLE &TABLE_Q) +        
0024.00                           (WHERE &WHERE_Q) (COMP +           
0025.00                           &COMP_Q) (VALUE &VALUE_Q))         
0026.00              GOTO       CMDLBL(END)                          
0027.00  ERROR:      SNDUSRMSG  MSG('ERROR OCCURED')                 
0028.00  END:                                                        
0029.00  ENDPGM                                                      
 
Error:
 
   2000 - STRQMQRY QMQRY(MENTIS2/FILE1QM1) SETVAR((SELECT 'SELECT') (FIELDS
   'COLUMN_NAME,TABLE_NAME,LENGTH,DATA_TYPE') (FROM 'FROM') (TABLE
   'SYSCOLUMNS') (WHERE 'WHERE') (COMP 'TABLE_OWNER=') (VALUE 'MENTIS'))
 Column MENTIS not in specified tables.
 RUN QUERY command failed with SQLCODE -206.
 RUN QUERY command ended due to error.
 STRQMQRY command failed.
 Function check. QWM2701 unmonitored by FILE1CL1 at statement 0000002000,
   instruction X'0000'.


Software/Hardware used:
iseries

Answer Wiki

Thanks. We'll let you know when a new response is added.

The Value needs to SPECIFY that it is a value and not a field.  You do this by changing (VALUE ‘MENTIS’) to (VALUE ”’MENTIS”’)

This causes the value to have quotes around it and QMQRY will know it is not a field

NOTE: This is for any time you are setting equal to a character value.  Numeric values are fine without the quotes.

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • HABBIE
    Great. It is working now. I can see my expected result.
    Thanks a lot BigKat.

    820 pointsBadges:
    report
  • HABBIE
    Could you please tell me , is there any limit , only certain number of fields can be selected here,

    0004.00              DCL        VAR(&FIELDS_Q) TYPE(*CHAR) +        0005.00                           LEN(100) +                         
    0006.00                           VALUE('COLUMN_NAME,TABLE_NAME,LE+  
    0007.00                           NGTH,DATA_TYPE')   

    As, My table has more columns, from which I need to filter my query.
    820 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following