As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.
Join the TIBCO Community TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.
From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
Request access to the private WebFOCUS User Group (login required) to network with fellow members.
Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.
I have a Focus HOLD file containing a series of chronological times, some of which are recorded incorrectly.
I wish to correct the errors by comparing the records before and after, and setting the incorrect time to halfway between the two.
For example : 10:00 10:20 15:40 (this is the error) 10:36
The 15:40 error would be calculated as 10:28 and the record in the hold file would be corrected to this (using UPDATE ?)
I'm sure there is an easy way to do this but I am very new to using MAINTAIN. I know I can compare the previous record with LAST but is there a similar way of comparing the next record. Also, how do I write the calcuation back to the file ?
Any help will be greatly appreciated Thanks, TrevorThis message has been edited. Last edited by: Trevor M Wilson,
Posts: 12 | Location: Llanelli, South Wales, UK | Registered: November 17, 2005
DEFINE FILE CAR
KEY/I2 = DECODE COUNTRY (
'ENGLAND' 1
'JAPAN' 2
'ITALY' 3
'W GERMANY' 4
'FRANCE' 5
ELSE 0) ;
TIME/A5 = DECODE KEY (
1 '10:00'
2 '10:20'
3 '15:40'
4 '10:36'
5 '10:50'
ELSE ' ') ;
END
TABLE FILE CAR
SUM TIME BY KEY
ON TABLE HOLD AS TEST FORMAT FOCUS
END
-RUN
-* Part 2 - Process
MAINTAIN FILE TEST
-* Read hold data.
FOR ALL NEXT TEST.KEY INTO STK
TYPE "<STK.FOCCOUNT records "
-* Loop proccesing loaded records.
REPEAT STK.FOCCOUNT I/I5 = 1 ;
TYPE "Proccesing record <I - <STK(I).TIME "
IF (I GT 1) AND (I LT STK.FOCCOUNT) THEN BEGIN
-* Process erroneous times.
COMPUTE T0/A5 = STK(I).TIME ;
COMPUTE T1/A5 = STK(I-1).TIME ;
COMPUTE T2/A5 = STK(I+1).TIME ;
IF T0 GT T2 THEN BEGIN
COMPUTE
T1I/I3 = EDIT(MASK(T1, '99')) * 60 + EDIT(MASK(T1, '$$$99')) ;
T2I/I3 = EDIT(MASK(T2, '99')) * 60 + EDIT(MASK(T2, '$$$99')) ;
T3I/I5 = T1I + INT((T2I-T1I)/2) ;
T3H/I2 = INT(T3I/60) ;
T3M/I2 = T3I - T3H * 60 ;
STK(I).TIME = EDIT(T3H) | ':' | EDIT(T3M) ;
TYPE "* Corrected to <STK(I).TIME "
-* Updating
UPDATE TEST.TIME FROM STK(I) ;
ENDBEGIN
ENDBEGIN
ENDREPEAT I = I + 1 ;
END
-RUN
TABLE FILE TEST
PRINT *
END
Thanks, Mikel. That did the job perfectly. While I am a newcomer to the forum, (and no Webfocus expert) I hope that sometime I will be able to return the help that you have given me.
Regards,
Trevor Wilson ( CPP UK)
Posts: 12 | Location: Llanelli, South Wales, UK | Registered: November 17, 2005