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.
Hi everyone, as I said in a previous post I made i'm really new to Focus, learning it on-th-fly for a project here, and I'm having a problem that no matter how much I look and Work around I can't find a solution. I'll try to briefly explain the problem here, and then I'll copy the code to see if any of you can help me out with this. This is FOCUS 7.6.2 on OS/390 The problem is I have a file, and I need to update (or just bypass) a few records on it depending on user action, those records come up in a CRTFORM, and in sequence. When there are no more records in the file to be displayed, I just update the records. The problem I'm having here is that even when some records are displayed on the CRTFORM (making me certain that the record is there), it later rejects the transaction stating there was no match on the segment. This is the first problem, the biggest issue is that if I enter the screen again, and re-try the update action, everything goes fine, even for the records that were rejected in the first Run. I'm honestly out of ideas of what could be happening here, if anyone can bring any light to my thoughts it would be really appreciated. Below is the code:
-SET &&TEMPID=' ';
-TSO RUN GETUSER,&&TEMPID
-SET &&LOGID = EDIT(&&TEMPID, '9999999');
TABLE FILE SECFLLOG
PRINT *
IF SEC_OPERID NE '&&LOGID'
IF VER_STATUS EQ ' '
ON TABLE SET EXTRACT ON
ON TABLE HOLD AS APPRFILE FORMAT FOCUS
END
-RUN
-IF &RECORDS EQ 0 GOTO NOTHING ELSE GOTO LOOPR;
-***
-NOTHING
-***
-SET &ACTION = 'X';
-CRTFORM LINE 1
-"*********************************************************************"
-"* <69 *"
-"* THERE ARE NO PENDING REQUESTS THAT YOUR USERID CAN APPROVE <69 *"
-"* PRESS ENTER TO GO BACK <T.&ACTION> <69 *"
-"* <69 *"
-"*********************************************************************"
IF &ACTION IS 'X' GOTO EXITIT;
-***
-LOOPR
MODIFY FILE APPRFILE
NEXT USERID
ON NONEXT GOTO NORECS
ON NEXT COMPUTE
VER_OPERID = '&&LOGID';
VER_MAINT_DT = TODAY(VER_MAINT_DT)
VER_TIME = HHMMSS(VER_TIME);
ON NEXT CRTFORM LINE 1
"*********************************************************************"
"* APPROVE OR REJECT OUTSTANDING REQUESTS <69 *"
"*-------------------------------------------------------------------*"
"* ENTER ACTION (A/R/B/X): <T.VER_STATUS> <69 *"
"*-------------------------------------------------------------------*"
"* REQUEST DATA <69 *"
"* USERID : <D.USERID REQ_SYSTEM : <D.REQ_SYSTEM <69 *"
"* REQ_TYPE : <D.REQ_TYPE REQ_STATUS : <D.REQ_STATUS <69 *"
"* NAME BEFORE : <D.FIRST_NAM_BF/50 <69 *"
"* SURNAME BF : <D.LAST_NAME_BF/50 <69 *"
"* NAME AFTER : <D.FIRST_NAM_AF/50 <69 *"
"* SURNAME AF : <D.LAST_NAME_AF/50 <69 *"
"* AUTH. BEFORE: <D.LEVEL_BFOR AUTH. AFTER : <D.LEVEL_AFTR <69 *"
"*-------------------------------------------------------------------*"
"* REQUEST | VALIDATION <69 *"
"* SEC_OPERID : <D.SEC_OPERID | VER_OPERID : <D.VER_OPERID <69 *"
"* SEC_MAINT_DT : <D.SEC_MAINT_DT | VER_MAINT_DT : <D.VER_MAINT_DT <69 *"
"* SEC_TIME : <D.SEC_TIME | VER_TIME : <D.VER_TIME <69 *"
"*********************************************************************"
" "
" "
" "
IF VER_STATUS IS 'B' GOTO TOP;
IF VER_STATUS IS 'X' GOTO EXIT;
-***
-* This last part with the updates are already quite bad to understand, the second ON MATCH was added because
-* in prior runs i was always losing the update on the last record.
-***
ON MATCH UPDATE VER_OPERID VER_MAINT_DT VER_TIME VER_STATUS
ON NEXT UPDATE VER_OPERID VER_MAINT_DT VER_TIME VER_STATUS
ON NEXT GOTO TOP
ON MATCH UPDATE VER_OPERID VER_MAINT_DT VER_TIME VER_STATUS
ON NONEXT GOTO NORECS
-***
CASE NORECS
COMPUTE
ACTION/A1 = 'X';
CRTFORM
"**********************************************************************"
"* <69 *"
"* THERE ARE NO PENDING REQUESTS THAT YOUR USERID CAN APPROVE <69 *"
"* PRESS ENTER TO GO BACK <69 *"
"* <69 *"
"**********************************************************************"
IF ACTION IS 'X' GOTO EXIT;
ENDCASE
-***
DATA VIA FIDEL
LOG INVALID MSG OFF
END
-***
-EXITIT
-RUN
-EXIT
This message has been edited. Last edited by: andrekilik,
FOCUS 7.6 Mainframe, Outputs available
Posts: 15 | Location: Brasil | Registered: May 21, 2014
TABLE FILE SECFLLOG
PRINT *
IF SEC_OPERID NE '&&LOGID'
IF VER_STATUS EQ ' '
ON TABLE SET EXTRACT ON
ON TABLE HOLD AS APPRFILE FORMAT FOCUS
END
When you use PRINT * and then HOLD FORMAT FOCUS, your key field is going to be FOCLIST. Are you sure you sure you want to extract all records where the SEC_OPID is NOT EQUAL to the user-id?
Then 2: your NEXT command should be
MODIFY FILE APPRFILE
NEXT FOCLIST
Then 3: you are missing a semi colon
ON NEXT COMPUTE
VER_OPERID = '&&LOGID';
VER_MAINT_DT = TODAY(VER_MAINT_DT); <- here
VER_TIME = HHMMSS(VER_TIME);
You don't differentiate between A(pprove) and R(eject)
Following your ON NEXT CRTFORM, you have ON MATCH commands which do no got with NEXT processing. Delete them!
ON MATCH UPDATE VER_OPERID VER_MAINT_DT VER_TIME VER_STATUS
ON NEXT UPDATE VER_OPERID VER_MAINT_DT VER_TIME VER_STATUS
ON NEXT GOTO TOP
ON MATCH UPDATE VER_OPERID VER_MAINT_DT VER_TIME VER_STATUS
ON NONEXT GOTO NORECS
Start from all this, and see where it gets you...
Daniel In Focus since 1982 wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006
Originally posted by Danny-SRL: Andre, You do have many problems. 1.
TABLE FILE SECFLLOG
PRINT *
IF SEC_OPERID NE '&&LOGID'
IF VER_STATUS EQ ' '
ON TABLE SET EXTRACT ON
ON TABLE HOLD AS APPRFILE FORMAT FOCUS
END
When you use PRINT * and then HOLD FORMAT FOCUS, your key field is going to be FOCLIST. Are you sure you sure you want to extract all records where the SEC_OPID is NOT EQUAL to the user-id?
Yes I do, if I didn't that wouldn't be my condition would it? I need to show all the records that were input by other users, and that have a ver_status in blank (in system meaning, all pending requests opened by other users, i can't see my own opened records). I was using * because I need all the fields in the file, as in the CRTFORM shown subsequently, that are all the file fields. Following your sugestion, I changed it to a list of all the fields naming each one. The problem kept being the same.
quote:
You don't differentiate between A(pprove) and R(eject)
Because I don't need to, I just want to jump over to the next record if the action entered was B, and get out if it was X, if it is either A or R, it should just update the record with the corresponding value. There's another focexec that takes care of reading this updated info to take action later in the process.
quote:
Following your ON NEXT CRTFORM, you have ON MATCH commands which do no got with NEXT processing. Delete them!
I think I had pointed clearly in the comment that I had left this on match because without it, the last record was never updated, if you understand why then explain me, and how it should be...
But spite all of that, using your recommendations, I was able to find out that basically my problem was the APPRFILE that I was using. It was really losing it's key fields even when I had inputed all the fields (I later use a match to input the records from apprfile updated back to secfllog)
So I started looking at all the process, and thought of a solution that is working almost perfectly, now it updates perfectly, but it shows all records on file, and I need to filter records using that condition on the first table file I have shown earlier. Here is the code that I'm using now, I tried skipping records that matched my condition using VALIDATE, but to no avail. Is there a way to filter the records properly? MY ONLY PROBLEM NOW IS THE FILTERING OF THE RECORDS Some of your previous pointed errors, might still be here, because it was the only I found to make the last record be updated..
-TSO RUN GETUSER,&&TEMPID
-SET &&LOGID = EDIT(&&TEMPID, '9999999');
TABLE FILE SECFLLOG
PRINT REQ_SYSTEM
USERID AND HOLD
IF SEC_OPERID NE '&&LOGID'
IF VER_STATUS EQ ' '
END
-RUN
-IF &RECORDS EQ 0 GOTO NOTHING ELSE GOTO LOOPR;
-***
-NOTHING
-***
-SET &ERRMSG = ' ';
-SET &ACTION = 'X';
-CRTFORM LINE 1
-"*********************************************************************"
-"* <69 *"
-"* THERE ARE NO PENDING REQUESTS THAT YOUR USERID CAN APPROVE <69 *"
-"* PRESS ENTER TO GO BACK <T.&ACTION> <69 *"
-"* <69 *"
-"*********************************************************************"
-" "
-" "
-"<.HD.&ERRMSG"
-***
-IF &ACTION IS 'X' GOTO EXITIT;
-LOOPR
-*MODIFY FILE APPRFILE
MODIFY FILE SECFLLOG
NEXT REQ_SYSTEM USERID
-****
-* the below validates are what I'm trying to use right now to skip the records
-* that should not be shown in screen, but didn't work.
-* actually this is what i need, HOW TO FILTER THE RECORDS SHOWN.
-****
VALIDATE
OPETEST = SEC_OPERID NE '&&LOGID';
ON INVALID GOTO JUMPREC
VALIDATE
VERTEST = VER_STATUS EQ ' ';
ON INVALID GOTO JUMPREC
ON NONEXT GOTO NORECS
ON NEXT COMPUTE
VER_OPERID = '&&LOGID';
VER_MAINT_DT = TODAY(VER_MAINT_DT);
VER_TIME = HHMMSS(VER_TIME);
ON NEXT CRTFORM LINE 1
"*********************************************************************"
"* APPROVE OR REJECT OUTSTANDING REQUESTS <69 *"
"*-------------------------------------------------------------------*"
"* ENTER ACTION (A/R/B/X): <T.VER_STATUS> <69 *"
"*-------------------------------------------------------------------*"
"* REQUEST DATA <69 *"
"* USERID : <D.USERID REQ_SYSTEM : <D.REQ_SYSTEM <69 *"
"* REQ_TYPE : <D.REQ_TYPE REQ_STATUS : <D.REQ_STATUS <69 *"
"* NAME BEFORE : <D.FIRST_NAM_BF/50 <69 *"
"* SURNAME BF : <D.LAST_NAME_BF/50 <69 *"
"* NAME AFTER : <D.FIRST_NAM_AF/50 <69 *"
"* SURNAME AF : <D.LAST_NAME_AF/50 <69 *"
"* AUTH. BEFORE: <D.LEVEL_BFOR AUTH. AFTER : <D.LEVEL_AFTR <69 *"
"*-------------------------------------------------------------------*"
"* REQUEST | VALIDATION <69 *"
"* SEC_OPERID : <D.SEC_OPERID | VER_OPERID : <D.VER_OPERID <69 *"
"* SEC_MAINT_DT : <D.SEC_MAINT_DT | VER_MAINT_DT : <D.VER_MAINT_DT <69 *"
"* SEC_TIME : <D.SEC_TIME | VER_TIME : <D.VER_TIME <69 *"
"*********************************************************************"
" "
" "
" "
IF VER_STATUS IS 'B' GOTO TOP;
IF VER_STATUS IS 'X' GOTO EXIT;
-***
ON MATCH UPDATE VER_OPERID VER_MAINT_DT VER_TIME VER_STATUS
ON NEXT UPDATE VER_OPERID VER_MAINT_DT VER_TIME VER_STATUS
ON NEXT GOTO TOP
ON MATCH UPDATE VER_OPERID VER_MAINT_DT VER_TIME VER_STATUS
ON NONEXT GOTO NORECS
-***
CASE NORECS
COMPUTE
ACTION/A1 = 'X';
CRTFORM
"**********************************************************************"
"* <69 *"
"* THERE ARE NO PENDING REQUESTS THAT YOUR USERID CAN APPROVE <69 *"
"* PRESS ENTER TO GO BACK <69 *"
"* <69 *"
"**********************************************************************"
IF ACTION IS 'X' GOTO EXIT;
ENDCASE
CASE JUMPREC
NEXT REQ_SYSTEM USERID
GOTO TOP
ENDCASE
-***
DATA VIA FIDEL
LOG INVALID MSG OFF
END
TABLE FILE SECFLLOG
PRINT USERID AND HOLD AS USERFILE
IF VER_OPERID EQ '&&LOGID'
IF VER_STATUS EQ 'A'
IF VER_MAINT_DT EQ '&PROCDATE'
END
-RUN
-IF &RECORDS EQ 0 GOTO EXITIT;
-READLOOP
-READ USERFILE NOCLOSE &USERID.A7.
TSO EX 'EPO.ENP1.PCS.CLIST(SUBCLIST)' '&USERID'
-PROMPT &TESTE
-IF &IORETURN NE 0 GOTO EXITIT;
-GOTO READLOOP;
-***
-EXITIT
-RUN
-EXIT
FOCUS 7.6 Mainframe, Outputs available
Posts: 15 | Location: Brasil | Registered: May 21, 2014
When using MODIFY, there are some basics that should be adhered to, the main one is the order of statements, and how MODIFY interprets these.
The first block of code is an implied CASE TOP with an implied ENDCASE.
In its basic form, When a NEXT is issued, ALL following statements until an ENDCASE is encountered are based on the ON NEXT or ON NONEXT conditions. This means that using and IF or VALIDATE without one of these conditions causes these commands to be processed out of sequence.
As Danny said, an ON MATCH has no place within NEXT processing. Whatever the issues that exist this is incorrect syntax.
Rather than changing the base logic, which was fine, simplify to what it should be:
MODIFY FILE APPRFILE
-* implied CASE TOP
NEXT USERID
ON NONEXT GOTO NORECS
ON NEXT COMPUTE
VER_OPERID = '&&LOGID';
VER_MAINT_DT = TODAY(VER_MAINT_DT);
VER_TIME = HHMMSS(VER_TIME);
ON NEXT CRTFORM LINE 1
"*********************************************************************"
"* APPROVE OR REJECT OUTSTANDING REQUESTS <69 *"
"*-------------------------------------------------------------------*"
"* ENTER ACTION (A/R/B/X): <T.VER_STATUS> <69 *"
"*-------------------------------------------------------------------*"
"* REQUEST DATA <69 *"
"* USERID : <D.USERID REQ_SYSTEM : <D.REQ_SYSTEM <69 *"
"* REQ_TYPE : <D.REQ_TYPE REQ_STATUS : <D.REQ_STATUS <69 *"
"* NAME BEFORE : <D.FIRST_NAM_BF/50 <69 *"
"* SURNAME BF : <D.LAST_NAME_BF/50 <69 *"
"* NAME AFTER : <D.FIRST_NAM_AF/50 <69 *"
"* SURNAME AF : <D.LAST_NAME_AF/50 <69 *"
"* AUTH. BEFORE: <D.LEVEL_BFOR AUTH. AFTER : <D.LEVEL_AFTR <69 *"
"*-------------------------------------------------------------------*"
"* REQUEST | VALIDATION <69 *"
"* SEC_OPERID : <D.SEC_OPERID | VER_OPERID : <D.VER_OPERID <69 *"
"* SEC_MAINT_DT : <D.SEC_MAINT_DT | VER_MAINT_DT : <D.VER_MAINT_DT <69 *"
"* SEC_TIME : <D.SEC_TIME | VER_TIME : <D.VER_TIME <69 *"
"*********************************************************************"
" "
" "
" "
ON NEXT IF VER_STATUS IS 'B' GOTO TOP;
ON NEXT IF VER_STATUS IS 'X' GOTO EXIT;
-***
ON NEXT UPDATE VER_OPERID VER_MAINT_DT VER_TIME VER_STATUS
ON NEXT GOTO TOP
-***
-* implied ENDCASE
CASE NORECS
COMPUTE
ACTION/A1 = 'X';
CRTFORM
"**********************************************************************"
"* <69 *"
"* THERE ARE NO PENDING REQUESTS THAT YOUR USERID CAN APPROVE <69 *"
"* PRESS ENTER TO GO BACK <69 *"
"* <69 *"
"**********************************************************************"
IF ACTION IS 'X' GOTO EXIT;
ENDCASE
-***
DATA VIA FIDEL
LOG INVALID MSG OFF
END
This code should work as you expect. With the correct syntax any issues that appear can be investigated. If the syntax is wrong it is problematic to cure issues.
Alan. WF 7.705/8.007
Posts: 1451 | Location: Portugal | Registered: February 07, 2007
Oh thanks for that, but that still doesn't answer my question main question. How do I filter the records for the modify? Using the first example of extracting a file, some records are always rejected, using the second example I can't filter any records... And that's what I really need...
FOCUS 7.6 Mainframe, Outputs available
Posts: 15 | Location: Brasil | Registered: May 21, 2014
This is how my code looks now, and even when it show me the records in the screen, it rejects then when trying to merge with the original data file: The thing is, I need to modify only the records that have this filtering option, when I try merging the files, some records give me a nomatch, and are rejected... Is there a way I can use modify directly into SECFLLOG applying that filter to show only the records I want on the CRTFORM? IF not, what am I doing wrong in this merging of the datafiles?
-SET &&TEMPID=' ';
-TSO RUN GETUSER,&&TEMPID
-SET &&LOGID = EDIT(&&TEMPID, '9999999');
TABLE FILE SECFLLOG
PRINT REQ_SYSTEM
USERID
FIRST_NAM_BF
FIRST_NAM_AF
LAST_NAME_BF
LAST_NAME_AF
REQ_TYPE
REQ_STATUS
SEC_OPERID
SEC_MAINT_DT
SEC_TIME
VER_OPERID
VER_MAINT_DT
VER_TIME
VER_STATUS
LEVEL_BFOR
LEVEL_AFTR
IF SEC_OPERID NE '&&LOGID'
IF VER_STATUS EQ ' '
BY REQ_SYSTEM BY USERID
ON TABLE SET EXTRACT ON
ON TABLE HOLD AS APPRFILE FORMAT FOCUS INDEX REQ_SYSTEM USERID
END
-RUN
-IF &RECORDS EQ 0 GOTO NOTHING ELSE GOTO LOOPR;
-***
-NOTHING
-***
-SET &ERRMSG = ' ';
-SET &ACTION = 'X';
-CRTFORM LINE 1
-"*********************************************************************"
-"* <69 *"
-"* THERE ARE NO PENDING REQUESTS THAT YOUR USERID CAN APPROVE <69 *"
-"* PRESS ENTER TO GO BACK <T.&ACTION> <69 *"
-"* <69 *"
-"*********************************************************************"
-" "
-" "
-"<.HD.&ERRMSG"
-***
IF &ACTION IS 'X' GOTO EXITIT;
-LOOPR
MODIFY FILE APPRFILE
-*MODIFY FILE HOLD
NEXT REQ_SYSTEM USERID
ON NONEXT GOTO NORECS
ON NEXT COMPUTE
VER_OPERID = '&&LOGID';
VER_MAINT_DT = TODAY(VER_MAINT_DT);
VER_TIME = HHMMSS(VER_TIME);
ON NEXT CRTFORM LINE 1
"*********************************************************************"
"* APPROVE OR REJECT OUTSTANDING REQUESTS <69 *"
"*-------------------------------------------------------------------*"
"* ENTER ACTION (A/R/B/X): <T.VER_STATUS> <69 *"
"*-------------------------------------------------------------------*"
"* REQUEST DATA <69 *"
"* USERID : <D.USERID REQ_SYSTEM : <D.REQ_SYSTEM <69 *"
"* REQ_TYPE : <D.REQ_TYPE REQ_STATUS : <D.REQ_STATUS <69 *"
"* NAME BEFORE : <D.FIRST_NAM_BF/50 <69 *"
"* SURNAME BF : <D.LAST_NAME_BF/50 <69 *"
"* NAME AFTER : <D.FIRST_NAM_AF/50 <69 *"
"* SURNAME AF : <D.LAST_NAME_AF/50 <69 *"
"* AUTH. BEFORE: <D.LEVEL_BFOR AUTH. AFTER : <D.LEVEL_AFTR <69 *"
"*-------------------------------------------------------------------*"
"* REQUEST | VALIDATION <69 *"
"* SEC_OPERID : <D.SEC_OPERID | VER_OPERID : <D.VER_OPERID <69 *"
"* SEC_MAINT_DT : <D.SEC_MAINT_DT | VER_MAINT_DT : <D.VER_MAINT_DT <69 *"
"* SEC_TIME : <D.SEC_TIME | VER_TIME : <D.VER_TIME <69 *"
"*********************************************************************"
" "
" "
" "
IF VER_STATUS IS 'B' GOTO TOP;
IF VER_STATUS IS 'X' GOTO EXIT;
-***
ON NEXT UPDATE VER_OPERID VER_MAINT_DT VER_TIME VER_STATUS
ON NEXT GOTO TOP
-***
CASE NORECS
COMPUTE
ACTION/A1 = 'X';
CRTFORM
"**********************************************************************"
"* <69 *"
"* THERE ARE NO PENDING REQUESTS THAT YOUR USERID CAN APPROVE <69 *"
"* PRESS ENTER TO GO BACK <69 *"
"* <69 *"
"**********************************************************************"
IF ACTION IS 'X' GOTO EXIT;
ENDCASE
-***
DATA VIA FIDEL
LOG INVALID MSG OFF
END
-***
-UPDLOG
MATCH FILE APPRFILE
SUM REQ_SYSTEM
FIRST_NAM_BF
FIRST_NAM_AF
LAST_NAME_BF
LAST_NAME_AF
REQ_TYPE
REQ_STATUS
SEC_OPERID
SEC_MAINT_DT
SEC_TIME
VER_OPERID
VER_MAINT_DT
VER_TIME
VER_STATUS
LEVEL_BFOR
LEVEL_AFTR
BY REQ_SYSTEM BY USERID
RUN
FILE SECFLLOG
SUM REPORT_ST
BY REQ_SYSTEM BY USERID
AFTER MATCH HOLD OLD-AND-NEW
END
RUN
-***
MODIFY FILE SECFLLOG
COMPUTE
FIXFORM FROM HOLD
MATCH REQ_SYSTEM USERID
ON MATCH UPDATE VER_OPERID VER_MAINT_DT VER_TIME VER_STATUS
ON NOMATCH REJECT
DATA ON HOLD
END
-EXITIT
-RUN
-EXIT
FOCUS 7.6 Mainframe, Outputs available
Posts: 15 | Location: Brasil | Registered: May 21, 2014
IF VER_STATUS IS 'B' GOTO TOP; IF VER_STATUS IS 'X' GOTO EXIT;
-- those should be conditioned with ON NEXT. Modify rearranges the directives in the top (or only) case, and generally promotes all unconditional ones to the top, ahead of the MATCH (or NEXT). (Use the MODIFY ... ECHO facility to verify the structure that will actually be run.)
I would sooner drive the MODIFY with a transation file, using MATCH rather than NEXT. With NEXT, GOTO TOP may reset position so you never get past the first segment instance.
MATCH FILE APPRFILE SUM REQ_SYSTEM ... BY REQ_SYSTEM BY USERID RUN
-- It's not advisable to have two identically named columns, in the transation file fed to the final MODIFY.
-- If you only want to update rows marked Approved or Rejected by the user: add WHERE VER_STATUS IN ('A','R'); to the first part of the MATCH FILE.
-- since you make no further reference to REPORT_ST, why do you need a MATCH FILE step at all? By construction, all the rows in APPRFILE are matchable. A simple TABLE FILE APPRFILE ... ON TABLE HOLD should do.
-- If you still get unexpected NOMATCH in the MODIFY, investigate the content of the HOLD file.
- Jack Gross WF through 8.1.05
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005
-- If you only want to update rows marked Approved or Rejected by the user: add WHERE VER_STATUS IN ('A','R'); to the first part of the MATCH FILE.
-- since you make no further reference to REPORT_ST, why do you need a MATCH FILE step at all? By construction, all the rows in APPRFILE are matchable. A simple TABLE FILE APPRFILE ... ON TABLE HOLD should do.
As I stated I'm very new to focus, having to use it for a project here now. I'm using that MATCH FILE, because it's the only way I know to merge data from one source to another. My problem is: I have the file SECFLLOG, I need to show in a loop through a CRTFORM all records that have a ver_status equal ' ', and that have the sec_operid different from the current logged userid. I have tried two approaches for that: 1 - Directly using a MODIFY SECFLLOG: With this one, my records were all updated properly, but I couldn't filter the user or the status, it would simply loop through all the records, and that's not what is functionally needed.
2 - Since my first approach didn't work, I tried making it through a hold file, containing all records that would apply to my filtering. (THE APPRFILE shown earlier) The problem here is, even when I point out the fields I want as index, it looks like FOCUS creates the FOCLIST index mentioned here earlier, and this makes it loose itself when I try merging it back to SECFLLOG
quote:
If you still get unexpected NOMATCH in the MODIFY, investigate the content of the HOLD file.
That's exaclty the problem IT's inserting 8bytes before the first field (req_system), the start of the data for all records looks like this: :: : :SYSTEUSERID78
I believe that those at the beginning are what are causing my nomatchs. My last try right now, was to make a -read from the hold file, excluding those 8first bytes as a filler field... Also didn't work.. It gives me now FOC209.. saying that data exceeds lenght... I'm completely frustated here...
SO AGAIN, is there a way to filter the records directly through MODIFY? If not, is there a way to create a HOLD without this FOCLIST parameter, or if this is not caused by the FOCLIST, what is causing it? How can I make my data matchable?
FOCUS 7.6 Mainframe, Outputs available
Posts: 15 | Location: Brasil | Registered: May 21, 2014
FOCLIST occurs when you use PRINT, or in MATCH FILE if the sort keys on the two sides of the match are not identically named and formatted. Neither of those conditions apply in the code you posted.
Toss in
?FF HOLD -EXIT
before the finAl MODIFY, and post the output.
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005
this link is broken, tried searching about it on the FOCUS tech lib i have here (http://ecl.informationbuilders.com/focus/index.jsp?topic=%2Fshell_76%2Fsup%2Fsu_cms%2F02cmssu8.htm)
Seems like this will give me more trouble than anything else (i'm already overdue with this, and I don't even have authorization to do some of the things required to use this sinkmachine and HLIPRINT). I have 10 years of cobol experience, and this FOCUS thing is driving me mad... I came to this forum because I was completely hopeless, for me It's like FOCUS has WILL, and works based on his will not on the code.
Seriously guys, is there no way to filter records on a modify? If there's a way, please point me.
If there's no way, I really need to know why my data doesn't match... I just looked up the data on both files, and was capable to make an exact copy of my original SECFLLOG into APPRFILE. Still, it didn't load the data using a fixform. Below, follow the complete code and the original focmast, of what I'm trying to do. If you look closely, My last resort was trying to make a read from the hold file, with all the fields using the same format they have on the original FOCMAST, and STILL got an error... The second part of what i copied, Is an actual execution, not code. So the run values are in there, and at least I can't see anything wrong with the data, even because I'm moving it positionally...
-SET &&TEMPID=' ';
-TSO RUN GETUSER,&&TEMPID
-SET &&LOGID = EDIT(&&TEMPID, '9999999');
TABLE FILE SECFLLOG
PRINT REQ_SYSTEM
USERID
FIRST_NAM_BF
FIRST_NAM_AF
LAST_NAME_BF
LAST_NAME_AF
REQ_TYPE
REQ_STATUS
SEC_OPERID
SEC_MAINT_DT
SEC_TIME
VER_OPERID
VER_MAINT_DT
VER_TIME
VER_STATUS
LEVEL_BFOR
LEVEL_AFTR
IF SEC_OPERID NE '&&LOGID'
IF VER_STATUS EQ ' '
BY REQ_SYSTEM BY USERID
ON TABLE SET EXTRACT ON
ON TABLE HOLD AS APPRFILE FORMAT FOCUS INDEX REQ_SYSTEM USERID
END
-RUN
-IF &RECORDS EQ 0 GOTO NOTHING ELSE GOTO LOOPR;
-***
-NOTHING
-***
-SET &ERRMSG = ' ';
-SET &ACTION = 'X';
-CRTFORM LINE 1
-"*********************************************************************"
-"* <69 *"
-"* THERE ARE NO PENDING REQUESTS THAT YOUR USERID CAN APPROVE <69 *"
-"* PRESS ENTER TO GO BACK <T.&ACTION> <69 *"
-"* <69 *"
-"*********************************************************************"
-" "
-" "
-"<.HD.&ERRMSG"
-***
IF &ACTION IS 'X' GOTO EXITIT;
-LOOPR
MODIFY FILE APPRFILE
-*MODIFY FILE HOLD
NEXT REQ_SYSTEM USERID
ON NONEXT GOTO NORECS
ON NEXT COMPUTE
VER_OPERID = '&&LOGID';
VER_MAINT_DT = TODAY(VER_MAINT_DT);
VER_TIME = HHMMSS(VER_TIME);
ON NEXT CRTFORM LINE 1
"*********************************************************************"
"* APPROVE OR REJECT OUTSTANDING REQUESTS <69 *"
"*-------------------------------------------------------------------*"
"* ENTER ACTION (A/R/B/X): <T.VER_STATUS> <69 *"
"*-------------------------------------------------------------------*"
"* REQUEST DATA <69 *"
"* USERID : <D.USERID REQ_SYSTEM : <D.REQ_SYSTEM <69 *"
"* REQ_TYPE : <D.REQ_TYPE REQ_STATUS : <D.REQ_STATUS <69 *"
"* NAME BEFORE : <D.FIRST_NAM_BF/50 <69 *"
"* SURNAME BF : <D.LAST_NAME_BF/50 <69 *"
"* NAME AFTER : <D.FIRST_NAM_AF/50 <69 *"
"* SURNAME AF : <D.LAST_NAME_AF/50 <69 *"
"* AUTH. BEFORE: <D.LEVEL_BFOR AUTH. AFTER : <D.LEVEL_AFTR <69 *"
"*-------------------------------------------------------------------*"
"* REQUEST | VALIDATION <69 *"
"* SEC_OPERID : <D.SEC_OPERID | VER_OPERID : <D.VER_OPERID <69 *"
"* SEC_MAINT_DT : <D.SEC_MAINT_DT | VER_MAINT_DT : <D.VER_MAINT_DT <69 *"
"* SEC_TIME : <D.SEC_TIME | VER_TIME : <D.VER_TIME <69 *"
"*********************************************************************"
" "
" "
" "
IF VER_STATUS IS 'B' GOTO TOP;
IF VER_STATUS IS 'X' GOTO EXIT;
-***
ON NEXT UPDATE VER_OPERID VER_MAINT_DT VER_TIME VER_STATUS
ON NEXT GOTO TOP
-***
CASE NORECS
COMPUTE
ACTION/A1 = 'X';
CRTFORM
"**********************************************************************"
"* <69 *"
"* THERE ARE NO PENDING REQUESTS THAT YOUR USERID CAN APPROVE <69 *"
"* PRESS ENTER TO GO BACK <69 *"
"* <69 *"
"**********************************************************************"
IF ACTION IS 'X' GOTO EXIT;
ENDCASE
-***
DATA VIA FIDEL
LOG INVALID MSG OFF
END
-***
-UPDLOG
MATCH FILE APPRFILE
SUM REQ_SYSTEM
FIRST_NAM_BF
FIRST_NAM_AF
LAST_NAME_BF
LAST_NAME_AF
REQ_TYPE
REQ_STATUS
SEC_OPERID
SEC_MAINT_DT
SEC_TIME
VER_OPERID
VER_MAINT_DT
VER_TIME
VER_STATUS
LEVEL_BFOR
LEVEL_AFTR
BY REQ_SYSTEM BY USERID
RUN
FILE SECFLLOG
SUM REPORT_ST
BY REQ_SYSTEM BY USERID
AFTER MATCH HOLD OLD-AND-NEW
END
RUN
-***
MODIFY FILE SECFLLOG
COMPUTE
FIXFORM FROM HOLD
MATCH REQ_SYSTEM USERID
ON MATCH UPDATE VER_OPERID VER_MAINT_DT VER_TIME VER_STATUS
ON NOMATCH REJECT
DATA ON HOLD
END
TABLE FILE APPRFILE
PRINT REQ_SYSTEM
USERID
VER_OPERID
VER_MAINT_DT
VER_TIME
VER_STATUS AND HOLD AS USERFILE
IF VER_OPERID IS '&&LOGID'
IF VER_STATUS IS 'A'
END
-RUN
-IF &RECORDS EQ 0 GOTO EOJ;
-READLOOP
-READ USERFILE NOCLOSE &HSYS.A5. &HFIL.A3. &HUSER.A8.,
- &HOPER.A7. &HFIL.A1. &HDT.A8. &HTM.A8. &HSTAT.A1.
-TYPE &hsys &huser &hoper &hdt &htm &hstat
BTCCS CHKLF01 CHKTMPC 08/11/14 15.43.35 A
-RUN
MODIFY FILE SECFLLOG
COMPUTE
REQ_SYSTEM = 'BTCCS';
USERID = 'CHKLF01 ';
MATCH REQ_SYSTEM USERID
ON NOMATCH REJECT
ON MATCH COMPUTE
VER_OPERID = 'CHKTMPC';
VER_MAINT_DT = '08/11/14';
VER_TIME = '15.43.35';
VER_STATUS = 'A';
ON MATCH UPDATE VER_OPERID VER_MAINT_DT VER_TIME VER_STATUS
DATA ON USERFILE
END
-RUN
(FOC209) THE DATA VALUE EXCEEDS ITS LENGTH SPECIFICATION: BTCCS
EDSNETO CHKTMPC 08/11/1415.43.37A
-*TSO EX 'EPO.ENP1.PCS.CLIST(SUBCLIST)' '&USERID'
-IF 0 NE 0 GOTO EOJ;,
-GOTO READLOOP;
Sorry for all the bothering guys, and if I seemed harsh to anyone, but I'm almost throwing punches against the monitor here... Been on this for almost a week, and still got no clue of what is wrong.
FOCUS 7.6 Mainframe, Outputs available
Posts: 15 | Location: Brasil | Registered: May 21, 2014
Originally posted by j.gross: FOCLIST occurs when you use PRINT, or in MATCH FILE if the sort keys on the two sides of the match are not identically named and formatted. Neither of those conditions apply in the code you posted.
Toss in
?FF HOLD -EXIT
before the finAl MODIFY, and post the output.
Answering your questions: I've made it to the APPRFILE and SECFLLOG (used it on the last piece of code, so no Hold)
So structurally both files are identical, but when I try to simply do a modify using fixform, I get this:
MODIFY FILE SECFLLOG
ENTER SUBCOMMANDS:,
COMPUTE
FIXFORM FROM APPRFILE
MATCH REQ_SYSTEM USERID
ON NOMATCH REJECT
ON MATCH UPDATE VER_OPERID VER_STATUS VER_MAINT_DT VER_TIME
DATA ON APPRFILE
END
STARTING:,
(FOC415)TRANS 1 REJECTED NOMATCH SECFLROT,
: BTCCSEDSNETO TEST 3,
APCHKTMPB08/11/1414.40.37CHKTMPC08/11/1417.02.04A3 ::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
It kept giving me trans 2 rejected, trans 3 rejected... up to 10 or 11 transactions, when all I had in APPRFILE was one record... Where's it getting all this data from?
FOCUS 7.6 Mainframe, Outputs available
Posts: 15 | Location: Brasil | Registered: May 21, 2014
The FOC209 is a side-effect of the fact that the final Modify lacks an input directive (fixform freeform or crtform), so Modify is supplying a default one. Not important -- the Table and Modify in the loop are extraneous; the earlier Modify already applied the update.
I think this is what you need --
-SET &&TEMPID=' ';
-TSO RUN GETUSER,&&TEMPID
-SET &&LOGID = EDIT(&&TEMPID, '9999999');
TABLE FILE SECFLLOG
PRINT
FIRST_NAM_BF (1)
FIRST_NAM_AF
LAST_NAME_BF
LAST_NAME_AF
REQ_TYPE
REQ_STATUS
SEC_OPERID
SEC_MAINT_DT
SEC_TIME
VER_OPERID
VER_MAINT_DT
VER_TIME
VER_STATUS
LEVEL_BFOR
LEVEL_AFTR
BY REQ_SYSTEM
BY USERID
IF SEC_OPERID NE '&&LOGID'
IF VER_STATUS EQ ' '
ON TABLE HOLD AS APPRFILE FORMAT FOCUS (2)
END
-RUN
-IF &RECORDS EQ 0 GOTO NOTHING ELSE GOTO LOOPR;
-***
-NOTHING
-***
-SET &ERRMSG = ' ';
-SET &ACTION = 'X';
-CRTFORM LINE 1
-"*********************************************************************"
-"* <69 *"
-"* THERE ARE NO PENDING REQUESTS THAT YOUR USERID CAN APPROVE <69 *"
-"* PRESS ENTER TO GO BACK <T.&ACTION> <69 *"
-"* <69 *"
-"*********************************************************************"
-" "
-" "
-"<.HD.&ERRMSG"
-***
- GOTO EXITIT
-LOOPR
?FF APPRFILE
CHECK FILE APPRFILE PICT (3)
-RUN
MODIFY FILE APPRFILE
NEXT REQ_SYSTEM USERID FOCLIST
ON NONEXT GOTO EXIT
ON NEXT COMPUTE
VER_OPERID = '&&LOGID';
VER_MAINT_DT = TODAY(VER_MAINT_DT);
VER_TIME = HHMMSS(VER_TIME);
ON NEXT CRTFORM LINE 1
"*********************************************************************"
"* APPROVE OR REJECT OUTSTANDING REQUESTS <69 *"
"*-------------------------------------------------------------------*"
"* ENTER ACTION (A/R/B/X): <T.VER_STATUS> <69 *"
"*-------------------------------------------------------------------*"
"* REQUEST DATA <69 *"
"* USERID : <D.USERID REQ_SYSTEM : <D.REQ_SYSTEM <69 *"
"* REQ_TYPE : <D.REQ_TYPE REQ_STATUS : <D.REQ_STATUS <69 *"
"* NAME BEFORE : <D.FIRST_NAM_BF/50 <69 *"
"* SURNAME BF : <D.LAST_NAME_BF/50 <69 *"
"* NAME AFTER : <D.FIRST_NAM_AF/50 <69 *"
"* SURNAME AF : <D.LAST_NAME_AF/50 <69 *"
"* AUTH. BEFORE: <D.LEVEL_BFOR AUTH. AFTER : <D.LEVEL_AFTR <69 *"
"*-------------------------------------------------------------------*"
"* REQUEST | VALIDATION <69 *"
"* SEC_OPERID : <D.SEC_OPERID | VER_OPERID : <D.VER_OPERID <69 *"
"* SEC_MAINT_DT : <D.SEC_MAINT_DT | VER_MAINT_DT : <D.VER_MAINT_DT <69 *"
"* SEC_TIME : <D.SEC_TIME | VER_TIME : <D.VER_TIME <69 *"
"*********************************************************************"
" "
" "
" "
ON NEXT IF VER_STATUS IS 'X' GOTO EXIT;
ON NEXT IF VER_STATUS IS 'B' GOTO TOP;
-***
ON NEXT UPDATE VER_OPERID VER_MAINT_DT VER_TIME VER_STATUS
ON NEXT GOTO TOP
-***
DATA VIA FIDEL
LOG INVALID MSG OFF
END
-***
-UPDLOG
TABLE FILE APPRFILE
PRINT
VER_OPERID (4)
VER_MAINT_DT
VER_TIME
VER_STATUS
BY REQ_SYSTEM
BY USERID
IF VER_STATUS EQ 'A' OR 'R' (5)
ON TABLE HOLD
END
-RUN
?FF HOLD
?FF SECFLLOG
-***
MODIFY FILE SECFLLOG
FIXFORM FROM HOLD
MATCH REQ_SYSTEM USERID
ON NOMATCH REJECT
ON MATCH UPDATE VER_OPERID VER_MAINT_DT VER_TIME VER_STATUS
DATA ON HOLD
END
NOTES:
(1) Omit REQ_SYSTEM and USERID here, they are already included because of the BY clauses.
(2) INDEX is not needed
(3) FOCLIST is automatically introduced as a tie-breaker key in the FOCUS Hold file, because of the PRINT verb.
(4) Include just the fields to be matched and those to be updated
(5) Filter out the records that are not marked Accept or Reject
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005
It happens all the times. What seems to be even more weird, is that if I enter the screen again, It will show me the record that wasn't updated, and on this second run, it updates normally...
FOCUS 7.6 Mainframe, Outputs available
Posts: 15 | Location: Brasil | Registered: May 21, 2014
The records in HOLD and the transaction string under FOC415 do not correspond! I suspect it is somehow picking up a different HOLD file.
Try WHENCE HOLD MASTER WHENCE HOLD FOCTEMP
And try changing HOLD to something less generic, maybe SECFLVER.
Note also that the segtype=S1 declaration would cause all transations against REQ_SYSTEM=WHS to be applied to a single instance (even if there is a whole series of USERID's under WHS), *if* Modify (incorrectly) treats a Match of a key- and non-key field (MATCH REQ_SYSTEM USERID) as just a Match on the key-field (MATCH REQ_SYSTEM). Just a suspicion.
Get that SEGTYPE changed to S2, rebuild the SECFLLOG Focus file, verify that all the records are now in proper sequence (TABLEF FILE SECFLLOG PRINT REQ_SYSTEM USERID ...), and try again.
HTH
- Jack Gross WF through 8.1.05
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005
Jack And Alan, Changed the SEGTYPE to S2, rebuilt the files and it worked smoothly. Thanks a lot for this one. I would never think the problem was in the focmast.
FOCUS 7.6 Mainframe, Outputs available
Posts: 15 | Location: Brasil | Registered: May 21, 2014