Gurumanoj Gurusamy
New User
Joined: 11 Nov 2010 Posts: 22 Location: Mumbai
|
|
|
|
Hi,
I am trying to run below query in Cobol,
Code: |
Select Min(TimestampDiff(2,Char(D.LAST_UPD_TIMESTAMP-D.SETUP_TIMESTAMP))),
Max(TimestampDiff(2,Char(D.LAST_UPD_TIMESTAMP-D.SETUP_TIMESTAMP))),
Avg(TimestampDiff(2,Char(D.LAST_UPD_TIMESTAMP-D.SETUP_TIMESTAMP)))
From NUPG.TPGDLOG D, NUPG.TPGSLOG C
WHERE C.MB_Unique_Id = D.MB_Unique_Id And
C.Receive_Timestamp > '2013-05-17-23.46.09.000000' And
C.Receive_Timestamp < '2013-05-18-23.53.18.000000' And
C.System_Id = 'Exceed' And
D.Process_Name = 'PDF Archive' And
D.Process_Status = 'C' |
In Spufi it gave me proper output,
Same when I tried in cobol by defining host variables properly as below,
Code: |
SELECT
MIN(
TimestampDiff(
2,Char(D.LAST_UPD_TIMESTAMP - D.SETUP_TIMESTAMP)))
INTO :WS-MIN-VALUE ,
MAX(
TimestampDiff(
2,Char(D.LAST_UPD_TIMESTAMP - D.SETUP_TIMESTAMP)))
INTO :WS-MAX-VALUE ,
AVG(
TimestampDiff(
2,Char(D.LAST_UPD_TIMESTAMP - D.SETUP_TIMESTAMP)))
INTO :WS-AVG-VALUE
FROM TPGDLOG D,
TPGSLOG C
WHERE C.MB_UNIQUE_ID = D.MB_UNIQUE_ID AND
C.RECEIVE_TIMESTAMP > :WS-START-TS AND
C.RECEIVE_TIMESTAMP <= :WS-END-TS AND
UPPER(C.SYSTEM_ID) = :WS-SYSTEM AND
D.PROCESS_NAME = 'PDF Archive' AND
D.PROCESS_STATUS = 'C' |
Getting following error message,
IGYPS0226-E DSNH104I DSNHPARS LINE 158 COL 333 ILLEGAL SYMBOL "(". SOME SYMBOLS THAT MIGHT BE LEGAL ARE: FROM , .
But when I tried with one aggregate function it compiled properly.
Host variable declaration are done as follow,
Code: |
03 WS-MIN-VALUE PIC S9(7)V9(2) COMP-3.
03 WS-MAX-VALUE PIC S9(7)V9(2) COMP-3.
03 WS-AVG-VALUE PIC S9(5)V9(2) COMP-3. |
Please help |
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Even though the sql has been Coded, the presentation is still not as readable as it could be. Please use Preview in the future to ensure the post is properly indented.
It may not matter, but there is no comma after INTO :WS-AVG-VALUE
Are multiple INTOs allowed? I don't know and have no way to test now. |
|