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



The only thing that looks non-standard is the @TodayDate. That should be
replaced with CURRENT DATE and this assumes that OHORDD is a actual date.
If it is a 6 or 8 characters numeric or alpha you need something like my or
iDate (www.think400.dk/downlods.htm). or in your code you need to convert
the current date to an alpha or numeric field and use the :FieldName syntax
to bring in the date.

Also, why do you need the UNION's. Cannot you just do a single query with
ORORDT In('COT','COS','COC','COE','COR')?

Also, the SQL will automatically use the logical index if it needs it. Run
the query with debug on to see unlaying messages or use Index Adviser in
Ops Nav to see what it recommends for indexes.

Also since the field names all seem to be different do you need to qualify
the fields?


On Sat, May 18, 2013 at 8:43 PM, Crystal Reports <
crystalcleardecisions@xxxxxxxxx> wrote:

HI I wrote this stored procedure as for the sql server. I took this code
and ran in on AS/400
using the STRSQL and pasting it. It has several errors at "ON" I didnt'
write down the error code and now am not at work. But looking at this
syntax generally, can you tell me which
terms are used differently. Also, Would it be better to create a logical
file to do this, or leave as SQL. It would need to run whenever the user
runs the report in Crystal for the most current data set.

SELECT
NOTEH6.UARIDC,
NOTEH6.UANOTL,
NOTEP1.UCCMT,
OEORH41.OHORD#,
OEORH41.OHOSTC,
OEORH41.OHORDT,
OEORH41.OHORDD,
OEORH41.OHPO#,
OEORH41.OHSHTC,
OEORH41.OHSLR#,
OETRA95.OTTRNC,
REFER1.RFCAT,
REFER1.RFDAT
FROM
OEORH41 INNER JOIN REFER1
ON OEORH41.OHSHTC = REFER1.RFSLC
INNER JOIN OETRA95
ON OEORH41.OHCOM# = OETRA95.OTCOM#
AND ON OEORH41.OHORD# = OETRA95.OTORD#
INNER JOIN NOTEH6 ON OEORH41.OHENT# = NOTEH6.UAENT#
AND ON OEORH41.OHSFX# = NOTEH6.UASFX#
INNER JOIN NOTEP1 ON NOTEH6.UANOTT = NOTEP1.UCNOTT
AND ON NOTEH6.UANTK = NOTEP1.UCNTK
AND ON NOTEH6.UANOT# = NOTEP1.UCNOT#
WHERE
NOTEH6.UARIDC = "UA" and
OETRA95.OTTRNC = "001" and
OEORH41.OHORDD = {@TodaysDate} and
OEORH41.OHORDT = "COC"
OEORH41.OHOSTC <> "CN" and
REFER1.RFCAT = "0023"

UNION ALL

SELECT
NOTEH6.UARIDC,
NOTEH6.UANOTL,
NOTEP1.UCCMT,
OEORH41.OHORD#,
OEORH41.OHOSTC,
OEORH41.OHORDT,
OEORH41.OHORDD,
OEORH41.OHPO#,
OEORH41.OHSHTC,
OEORH41.OHSLR#,
OETRA95.OTTRNC,
REFER1.RFCAT,
REFER1.RFDAT
FROM
OEORH41 INNER JOIN REFER1
ON OEORH41.OHSHTC = REFER1.RFSLC
INNER JOIN OETRA95
ON OEORH41.OHCOM# = OETRA95.OTCOM#
AND ON OEORH41.OHORD# = OETRA95.OTORD#
INNER JOIN NOTEH6 ON OEORH41.OHENT# = NOTEH6.UAENT#
AND ON OEORH41.OHSFX# = NOTEH6.UASFX#
INNER JOIN NOTEP1 ON NOTEH6.UANOTT = NOTEP1.UCNOTT
AND ON NOTEH6.UANTK = NOTEP1.UCNTK
AND ON NOTEH6.UANOT# = NOTEP1.UCNOT#
WHERE
NOTEH6.UARIDC = "UA" and
OETRA95.OTTRNC = "001" and
OEORH41.OHORDD = {@TodaysDate} and
OEORH41.OHORDT = "COE"
OEORH41.OHOSTC <> "CN" and
REFER1.RFCAT = "0023"

UNION ALL

SELECT
NOTEH6.UARIDC,
NOTEH6.UANOTL,
NOTEP1.UCCMT,
OEORH41.OHORD#,
OEORH41.OHOSTC,
OEORH41.OHORDT,
OEORH41.OHORDD,
OEORH41.OHPO#,
OEORH41.OHSHTC,
OEORH41.OHSLR#,
OETRA95.OTTRNC,
REFER1.RFCAT,
REFER1.RFDAT
FROM
OEORH41 INNER JOIN REFER1
ON OEORH41.OHSHTC = REFER1.RFSLC
INNER JOIN OETRA95
ON OEORH41.OHCOM# = OETRA95.OTCOM#
AND ON OEORH41.OHORD# = OETRA95.OTORD#
INNER JOIN NOTEH6 ON OEORH41.OHENT# = NOTEH6.UAENT#
AND ON OEORH41.OHSFX# = NOTEH6.UASFX#
INNER JOIN NOTEP1 ON NOTEH6.UANOTT = NOTEP1.UCNOTT
AND ON NOTEH6.UANTK = NOTEP1.UCNTK
AND ON NOTEH6.UANOT# = NOTEP1.UCNOT#
WHERE
NOTEH6.UARIDC = "UA" and
OETRA95.OTTRNC = "001" and
OEORH41.OHORDD = {@TodaysDate} and
OEORH41.OHORDT = "COF"
OEORH41.OHOSTC <> "CN" and
REFER1.RFCAT = "0023"

