Focal Point
DECODE LIMITS In Mainframe FOCUS 7.2

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/595101413

December 10, 2009, 12:39 PM
Sandy Weller
DECODE LIMITS In Mainframe FOCUS 7.2
In MF FOCUS 7.2.5 what is the total character limit for DECODE tables. I want to try using decodes to a total of 7 files. I need to build the decodes on the fly. Thanks

This message has been edited. Last edited by: Sandy Weller,


Signature changes from project to project
December 10, 2009, 12:49 PM
EWoerle
Sandy,

What type of Database are you using? Are you connecting to FOCUS files? or another database that may use SQL.


Eric Woerle
WF 7.6.7 Reportting Server
ETL 7.6.10
Dev Studio 7.6.7
December 10, 2009, 12:55 PM
Sandy Weller
Eric,

I'm going to connect to flat files within a DEFINE. Does that makes a difference in total character count now?


Signature changes from project to project
December 10, 2009, 01:08 PM
Tom Flynn
From IBI Site:

FOCUS for Mainframe Techniques/Code Examples

How to get around the FOC017 error message when using WHERE field in FILE ddname syntax
Applicable to: All releases

As of IBM Mainframe Release 7.0, the previous FOCUS limit of 3,200 bytes in a file used for selection criteria has been changed to 32,767 literals. This change applies to IF tests that use the following syntax:

IF fieldname operator (ddname) [OR (ddname)...]

The limit for the WHERE phrase remains unchanged. See the FOCUS for IBM Mainframe User Manual for more information on IF and WHERE syntax. The old limit of 3,200 bytes still applies to all non-FOCUS databases with the exception of relational tables.

Here are some solutions to consider when using WHERE field in FILE ddname syntax:

If WHERE is being used, try changing the syntax to use the IF syntax as noted above.
If the file you are testing on is a non-FOCUS file, try changing the file to a FOCUS file by HOLDing it, using ON TABLE HOLD FORMAT FOCUS so that you can still use the IF fieldname operator (ddname) syntax. This will allow the maximum limit to be 32K.
If you can put the conditions you need met in a DEFINE, define a numeric field such that it is 1 if the condition is true, 0 if it is false. Then do a multi-verb request such as:
SUM DEFINE_FIELD BY SSN
PRINT whatever BY SSN
WHERE TOTAL DEFINE_FIELD GT 0

This will give you a list of only those SSN's that have any record that meets the DEFINE_FIELD criteria.

Consider the use of JOIN or DECODE as an alternative as documented in the Systems Journal Encyclopedia, Fall 1991.
Example using JOIN:

TABLE FILE ORIGLIS
SUM COMPUTE SELECT/I1=1;
BY ORIGDEPT
ON TABLE HOLD FORMAT FOCUS INDEX ORIGDEPT
END
JOIN DEPARTMENT IN EMPLOYEE TO ORIGDEPT IN HOLD AS JOIN1
TABLE FILE EMPLOYEE
PRINT LAST_NAME FIRST_NAME
IF SELECT NE 0
END

Example using DECODE:

DEFINE FILE EMPLOYEE
SELECT/I1=DECODE DEPARTMENT(DEPTLIST ELSE 1);
END
TABLE FILE EMPLOYEE
PRINT LAST_NAME FIRST_NAME
IF SELECT EQ 0
END

Split the external file into separate files and use multiple IF statements to get around the file limitation.


The Link


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
December 10, 2009, 01:20 PM
Sandy Weller
Thanks Tom,

If I read this right: If I'm using flat files for my DECODES I only get 3200 characters but if I write the lookups to a file FORMAT FOCUS I get up 32K.

Can I do DECODE in a DEFINE to the FORMAT FOCUS files?


Signature changes from project to project
December 10, 2009, 01:29 PM
Tom Flynn
Sandy,

Yep, that's what I would do. The key point I saw was:

quote:

The old limit of 3,200 bytes still applies to all non-FOCUS databases with the exception of relational tables.


Since you say you are using text files, I would hold the data FORMAT FOCUS (which creates a MODIFY overhead), then, try your DECODE against the HOLD file.

Another thought: After creating the FOCUS DB, you may be able to JOIN your data and forego the DECODE.

hth


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe