What is the best method of converting 1 row by 30 column hold file table to a 30 row by 2 column hold file table? I will need to perform additional computations on the table after the conversion.
Thanks!This message has been edited. Last edited by: <Kathryn Henning>,
WebFOCUS 8008 Windows, All Outputs
October 01, 2014, 05:55 PM
Waz
Whats the format of the 30 columns, are they all the same ?
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
October 02, 2014, 03:17 AM
Tony A
Hi John,
You might be able to use a master that uses OCCURS
.... or ....
I gave a 30 minute lunchtime demo on a technique that may fit this requirement.
Consider this code and how it repeats the two columns that I want, and places a carriage return to separate each "line" of output. You could use a line feed char instead Using an alternative master gives me the columnar output.
EX -LINES 12 EDAPUT MASTER,TEMPDATA,CV,MEM
FILENAME=TEMPDATA, SUFFIX=FIX, $
SEGMENT=SEG01, SEGTYPE=S0, $
FIELD=KEYCOL, USAGE=A15, ACTUAL=A15, $
FIELD=DATA01, USAGE=A10, ACTUAL=A10, $
FIELD=DATA02, USAGE=A10, ACTUAL=A10, $
FIELD=DATA03, USAGE=A10, ACTUAL=A10, $
FIELD=DATA04, USAGE=A10, ACTUAL=A10, $
FIELD=DATA05, USAGE=A10, ACTUAL=A10, $
FIELD=DATA06, USAGE=A10, ACTUAL=A10, $
FIELD=DATA07, USAGE=A10, ACTUAL=A10, $
FIELD=DATA08, USAGE=A10, ACTUAL=A10, $
FILEDEF TEMPDATA DISK TEMPDATA.TXT
-RUN
-WRITE TEMPDATA Key Value data 01 data 02 data 03 data 04 data 05 data 06 data 07 data 08
-RUN
TABLE FILE TEMPDATA
PRINT
-REPEAT :Loop FOR &Cntr FROM 1 TO 8;
KEYCOL DATA0&Cntr.EVAL
COMPUTE CR/A1 = HEXBYT(13, 'A1');
-:Loop
ON TABLE HOLD AS HOLDDATA FORMAT ALPHA
END
-RUN
CMD TYPE HOLDDATA.FTM
EX -LINES 6 EDAPUT MASTER,HOLDDATA,CV,MEM
FILENAME=HOLDDATA, SUFFIX=FIX, $
SEGMENT=SEG01, SEGTYPE=S0, $
FIELD=KEYCOL, USAGE=A15, ACTUAL=A15, $
FIELD=DATAVAL, USAGE=A10, ACTUAL=A10, $
FIELD=CR, USAGE=A1, ACTUAL=A1, $
TABLE FILE HOLDDATA
PRINT DATAVAL
BY KEYCOL
ON TABLE SET PAGE NOLEAD
END
-RUN
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
October 02, 2014, 08:01 AM
John Power
Waz,
All columns are the same format. My specific format is P13.2CM. For future reference, is there a type of format that would cause problems?
Thanks, John
WebFOCUS 8008 Windows, All Outputs
October 02, 2014, 09:44 AM
Alan B
There is no best method, it all depends on circumstance and preference.
One of my favourite for this is to use OVER and FORMAT WP:
APP HOLD BASEAPP
TABLE FILE CAR
PRINT COUNTRY AS '' RCOST/D7c AS '' DCOST/D7c AS ''
OVER COUNTRY AS '' RCOST/D7c AS '' DCOST/D7c AS ''
OVER COUNTRY AS '' RCOST/D7c AS '' DCOST/D7c AS ''
OVER COUNTRY AS '' RCOST/D7c AS '' DCOST/D7c AS ''
OVER COUNTRY AS '' RCOST/D7c AS '' DCOST/D7c AS ''
OVER COUNTRY AS '' RCOST/D7c AS '' DCOST/D7c AS ''
OVER COUNTRY AS '' RCOST/D7c AS '' DCOST/D7c AS ''
OVER COUNTRY AS '' RCOST/D7c AS '' DCOST/D7c AS ''
OVER COUNTRY AS '' RCOST/D7c AS '' DCOST/D7c AS ''
OVER COUNTRY AS '' RCOST/D7c AS '' DCOST/D7c AS ''
OVER COUNTRY AS '' RCOST/D7c AS '' DCOST/D7c AS ''
OVER COUNTRY AS '' RCOST/D7c AS '' DCOST/D7c AS ''
OVER COUNTRY AS '' RCOST/D7c AS '' DCOST/D7c AS ''
OVER COUNTRY AS '' RCOST/D7c AS '' DCOST/D7c AS ''
OVER COUNTRY AS '' RCOST/D7c AS '' DCOST/D7c AS ''
BY COUNTRY NOPRINT
ON TABLE HOLD AS MLINE FORMAT WP
ON TABLE SET PAGE NOLEAD
ON TABLE SET LINES 998
END