[CLOSED] how to define a hold file inside a TABLE command
can we dynamically define the hold file inside a TABLE command so that when the report runs it will save each record in separate file with different user defined namesThis message has been edited. Last edited by: Kerry,
WebFocus 5.2.5 HP-UX(UNIX) EXCEL, HTML, PDF and OLAP
December 23, 2010, 03:21 AM
GamP
No, you can't.
GamP
- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
December 23, 2010, 04:25 AM
MKS
Is there any other solution for below situation i have a example situation like below
TABLE FILE CAR
PRINT BODYTYPE
ON TABLE HOLD AS BDY_TYPE FORMAT ALPHA
END
-RUN
TABLE FILE CAR
PRINT BODYTYPE RETAIL_COST SALES
WHERE BODYTYPE IN FILE BDY_TYPE
ON TABLE SET ONLINE-FMT PDF
END
-RUN
-EXIT
and i would like to print retail_cost and sales for each bodytype in different files, and save it to disk. I know about PAGE-BREAK, but it creates report in same file different page, but i need the report to be in different file.
WebFocus 5.2.5 HP-UX(UNIX) EXCEL, HTML, PDF and OLAP
December 23, 2010, 05:00 AM
Tony A
You can use PUTDDREC - an oft overlooked function - to output records into a file from within a table request.
You MUST filedef the output files beforehand.
FILEDEF RCOST DISK OUT1.TXT
FILEDEF SALES DISK OUT2.TXT
-RUN
TABLE FILE CAR
BY BODYTYPE
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE SAVE AS BDYTYPE
END
-RUN
TABLE FILE CAR
PRINT COMPUTE RCOSTA/A12 = FTOA(RETAIL_COST, '(D7)', 'A12');
COMPUTE SALESA/A12 = FTOA(SALES, '(D6)', 'A12');
COMPUTE OUT1/I11 = PUTDDREC('RCOST', 5, RCOSTA, 12, OUT1);
COMPUTE OUT2/I11 = PUTDDREC('SALES', 5, SALESA, 12, OUT2);
WHERE BODYTYPE IN FILE BDYTYPE
ON TABLE SAVE
END
-RUN
CMD TYPE OUT*.TXT
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
December 23, 2010, 05:12 AM
MKS
unlucky PUTDDREC is not available in 5.2 version.
WebFocus 5.2.5 HP-UX(UNIX) EXCEL, HTML, PDF and OLAP
December 23, 2010, 05:23 AM
Tony A
Time to push for that upgrade? Especially as 5.2.5 is now relatively old - is it "functionally stabalised" yet?
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
December 23, 2010, 06:48 AM
<JG>
quote:
is it "functionally stabalised" yet?
Very. May 2007 to be exact.
The old fashioned way
TABLE FILE CAR
BY COUNTRY
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE SAVE AS FILELIST
END
-RUN
-SET &LOOP=&LINES;
-REPEAT ENDLOOP &LOOP TIMES
-READ FILELIST NOCLOSE &COUNTRY.A10.
FILEDEF DEST DISK &COUNTRY.EVAL.FTM
-RUN
TABLE FILE CAR
PRINT DCOST RCOST
BY COUNTRY
WHERE COUNTRY EQ '&COUNTRY'
ON TABLE SAVE AS DEST
END
-ENDLOOP
December 23, 2010, 09:17 PM
MKS
I believe there should be some way out. It's a simple requirement.
"Table file" command itself would create the report in different file and store with different name, after all the "table file" can create all report in same file with PAGE-BREAK.
I am searching hard, will keep this discussion, updated.
WebFocus 5.2.5 HP-UX(UNIX) EXCEL, HTML, PDF and OLAP
December 24, 2010, 09:46 AM
George Patton
I'm a bit foggy on this but I seem to recollect using something like this in the past, with IN and the HOLD in brackets:
TABLE FILE CAR PRINT BODYTYPE ON TABLE HOLD END -RUN TABLE FILE CAR PRINT BODYTYPE RETAIL_COST SALES WHERE BODYTYPE IN (HOLD) ON TABLE SET ONLINE-FMT PDF END
BODYTYPE RETAIL_COST SALES CONVERTIBLE 8,878 0 SEDAN 13,491 12000 SEDAN 17,850 20 SEDAN 3,139 43000 COUPE 31,500 0 SEDAN 3,339 35030 SEDAN 5,970 7800 HARDTOP 5,100 0 SEDAN 5,925 4800 ROADSTER 6,820 13000 COUPE 6,820 12400 SEDAN 5,940 8950 SEDAN 6,355 8900 SEDAN 9,097 14000 SEDAN 9,495 15600 SEDAN 13,752 14000 SEDAN 14,123 18940 SEDAN 5,610 0
TABLE FILE CAR PRINT BODYTYPE ON TABLE SAVE END -RUN TABLE FILE CAR PRINT BODYTYPE RETAIL_COST SALES WHERE BODYTYPE IN (SAVE) OR IF BODYTYPE EQ (SAVE) ON TABLE SET ONLINE-FMT PDF END
WHERE BODYTYPE EQ (SAVE) will not work.
December 27, 2010, 05:15 AM
Vinay Kumar
Opaltosh,
Your logic is working fine when i am using only IF condition. When i am giving only WHERE condition, it is throwing error.
FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED: HOLD
Could you please help me with the above error.
WebFOCUS 7.6.4, Mainframe Focus Windows XP, All Output Formats
December 27, 2010, 05:52 AM
<JG>
That is because the syntax for WHERE is wrong in the example.
IF BODYTYPE IN (SAVE) is correct
WHERE syntax is
WHERE BODYTYPE IN FILE
December 27, 2010, 05:58 AM
Vinay Kumar
The below code also worked for me. IF EID EQ (SAVE)
The WHERE clause you have mentioned in the above post would be in the format WHERE BODYTYPE IN FILE SAVE, this worked for me.
Thanks JG.
WebFOCUS 7.6.4, Mainframe Focus Windows XP, All Output Formats
December 28, 2010, 06:24 AM
OPALTOSH
My point was that using HOLD and WHERE is more complicated than using SAVE and IF.
Creating a HOLD file also creates a MAS file which is redundant. SAVE is all that is requred for this scenario.
And why use WHERE ... IN FILE SAVE when IF ... EQ (SAVE) works.