Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Dynamic MFD Creation

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Dynamic MFD Creation
 Login/Join
 
Silver Member
posted
Hi guys,

When I try to execute the below code to read the sample data file.(forum.txt)
3rd line from Sample data is missing. Culprit is '$' sign.
Any suggestion would be appreciated. I searched forums..but no luck.

SAMPLE Data:
  
From Bank,To Bank
Bank A,BANK AA
BANK B $ MOVE,BANK BB
BANK C,BANK CC


  
EX -LINES 5 EDAPUT MASTER,BANK,CSV,FILE
FILE=BANK, SUFFIX=COMT, DATASET='/location/forum.txt'
SEGNAME=BANK, SEGTYPE=S0, $
FIELD=FRM_BK, ALIAS=FRM_BK, USAGE=A50, ACTUAL=A50,$
FIELD=TO_BK, ALIAS=TO_BK, USAGE=A50, ACTUAL=A50,$
-*
TABLE FILE BANK
PRINT *
END



Environemnt:
WFRS: AIX: 5.3 Win XP.
HTML, EXCEL,PDF

This message has been edited. Last edited by: Kerry,
 
Posts: 36 | Location: Boston MA | Registered: October 12, 2006Report This Post
Expert
posted Hide Post
You may have to have the offending text in quotes "


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Expert
posted Hide Post
I'm not really thrilled about asking if your incoming format can be changed. But, Can It? If so, consider the following:
APP FI BANKFILE DISK BANKFILE.MAS (LRECL 80
-RUN
-WRITE BANKFILE
-WRITE BANKFILE FILE=BANKFILE, SUFFIX=FOC, SEGNAME=SEG1, SEGTYPE=S0,$
-WRITE BANKFILE FIELD=FRM_BK, ALIAS=FRM_BK, USAGE=A20, ACTUAL=A20,$
-WRITE BANKFILE FIELD=TO_BK, ALIAS=TO_BK, USAGE=A20, ACTUAL=A20,$
CREATE FILE BANKFILE 
-RUN
MODIFY FILE BANKFILE 
FIXFORM FRM_BK/A20 TO_BK/A20
DATA
From Bank           To Bank             
Bank A              BANK AA             
BANK C              BANK CC             
BANK B $ MOVE       BANK BB             
END
-RUN
TABLE FILE BANKFILE
PRINT *
END
Use CREATE as required. After all you indicate that the fields are A20, right?

Just food for thought...
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
<JG>
posted
What you have hit a version related issue.

It's known to occur in various forms prior to 7.6.x

I works perfectly correctly in 7.6.10

You have 2 options to get it to work in pre 7.6.x

1. as suggested by Waz, have your CSV file conform standard CSV format and enclose alphanumerics in double quotes

2. use a variation on Dougs method and load the data to a Focus database

-SET &ECHO=ALL;
FILEDEF BANK DISK BANK.CSV
-RUN
-WRITE BANK From Bank,To Bank
-WRITE BANK Bank A,BANK AA
-WRITE BANK BANK B $ MOVE,BANK BB
-WRITE BANK BANK C,BANK CC
FILEDEF BANKFILE DISK BANKFILE.MAS (LRECL 80
-RUN
-WRITE BANKFILE
-WRITE BANKFILE FILE=BANKFILE, SUFFIX=FOC, SEGNAME=SEG1, SEGTYPE=S0,$
-WRITE BANKFILE FIELD=FRM_BK, ALIAS=FRM_BK, USAGE=A20, ACTUAL=A20,$
-WRITE BANKFILE FIELD=TO_BK, ALIAS=TO_BK, USAGE=A20, ACTUAL=A20,$
CREATE FILE BANKFILE
-RUN
MODIFY FILE BANKFILE
FREEFORM FRM_BK TO_BK
DATA
-INCLUDE BANK
END
-RUN
TABLE FILE BANKFILE
PRINT *
END
 
Report This Post
Silver Member
posted Hide Post
Thanks for your help Waz, Doug, JG.
CSV file comes from Users, Business can't offend with quotes". or Can not replace with any other character.

At first I created Focus database, but business user will keep updated with new CSV file.
I'm looking for a solution where..
User's will load the CSV file and when we run a program, everything this MFD should be created...

Any suggestions would appreciated.
 
Posts: 36 | Location: Boston MA | Registered: October 12, 2006Report This Post
<JG>
posted
The above example using a FOCUS database is totally dynamic and exists only for the period of the request.

just replace

FILEDEF BANK DISK BANK.CSV
-RUN
-WRITE BANK From Bank,To Bank
-WRITE BANK Bank A,BANK AA
-WRITE BANK BANK B $ MOVE,BANK BB
-WRITE BANK BANK C,BANK CC

with a filedef to your actual CSV file
 
Report This Post
Expert
posted Hide Post
You could also read the file as a single field, ans split it up with GETTOK.

This relies on the commas being the delimiters only and not embedded in the text.

EX -LINES 5 EDAPUT FOCTEMP,BANK,CV,FILE
From Bank,To Bank
Bank A,BANK AA
BANK B $ MOVE,BANK BB
BANK C,BANK CC

EX -LINES 6 EDAPUT MASTER,BANK,CV,FILE
FILE=BANK, SUFFIX=FIX
SEGNAME=BANK, SEGTYPE=S0, $
FIELD=LINE, USAGE=A101, ACTUAL=A101, $
DEFINE FRM_BK/A50 = GETTOK(LINE,101,1,',',50,'A50') ;
DEFINE TO_BK/A50 = GETTOK(LINE,101,2,',',50,'A50') ;

-RUN

FILEDEF BANK DISK bank.ftm

TABLE FILE BANK
PRINT *
END


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Dynamic MFD Creation

Copyright © 1996-2020 Information Builders