[SOLVED] Creating HOLD file to store results from loop
Good Morning,
I am iterating over a table of guids and preforming some business logic on each. When that's complete, depending on what happened during the business logic, I may push the guid to a results table. It looks like my best, (only?), option is to create a hold using filedef and -WRITE the guid to that file.
A couple Q's:
1. I came across some code which suggests the way to approach this is something like:
FILEDEF RESULTS DISK ????/results.ftm -RUN
- begin my loop - do my work
- if I want to write the guid -WRITE RESULTS &GUID
- end of loop
Does that look right? Do I not need to define a mas file? If that is the right way to go about it I'm getting the following error so maybe I'm missing something?
2. I learnt a little while ago that if I want my holds to be removed at the end of the request I don't want "ON TABLE HOLD AS 'foccache/temp_hold" but rather "ON TABLE HOLD AS temp_hold" as foccache is session, the other route is for the duration of the request, (feel free to correct me if I'm wrong about that). So with that in mind, where would I want to create this hold if I want it to be deleted at the end of the request? So in the below code, what should "????" be?
FILEDEF RESULTS DISK ????/results.ftm -RUN
Thanks!This message has been edited. Last edited by: FP Mod Chuck,
Windows 8203 All output formats
January 28, 2019, 02:35 AM
Dave
Hi Sean,
by default foccache is used ( session based storage )
so result.ftm and foccache/result.ftm should be the same.
I have similar code. But I don't use ( nor like :-) ) -WRITE
One of the things that can be done is APPEND.
FILEDEF HOLD DISK HOLD.FTM (APPEND
SET HOLDLIST = PRINTONLY
Then just hold what you need 'do your work' this could be any dummy request.
begin loop
TABLE FILE CAR
SUM COMPUTE GUID/A255 = 'thisIsNotARealGuid';
BY COUNTRY
WHERE RECORDLIMIT EQ 1
ON TABLE HOLD FORMAT ALPHA
END
end loop
TABLE FILE HOLD
PRINT *
END
g'luck,
_____________________ WF: 8.0.0.9 > going 8.2.0.5
January 28, 2019, 03:11 AM
Tony A
quote:
so result.ftm and foccache/result.ftm should be the same.
Monday morning brain freeze? result.ftm will go to the foctemp folder for the agent used and not the foccache folder for the user.
If you are only wishing to output certain records from your processing, then look at using PUTDDREC - document .
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
January 28, 2019, 06:25 AM
Dave
...eehm... yeah. But for this case the effect is the same I guess.