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

The wonders of Display Query (DSPQRY)

The DSPQRY command displays the queries sorted by descending date/time.

The Accounting Manager wants you to rerun the special Query/400 report you set up last week, but you can't remember the name of it. Type DSPQRY followed by your query library name, and it displays your queries sorted by-descending date/time.

CL program does a DSPOBJD of the query library to a file in QTEMP, then runs a query against that file.

Note: You have to create a file in QTEMP (do the DSPOBJD) before you can create the query.

 

DSPQRY command source:
CMD        PROMPT('Display Queries')     
                                         
PARM       KWD(LIB) TYPE(*CHAR) LEN(10) +
             PROMPT('Library name')      

DSPQRY CL program:
             PGM        PARM(&LIB)

             DCL        VAR(&LIB) TYPE(*CHAR) LEN(10)

             IF         COND(&LIB *EQ '          ') THEN(DO)
             SNDPGMMSG  MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('Library +
                          name required') TOPGMQ(*EXT) MSGTYPE(*STATUS)
             DLYJOB     DLY(2)
             GOTO       CMDLBL(ENDPGM)
             ENDDO

             DSPOBJD    OBJ(&LIB/*ALL) OBJTYPE(*QRYDFN) +
                          OUTPUT(*OUTFILE) OUTFILE(QTEMP/TMPDSPOBJ)

             RUNQRY     QRY(QGPL/DSPQRY) QRYFILE((*SAME))

 ENDPGM:     ENDPGM


DSPQRY Query Definition:





 5722QU1  V5R1M0  010525         IBM Query for AS/400         NORITSU
3/07/05   10:13:46         Page    1


   Query . . . . . . . . . . . . . . . . . DSPQRY
     Library . . . . . . . . . . . . . . . QGPL
   Query text  . . . . . . . . . . . . . .
   Query CCSID . . . . . . . . . . . . . . 65535
   Query language id . . . . . . . . . . . ENU
   Query country id  . . . . . . . . . . . US

     *** . is the decimal separator character for this query ***
   Collating sequence  . . . . . . . . . . Hexadecimal





   Processing options
     Use rounding  . . . . . . . . . . . . Yes (default)
     Ignore decimal data errors  . . . . . No (default)
     Ignore substitution warnings  . . . . Yes
     Use collating for all compares  . . . Yes

   Special conditions

     *** All records selected by default ***



 Selected files

   ID     File           Library       Member        Record Format

   T01    TMPDSPOBJ      QTEMP         *FIRST        QLIDOBJD


 Result fields

   Name        Expression                         Column Heading
Len  Dec

   SRTDAT      SUBSTR(ODLDAT,5,2) || SUBSTR(ODLD
               AT,1,4)
   CHGDAT      SUBSTR(ODLDAT,1,2) || '/' || SUBS  Chg Date
               TR(ODLDAT,3,2) || '/' || SUBSTR(O
               DLDAT,5,2)
   CHGTIM      SUBSTR(ODLTIM,1,2) || ':' || SUBS  Chg Time
               TR(ODLTIM,3,2) || ':' || SUBSTR(O
               DLTIM,5,2)


 Ordering of selected fields

   Field           Sort      Ascending/  Break  Field
   Name            Priority  Descending  Level  Text

   ODLCEN          10        D                  Change century: 0=19xx,
1=20xx





                                 IBM Query for AS/400
3/07/05   10:13:46         Page    2


 Ordering of selected fields (continued)

   Field           Sort      Ascending/  Break  Field
   Name            Priority  Descending  Level  Text

   SRTDAT          20        D
   ODLTIM          30        D                  Change time (HHMMSS)
   CHGDAT
   CHGTIM
   ODOBNM                                       Object
   ODOBTX                                       Text description


 Report column formatting and summary functions
   Summary functions:  1-Total, 2-Average, 3-Minimum, 4-Maximum, 5-Count
Overrides
   Field           Summary    Column                                Dec
Null       Dec  Numeric
   Name            Functions  Spacing  Column Headings         Len  Pos
Cap   Len  Pos  Editing

   ODLCEN                     0        *none                     1
0
   SRTDAT                     0        *none                     6
0
   ODLTIM                     0        *none                     6
0
   CHGDAT                     0        Chg Date                  8
   CHGTIM                     2        Chg Time                  8
   ODOBNM                     2        Query                    10
   ODOBTX                     2        Description              50


 Selected output attributes

   Output type . . . . . . . . . . . . . . Display
   Form of output  . . . . . . . . . . . . Detail
   Line wrapping . . . . . . . . . . . . . No



                 * * * * *    E N D   O F   Q U E R Y   P R I N T   * *
* * *

  
  


Dig Deeper on iSeries programming commands

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

Close