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.
DATE (1001).............: STATE (AZ, CA, LA).....: CAR (123, 456, 789)......: INV (C10013801A)..........:
And the existing code is as below. [ code ]
MATCH ACDTE ON MATCH CONTINUE ON NOMATCH TYPE "THIS DATE IS NOT ON THE D/B." MATCH CAR ON MATCH CONTINUE ON NOMATCH TYPE "THIS CAR IS NOT ON THE D/B FOR MATCH STATE ON MATCH CONTINUE ON NOMATCH TYPE "THIS ST IS NOT in D/B FOR MATCH INV ON NOMATCH TYPE " ON MATCH ACTIVATE PDATE ON MATCH COMPUTE PDATE = 'CANCEL'; ON MATCH UPDATE PDATE ON MATCH TYPE "THE PAYMENT DATE HAS BEEN CANCELLED FOR DATA VIA FIDEL END -RUN -EXIT
[ code ]
Now I need to add a value in the STATE field "ALL" ie
DATE [1001)............................: STATE [AZ, CA, LA, ALL)................: CARRIER [123, 456, 789)................: INVOICE NUMBER [C10013801A)............:
and Make a match on the THREE remaining values [previously 4 Values: DATE, STATE, CARRIER, and RAP INVOICE.) provided by the end user: DATE, CARRIER, and RAP INVOICE. When an exact match is found, modify the following field: PAY_DATE change value to ‘CANCEL’
When selection for STATE equal ALL, change PAY_DATE to equal ‘CANCEL” for all records that match on DATE, CARRIER and RAP_INVOICE values provided on the input screen.
please guide how to accomplish this task.
Thanks in advance...
Best Regards, Poryes
Focus Mainframe 7.6.5This message has been edited. Last edited by: Kerry,
Please place your code examples between [ code ] and [ /code ] markers.
You cannot skip a key with MATCH logic, so you will need to use NEXT and CASE logic. Something like the sample code below is a start - I can't test this code, so I doubt it is execution-ready. As an alternative to using NEXT logic, it might be easier to TABLE the data using the user input, HOLD the results, and use the HOLD file as input to the MODIFY. This approach would allow you to use straight MATCH logic. Also, if your STATE field does not have a length of at least three, you won't be able to use 'ALL' as an input. The ACTIVATE command is not necessary because the COMPUTE automatically activates the field.
MODIFY FILE <filename>
MATCH ACDTE
ON MATCH CONTINUE
ON NOMATCH TYPE
"THIS DATE IS NOT ON THE D/B."
ON NOMATCH REJECT
MATCH CAR
ON MATCH IF STATE EQ 'ALL' GOTO STATE_LOOP ;
ON MATCH CONTINUE
ON NOMATCH TYPE
"THIS CAR IS NOT ON THE D/B FOR <ACTDTE "
ON NOMATCH REJECT
MATCH STATE
ON MATCH CONTINUE
ON NOMATCH TYPE
"THIS ST IS NOT in D/B FOR <CAR FOR <ACTDTE "
ON NOMATCH REJECT
MATCH INV
-* ON MATCH ACTIVATE PDATE
ON MATCH COMPUTE PDATE = 'CANCEL';
ON MATCH UPDATE PDATE
ON MATCH TYPE
"THE PAYMENT DATE HAS BEEN CANCELLED FOR <CAR FOR <INVNO "
ON NOMATCH TYPE
"<INV IS AN INCRCT INV FOR <CAR <STATE "
ON NOMATCH REJECT
ON MATCH/NOMATCH GOTO TOP
CASE STATE_LOOP
NEXT STATE
ON NEXT GOTO INV_LOOP
ON NONEXT GOTO TOP
ENDCASE
CASE INV_LOOP
NEXT INV
ON NEXT IF D.INV NE INV GOTO INV_LOOP ;
ON NEXT COMPUTE PDATE = 'CANCEL';
ON NEXT UPDATE PDATE
ON NEXT TYPE
"THE PAYMENT DATE HAS BEEN CANCELLED FOR <CAR FOR <INVNO "
ON NEXT ACTIVATE ACDTE CAR STATE INV
ON NEXT/NONEXT GOTO STATE_LOOP
ENDCASE
DATA VIA FIDEL
END
This message has been edited. Last edited by: Dan Satchell,
WebFOCUS 7.7.05
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007
Mixing MATCH and NEXT logic can be tricky, and after my earlier posting, it occurred to me that the database pointer could get lost for the MATCHed fields during the looping NEXT updates. Hopefully, this new logic will eliminate that problem. Essentially, this code captures user input for STATE in CASE AT START, a special case that runs only once at the beginning of the MODIFY process; if the user enters 'ALL' for STATE, the logic should loop through the states for the ACDTE and CAR entered by the user, MATCH each ACDTE/CAR/STATE/INV combination in turn, and update PDATE; if the user enters a specific STATE, the logic should MATCH ACDTE/CAR/STATE/INV and update PDATE for that single record. Again, this code has not been tested, so very likely requires some additional work.
MODIFY FILE <filename>
GOTO INV_UPDATE
CASE INV_UPDATE
MATCH ACDTE
ON MATCH CONTINUE
ON NOMATCH TYPE
"THIS DATE IS NOT ON THE D/B."
ON NOMATCH GOTO TOP
MATCH CAR
ON MATCH IF STATE EQ 'ALL' GOTO STATE_NEXT ;
ON MATCH CONTINUE
ON NOMATCH TYPE
"THIS CAR IS NOT ON THE D/B FOR <ACTDTE "
ON NOMATCH GOTO TOP
MATCH STATE
ON MATCH CONTINUE
ON NOMATCH TYPE
"THIS ST IS NOT IN D/B FOR <CAR FOR <ACTDTE "
ON NOMATCH GOTO TOP
MATCH INV
ON MATCH COMPUTE PDATE = 'CANCEL';
ON MATCH UPDATE PDATE
ON MATCH TYPE
"THE PAYMENT DATE HAS BEEN CANCELLED FOR <CAR FOR <INV "
ON NOMATCH TYPE
"<INV IS AN INCORRECT INV FOR <CAR <STATE "
ON MATCH/NOMATCH IF STATE_INPUT EQ 'ALL' GOTO REMATCH_KEYS ;
ON MATCH/NOMATCH GOTO TOP
ENDCASE
CASE STATE_NEXT
NEXT STATE
ON NEXT COMPUTE STATE = D.STATE ;
ON NEXT GOTO INV_UPDATE
ON NONEXT GOTO TOP
ENDCASE
CASE REMATCH_KEYS
ACTIVATE RETAIN ACDTE CAR STATE
MATCH ACDTE CAR STATE
ON MATCH GOTO STATE_NEXT
ON NOMATCH TYPE
"ERROR: THIS SHOULD NEVER HAPPEN"
ON NOMATCH GOTO EXIT
ENDCASE
CASE AT START
COMPUTE STATE_INPUT/A3 = STATE ;
ENDCASE
DATA VIA FIDEL
END
WebFOCUS 7.7.05
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007
Yeah previously the code was working, ie.., It will update only the first record PDATE value to 'CANCEL' but not all the records. Requirement is to update all the 5 Matching records PDATE value to 'CANCEL'
The code I suggested is designed to update only one record for each set of key values for ACDTE, CAR, STATE, and INV. Are there multiple records in your data with the same key values?
WebFOCUS 7.7.05
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007
Yes Dan, We have multiple records with same key values for ACTDTE,CAR,INV.
So all the matching values for ACTDTE, CAR, INV and all the combination of STATE values will be retreived and update the PDATE value to CANCEL.
Eg:
TABLE FILE PRINT * WHERE DATE EQ 1004 WHERE CAR EQ '123' WHERE INV EQ 'D20012345' END
It retrieved 5 records with the same values (ACTDTE,CAR,INV) except for STATE.
DATE CAR STATE INV PDATE PDATE 1004 123 AZ D20012345 100402 1004 123 NY D20012345 100402 1004 123 GA D20012345 100402 1004 123 AL D20012345 100402 1004 123 NC D20012345 100402
My i/p screen and values I supplied,
DATE [1001)............................: 1004 STATE [AZ, CA, LA, ALL)................: ALL CARRIER [123, 456, 789)................: 123 INVOICE NUMBER [C10013801A)............: D20012345
It has to change the values for PDATE to CANCEL for all the 5 records. ie If STATE = ALL then all the matchig records should be retrieved and changed PDATE to CANCEL.
MODIFY FILE <filename>
COMPUTE STATE_INPUT/A3=;
IF STATE EQ 'ALL' GOTO STATE_ALL ;
GOTO INV_UPDATE
CASE STATE_ALL
COMPUTE STATE_INPUT/A3 = 'ALL';
GOTO INV_UPDATE
ENDCASE
CASE INV_UPDATE
MATCH ACDTE
ON MATCH CONTINUE
ON NOMATCH TYPE
"THIS DATE IS NOT ON THE D/B."
ON NOMATCH GOTO TOP
MATCH CAR
ON MATCH IF STATE EQ 'ALL' GOTO STATE_NEXT ;
ON MATCH CONTINUE
ON NOMATCH TYPE
"THIS CAR IS NOT ON THE D/B FOR <ACTDTE "
ON NOMATCH GOTO TOP
MATCH STATE
ON MATCH CONTINUE
ON NOMATCH TYPE
"THIS ST IS NOT IN D/B FOR <CAR FOR <ACTDTE "
ON NOMATCH GOTO TOP
MATCH INV
ON MATCH COMPUTE PDATE = 'CANCEL';
ON MATCH UPDATE PDATE
ON MATCH TYPE
"THE PAYMENT DATE HAS BEEN CANCELLED FOR <CAR FOR <INV "
ON NOMATCH TYPE
"<INV IS AN INCORRECT INV FOR <CAR <STATE "
ON MATCH/NOMATCH IF STATE_INPUT EQ 'ALL' GOTO REMATCH_KEYS ;
ON MATCH/NOMATCH GOTO TOP
ENDCASE
CASE STATE_NEXT
NEXT STATE
ON NEXT COMPUTE STATE = D.STATE ;
ON NEXT GOTO INV_UPDATE
ON NONEXT GOTO TOP
ENDCASE
CASE REMATCH_KEYS
ACTIVATE RETAIN ACDTE CAR STATE
MATCH ACDTE CAR STATE
ON MATCH GOTO STATE_NEXT
ON NOMATCH TYPE
"ERROR: THIS SHOULD NEVER HAPPEN"
ON NOMATCH GOTO EXIT
ENDCASE
DATA VIA FIDEL
END
WebFOCUS 7.7.05
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007
DATE CAR STATE INV PDATE PDATE 1004 123 AZ D20012345 100402 1004 123 NY D20012345 100402 1004 123 GA D20012345 100402 1004 123 AL D20012345 100402 1004 123 NC D20012345 100402
I have given the i/p which satiesfies with the above five records. Once I filled the i/p screen and ENTER, below are the messages......
D20012345 IS AN INCORRECT INVOICE FOR 123. FOR D20012345 . THE PAYMENT DATE HAS BEEN CANCELLED FOR 123 FOR D20012345 . D20012345 IS AN INCORRECT INVOICE FOR 123. FOR D20012345 . THE PAYMENT DATE HAS BEEN CANCELLED FOR 123 FOR D20012345 .
Not sure why I'm getting the above messages and also there are 5 records which satiesfies the above input records but it was giving ACCEPTED = 4 UPDATED = 28
You need to expand your messages so they include all of the relevant information. This should give you a better understanding of which transactions are updating and which are failing. For example:
ON MATCH TYPE
"THE PAYMENT DATE HAS BEEN CANCELLED FOR ACDTE:<ACDTE CAR:<CAR STATE:<STATE INV:<INV "
ON NOMATCH TYPE
"<INV IS AN INCORRECT INV FOR ACDTE:<ACDTE CAR:<CAR STATE:<STATE "
You can also use the MODIFY ECHO and TRACE facilities to help debug your code. The TRACE facility, in particular, should be helpful in following the logic flow of the MODIFY code for a transaction. This link provides further info about these facilities:
The UPDATED=28 result indicates that 28 PDATE values were updated. Therefore you should have 28 messages indicating which records were updated. It is very surprising that your post only shows 2 update messages. Were there more? In addition, it is impossible to assess these results without seeing both the master description for the file you are updating and the MODIFY code. Please post the master description and your MODIFY code.
Finally, as I said earlier, mixing MATCH and NEXT logic can be very tricky. Is it possible you could avoid this issue with a different approach? For example, can you use -PROMPT or -CRTFORM with TABLE and MODIFY to accomplish your task?
-SET &MSG = ' ';
-*
-:TOP
-CRTFORM BEGIN
-"DATE (1001).................: <&DATE/4"
-"STATE (AZ, CA, LA, or ALL)..: <&STATE/3"
-"CAR (123, 456, 789).........: <&CAR/3"
-"INV (C10013801A)............: <&INV/10"
-" "
-"<D.&MSG "
-CRTFORM END
-*
-SET &STATEX = IF &STATE EQ 'ALL' THEN '$*' ELSE &STATE ;
-*
TABLE FILE filename
PRINT ACDTE CAR STATE INV
WHERE ACDTE EQ '&DATE'
WHERE CAR EQ '&CAR'
WHERE STATE EQ '&STATEX'
WHERE INV EQ '&INV'
ON TABLE HOLD
END
-*
-RUN
-IF &LINES GT 0 GOTO :UPDATE ;
-SET &MSG = 'No records match your input.';
-GOTO :TOP
-*
-:UPDATE
MODIFY FILE filename
FIXFORM FROM HOLD
MATCH ACDTE CAR STATE INV
ON MATCH COMPUTE PDATE = 'CANCEL';
ON MATCH UPDATE PDATE
ON MATCH TYPE
"THE PAYMENT DATE HAS BEEN CANCELLED FOR ACDTE:<ACDTE CAR:<CAR STATE:<STATE INV:<INV "
ON NOMATCH TYPE
"<INV IS AN INCORRECT INV FOR ACDTE:<ACDTE CAR:<CAR STATE:<STATE "
ON NOMATCH REJECT
DATA ON HOLD
END
This message has been edited. Last edited by: Dan Satchell,
WebFOCUS 7.7.05
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007
MODIFY FILE (filename) COMPUTE STATE_INPUT/A3=; IF STATE EQ 'ALL' GOTO STATE_ALL ; GOTO INV_UPDATE
CASE STATE_ALL COMPUTE STATE_INPUT/A3 = 'ALL'; GOTO INV_UPDATE ENDCASE
CASE INV_UPDATE MATCH ACDTE ON MATCH CONTINUE ON NOMATCH TYPE "THIS DATE IS NOT ON THE D/B." ON NOMATCH GOTO TOP
MATCH CAR ON MATCH IF STATE EQ 'ALL' GOTO STATE_NEXT ; ON MATCH CONTINUE ON NOMATCH TYPE "THIS CAR IS NOT ON THE D/B FOR <ACTDTE " ON NOMATCH GOTO TOP
MATCH STATE ON MATCH CONTINUE ON NOMATCH GOTO TOP
MATCH INV ON MATCH COMPUTE PDATE = 'CANCEL'; ON MATCH UPDATE PDATE ON MATCH TYPE "THE PAYMENT DATE HAS BEEN CANCELLED FOR <CAR FOR <INV " ON NOMATCH TYPE "<INV IS AN INCORRECT INV FOR <CAR <STATE " ON MATCH/NOMATCH IF STATE_INPUT EQ 'ALL' GOTO REMATCH_KEYS ; ON MATCH/NOMATCH GOTO TOP ENDCASE
CASE STATE_NEXT NEXT STATE ON NEXT COMPUTE STATE = D.STATE ; ON NEXT GOTO INV_UPDATE ON NONEXT GOTO TOP ENDCASE
CASE REMATCH_KEYS ACTIVATE RETAIN ACDTE CAR STATE MATCH ACDTE CAR STATE ON MATCH GOTO STATE_NEXT ON NOMATCH TYPE "ERROR: THIS SHOULD NEVER HAPPEN" ON NOMATCH GOTO EXIT ENDCASE
DATA VIA FIDEL END
Please have a look and thanks in advance.....This message has been edited. Last edited by: Poryes,