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



Agreed, you are missing a lot of closing parenthesis for your sum
functions.


On Tue, Apr 24, 2012 at 4:51 PM, Hiebert, Chris <
chris.hiebert@xxxxxxxxxxxxxx> wrote:

You appear to be missing a lot of Closing parenthesis.

Chris Hiebert

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jeff Young
Sent: Tuesday, April 24, 2012 2:36 PM
To: rpg400-l@xxxxxxxxxxxx; midrange-l@xxxxxxxxxxxx
Subject: SQL Question

I have the following SQL Statment:

Exec SQL

Select

-- Payment Transaction Count

Sum(Case EpArTrnTp

When 'PA' Then 1 Else 0 End),

-- Payment Total Amount

Sum(Case EpArTrnTp

When 'PA' Then EpArTrAm Else 0 End,

-- Invoice/Credit Transaction Count

Sum(Case

When EpArTrnTp in ('IN','CM') Then 1 Else 0 End),

-- Invoice Total Amount

Sum(Case EpArTrnTp

When 'IN' Then EpArTrAm Else 0 End,

-- Credit Total Amount

Sum(Case EpArTrnTp

When 'CR' Then EpArTrAm Else 0 End,

-- Adjustment Transaction Count

Sum(Case

When EpArTrnTp in ('DM','NC') Then 1 Else 0 End),

-- Adjustment Total Charge Back Amount

Sum(Case EpArTrnTp

When 'DM' Then EpArTrAm Else 0 End,

-- Adjustment Return Check Amount

Sum(Case EpArTrnTp

When 'NC' Then EpArTrAm Else 0 End

Into

:Payment_Transaction_Count,

:Payment_Total,

:Off_Line_Transaction_Count,

:Off_Line_Invoice_Total,

:Off_Line_Credit_Total,

:Adjustment_Transaction_Count,

:Adjustment_CB_Total

:Adjustment_Debit_Total

From VXbEpDArt

Group by EpArTrnTp; // Invoice & Credits Only My fields are defined as
follows:

D Off_Line_Invoice_Total...

D S Like(##Bal)

D Off_Line_Credit_Total...

D S Like(##Bal)

D Off_Line_Transaction_Count...

D S Like(##Trn_Cnt)

D Adjustment_Debit_Total...

D S Like(##Bal)

D Adjustment_Credit_Total...

D S Like(##Bal)

D Adjustment_CB_Total...

D S Like(##Bal)

D Adjustment_Transaction_Count...

D S Like(##Trn_Cnt)

D Payment_Total...

D S Like(##Bal)

D Payment_Transaction_Count...

D S Like(##Trn_Cnt)
##Bal = 11.2
##Trn_Cnt = 3.0

When I attempt to complie, I receive the following messages from the
pre-compiler:
Position 18 Token EPARTRNTP was not valid. Valid tokens:
, FROM INTO.

Position 12 Keyword INTO not expected. Valid tokens: ) ,.

Position 14 Indicator variable ADJUSTMENT_DEBIT_TOTAL not SMALLINT type.
What am I doing wrong?

Thanks,
--
Jeff Young
Sr. Programmer Analyst
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.

--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-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.