Focal Point
Need to report on a flat .fex (text) file
October 03, 2007, 11:57 AM
mark66Need to report on a flat .fex (text) file
Hi all,
This is something I hope will be relatively straight forward...
We currently write out some program stats to a .fex file, with a comma separating each variable.
Example:
-* WRITE STATS TO LOG
FILEDEF LOG DISK /home/iadmindev/ibi/apps/log/log.fex (APPEND
-RUN
-WRITE LOG &LOG_USER, &TERRITORY, &RUNDATE, &STARTED, &ENDED, &RUNTIME
This is old code that has been running for ages and our .fex file now has many lines.
I now want to pick up this flat file using a WebFocus report and output in Excel.
My first problem is reading the file. Can I pick up a file without a .ACX definition file? I am reluctant to create a .ACX file as I am intending on writing many more lines to this file, some with 5 fields, some with up to 20 fields.
If I can resolve that first problem of picking up the file, can I get WebFocus to simply output all lines, using the comma as the separator?
I am worried that I have been asking the most obvious questions, but this is all well of the beaten path of my usual WebFocus escapades!
Thanks
Mark
WebFocus 765. iSeries v5r4
October 03, 2007, 12:07 PM
GinnyJakesIf a file is a squential file, as yours it, you never have an .acx file. But you will require a master and either a DATASET parameter in the master or an APP FI (FILEDEF) in the program.
Please do a search on the IBI website for comma-delimited data in order to find the best SUFFIX value for your master that most closely describes your data. Examples are COMMA and COMT. Read the description of each value and pick the one that most closely matches your data.
Once you have the master, you will be able to do your report.
Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
October 04, 2007, 05:17 AM
mark66Hi Ginny,
Thanks for your reply. I have read through quite a bit of the online documentation, and it does seem that what I am wanting to do should be very straight forward, but unfortunately I haven't been able to suceed yet!!
One problem is that I have no experience of creating Master files or File definitions etc. All our Master & ACX files are created outside of WebFocus in a complex Excel Macro and then they are uploaded to WebFocus.
Ok, this is what I have created so far
My flat file,
log.fex containing some made up sample data:
USER,TERRITORY,RUNDATE,STARTTIME,ENDTIME,RUNTIME,$
Fred,UK,20070910,1000,1001,1,$
Sam,UK,20070912,1500,1501,1,$
I have then manually created the following Master file:
log.mas containing:
FILE=MARK_LOG, SUFFIX=COMMA,$
My program then consists of:
FILEDEF LOG DISK /home/iadmindev/ibi/apps/log/log.fex
-RUN
TABLE FILE LOG
PRINT *
END
-RUN
When I run the code I get the following error:
(FOC3601) ERROR AT OR NEAR LINE 2 IN PROCEDURE LOG
(FOC1822) WARNING. INVALID SYMBOL:
v
ÈÈÈ
BYPASSING TO END OF COMMAND
I have tried many variations of SUFFIX, changed the data and filedefs but without any luck!
Can someone point out where I am going wrong?
Thanks again,
Mark
WebFocus 765. iSeries v5r4
October 04, 2007, 06:54 AM
Tony AMark,
Your master file is incomplete, all you have done is given it a name and a type!
Try this -
FILEDEF MARKLOG DISK MARK.log
FILEDEF LOGMAS DISK MARKLOG.MAS
-RUN
-WRITE MARKLOG USER,TERRITORY,RUNDATE,STARTTIME,ENDTIME,RUNTIME,$
-WRITE MARKLOG Fred,UK,20070910,1000,1001,1,$
-WRITE MARKLOG Sam,UK,20070912,1500,1501,1,$
-WRITE LOGMAS FILE=MARK_LOG, SUFFIX=COMT,$
-WRITE LOGMAS SEGMENT=SEG01,$
-WRITE LOGMAS FIELD=USER, FORMAT=A10V,$
-WRITE LOGMAS FIELD=RUNDATE, FORMAT=A10V,$
-WRITE LOGMAS FIELD=STARTTIME, FORMAT=A10V,$
-WRITE LOGMAS FIELD=ENDTIME, FORMAT=A10V,$
-WRITE LOGMAS FIELD=RUNTIME, FORMAT=A10V,$
-WRITE LOGMAS FIELD=TERM, FORMAT=A10V,$
-RUN
TABLE FILE MARKLOG
PRINT *
END
Just a suggestion, but I wouldn't suggest that you use the file extension of ".fex" for log files, I would always use ".log" to indicate what the usage is.
The only exceptance is that if it is an old system then you used to require the .fex extension to be able to INCLUDE a file in another fex.
This actually might point to the fact that this is used elsewhere (perhaps in a MODIFY process?) to be able to update a central database?
T
p.s. I am still contracting, you have my details
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 04, 2007, 09:07 AM
PBrightwellSince this is a comma delimited file have you tried opening it in Excel without running it through WebFocus?
Pat
WF 7.6.8, AIX, AS400, NT
AS400 FOCUS, AIX FOCUS,
Oracle, DB2, JDE, Lotus Notes