September 29, 2005, 06:20 AM
<lumen>not writable
Hi
While I write records from a stack to a sequential file I am getting the error " not writable segment".
I am able to write the same to a focus file.Code is as given below.
MAINTAIN FILE OUTSTACK AND TATB
FOR ALL NEXT OUTSTACK.EMPID INTO TASTACK;
FOR ALL INCLUDE TATB.EMPID FROM TASTACK;
END
OUTSTACK is a stack.
TATB is declared as SUFFIX=FIX
Thanks
October 03, 2005, 12:46 PM
Maintain WizardYou cannot include records to a file with a suffix of FIX with the INCLUDE command from Maintain. The syntax that you supplied works when both MASTER files have the exact same fields (name, format length). But both need to have writable suffixes.
For Maintain to write to a FIX file, you have to use the TYPE ON syntax. It would look something like this:
MAINTAIN FILE OUTSTACK
FOR ALL NEXT EMPID INTO TASTACK
COMPUTE I/I2=1;
REPEAT TATSTACK.FOCCOUNT
TYPE ON TATB "<TATSTK[I].EMPID"
-* The line before should have parens, but I used brackets to get past the filter.
COMPUTE I=I+1;
ENDREPEAT
END
You will have to have to include each field in the stack on the TYPE ON line, and be careful with the spacing. Also, make sure your FILEDEF command has the APPEND statement so new data is added to the file, and does not overwrite other data.
Mark