× 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.



Tim

Here is an example from IBM, I hope it helps.


Example 4: Using the %SST Built-In Function

OPNQRYF FILE((histlib/ordfile hist1))
OPTION(*inp *upd *dlt)
FORMAT(ordinfo orddtls) QRYSLT('month=7')
MAPFLD((year '%sst(orddate 5 2)' *char 2)
(month '%sst(orddate 1 2)' *char 2)
(day '%sst(orddate 3 2)' *char 2)
(YYMMDD 'YEAR *CAT MONTH *CAT DAY'))

This command uses the %SST built-in function to create a substring of the
year, month, and day parts of character field ORDDATE in file ORDFILE. If
the file ORDINFO has a record format, ORDDTLS, containing at least the
field's YEAR, MONTH, and DAY records, these fields have input-only usage in
the open query file record format because they are defined by using a
built-in function (%SST) and are mappings that mix character and numeric
(zoned decimal format) types. The file is opened for input, update, and
delete operations, but none of the field's YEAR, MONTH, and DAY records are
updated using the open query file open data path (ODP). The open query file
uses only records in the HIST1 member of file ORDFILE in library HISTLIB,
and the records retrieved through the file have the same format as record
format ORDDTLS in file ORDINFO. Only records pertaining to the month of July
are processed through the open query file (QRYSLT parameter).

Vincent


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of tim
Sent: July 3, 2009 9:30 AM
To: 'RPG programming on the IBM i / System i'
Subject: opnqryf question

I have a packed date field (mmddyy format) defined as follows:

P 176 179 0XDATE



I would like to use this field in an opnqryf. I would like to convert this
to YMD to make comparison easy. I know I have to use a mapfld, but not sure
the syntax. Any help would be great


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.