April 23, 2007, 08:40 AM
Bruce C. LitzkowMODIFY for retrieval only
Many years ago, IBI's advanced modify course materials had examples of code using MODIFY for retrieval only. Can anyone find this and send it to me or tell me where to find it online?
April 23, 2007, 09:58 AM
David BriarsHi Bruce,
If you want to use the MODIFY command, but not to update a FOCUS db, you will want to be sure to use the USE command with the READ parameter. This will protect your db, from an inadvertent update.
Beyond this, one of the major ways to get output from a MODIFY command, besides INCLUDE, UPDATE, or DELETE, would be to use the 'TYPE ON ddname' command.
With 'TYPE ON ddname' you'd be creating a flat file, via the MODIFY command.
Is this the type (no pun intended) of thing you are looking to do?
Regards,
Dave
April 23, 2007, 02:01 PM
Jim_at_LMBruce:
From what I can recall, MODIFY for retrieval worked well with well designed FOCUS hierarchies or relations. The TYPE command can be used to outptut desired data into a sequential file.
With the MATCH key1. .. ON MATCH GOTO CASE1 - NEXT field ON NEXT FIELD IF D.field .. - or ON NEXT COMPUTE - worked nice to evaluate, retrieve and compute new values. Usually, conditions in a lower level segment could be evaluated in a NEXTing sequence to set summaries or switches to control other aggreagation/selection from other higher (or lower) level segments.
File inversion worked nice as well as long as the key field(s) were indexed (you could NEXT thru a lower level chain and make decisions on what to do with the higher level instances). I can recall a method where use of a COMBINE FILE structure to retrieve from one database while doing INCLUDEs to a single relation containing summary data worked well.
It depends on the application and what you are trying to solve. I have found that using pre-defined access paths with file inversions and multiple HOLD files using a combination of TABLEF and TABLE usually gets me the results I want. From there, I can summarize more, HOLD as a FOCUS file, do JOINs etc.
Jim
April 26, 2007, 01:57 PM
KerryHi Bruce,
Has this issue been resolved? Thanks to David and Jim's input.
Please try the code:
COMBINE EMPDATA AND LOCATOR PREFIX L_ AS EMPLOC
MODIFY FILE EMPLOC
PROMPT PIN.ENTER A PIN NUMBER.
COMPUTE L_PIN=PIN;
PERFORM GETNAME
PERFORM GETLOCATION
PERFORM TYPEMEOUT
CASE GETNAME
MATCH PIN
ON NOMATCH REJECT
ON MATCH GOTO ENDCASE
ENDCASE
CASE GETLOCATION
MATCH L_PIN
ON NOMATCH REJECT
ON MATCH GOTO ENDCASE
ENDCASE
CASE TYPEMEOUT
TYPE
"</2 EMPLOYEE ID: <D.PIN"
" NAME: <D.FIRSTNAME <D.LASTNAME "
" ADDRESS: <D.L_SITE"
" FLOOR: <D.L_FLOOR </2"
ENDCASE
DATA
This is what the output would look like:
EMPLOYEE ID: 000000310
NAME: JEFF LIEBER
ADDRESS: 238 BEECHWOOD PLACE
FLOOR: 24
Hope this helps.
Cheers,
Kerry
April 27, 2007, 04:48 PM
HåkanBruce,
another alternative is using Maintain. Besides from being useful for prompting etc, there's so much you could do with Maintain that Modify can't.
Håkan
April 30, 2007, 11:53 AM
Bruce C. LitzkowThanks to all of you for your suggestions. I thought of the TYPE ON DDNAME. My friend ended up using COMBINE and it worked fine.