July 08, 2008, 05:53 AM
VedCreate 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?
July 08, 2008, 07:04 AM
FrankDutchYou 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....
July 08, 2008, 07:21 AM
FrankDutchI 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.
July 08, 2008, 07:42 AM
Danny-SRLVed,
Do you have one record containing that string or many?
July 08, 2008, 08:27 AM
VedI just have an amper variable that contains the comma separated values (as a single string)
July 08, 2008, 09:46 AM
Danny-SRLVed,
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