August 09, 2005, 01:46 AM
susannahMODIFY how to update an A1 field with a blank
Does anyone know how to MODIFY a file
with an UPDATE command when the field to be updated is to receive a blank value?
i can't seem to make it work.
i'm using fixform from a file, and the blanks are in the file ok.
August 09, 2005, 03:55 AM
Francis MarianiSusannah,
In your MODIFY, add a COMPUTE statment something like the one in this example:
-*-- Create test hold file ---
TABLE FILE EMPDATA
PRINT
COMPUTE MIDINITIALX/A1 = IF MIDINITIAL EQ 'C' THEN ' ' ELSE MIDINITIAL; AS 'MIDINITIAL'
BY PIN
WHERE MIDINITIAL EQ 'A' OR 'C'
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE SET ASNAMES ON
ON TABLE HOLD AS EMPH001 FORMAT ALPHA
END
-RUN
-*-- Modify data (even if blank) ---
MODIFY FILE EMPDATA
FIXFORM FROM EMPH001
MATCH PIN
-* Force blank update
ON MATCH COMPUTE MIDINITIAL = IF MIDINITIAL EQ ' ' THEN ' ' ELSE MIDINITIAL;
ON MATCH UPDATE MIDINITIAL
ON NOMATCH REJECT
DATA ON EMPH001
END
-RUN
August 09, 2005, 04:25 AM
susannahthanks francis, very much. that works like a charm.
August 09, 2005, 01:53 PM
Francis MarianiWorking the late shift?
August 09, 2005, 01:55 PM
j.grossFIXFORM FROM holdname
issues
conditional fixforms. (You can see that in the error message issued when the hold master includes fields that are undefined to the Modify).
If a conditional field is blank in the transaction record, the field value is set to blank (or zero), but the field is not marked 'active' -- i.e., it is not set to update the database field. The activate it, add either
COMPUTE fieldname=fieldname;
or
ACTIVATE RETAIN fieldname
after the FIXFORM.
Or use MAINTAIN, where the concept of activation does not exist.
August 09, 2005, 03:57 PM
susannahah. thanks for the insight, Jack. makes sense.
yep, francis, working way too late.
August 09, 2005, 04:04 PM
j.grossFIXFORM FROM holdname
issues
conditional fixforms. (You can see that in the error message issued when the hold master includes fields that are undefined to the Modify).
If a conditional field is blank in the transaction record, the field value is set to blank (or zero), but the field is not marked 'active' -- i.e., it is not set to update the database field. To activate it, add either
COMPUTE fieldname=fieldname;
or
ACTIVATE RETAIN fieldname
after the FIXFORM.
Or use MAINTAIN, where the concept of activation does not exist.