Focal Point
Utility to convert file to Amper Variable Array

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

April 14, 2008, 08:47 AM
hammo1j
Utility to convert file to Amper Variable Array
Someone might find this useful. Please post any improvements.
-* File FILEDEF2ARRAY.fex
-************************************* HISTORY *****************************************
-* By   Date        W/O     Modification
-* JPH  01/02/2008  -       Originally written
-*
-* Parameters
-* &FILEDEF  Filedef to read variables from
-* &FMT      Format to read variable eg A80 or , for Free Format (comma and eol delimited)
-* &VARNAME  Variable name
-*
-* Returned
-* &VARNAME0 = count of items &VARNAME1 = 1st item, &VARNAME2 = 2nd item etc etc
-*
-* Example
-* -DOS DIR /B \\PANDORA\C$\WF76\IBI\APPS\IFS\NEW_*.FOC > TEMP.DAT
-*
-* FILEDEF INFILE DISK TEMP.DAT
-* -RUN
-* -SET &FILEDEF  = 'INFILE' ;
-* -SET &FMT      = ',' ;
-* -SET &VARNAME  = 'FILE' ;
-* -INCLUDE FILEDEF2ARRAY
-*
-* -SET &FILE = 0 ;
-* -REPEAT :FLOOP FOR &I FROM 1 TO &FILE0
-* -TYPE &FILE.&I
-* -:FLOOP
-*
-* TABLE FILE CAR
-* PRINT COUNTRY
-* ON TABLE SAVE
-* END
-* -RUN
-* -SET &FILEDEF  = 'SAVE' ;
-* -SET &FMT      = 'A10' ;
-* -SET &VARNAME  = 'COUNTRY' ;
-* -INCLUDE FILEDEF2ARRAY
-*
-* -SET &COUNTRY = 0 ;
-* -REPEAT :CLOOP FOR &I FROM 1 TO &COUNTRY0
-* -TYPE &COUNTRY.&I
-* -:CLOOP
-*
-****************************************************************************************
-SET &VARNAME  = '&' | &VARNAME ;
-SET &F2A_INDEX = 0 ;
-SET &F2A_INPUT = 'NO INPUT' ;
-SET &F2A_READSTRING = IF &FMT | ' ' EQ ',' | ' ' THEN ', &' | 'F2A_INPUT'
-                      ELSE ' &' | 'F2A_INPUT.' | &FMT | '.' ;

-READ &FILEDEF.EVAL&F2A_READSTRING.EVAL
-REPEAT :F2A_LOOP WHILE &IORETURN EQ 0 ;
-SET &F2A_INDEX = &F2A_INDEX + 1 ;
-SET &VARNAME.EVAL.&F2A_INDEX = &F2A_INPUT   ;
-READ &FILEDEF.EVAL&F2A_READSTRING.EVAL
-:F2A_LOOP
-SET &VARNAME.EVAL0 = &F2A_INDEX ;





Server: WF 7.6.2 ( BID/Rcaster) Platform: W2003Server/IIS6/Tomcat/SQL Server repository Adapters: SQL Server 2000/Oracle 9.2
Desktop: Dev Studio 765/XP/Office 2003 Applications: IFS/Jobscope/Maximo
April 15, 2008, 10:17 AM
Kerry
Hi John,

Thanks a lot for sharing this with all. Big Grin

Cheers,

Kerry


Kerry Zhan
Focal Point Moderator
Information Builders, Inc.
April 15, 2008, 02:05 PM
susannah
"\\PANDORA"
Good One




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
April 15, 2008, 02:20 PM
hammo1j
We have another servers called ELECTRA and the Client machine called CHAOS so all our users access their business intelligence through a URL that involves chaos
 http://chaos/ibi_apps/WFServlet 


Of course these are Greek Gods[esses].

Any other funny names of servers out there?



Server: WF 7.6.2 ( BID/Rcaster) Platform: W2003Server/IIS6/Tomcat/SQL Server repository Adapters: SQL Server 2000/Oracle 9.2
Desktop: Dev Studio 765/XP/Office 2003 Applications: IFS/Jobscope/Maximo