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] -READ with comma delimited & variable length source

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] -READ with comma delimited & variable length source
 Login/Join
 
Silver Member
posted
I have a file that looks like this:
/media/rackspace/db2/clients/Jones/2011/2011-10/2011-10-01/852/ISA_006940860_000003234.edi,852,20110925,20111001,006940860,4014677150,16747,4
/media/rackspace/db2/clients/Jones/2011/2011-10/2011-10-01/852/ISA_014492501_400001168.edi,852,20110925,20111001,014492501,4014677150,40474,2

I have the following code:

FILEDEF INP DISK C:\CLIENTS\CLIENTS\EDILIST.CSV

-READ INP &DIR, &FTYPE, &S_DATE, &E_DATE, &TPID, &MFG, &SIZE, &COUNT
-IF &IORETURN NE 0 THEN GOTO DONE;
-TYPE &DIR; &FTYPE; &E_DATE
-SET &CTR= &CTR+1;
-IF &CTR LT 3 THEN GOTO LOOP;
-EXIT

-DONE

Here is the output this routine produces:

/; med; pace/db2
/; med; pace/db2


If I don't create DEFAULT or SET values for the variables in the -READ, the procedure failes. If I define the variables, the date returned matches the lenght of the variables I set up as the default. If I uset .Axx. syntax to define the langth, I get the results that match my format.

What I need is to read each item between the commas fully, so I can manipulate the results.

Running Windows vers 773

This message has been edited. Last edited by: Kerry,


Steve
 
Posts: 44 | Location: New York City | Registered: May 23, 2004Report This Post
Expert
posted Hide Post
set up 1 variable, with a specified length of blanks equal to the largest expected line in your file
make sure its full of blanks to initialize it, otherwise you're reading adjacent garbage in memory
read your line into that space
-READ INP &BIGTHING
Use the TRUNCATE function then to shrink it down to real size, and then the .LENGTH will work.
then token thru (or posit) to look for commas and set each of your individual variables...
i have a routine somewhere that loops thru a long string, looking for the posit of commas, until posit returns a zero
At each step, i set a REMAINDER string starting with the current posit and going to the end of the string....and then operate on that Remainder...
if you follow what i'm saying, i'll look up that code and give it to you, but it wont be till monday




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Silver Member
posted Hide Post
Hi Susan,

I thought of this too, but I am being stubborn. The documentation says that -READ can read from a comma delimited file. I guess I was hoping for too much. If it cannot do the parsing into the various variables, it really cannot read a comma delimited file.

I was thinking of reading in each single line and then using the GETTOK to pick it apart at each comma. Seems to be an overkill too. All of this will take a lot of time, for a very simple and one off process to figure out how to file a full directory's files into appropriate structures.

So, here is the question to IBI: Is the -READ supported for comma delimited files, the way one would expect it, or is it not?


Steve
 
Posts: 44 | Location: New York City | Registered: May 23, 2004Report This Post
Virtuoso
posted Hide Post
Steve, the odd lines in your sample output don't seem to be comma-separated but slash-separated.

Is that the way your file looks or is that just a wrapping effect of the content you posted?



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report This Post
Expert
posted Hide Post
You can write a master file that will parse the .csv, then you don't have to -read
set pcomma = on
remember that?

but like new jersey says, looks like DFIX with delimiter = /

or..if its both, then the way i sugested is perfect. i had a file i had to read every day from the cashregister vendor (name gratefully forgotten) that had 2 different formats in it...the overall format was comma delimited, but one field inside was a comment field with crlf that had to be parsed ...that was fun...




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Virtuoso
posted Hide Post
Steve,
I copied your data and put it into a sequential file. Then I ran your code with a few small changes:
  
-* File SteveC01.fex
FILEDEF INP DISK focalpoint/stevec01.txt
-RUN
-LOOP
-READ INP,&DIR,&FTYPE,&S_DATE,&E_DATE,&TPID,&MFG,&SIZE,&COUNT
-IF &IORETURN NE 0 THEN GOTO DONE;
-TYPE &DIR; &FTYPE; &E_DATE
-GOTO LOOP
-DONE

Notice:
The comma after -READ INP
No blanks between the &variables

And this is the output I received:
  
 /media/rackspace/db2/clients/Jones/2011/2011-10/2011-10-01/852/ISA_006940860_000003234.edi; 852; 20111001
 /media/rackspace/db2/clients/Jones/2011/2011-10/2011-10-01/852/ISA_014492501_400001168.edi; 852; 20111001


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

 
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006Report This Post
Expert
posted Hide Post
awesome!




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Expert
posted Hide Post
I think the commna after the IMP is the trigger to read comma delimited.


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
Virtuoso
posted Hide Post
Yes, Waz, you are correct...
And it is in the manual! (mirabile scripsu)


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

 
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006Report This Post
Expert
posted Hide Post
quote:
And it is in the manual


Eeker

Who'd a thunk it!


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] -READ with comma delimited & variable length source

Copyright © 1996-2020 Information Builders