IB - Developer Center    Forums  Hop To Forum Categories  FOCUS/WebFOCUS    Modify - single segment file question
Go
New
Search
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Platinum Member
Posted
Hi,

I'm not the greatest at MODIFY processing. Okay, what I got is a single segment focus db. What I need to do is match on the key fields then, ON NOMATCH INCLUDE, then ON MATCH, check one of the fields to see if that field matches the input file, if it does, then REJECT. If it doesn't, then update that field and update a timestamp field.

So, I started with something like this:
DEFINE FILE INFILE
STAMP1/HYYMDs=HGETC(8,STAMP1);
END
TABLE FILE INFILE
PRINT FIELD1
      STAMP1
BY    KEYFIELD1
BY    KEYFIELD2
ON TABLE SET ASNAMES ON
ON TABLE HOLD
END
-RUN
MODIFY TESTFILE
FIXFORM FROM HOLD
MATCH KEYFIELD1 KEYFIELD2
ON NOMATCH INCLUDE
ON MATCH

... not sure what to say here... 
    something to the effect of
    IF FIELD1 FROM HOLD = FIELD1 FROM TESTFILE
       THEN REJECT
    ELSE
       UPDATE FIELD1 STAMP1

END


I tried it this way and it didn't work. I think it's because FIELD1 is on the same segment as the keyfields not a child segment, so the second MATCH won't work...

MATCH KEYFIELD1 KEYFIELD2
ON NOMATCH INCLUDE
ON MATCH CONTINUE
MATCH FIELD1
ON NOMATCH UPDATE FIELD1 STAMP1
ON MATCH REJECT
END


That particular code gives me a (FOC411) THE ACTION AFTER 'ON NOMATCH' IS INVALID: UPDATE error.

I'm on 7.1.4.

Thanks for the assistance.


Prod: WF 7.1.3 WinXP
Dev: WF 7.6.4 WinXP
 
Posts: 156 | Location: Orlando, FL | Registered: October 17, 2006Reply With QuoteEdit or Delete MessageReport This Post
Master
Posted Hide Post
Anatess,

  
DEFINE FILE INFILE
STAMP1/HYYMDs=HGETC(8,STAMP1);
END
TABLE FILE INFILE
PRINT FIELD1
      STAMP1
BY    KEYFIELD1
BY    KEYFIELD2
ON TABLE SET ASNAMES ON
ON TABLE HOLD
END
-RUN
MODIFY TESTFILE
FIXFORM FROM HOLD
MATCH KEYFIELD1 KEYFIELD2
ON NOMATCH INCLUDE
ON MATCH IF FIELD1 EQ D.FIELD1 THEN GOTO TOP;
ON MATCH UPDATE STAMP1
DATA ON HOLD
END


Daniel
wf 7.6/WinXP/IIS/SSA
www.wrapapp.com
www.srl.co.il

 
Posts: 594 | Location: Tel Aviv, Israel | Registered: March 23, 2006Reply With QuoteEdit or Delete MessageReport This Post
Expert
Posted Hide Post
Anatess,

Because it is a single segment file, what Danny suggests above will work perfectly. However, if you ever encounter a multiple segment file then you might need to use -
VALIDATE field[/format] = expression;
ON VALID action
ON INVALID action

T


Old FOCUS coders never die, they just become functionally stable. (Tony A Wink)

Current Client: WebFOCUS 7.6.2 Win XP SP2/IIS 6/Tomcat 5.5 - MRE / BID MS SQL / Oracle - DevStudio 7.6.6 7.1.6
Local: WebFOCUS 7.6.6 7.1.6 on Win XP SP2/Apache/Tomcat 5.5 - Self Service
 
Posts: 2860 | Location: England U.K. (Freelance) | Registered: April 08, 2004Reply With QuoteEdit or Delete MessageReport This Post
Master
Posted Hide Post
Anatess,

Tony's addendum is to the point. Also, by using the VALIDATE command you can also type out some comments about rejected input records.

I think I was a bit elliptic in my example. To be a bit more explicit, in MODIFY any field name - in your example FIELD1 - is interpreted by MODIFY as coming from the input - in your example the HOLD file. In order to access the same field in the database - the FOCUS file - you add the D. prefix to the field name - D is a mnemonic for Database.

I hope this makes the subject clearer.


Daniel
wf 7.6/WinXP/IIS/SSA
www.wrapapp.com
www.srl.co.il

 
Posts: 594 | Location: Tel Aviv, Israel | Registered: March 23, 2006Reply With QuoteEdit or Delete MessageReport This Post
Platinum Member
Posted Hide Post
Danny, Tony,
You guys are the best! Your proposed solution worked perfectly.

Side note: I posted a question on the Microsoft discussion group on some such and it's been almost 2 weeks and the only response I got was - are you sure this is what you want to do? Sigh.

I love Focal Point!


Prod: WF 7.1.3 WinXP
Dev: WF 7.6.4 WinXP
 
Posts: 156 | Location: Orlando, FL | Registered: October 17, 2006Reply With QuoteEdit or Delete MessageReport This Post
 Previous Topic | Next Topic powered by eve community  
 

IB - Developer Center    Forums  Hop To Forum Categories  FOCUS/WebFOCUS    Modify - single segment file question

Copyright © 1996-2008 Information Builders, leaders in enterprise business intelligence.