It's been to long since I've done a modify. Can someone tell me why this one is not working? It rejects every record.
TABLE FILE CAR
PRINT
LENGTH AS 'WIDTH'
BY COUNTRY
BY CAR
ON TABLE SET ASNAMES ON
ON TABLE HOLD AS TEMP1 FORMAT ALPHA
END
TABLE FILE CAR
PRINT
WIDTH
BY COUNTRY
BY CAR
ON TABLE HOLD AS TEMP2 FORMAT ALPHA
END
-RUN
MODIFY FILE TEMP2
FIXFORM FROM TEMP1
MATCH COUNTRY CAR
ON NOMATCH REJECT
ON MATCH UPDATE WIDTH
DATA ON TEMP1
END
-RUN
TABLE FILE TEMP2
PRINT *
END
This message has been edited. Last edited by: <Kathryn Henning>,
8.2.03 AIX Client Windows Tomcat DB2, Terradata, SQL, Oracle
February 19, 2014, 06:09 PM
Waz
TEMP2, the modified file needs to be either an SQL table or a FOCUS file.
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
February 19, 2014, 07:30 PM
j.gross
WAZ: I thought so too, but decided to check, and lo and behold,
"Starting with Version 7.6.1, a fixed-formatted sequential file may be the target of the MODIFY procedure." - so says the Keysheet.
I imagine it only supports UPDATE.
RRKen: What's the error message?
[edit:]
By the nature of the in-place update, it would require a fixed-record-length Filedef. Better check whether that's what your HOLD generates.This message has been edited. Last edited by: j.gross,
February 19, 2014, 07:38 PM
Waz
Now you have be interested.
I wonder if its INCLUDE only, just adding to the file.
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
February 20, 2014, 05:49 AM
Danny-SRL
Waz, You are quite right. You can only add records to the end of an existing sequential file.
Daniel In Focus since 1982 wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF
February 20, 2014, 08:40 AM
j.gross
Fortunately, the error message (apparently) doesn't spell that out. If it did, the question would never have been posted, and we would have lost the educational opportunity provided by this thread.
February 20, 2014, 09:24 AM
George Patton
Why not just HOLD the second table as FORMAT FOCUS ?
That makes the MODIFY easy - INCLUDE, UPDATE, and DELETE are all supported.
Personally, I'd do the two HOLDS in reverse order and get:
TABLE FILE CAR
PRINT
WIDTH
BY COUNTRY
BY CAR
ON TABLE HOLD AS TEMP2 FORMAT FOCUS
-RUN
TABLE FILE CAR
PRINT
LENGTH AS 'WIDTH'
BY COUNTRY
BY CAR
ON TABLE SET ASNAMES ON
ON TABLE HOLD
END
MODIFY FILE TEMP2
FIXFORM FROM HOLD
MATCH COUNTRY CAR
ON NOMATCH REJECT
ON MATCH UPDATE WIDTH
DATA ON HOLD
END
-RUN
TABLE FILE TEMP2
PRINT *
END
This message has been edited. Last edited by: George Patton,
Even with GP's code I get the same problem off all records being rejected
quote:
0 NUMBER OF RECORDS IN TABLE= 18 LINES= 18
0 NUMBER OF RECORDS IN TABLE= 18 LINES= 18
0 ERROR AT OR NEAR LINE 25 IN PROCEDURE ADHOCRQ FOCEXEC *
(FOC439) WARNING. A MATCH CONDITION HAS BEEN ASSUMED FOR: FOCLIST
(FOC415)TRANS 1 REJECTED NOMATCH SEG01
ENGLAND JAGUAR @g?33333
(FOC415)TRANS 2 REJECTED NOMATCH SEG01
...
0 TRANSACTIONS: TOTAL = 18 ACCEPTED= 0 REJECTED= 18
SEGMENTS: INPUT = 0 UPDATED = 0 DELETED = 0
0 NUMBER OF RECORDS IN TABLE= 18 LINES= 18
8.2.03 AIX Client Windows Tomcat DB2, Terradata, SQL, Oracle
February 20, 2014, 10:27 AM
j.gross
When you use the PRINT verb, the output can include multiple rows with identical sort-key ("BY" field) values. In order to give each row in the result a unique set of keys in the generated FOCUS file, when you HOLD FORMAT FOCUS, a tie-breaker field named FOCLIST is added as a low-order sort key.
(You'll see it in the output of your final PRINT * request)
Since you are not providing FOCLIST in you FIXFORM, its value defaults to zero, hence the no-match condition.
To avoid that, change PRINT to SUM in the TABLE request that produces TEMP2.
February 20, 2014, 10:35 AM
RRKen
awesome, thanks FOCLIST was my problem thanks!
8.2.03 AIX Client Windows Tomcat DB2, Terradata, SQL, Oracle
February 21, 2014, 10:35 AM
George Patton
Oops ... my bad. Forgot about FOCLIST. Thanks Jack!