As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.
Join the TIBCO Community TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.
From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
Request access to the private WebFOCUS User Group (login required) to network with fellow members.
Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.
Below sample code I have works successfully as needed to insert 3 records to database. Can anyone help in simplifying the code to use only 1 MODIFY statement instead of 3 using REPEAT LOOP?
-:REC1
-SET &FLD1 = 'VAL1';
-SET &FLD2 = 'VAL2';
-SET &FLD3 = 'VAL3';
-GOTO :MODIFY1;
-:REC2
-SET &FLD1 = 'VAL1';
-SET &FLD2 = 'VAL4';
-SET &FLD3 = 'VAL5';
-GOTO :MODIFY2;
-:REC3
-SET &FLD1 = 'VAL1';
-SET &FLD2 = 'VAL6';
-SET &FLD3 = 'VAL7;
-GOTO :MODIFY3;
-:MODIFY1
MODIFY FILE TABLE_NAME
FREEFORM FLD1 FLD2 FLD3
MATCH FLD1
ON MATCH INCLUDE FLD2 FLD3
ON NOMATCH INCLUDE FLD2 FLD3
DATA
FLD1='&FLD1', FLD2='&FLD2', FLD3='&FLD3', $
END
-RUN
-GOTO :REC2;
-:MODIFY2
MODIFY FILE TABLE_NAME
FREEFORM FLD1 FLD2 FLD3
MATCH FLD1
ON MATCH INCLUDE FLD2 FLD3
ON NOMATCH INCLUDE FLD2 FLD3
DATA
FLD1='&FLD1', FLD2='&FLD2', FLD3='&FLD3', $
END
-RUN
-GOTO :REC3;
-:MODIFY3
MODIFY FILE TABLE_NAME
FREEFORM FLD1 FLD2 FLD3
MATCH FLD1
ON MATCH INCLUDE FLD2 FLD3
ON NOMATCH INCLUDE FLD2 FLD3
DATA
FLD1='&FLD1', FLD2='&FLD2', FLD3='&FLD3', $
END
-RUN
-GOTO :END1;
-:END1
Please suggest.
Thanks.This message has been edited. Last edited by: Enigma006,
You should be able to have all three records in the data area.
MODIFY FILE TABLE_NAME
FREEFORM FLD1 FLD2 FLD3
MATCH FLD1
ON MATCH INCLUDE FLD2 FLD3
ON NOMATCH INCLUDE FLD2 FLD3
DATA
FLD1='&FLD1a', FLD2='&FLD2a', FLD3='&FLD3a', $
FLD1='&FLD1b', FLD2='&FLD2b', FLD3='&FLD3b', $
FLD1='&FLD1c', FLD2='&FLD2c', FLD3='&FLD3c', $
END
Originally posted by Waz: You should be able to have all three records in the data area.
MODIFY FILE TABLE_NAME
FREEFORM FLD1 FLD2 FLD3
MATCH FLD1
ON MATCH INCLUDE FLD2 FLD3
ON NOMATCH INCLUDE FLD2 FLD3
DATA
FLD1='&FLD1a', FLD2='&FLD2a', FLD3='&FLD3a', $
FLD1='&FLD1b', FLD2='&FLD2b', FLD3='&FLD3b', $
FLD1='&FLD1c', FLD2='&FLD2c', FLD3='&FLD3c', $
END
hello waz, how would I direct the control to MODIFY? Each set of SET statement values will be replaced by next set if I give them continuously. please provide full code.
MODIFY FILE TABLE_NAME FREEFORM FLD1 FLD2 FLD3 MATCH FLD1 ON MATCH INCLUDE FLD2 FLD3 ON NOMATCH INCLUDE FLD2 FLD3 DATA FLD1='&FLD1', FLD2='&FLD2', FLD3='&FLD3', $ END
Go review the syntax; INCLUDE (as opposed to UPDATE) operates on entire segments, and does not take a list of fields. Also, ON MATCH INCLUDE is valid syntax, but rarely appropriate.
If FLD1 is the sole key, you probably need
ON MATCH REJECT
ON NOMATCH INCLUDE
or maybe
ON MATCH UPDATE FLD2 FLD3
ON NOMATCH INCLUDE
- Jack Gross WF through 8.1.05
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005
MODIFY FILE TABLE_NAME FREEFORM FLD1 FLD2 FLD3 MATCH FLD1 ON MATCH INCLUDE FLD2 FLD3 ON NOMATCH INCLUDE FLD2 FLD3 DATA FLD1='&FLD1', FLD2='&FLD2', FLD3='&FLD3', $ END
Go review the syntax; INCLUDE (as opposed to UPDATE) operates on entire segments, and does not take a list of fields. Also, ON MATCH INCLUDE is valid syntax, but rarely appropriate.
If FLD1 is the sole key, you probably need
ON MATCH REJECT
ON NOMATCH INCLUDE
or maybe
ON MATCH UPDATE FLD2 FLD3
ON NOMATCH INCLUDE
This is sample code and my main issue is looping the code and not REJECT or UPDATE records.
Originally posted by Waz: You should be able to have all three records in the data area.
MODIFY FILE TABLE_NAME
FREEFORM FLD1 FLD2 FLD3
MATCH FLD1
ON MATCH INCLUDE FLD2 FLD3
ON NOMATCH INCLUDE FLD2 FLD3
DATA
FLD1='&FLD1a', FLD2='&FLD2a', FLD3='&FLD3a', $
FLD1='&FLD1b', FLD2='&FLD2b', FLD3='&FLD3b', $
FLD1='&FLD1c', FLD2='&FLD2c', FLD3='&FLD3c', $
END
Enigma - You've marked it Solved, so this is just a comment.
When you put the incoming data after the DATA command at the bottom of a simple MODIFY the "looping" you refer to is implied and doesn't need to be explicitly coded. Control branches from before the END statement back up to the first line after the MODIFY FILE command. When the last data line is processed the END statement is invoked and control passes out of the MODIFY.
As Jack says, when the data is outside the MODIFY there are number of approaches - and the one he suggests here (with parameters after the FEX name) is news to me, even though I've been writing MODIFYs for 30 years ...
-* first.fex
EX SECOND 'aaa','bbb','ccc'
EX SECOND 'ddd','eee','fff'
EX SECOND 'ggg','hhh','iii'
-* second.fex
MODIFY FILE TABLE_NAME
FREEFORM FLD1 FLD2 FLD3
MATCH FLD1
ON MATCH REJECT
ON NOMATCH INCLUDE
DATA
FLD1='&1', FLD2='&2', FLD3='&3', $
END
Not that I recommend it -- why force parsing of the MODIFY three times? -- but it answers the original question: How to avoid coding three identical MODIFY procedures.
- Jack Gross WF through 8.1.05
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005