Focal Point
Multiple DECODE files

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

December 28, 2006, 02:43 PM
ibidevelop
Multiple DECODE files
Is it possible to use different DECODE files based on the value of a field?

For example,

APP FI MCEDMA PLANNING/mcedma.txt
APP FI MCFDMA PLANNING/mcfdma.txt
APP FI MSJDMA PLANNING/msjdma.txt
-RUN

DEFINE FILE CAR
OPDIV/A3 = DECODE COUNTRY(ENGLAND 'MCE' FRANCE 'MCF' JAPAN 'MCJ');
DMASTORE/A140 = IF OPDIV EQ 'MCE' THEN DECODE SEATS(MCEDMA) ELSE
IF OPDIV EQ 'MCF' THEN DECODE SEATS(MCFDMA) ELSE
IF OPDIV EQ 'MSJ' THEN DECODE SEATS(MSJDMA);
END

I get a FOC553 error message when I try this.

Thanks,

Joe
December 28, 2006, 03:12 PM
Glenda
What exactly are you trying to accomplish? What do you want your output to contain?


Glenda

In FOCUS Since 1990
Production 8.2 Windows
December 28, 2006, 03:27 PM
RichH
Hi Joe,
Having multiple DECODE files is fine so long as the total of all the DECODE files does NOT exceed the limit. Try cutting down the size of the files or only use two and see if it works then.
Rich


WebFOCUS 8202 Win 2012
Test - WebFOCUS 8203 on Win 2012
December 28, 2006, 04:01 PM
ibidevelop
Thanks Rich, I tried using just two and it still didn't work. It works as long as I use just one DECODE file, but I need to use different files depending on the country.

Glenda, What I'm trying to accomplish is to DECODE from different external files based on the value of a field. I do not always want to DECODE from the same file. So for England, I want to use one DECODE file, but for W Germany I want to use a totally different file for the DECODE.

Thanks,

Joe
December 28, 2006, 04:12 PM
ibidevelop
Glenda,

Additionally, my output will contain whatever is in the file. For example the file allocated to MCEDMA could contain the following sample string:

2 'New York-Newark-Edison, NY-NJ-PA;New York;002-Brooklyn'

While the file allocated to MCJDMA could contain the same code, but with a different string:

2 'San Francisco-Oakland-Fremont;San Francisco;004-Southland'

So in my example, if ENGLAND is the country, the OPDIV define field will be equal to MCE and the DECODE file should be MCEDMA. I should get back 'New York-Newark-Edison, NY-NJ-PA;New York;002-Brooklyn' if SEATS is equal to 2.

However, if JAPAN is the country, the OPDIV define field will be equal to MCJ and the DECODE file should be MCJDMA. I should get back 'San Francisco-Oakland-Fremont;San Francisco;004-Southland' if SEATS is equal to 2.

Does that make more sense? The first file, MCEDMA only has 179 records. The second file, MCJDMA only has 171 records. One has approximately 11,000 bytes and the other has 10,000 bytes.

Thanks,

Joe
December 28, 2006, 06:20 PM
dwf
Joe,

Not sure what your problem is (don't even know what a FOC553 is), but I have information that might provide a hint. I created three data files and populated then with one string each (using the two from your example, and one other). I created them as .fex files, by the way, because that's easy to do in developer studio. Ran your code against those three files and had no problems. So I'm inclined to suspect one of two things. Either there is too much data in your decode files, or there's a problem with file format. Did you create them via a HOLD statement? If so, did you use format ALPHA (might help)?


dwf
December 29, 2006, 08:44 AM
RichH
Hi Joe,
I simply created the two files, mcjdma.ftm and mcedma.ftm, added your 1 line of data to each and ran the request. It worked fine for me.
Rich


WebFOCUS 8202 Win 2012
Test - WebFOCUS 8203 on Win 2012
December 29, 2006, 09:50 PM
susannah
joe

your second decode is an incomplete if-then else-sequence. Might be contributing to the problem.
DMASTORE/A140 = IF OPDIV EQ 'MCE' THEN DECODE SEATS(MCEDMA) ELSE
IF OPDIV EQ 'MCF' THEN DECODE SEATS(MCFDMA) ELSE
IF OPDIV EQ 'MSJ' THEN DECODE SEATS(MSJDMA) ELSE 'XXX';

But in this case, one of your decode files is too large; from the mother ship, we read:
" 0(FOC553) A COMPUTATIONAL EXPRESSION IS TOO LARGE
A computational expression in a DEFINE, COMPUTE or -SET command is
too large (the limit is approximately 32K for the parsed version).
Split the computation up into two expressions, or issue the command
SET COMPUTE=OLD and retry."

and we get this incoming message from the big giant head by typing:
? 553

This message has been edited. Last edited by: susannah,




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
December 31, 2006, 09:59 AM
Fernando
Joe,

Use multiple fields like this:

APP FI MCEDMA PLANNING/mcedma.txt
APP FI MCFDMA PLANNING/mcfdma.txt
APP FI MSJDMA PLANNING/msjdma.txt
-RUN

DEFINE FILE CAR
OPDIV/A3 = DECODE COUNTRY(ENGLAND 'MCE' FRANCE 'MCF' JAPAN 'MCJ');
TEMPA/A140 = DECODE SEATS(MCEDMA);
TEMPB/A140 = DECODE SEATS(MCFDMA);
TEMPC/A140 = DECODE SEATS(MCJDMA);
DMASTORE/A140 = IF OPDIV EQ 'MCE' THEN TEMPA ELSE
IF OPDIV EQ 'MCF' THEN TEMPB ELSE
IF OPDIV EQ 'MSJ' THEN TEMPC;
END

Fernando


Prod WF 8.1.04, QA WF 8.2.03, Dev WF 8.2.03
January 03, 2007, 03:31 PM
ibidevelop
Thanks for all the responses.

It appears that it was the amount of data as RichH suggested. All of my files combined had over 44000 characters and the limit for DECODE is 32000.

Joe