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.



Read-Only Read-Only Topic
Go
Search
Notify
Tools
CSV file
 Login/Join
 
<Alberto>
posted
Hello,
I need to create a file where every fields are separeted by ; and characters without blanks and numeric filds without leading zeros.
I work with a sequential file, for example (where b is blank):

AAAAAAA000001.00BBBBB002
bbAAAAA000001.00bbbbb002
bbbbbCC000000.00bbbbD003

I need to get this file:

AAAAAAA;1.00;BBBB;2;
AAAAA;1.00;;2;
CC;.00;D;3;

I have already tried to do it using the saving format COM, but I don't want "" for character and I need ; as separator and no comma.
I will appriciate any help or shortcut to do it.

Thanks
Alberto
 
Report This Post
Virtuoso
posted Hide Post
I do something like this in the past, of course I was putting in the double qoute, but I'm sure the theory applies.
DEFINE FILE RTRTTBL
TMP_NAME/A32 = GETTOK(AA003,32,2,',',32,TMP_NAME);
SFX_NAME/A5 = GETTOK(AA003,32,3,',',5,SFX_NAME);
FMN_NAME/A32 = LJUST(32,TMP_NAME,FMN_NAME);
FST_NAME/A32 = GETTOK(FMN_NAME,32,1,' ',32,FST_NAME);
LST_NAME/A32 = GETTOK(AA003,32,1,',',32,LST_NAME);
ATTEMPTI/I6 = CRS_ATTEMPTED_HRS * 100;
EARNEDI/I6 = CRS_EARNED_HRS * 1000;
POINTSI/I6 = CRS_QPTS * 1000;
ATTEMPT/A5 = EDIT (ATTEMPTI,'$$99.99');
EARNED/A6 = EDIT (EARNEDI,'$99.999');
POINTS/A6 = EDIT (POINTSI,'$99.999');
TERMX/A6 = EDIT(TERM_CYT,'9999-9');
COURSELINE/A150= STU_ID | ',' | TERMX |
',"' | EDIT(CRS_ID,'9999$$$$') | '-' |
EDIT(CRS_ID,'$$$$9999') | '",' | ATTEMPT | ',' | EARNED | ',' |
OFFICIAL_GRADE | ',' | POINTS | ',' ;
NAMELINE/A150= STU_ID | ',' | FST_NAME | ',' | LST_NAME | ',' | RT25K;
END
 
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004Report This Post
Expert
posted Hide Post
as a corollary, here's an article on how to READ files with different delimeters.
[URL=http://techsupport.informationbuilders.com/sps/91671095.html ]http://techsupport.informationbuilders.com/sps/91671095.html [/URL]
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
<JG>
posted
I'm assuming that what you want is a variable length output file so as to minimize it.

look at the following


your master probably looks like this
FILE=x1, SUFFIX=FIX
SEGNAME=ROOT_SEG, SEGTYPE=S1, $
FIELD=FIELD1, ALIAS=FIELD1, USAGE=A7, ACTUAL=A7, $
FIELD=FIELD2, ALIAS=FIELD2, USAGE=D9.2S, ACTUAL=A9, $
FIELD=FIELD3, ALIAS=FIELD3, USAGE=A5, ACTUAL=A5, $
FIELD=FIELD4, ALIAS=FIELD4, USAGE=I4S, ACTUAL=A4, $
-*
your data like this
AAAAAAA000001.00 002
AAAAA000001.00 002
CC000000.00 D003
-*
-*
FILEDEF X1 DISK C:\IBI\APPS\BASEAPP\X1.FTM
FILEDEF X2 DISK C:\temp\X2.FTM
-RUN
SET HOLDLIST=PRINTONLY
DEFINE FILE X1
DELIM/A1=';';
END
TABLE FILE X1
PRINT
COMPUTE FIELD2A/A9=FTOA(FIELD2, '(D9.2)', 'A9'); NOPRINT
COMPUTE FIELD4A/D5.0=FIELD4; NOPRINT
COMPUTE FIELD4B/A5=FTOA(FIELD4A, '(D5.0)', 'A5'); NOPRINT
COMPUTE OUTLINE/A29=LJUST(7,FIELD1,'A7') || DELIM || LJUST(9,FIELD2A,'A9') || DELIM || LJUST(5,FIELD3,'A5') || DELIM || LJUST(5,FIELD4B,'A5') ;
ON TABLE SAVE AS X2
END
-RUN
FILEDEF X3 DISK C:\temp\X3.FTM (RECFM V
-RUN
-LOOP
-READ X2 &OUTLINE.A29.
-IF &IORETURN NE 0 GOTO EXIT;
-SET &NLINE= TRUNCATE(&OUTLINE);
-WRITE X3 &NLINE
-GOTO LOOP
-EXIT

This message has been edited. Last edited by: <Mabel>,
 
Report This Post
<Alberto>
posted
Actually my files are not so simple as in the example. I have about 20 files and most of them have more then 70 fields, so it will take long.

Thanks to all
 
Report This Post
Guru
posted Hide Post
I suppose the best option would be FORMAT TAB and then run some kind of utility to replace the X'09 with X'3B. You will also have to left-justify alpha fields. Something like this:

TABLE FILE infile
PRINT *
ON TABLE SET NULL ON
ON TABLE HOLD FORMAT TAB
END
 
Posts: 319 | Location: Stockholm, Sweden | Registered: February 04, 2004Report This Post
Gold member
posted Hide Post
Why not create one big field that is a concatenation of all fields with the delimeter thrown in between? The only trick, of course, is getting rid of those pesky leading zeroes in the numbers which you can do with a combination of LJUST and FTOA.

Here's a sample using the CAR file:



DEFINE FILE CAR
LINE/A256=COUNTRY||';'||CAR||';'||
LJUST(3,FTOA(SEATS,'(F3)','A3'),'A3')||';';
END
TABLE FILE CAR
PRINT LINE
ON TABLE SAVE
END
If you edit the output file you'll see it looks exactly as you have described.

This message has been edited. Last edited by: <Mabel>,
 
Posts: 55 | Location: New York | Registered: March 07, 2003Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic


Copyright © 1996-2020 Information Builders