Hi everyone, I'm pretty new to FOCUS, and having a few problems with it over the last few weeks. All the past problems I've had I could find an answer around here without posting. This time it was not the case, so I need some help from you guys.
The prolem is in this piece of code, I need to load the data from TEMPFILE, into SECURITY file, but it NEVER moves the data from the USERID field, which in my security file is the INDEX, and the main data I need on the file for further processing and reporting.
MATCH FILE TEMPFILE PRINT USERID FIRST_NAME_BF AS FIRST_NAME LAST_NAME_BF AS LAST_NAME LEVEL_BFOR AS LEVEL BY USERID RUN FILE SECURITY PRINT USERID BY USERID AFTER MATCH HOLD OLD-NOT-NEW END MODIFY FILE SECURITY FIXFORM FROM HOLD MATCH USERID ON NOMATCH INCLUDE END
Can someone tell me what I'm doing wrong? This piece of code is a copy of another program that does a similar function, and still this one's not moving the key field properly.
The data on the file gets like this, inserting only the first record and then rejecting all others, saying that its a duplicate of the key
USERID FIRST_NAME LAST_NAME ------ ---------- --------- ANDRE CASARINI
What I think even weird, is that it rejects the transactions saying that it has no userid, but shows me the userid in the transaction data:
(FOC405) TRANS 1 REJECTED DUPL: ROOT
CHKCASA ANDRE CASARINI
I really have no idea why this is happening. Any help will be highly appreciated, if you need any further info, please let me know.This message has been edited. Last edited by: andrekilik,
Mainframe, Outputs available
Hi Andre and welcome to the Point,
I am guessing that the USERID fields are exactly the same format?
What is the format of the SECURITY table?
This may not be exactly the same as your scenario but may help.
Note that I am using SUM (my preference for this - should avoid duplicates in any event).
Also I am not repeating the USERID into the output - you only need it once in each MATCH part. To stop the USERID being repeated in the second MATCH component, I am using another field but renaming it as NOTUSED, I then COMPUTE this within the MODIFY to prevent a FOC419 failure.
-* Preparation section -* This is only to get something similar to your scenario EX -LINES 6 EDAPUT MASTER, SECURITY, C, MEM, FILE=SECURITY, SUFFIX=FOC SEGNAME=SEG01 FIELDNAME=USERID ,A10 ,A10 , FIELDTYPE=I, $ FIELDNAME=FIRST_NAME ,A10 ,A10 , $ FIELDNAME=LAST_NAME ,A15 ,A15 , $ FIELDNAME=LEVEL ,A04 ,A04 , $ -RUN CREATE FILE SECURITY -RUN DEFINE FILE EMPDATA USERID/A10 = EDIT(LASTNAME,'9999999$')||EDIT(FIRSTNAME,'9$'); END TABLE FILE EMPDATA SUM FIRSTNAME AS FIRST_NAME LASTNAME AS LAST_NAME DIV AS LEVEL BY USERID WHERE DIV EQ 'CORP' ON TABLE SET HOLDLIST PRINTONLY ON TABLE SET ASNAMES ON ON TABLE HOLD AS BASEDATA END -RUN MODIFY FILE SECURITY FIXFORM FROM BASEDATA MATCH USERID ON MATCH REJECT ON NOMATCH INCLUDE DATA ON BASEDATA END -RUN -* End of preparation section MATCH FILE EMPDATA SUM FIRSTNAME AS FIRST_NAME LASTNAME AS LAST_NAME DIV AS LEVEL BY USERID RUN FILE SECURITY SUM LEVEL AS NOTUSED BY USERID AFTER MATCH HOLD AS LOADDATA OLD-NOT-NEW END MODIFY FILE SECURITY COMPUTE NOTUSED/A4 = ''; FIXFORM FROM LOADDATA MATCH USERID ON MATCH REJECT ON NOMATCH INCLUDE DATA ON LOADDATA END -RUNgives -
NUMBER OF RECORDS SELECTED= 41 LINES= 41 NUMBER OF RECORDS SELECTED= 8 LINES= 8 LINES OF MATCH OUTPUT = 33 TRANSACTIONS: TOTAL = 33 ACCEPTED= 33 REJECTED= 0 SEGMENTS: INPUT = 33 UPDATED = 0 DELETED = 0
Hi Tony, thanks for the quick reply. Your solution helped me, it's now working.
Mainframe, Outputs available
That's good to hear!
|Powered by Social Strata|