Focal Point
ACROSS Verb Question

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/7531091132

June 05, 2007, 05:07 PM
Alaga
ACROSS Verb Question
FOCUS MVS/390 V7.3

Hi all,
I was wondering if any of you could help me with the following case:

I have a file that looks like this:

ID CustCD CustDT CustAmt
-- ------ -------- -------
01 00001 12/31/04 12.50
01 00002 12/31/05 14.50
02 00001 12/12/05 10.00
03 00001 11/21/04 13.00
03 00001 12/22/05 12.00

I want file to look like this:

ID CustCD CustDT CustAmt CustCD CustDT CustAmt
-- ------ -------- ------- ------ -------- -------
01 00001 12/31/04 12.50 00002 12/31/05 14.50
02 00001 12/12/05 10.00 0 0 0.00
03 00001 11/21/04 13.00 00001 12/22/05 12.00

Your help is greatly appreciated.

Thanks,

Alaga
June 05, 2007, 05:12 PM
susannah
Alaga, you're going to want to define a variable that enumerates the number of records per ID.
There are several ways to do this, the least elegant of which might be:
DEFINE FILE ..
FLAG/I4=IF ID NE LAST ID THEN 1 ELSE 1 + LAST ID;
END
TABLE FILE ...
SUM CustCD CustDT CustAMT
BY ID
ACROSS FLAG AS ''
END




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
June 05, 2007, 05:52 PM
Alan B
I think this could be done a little more simply:
-*maybe NODATA if required
SET NODATA=0
TABLE FILE fileName
SUM CustCD CustDT CustAMT
BY ID
ACROSS CUST_CD NOPRINT
END


(There is no such concept as 'least elegant' Susannah, just different approaches.)


Alan.
WF 7.705/8.007
June 08, 2007, 09:14 AM
Alaga
Thank you all for your responses.

It worked both ways.

Your help is greatly appreciated.

Alaga.