Focal Point
[CLOSED]Creating master file programmatically

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/5137048386

September 12, 2016, 08:04 AM
Al_C
[CLOSED]Creating master file programmatically
I start out creating a folder for the project and issue these commands

APP PREPENDPATH USERPRJ
APP HOLD USERPRJ
APP HOLDMETA USERPRJ
APP SHOWPATH

run my fex to create a table with the data i need in the master

-*
TABLE FILE MASTER_LIST
COUNT * AS NUM_STU_ALL_CLASSES
PRINT
STC_PERSON_ID
STC_TERM
STC_CRED
STC_STATUS_DATE
COURSES_ID
SEC_INSTR_METHODS
STC_CRED
OL_FLAG
OL_CREDS
TOT.STC_CRED AS NUM_STU_ALL_CREDS
TOT.OL_CREDS AS NUM_STU_OL_CREDS
TOT.OL_FLAG AS NUM_STU_OL_CLASSES
BY SEC_TERM
BY STC_STATUS_DATE
WHERE STC_TERM CONTAINS '&ACAD_TERM'
WHERE (((POS EQ 1) AND (STC_STATUS EQ 'A' OR 'N')) OR ((STC_VERIFIED_GRADE NE MISSING) OR (STC_VERIFIED_GRADE GT ' ')))
ON TABLE HOLD AS TED
-*ON TABLE PCHOLD FORMAT EXL2K
END
-*S-EXIT
-*
-*
WHENCE TED MASTER

-EXIT



but when i try to run a fex using the newly created master i get this error

0 ERROR AT OR NEAR LINE 8 IN PROCEDURE ADHOCRQ FOCEXEC *
(FOC226) FILEDEF OR ALLOC MISSING FOR EXTERNAL FILE: TED

from running this

APP PREPENDPATH USERPRJ
APP HOLD USERPRJ
APP HOLDMETA USERPRJ
APP SHOWPATH
TABLE FILE TED
PRINT *
ON TABLE PCHOLD FORMAT EXL2K
END



Can someone point me to anything on how to programmatically create a master file that can be used by other fex's?

thanks

This message has been edited. Last edited by: <Emily McAllister>,


WebFOCUS 7.6.9
Windows
all output (Excel, HTML, PDF)
September 12, 2016, 09:12 AM
Tony A
quote:
(FOC226) FILEDEF OR ALLOC MISSING FOR EXTERNAL FILE: TED

Nothing wrong with your master file, you just need to tell WebFOCUS where your data file is!

The error message is telling you that it is not FILEDEFd or ALLOCd.

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 
September 12, 2016, 09:15 AM
Tony A
quote:
APP HOLD USERPRJAPP HOLDMETA USERPRJ

BTW,
So you only need APP HOLD to hold both files produced by your focexec.

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 
September 12, 2016, 10:04 AM
Al_C
OK, I changed the command to
APP HOLD USERPRJ
and it creates a .mas file in the directory (as it had been), but I still get the (FOC226) FILEDEF OR ALLOC MISSING FOR EXTERNAL FILE: TED
error.

I was expecting top see a .acx file with the same name. Is that what I should see?


WebFOCUS 7.6.9
Windows
all output (Excel, HTML, PDF)
September 12, 2016, 10:14 AM
Tony A
You wouldn't get an access file (acx) with a HOLD, as it isn't required for just a basic binary HOLD file.

The answer to your question is still in the message "FILEDEF or ALLOC is missing". Look up FILEDEF and you should comprehend what the error message is telling you.

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 
September 13, 2016, 03:06 AM
Danny-SRL
ALC,

Apparently, you would like to have the FILEDEF written somewhere.
You can put it in the MASTER file with the DATASET attribute.
I suppose, however, that you would like this to be done automatically...
So, a bit of FOCUS wizardry:
  
-SET &ECHO=ALL;
-* File alc01.fex
-DEFAULT &APPH=userprj
APP HOLD &APPH
TABLE FILE CAR
SUM CNT.CAR AS CARCNT
SUM SALES
BY COUNTRY BY BODYTYPE
ON TABLE SET ASNAMES ON
ON TABLE HOLD AS EXT
END
-RUN
FILEDEF MAS DISK &APPH/ext.mas 
FILEDEF NMAS DISK &APPH/next.mas 
-RUN
-SET &I=0;
-#LOOP
-SET &I = &I + 1;
-SET &G=DECODE &I(1 #F 2 #S ELSE #N);
-GOTO &G.EVAL
-#F
-* File definition
-READ MAS,&LL1,&LL2,&LL3
-IF &IORETURN GOTO #DONE;
-SET &LL3='DATASET=' || &APPH || '/EXT.FTM';
-WRITE NMAS &LL1, &LL2, &LL3, $
-GOTO #LOOP
-#S 
-* Segment definition
-READ MAS,&LL1,&LL2
-IF &IORETURN GOTO #DONE;
-WRITE NMAS &LL1, &LL2, $
-GOTO #LOOP
-#N
-* Field definition
-READ MAS,&LL1,&LL2,&LL3,&LL4
-IF &IORETURN GOTO #DONE;
-WRITE NMAS &LL1, &LL2, &LL3, &LL4, $
-GOTO #LOOP
-#DONE
!del C:\IBI\APPS\&APPH|\ext.mas
!rename C:\IBI\APPS\&APPH|\next.mas ext.mas



Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

September 13, 2016, 05:24 AM
Wep5622
Does the failing fex include this line:?
APP PREPENDPATH USERPRJ


Because if it doesn't, that would explain why the master can't be found. Unless USERPRJ is in your server (or Dev/App-studio) path, then you don't need that line anywhere.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
September 13, 2016, 01:40 PM
Danny-SRL
Wep,
The problem is not the master it is the data.
A FILEDEF is necessary when running against a sequential file.


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

September 13, 2016, 01:59 PM
Lary Dooley
Remember an agent has it's own thread and holds etc disappear after the agent finishes unless you do something to move things out of the temporary space.


8.0.1
September 14, 2016, 04:58 AM
Al_C
Our administrator did add the directory to the path, but that was because InfoAssist needed it.


WebFOCUS 7.6.9
Windows
all output (Excel, HTML, PDF)
September 14, 2016, 05:13 AM
Al_C
quote:
ON TABLE HOLD AS TED

was update to
ON TABLE HOLD AS TED FORMAT FOCUS, and it looks like everything works. I was under the impression that format focus was the default for hold files, but after reading lots of help the default may in fact be binary. I want to test a few more things, but at least i'm making progress

Thanks everyone


WebFOCUS 7.6.9
Windows
all output (Excel, HTML, PDF)
September 14, 2016, 10:26 AM
eric.woerle
The default for hold files is Alpha. Less overhead. Basically a space delimited text file.


Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix
Oracle 11.2.0.2