Focal Point
Create a HOLD file from a String

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

July 08, 2008, 05:53 AM
Ved
Create a HOLD file from a String
I have a String that contains values separated by comma.
I need to create a HOLD file out of the entries in this string.

Example: Say the String is ABC,DEF,DFR,GHT,PQR

I need to have a HOLD file out of this string such that its content would be

ABC
DEF
DFR
GHT
PQR

Can anyone provide any insights into this?


Web Focus 7.1.6
Hosted on Unix Box
July 08, 2008, 07:04 AM
FrankDutch
You might create a master that looks like this

FILENAME=FP, SUFFIX=COM
SEGNAME=ROOT, OCCURS=VARIABLE
FIELD=CODE,,A6,,$


Never tried the "occurs=varibale" with a COM file, but you can try.

The master file describes your text file.

But if this is for only one time and the file is not that big I would do it in an other way.

Open the file in an editor.
Find and replace the comma for a CRLF and save the file again....




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

July 08, 2008, 07:21 AM
FrankDutch
I tested it myself

It does not work with COM

So I added a extra field that reeds the comma and then it does work.

I'm looking forward to some other solutions.




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

July 08, 2008, 07:42 AM
Danny-SRL
Ved,

Do you have one record containing that string or many?


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

July 08, 2008, 08:27 AM
Ved
I just have an amper variable that contains the comma separated values (as a single string)


Web Focus 7.1.6
Hosted on Unix Box
July 08, 2008, 09:46 AM
Danny-SRL
Ved,

Try this:

  
-* File ved3.fex
FILEDEF VED DISK VED.FTM
-RUN
-SET &VED='ABC,DEF,DFR,GHT,PQR';
-SET &V='X';
-SET &I=0;
-REPEAT #V1 WHILE &V NE ' ';
-SET &I=&I+1;
-SET &V=GETTOK(&VED, &VED.LENGTH, &I, ',', 3, 'A3');
-IF &V EQ ' ' GOTO #VDONE;
-WRITE VED &V
-#V1
-#VDONE
-RUN
!TYPE VED.FTM



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