Missed the second part....

LRDTE IN (20081231, 20091231, 20101231, 20111231)

I think what you are asking for is:

Mod(lrdte, 10000) = 1231.

HOWEVER, please note that using a function on the LRDTE column will preclude the use of an index over
that column for selection. You might end up forcing a full table scan.

You could do something like so instead:

LRDTE in ( (year(current_date) * 10000) + 01231,
(year(current_date) * 10000) + 11231,
(year(current_date) * 10000) + 21231,
(year(current_date) * 10000) + 31231 )


Charles Wilt
Software Engineer
CINTAS Corporation - IT 92B

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-
bounces@xxxxxxxxxxxx] On Behalf Of macwheel99@xxxxxxxxxx
Sent: Tuesday, March 18, 2008 4:38 PM
To: List M-L
Subject: Fw: SQL String Question

I am working on a program & realized I don't know how to do strings in

---------- Forwarded Message -----------
From: "Al Macintyre" at work
To: Al at home, which is an M-L subscriber
Sent: Tue, 18 Mar 2008 13:49:21 -0500
Subject: SQL String Question

The code below is embedded in an RPG/400 program running in V5R1.  It is
accessing BPCS customer orders.  I need to increase the level of

I have one routine to get grand total of orders, then others to get
various exception totals, such as FORECAST, Dec-31, various combinations,
which I subtract from total to get "real" customer orders that will be
shipped the customer.

We have in HCPO (customer purchase order) field the word FORECAST for the
purpose of telling MRP to order raw materials.

Some HCPO contain the word FORECAST then some other stuff ... I urgently
need to learn how to select on the basis of the first 8 columns of the
field HCPO with this text, or re-write the program a different way.
Actually several programs, which are using the same technique.

instead of              LORD IN  (SELECT HORD FROM ECH WHERE

We use the last day of the year to contain Estimated Annual needs of the
customer that have not yet been filled.  So I have the following code.

LRDTE IN     (20081231, 20091231, 20101231, 20111231)

I could advance dates in programs like this each year, if I remember them
all, but I would prefer to select on the basis of the last 4 digits of the
8 digit date.

  C+                             INTO :ORDWRK
  C+                        AND LCUST=:CUST
  C+                       AND LICFAC=:FAC
  C+                        AND LWHS>=:YWHS
  C+                        AND LWHS<=:ZWHS
  C+                         AND LID='CL'
  C+                      AND LCLAS<>'11'
  C+                      AND LRDTE IN
  C+          (20081231, 20091231, 20101231, 20111231)
  C+                      AND LORD IN


Al Macintyre

BPCS/400 Guru

------- End of Forwarded Message -------

WOW! Homepage (http://www.wowway.com)

This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.

This e-mail transmission contains information that is intended to be confidential and privileged. If you receive this e-mail and you are not a named addressee you are hereby notified that you are not authorized to read, print, retain, copy or disseminate this communication without the consent of the sender and that doing so is prohibited and may be unlawful. Please reply to the message immediately by informing the sender that the message was misdirected. After replying, please delete and otherwise erase it and any attachments from your computer system. Your assistance in correcting this error is appreciated.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 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].