Your secong SUM() function does not have a closing paren...

-Eric DeLong

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Jeff Young
Sent: Tuesday, April 24, 2012 3: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,

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.