Problem solve Get help with specific problems with your technologies, process and projects.

Quick view contents of a data file

Use this command to view the contents of a data file.

We use this command to view the contents of a data file. It's really just a wraparound of RUNQRY, but it is very convenient.

Usage: q filename

  • Save the CL source into member QC in QGPL/QCLSRC
  • Compile with CRTCLPGM QGPL/QC QGPL/QCLSRC
  • Save the CMD source into member Q in QGPL/QCMDSRC
  • Compile with CRTCMD CMD(QGPL/Q) PGM(QGPL/QC) SRCFILE(QGPL/QCMDSRC)
     CL member QC:
    /* this lets you type Q filename and get a query w/selection up */     
    PGM PARM(&FILENAME)                                                    
        DCL &FILENAME *CHAR 10                                             
                 RUNQRY     QRY(*NONE) QRYFILE((&FILENAME)) RCDSLT(*YES)   
                 MONMSG     MSGID(QRY1012) EXEC(SNDPGMMSG MSGID(CPF9898) + 
                              MSGF(QCPFMSG) MSGDTA('File ' *CAT +          
                              &FILENAME *TCAT ' doesn''t exist') +         
                              TOPGMQ(*PRV (*)) MSGTYPE(*ESCAPE))           
                                                                           
    ENDPGM       

    ==================================
    MORE INFORMATION ON THIS TOPIC
    ==================================

    The Best Web Links: tips, tutorials and more.

    Ask your programming questions--or help out your peers by answering them--in our live discussion forums.

    Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.

    CMD member Q: cmd prompt('quick query of file') PARM KWD(FILE) TYPE(*NAME) LEN(10) MIN(1) + EXPR(*YES) CHOICE('(assumes *LIBL)') + PROMPT('Filename')
  • Dig Deeper on iSeries CL programming

    Start the conversation

    Send me notifications when other members comment.

    Please create a username to comment.

    -ADS BY GOOGLE

    SearchDataCenter

    Close