UNION ALL

SELECT
NOTEH6.UARIDC,
NOTEH6.UANOTL,
NOTEP1.UCCMT,
OEORH41.OHORD#,
OEORH41.OHOSTC,
OEORH41.OHORDT,
OEORH41.OHORDD,
OEORH41.OHPO#,
OEORH41.OHSHTC,
OEORH41.OHSLR#,
OETRA95.OTTRNC,
REFER1.RFCAT,
REFER1.RFDAT
FROM
OEORH41 INNER JOIN REFER1
ON OEORH41.OHSHTC = REFER1.RFSLC
INNER JOIN OETRA95
ON OEORH41.OHCOM# = OETRA95.OTCOM#
AND ON OEORH41.OHORD# = OETRA95.OTORD#
INNER JOIN NOTEH6 ON OEORH41.OHENT# = NOTEH6.UAENT#
AND ON OEORH41.OHSFX# = NOTEH6.UASFX#
INNER JOIN NOTEP1 ON NOTEH6.UANOTT = NOTEP1.UCNOTT
AND ON NOTEH6.UANTK = NOTEP1.UCNTK
AND ON NOTEH6.UANOT# = NOTEP1.UCNOT#
WHERE
NOTEH6.UARIDC = "UA" and
OETRA95.OTTRNC = "001" and
OEORH41.OHORDD = {@TodaysDate} and
OEORH41.OHORDT = "COR"
OEORH41.OHOSTC <> "CN" and
REFER1.RFCAT = "0023"

UNION ALL

SELECT
NOTEH6.UARIDC,
NOTEH6.UANOTL,
NOTEP1.UCCMT,
OEORH41.OHORD#,
OEORH41.OHOSTC,
OEORH41.OHORDT,
OEORH41.OHORDD,
OEORH41.OHPO#,
OEORH41.OHSHTC,
OEORH41.OHSLR#,
OETRA95.OTTRNC,
REFER1.RFCAT,
REFER1.RFDAT
FROM
OEORH41 INNER JOIN REFER1
ON OEORH41.OHSHTC = REFER1.RFSLC
INNER JOIN OETRA95
ON OEORH41.OHCOM# = OETRA95.OTCOM#
AND ON OEORH41.OHORD# = OETRA95.OTORD#
INNER JOIN NOTEH6 ON OEORH41.OHENT# = NOTEH6.UAENT#
AND ON OEORH41.OHSFX# = NOTEH6.UASFX#
INNER JOIN NOTEP1 ON NOTEH6.UANOTT = NOTEP1.UCNOTT
AND ON NOTEH6.UANTK = NOTEP1.UCNTK
AND ON NOTEH6.UANOT# = NOTEP1.UCNOT#
WHERE
NOTEH6.UARIDC = "UA" and
OETRA95.OTTRNC = "001" and
OEORH41.OHORDD = {@TodaysDate} and
OEORH41.OHORDT = "COS"
OEORH41.OHOSTC <> "CN" and
REFER1.RFCAT = "0023"

UNION ALL

SELECT
NOTEH6.UARIDC,
NOTEH6.UANOTL,
NOTEP1.UCCMT,
OEORH41.OHORD#,
OEORH41.OHOSTC,
OEORH41.OHORDT,
OEORH41.OHORDD,
OEORH41.OHPO#,
OEORH41.OHSHTC,
OEORH41.OHSLR#,
OETRA95.OTTRNC,
REFER1.RFCAT,
REFER1.RFDAT
FROM
OEORH41 INNER JOIN REFER1
ON OEORH41.OHSHTC = REFER1.RFSLC
INNER JOIN OETRA95
ON OEORH41.OHCOM# = OETRA95.OTCOM#
AND ON OEORH41.OHORD# = OETRA95.OTORD#
INNER JOIN NOTEH6 ON OEORH41.OHENT# = NOTEH6.UAENT#
AND ON OEORH41.OHSFX# = NOTEH6.UASFX#
INNER JOIN NOTEP1 ON NOTEH6.UANOTT = NOTEP1.UCNOTT
AND ON NOTEH6.UANTK = NOTEP1.UCNTK
AND ON NOTEH6.UANOT# = NOTEP1.UCNOT#
WHERE
NOTEH6.UARIDC = "UA" and
OETRA95.OTTRNC = "001" and
OEORH41.OHORDD = {@TodaysDate} and
OEORH41.OHORDT = "COT"
OEORH41.OHOSTC <> "CN" and
REFER1.RFCAT = "0023"

Thank you,
Paul
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
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.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.