IBM ISERIES SC41-5210-04 User Manual

Page 84

Advertising
background image

selection on specific year, month, and day values. The marked (*) lines are necessary and a sample report
follows. If you require rounding for fields in the report (instead of truncation), you can add to each of the
intermediate expressions a minus one half, as follows:

MM = (MMDDYY/10000)-0.5.

Example 1

5728QU1 R03 M00 900824 IBM OS/400 Query 10/04/90 14:17:45 Page 1

Query . . . . . . . . . . . . . . . . . YYMMDD02

Library . . . . . . . . . . . . . . . CRP

Query text . . . . . . . . . . . . . . MMDDYY to YYMMDD

Collating sequence . . . . . . . . . . Hexadecimal

Processing options

*

Use rounding . . . . . . . . . . . . No

Ignore decimal data errors . . . . . No (default)

Selected files

ID

File

Library

Member

Record Format

T01

MMDDYY

QTEMP

MMDDYY

MMDDYY

Result fields

Name

Expression

Column Heading Len Dec

* MM

(mmddyy/10000)

2

0

* DD

(mmddyy/100 - (mm * 100))

2

0

* YY

(mmddyy - (mm*10000 + dd*100))

2

0

* YYMMDD (yy*10000)+(mm*100)+dd

6

0

* * * * *

E N D

O F

Q U E R Y

P R I N T

* * * * *

MM DD

YY

YYMMDD MMDDYY

08 31

90

900831 083190

* * * E N D O F R E P O R T * * *

Example 2: Working with numeric dates in Query for iSeries: This example shows the reverse in
formatting— converting a numeric YYMMDD to MMDDYY. The marked (*) lines are necessary and a
sample report follows.

Example 2

Query . . . . . . . . . . . . . . . . . YYMMDD01

Library . . . . . . . . . . . . . . . CRP

Query text . . . . . . . . . . . . . . YYMMDD to MMDDYY

Collating sequence . . . . . . . . . . EBCDIC

Processing options

*

Use rounding . . . . . . . . . . . . No

Ignore decimal data errors . . . . . No (default)

Special conditions

*** All records selected by default ***

Selected files

ID

File

Library

Member

Record Format

T01

YYMMDD

QGPL

JUNK

YYMMDD

Result fields

Name

Expression

Column Heading

Len Dec

* YY

(yymmdd/10000)

2

0

* MM

(yymmdd/100 - (yy * 100))

2

0

* DD

(yymmdd - (yy*10000 + mm*100))

2

0

* MMDDYY (mm*10000)+(dd*100)+yy

6

0

* * * * *

E N D

O F

Q U E R Y

P R I N T

* * * * *

MM DD YY

MMDDYY YYMMDD

08 31 90

083190 900831

* * * E N D O F R E P O R T * * *

72

Query for iSeries Use V5R2

Advertising