Issuing JOIN CLEAR * before a join is good practice.
In theory, if you name your joins e.g. AS J1 etc. they should over write if you reuse the name.
HOWEVER there have been many reported BUGS where this does not happen and you have problems.
Memory management is ALWAYS a good idea.
August 28, 2008, 04:55 PM
Darin Lee
I think JG explained it nicely. IN essence, if you haven't got a reason NOT to use then, then use it as a standard practice.
Here's what I go by - if there's only a single table request in the fex - no reason to use it. If there are subsequent TABLE commands the include additional joins, I always use it (unless, of course, in those circumstances where I want it to remain in effect and NOT cleared.)
Regards,
Darin
In FOCUS since 1991 WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex WF Client: 77 on Linux w/Tomcat
August 28, 2008, 05:02 PM
Diptesh Patel
Another reason why mainframe Focexecs have JOIN CLEAR * in them is because a JOIN stays in effect for the duration of the session. In case of Mainframe focexecs, very often it is in an online environment, where several Focexecs are run one after the other in the same session. At least that was the reason I got into the habit of coding JOIN CLEAR * at the very least before the first JOIN in a focexec. That way, I know I do not have an old join from a previously run Focexec potentially messing up my current Focexec.
Diptesh WF 7.1.7 - AIX, MVS
August 29, 2008, 09:01 AM
jgelona
Whoever told you the JOIN CLEAR * is not necessary is mistaken. There are situations, like a single table request where it is not needed, but it is required in the following:
JOIN FIELDA1 IN FILEA TO FIELDB1 IN FILEB
TABLE FILE FILEA
PRINT FIELDB2
BY KEYA
ON TABLE HOLD
END
MODIFY FILE FILEA
...
END
If you don't use one after the TABLE request, the MODIFY will fail.
There are also efficiencies to take into account. JOINs, FILEDEFs and DEFINEs use memory. When I am done with them, I always clear JOINs, FILEDEFs and DEFINEs. It is a habit I picked up back in the old PC FOCUS under MS/DOS days where a program may not run if these items were not cleared.
In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.