Focal Point
[SOLVED]Problem with edit(?)

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

July 30, 2013, 05:30 PM
Lloyd
[SOLVED]Problem with edit(?)
Hi all I am having yet another strange issue. The two sets of data are run from the same code, the only difference is the top set was taken from the full report, and the for bottom set I added a where clause for those specific records.

  
- 00000205                    WOMENS KNIT DRESS
- 00000205                    WOMENS KNIT DRESS
- 00000205                    WOMENS KNIT DRESS

  
- 00000205L/S  WRAP DRESS W/ PWOMENS KNIT DRESS
- 00000205L/S  WRAP DRESS W/ PWOMENS KNIT DRESS
- 00000205L/S  WRAP DRESS W/ PWOMENS KNIT DRESS

The issue is the large blank area in the top set of records, it should be identical to the bottom set. This Field is created by using EDIT to select only 20 chars. As you can see it doesn't seem to work properly.

This is the code I used, seems pretty basic.
  
PROD_DESCR/A20 = UPCASE(20, EDIT(STYLE_DESC, '99999999999999999999$$$$$'), 'A20');


Any one seen this behavior before?

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


Lloyd Prendergast
Michael Kors (USA), Inc.
Phone: 201-453-5076
Fax: 646-354-4776
Lloyd.Prendergast@Michaelkors.com


WebFOCUS 523
WebFOCUS 7.6
WebFOCUS 7.7

Windows Server 2005
Windows Server 2008

Iseries V5R3M0
Iseries V5R5M0
Iseries V6R1M0
July 30, 2013, 06:11 PM
Waz
Is the code in a COMPUTE ?

You may have to set HOLDLIST = PRINTONLY.

Can you post that code ?


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

July 31, 2013, 09:38 AM
Lloyd
what's even stranger is that some times it works....
I'll also add that this report has been running for several years with only minor changes, but no recent changes.
  
-	05		                WOMENS KNIT TOP
-	05		                WOMENS KNIT TOP
-	05	SHAKER STITCH SCARF	WOMENS ACCESSORIES
-	05		                WOMENS ACCESSORIES
-	05		                WOMENS ACCESSORIES



Here's the code I edited out a significant amount of decode logic, becuase its lengthy.
..and before any body asks, I did not write this code. I inherited it......

JOIN ADATA WITH INSEAM IN mtx_products_new TO ALL ADATA IN BL AS J


DEFINE  FILE mtx_products_new
ADATA/A1 WITH INSEAM = ' ' ;
AATEMP/A2 = GETTOK(INSEAM,25,1,'|',2,AA) ;
AA/A2 = IF AATEMP EQ ' ' THEN '-' ELSE AATEMP ;
BB/A2 =GETTOK(INSEAM,25,2,'|',2,BB) ;
CC/A2 = GETTOK(INSEAM,25,3,'|',2,CC) ;
DD/A2 = GETTOK(INSEAM,25,4,'|',2,DD) ;
EE/A2 =GETTOK(INSEAM,25,5,'|',2,EE) ;
FF/A2 = GETTOK(INSEAM,25,6,'|',2,FF) ;
-*KTR/I2 = IF BB EQ ' ' THEN 1 ELSE IF CC EQ ' ' THEN 2 ELSE IF DD EQ ' ' THEN 3 ELSE  IF EE EQ ' ' THEN 4 ELSE IF FF EQ ' ' THEN 5 ELSE 99 ;
XX/A2 = IF AKEY EQ '1'  THEN AA ELSE IF AKEY EQ '2'  THEN BB  ELSE IF AKEY EQ '3'  THEN CC ELSE IF AKEY EQ '4'  THEN DD ELSE IF AKEY EQ '5'  THEN EE ELSE ' ';
-*IF BDATA EQ '03' THEN CC ELSE IF BKEY EQ '4' THEN DD ;

LWDATE/YYMD = HDATE(LAST_MODIFIED_DATE,'YYMD');
XDIVISION/I2 = DECODE DIVISION
(M 20 C 10 T 10 P 23 W 24 L 26 Q 26 K 15 J 25) ;
XSEASON/A3 = IF DELIVERY_PERIOD_CODE EQ '09' THEN 'B99' ELSE SEASON ;
PACKHANG/A1 = IF PACK_METHOD EQ 'H' THEN 'H' ELSE 'P';
ZZ/A25 = STRIP(25, PRODUCT_TYPE, ' ', 'A25');
YY/A40 = EDIT(XDIVISION) ||   ZZ ;
PROD_DESCR/A20 = UPCASE(20, EDIT(STYLE_DESC, '99999999999999999999$$$$$'), 'A20');

RLMSEASON/A3 = IF XSEASON EQ 'S9' THEN 'S09' ELSE
			   IF XSEASON EQ 'U9' THEN 'U09' ELSE
               IF XSEASON EQ 'F9' THEN 'F09' ELSE
			   IF XSEASON EQ 'H9' THEN 'H09' ELSE
               IF XSEASON EQ 'R9' THEN 'R09' ELSE
               IF XSEASON EQ 'S0' THEN 'S10' ELSE
			   IF XSEASON EQ 'U0' THEN 'U10' ELSE
               IF XSEASON EQ 'F0' THEN 'F10' ELSE
			   IF XSEASON EQ 'H0' THEN 'H10' ELSE
               IF XSEASON EQ 'R0' THEN 'R10' ELSE
			   IF XSEASON EQ 'S1' THEN 'S11' ELSE
			   IF XSEASON EQ 'U1' THEN 'U11' ELSE
               IF XSEASON EQ 'F1' THEN 'F11' ELSE
			   IF XSEASON EQ 'H1' THEN 'H11' ELSE
               IF XSEASON EQ 'R1' THEN 'R11' ELSE
			   IF XSEASON EQ 'S2' THEN 'S12' ELSE
			   IF XSEASON EQ 'U2' THEN 'U12' ELSE
               IF XSEASON EQ 'F2' THEN 'F12' ELSE
			   IF XSEASON EQ 'H2' THEN 'H12' ELSE
               IF XSEASON EQ 'R2' THEN 'R12' ELSE
			   IF XSEASON EQ 'S3' THEN 'S13' ELSE
			   IF XSEASON EQ 'U3' THEN 'U13' ELSE
               IF XSEASON EQ 'F3' THEN 'F13' ELSE
			   IF XSEASON EQ 'H3' THEN 'H13' ELSE
               IF XSEASON EQ 'R3' THEN 'R13' ELSE
			   IF XSEASON EQ 'S4' THEN 'S14' ELSE
			   IF XSEASON EQ 'U4' THEN 'U14' ELSE
               IF XSEASON EQ 'F4' THEN 'F14' ELSE
			   IF XSEASON EQ 'H4' THEN 'H14' ELSE
               IF XSEASON EQ 'R4' THEN 'R14' ELSE
               IF XSEASON EQ 'S5' THEN 'S15' ELSE
			   IF XSEASON EQ 'U5' THEN 'U15' ELSE
               IF XSEASON EQ 'F5' THEN 'F15' ELSE
			   IF XSEASON EQ 'H5' THEN 'H15' ELSE
               IF XSEASON EQ 'R5' THEN 'R15' ELSE
               XSEASON;

RLMCATCODE/A10 = DECODE YY(10Accessories,'09' ...
-**
ELSE III) ;

RLMCATDESC/A40 = DECODE YY(10Accessories,'Accessories' ...
-**
ELSE III) ;

RLMSTYDSC2/A40 = DECODE YY(10Accessories,'MENS ACCESSORIES' ...
-**
ELSE III) ;

RLMSTYDSC2_CAP/A40 = UPCASE(40,RLMSTYDSC2 , 'A40');
FABRIC_CONTENT_CAP/A100V = UPCASE(100, FABRIC_CONTENT, 'A100V');

NEW_SCALE/A10 = IF SELLING_SIZE_CODE EQ 'W5' AND XX EQ '31' THEN 'W6' ELSE
                IF SELLING_SIZE_CODE EQ 'W5' AND XX EQ '33' THEN 'W7' ELSE
                IF SELLING_SIZE_CODE EQ 'W5' AND XX EQ '35' THEN 'M1' ELSE
                SELLING_SIZE_CODE;

END

TABLE FILE mtx_products_new

BY XDIVISION AS 'Division'
-*BY DIVISION AS 'Division'
BY RLMSEASON AS 'Season'
BY STYLE_NUMBER AS 'Style Number'
BY COLOR_CODE AS 'Color Code'
PRINT
COLOR_NAME AS 'Color Name'
NEW_SCALE AS 'Size Scale'
XX AS 'Inseam'
DELIVERY_PERIOD_CODE AS 'Delivery Period'
-* Description length in RLM is only 20 characters
-* EDI_DESCRIPTION AS 'Style Description'
PROD_DESCR AS 'Style Description'
RLMSTYDSC2_CAP AS 'Style Description 2'
RLMCATCODE AS 'RLM Category Code'
RLMCATDESC AS 'RLM Category Description'
FABRIC_CONTENT_CAP AS 'Fabric Content'
PACKHANG AS 'Pack/Hang'
US_WHOLESALE__WHOLESALE_PRICE AS 'Wholesale Price'
US_WHOLESALE__RETAIL_PRICE AS 'MSRP'
US_OUTLET__RETAIL_PRICE AS 'Outlet Price'
LDP_COST AS 'RLM Cost'


-IF &DIVISION EQ '$*' THEN GOTO NODIV ;
IF DIVISION EQ '&DIVISION'
-NODIV
-IF &SEASON EQ '$*' THEN GOTO NOSEA ;
IF SEASON EQ '&SEASON'
-NOSEA ;
-IF &DPER EQ '$*'  THEN GOTO NODP ;
IF  DELIVERY_PERIOD_DESCRIPTION EQ '&DPER'
-NODP
-IF &LINE_PLAN EQ '$*' THEN GOTO NOLP
IF LINE_PLAN EQ '&LINE_PLAN'
-NOLP
-IF &PRODUCT_STATUS EQ '$*' THEN GOTO NOPS ;
IF PRODUCT_STATUS EQ '&PRODUCT_STATUS' ;
-NOPS
-IF &RLM_EXPORT_FLAG EQ '$*' THEN GOTO NOXFLG ;
IF RLM_EXPORT_FLAG EQ '&RLM_EXPORT_FLAG'
-NOXFLG
IF LWDATE GE '&LAST_MODIFIED_DATE'

IF XX NE ' '
ON TABLE PCHOLD FORMAT EXL2K
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL

ON TABLE SET STYLE *
UNITS=IN,
PAGESIZE='SCREEN',
LEFTMARGIN=0.000000,
RIGHTMARGIN=0.000000,
TOPMARGIN=0.000000,
BOTTOMMARGIN=0.000000,
SQUEEZE=ON,
ORIENTATION=LANDSCAPE,
$
TYPE=REPORT,
GRID=OFF,
FONT='ARIAL',
SIZE=8,
COLOR='BLACK',
BACKCOLOR='NONE',
STYLE=NORMAL,
RIGHTGAP=0.125000,
TOPGAP=0.013889,
BOTTOMGAP=0.027778,
$
TYPE=DATA,
FONT='ARIAL',
SIZE=8,
COLOR='BLACK',
BACKCOLOR=( 'WHITE' RGB(255 255 224) ),
STYLE=NORMAL,
$
TYPE=TITLE,
STYLE=BOLD,
$
TYPE=TABHEADING,
STYLE=BOLD,
$
TYPE=TABFOOTING,
STYLE=BOLD,
$
TYPE=HEADING,
BACKCOLOR=RGB(210 180 140),
SIZE=10,
STYLE=BOLD,
$
TYPE=FOOTING,
STYLE=BOLD,
$
TYPE=SUBHEAD,
SIZE=10,
STYLE=BOLD,
$
TYPE=SUBFOOT,
SIZE=10,
STYLE=BOLD,
$

TYPE=SUBTOTAL,
BACKCOLOR=RGB(210 210 210),
SIZE=8,
STYLE=BOLD,
$
TYPE=GRANDTOTAL,
BACKCOLOR=RGB(210 210 210),
SIZE=10,
STYLE=BOLD,
$
ENDSTYLE
END
-EXIT



Lloyd Prendergast
Michael Kors (USA), Inc.
Phone: 201-453-5076
Fax: 646-354-4776
Lloyd.Prendergast@Michaelkors.com


WebFOCUS 523
WebFOCUS 7.6
WebFOCUS 7.7

Windows Server 2005
Windows Server 2008

Iseries V5R3M0
Iseries V5R5M0
Iseries V6R1M0
July 31, 2013, 09:43 AM
Doug
quote:
what's even stranger is that some times it works....
I'll also add that this report has been running for several years with only minor changes, but no recent changes.
~~~ Something changed.

Can you mimic this with astandard / sample IB file?
July 31, 2013, 09:54 AM
Lloyd
That's the thing, I can't.. or haven't been able to. It always seems to work as expected...

I have stripped the report down to just the decode and a simple print statement, and it works as expected...

My only thought is something changed on the PLM (that's where this data is coming from, and seperate system running oracle) but it won't explain why it works some times and not others.


Lloyd Prendergast
Michael Kors (USA), Inc.
Phone: 201-453-5076
Fax: 646-354-4776
Lloyd.Prendergast@Michaelkors.com


WebFOCUS 523
WebFOCUS 7.6
WebFOCUS 7.7

Windows Server 2005
Windows Server 2008

Iseries V5R3M0
Iseries V5R5M0
Iseries V6R1M0
July 31, 2013, 12:09 PM
Doug
quote:
it won't explain why it works some times and not others

~ ~ ~ It may be DATA DEPENDENT...
July 31, 2013, 12:53 PM
Lloyd
quote:

it won't explain why it works some times and not others


...what I mean by that, if I run it via MRE or devstudio (the existing report which has been working until now) I get the missing field.

When I strip the report down to just the single define (for the decode) and simple 'table file print', I get the expected result.


Lloyd Prendergast
Michael Kors (USA), Inc.
Phone: 201-453-5076
Fax: 646-354-4776
Lloyd.Prendergast@Michaelkors.com


WebFOCUS 523
WebFOCUS 7.6
WebFOCUS 7.7

Windows Server 2005
Windows Server 2008

Iseries V5R3M0
Iseries V5R5M0
Iseries V6R1M0
July 31, 2013, 05:57 PM
Waz
Can you now start adding bit back into the code till the problem occurs.

Then you will know what piece of code is causing it.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

July 31, 2013, 06:25 PM
Lloyd
Yeah, that's where I've been today for the most part...

here's another facepalm moment....If I take the full report, add a where clause for one of the lines that didn't work...it works.....


Lloyd Prendergast
Michael Kors (USA), Inc.
Phone: 201-453-5076
Fax: 646-354-4776
Lloyd.Prendergast@Michaelkors.com


WebFOCUS 523
WebFOCUS 7.6
WebFOCUS 7.7

Windows Server 2005
Windows Server 2008

Iseries V5R3M0
Iseries V5R5M0
Iseries V6R1M0
August 01, 2013, 03:42 AM
Tony A
Hi Lloyd,

Try trapping the SQL in each case and see if that gives any clues.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
August 01, 2013, 02:33 PM
susannah
some of your style descriptions in your source data file may have become right adjusted...just to keep you crazy. happens in external-sourced data systems sometimes.
try to stick in a LJUST on style_desc before editing and carrying on..




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
August 02, 2013, 10:38 AM
Lloyd
Susannah, your are my hero-ine....
I never would of thought to try that, still not sure why it worked. When I look at the data its clearly not right justified. ...and even if it were I wanted 20 chars out of 25, something should of printed.

and than there's the randomness factor..some records working, some records not...

But it's fixed.


Lloyd Prendergast
Michael Kors (USA), Inc.
Phone: 201-453-5076
Fax: 646-354-4776
Lloyd.Prendergast@Michaelkors.com


WebFOCUS 523
WebFOCUS 7.6
WebFOCUS 7.7

Windows Server 2005
Windows Server 2008

Iseries V5R3M0
Iseries V5R5M0
Iseries V6R1M0
August 02, 2013, 11:54 AM
susannah
that's the trouble with 'looking' at the data in html, all the leading blanks are smashed into 1 blank.
i think SET STYLEMODE = FIXED (or somesuch) helps.
we had that problem with KPI data, the folks who sent over the cashregister data from our stores... so i remembered..




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
August 02, 2013, 02:23 PM
Doug
I don't know what I like more:
quote:
LJUST . . . before carrying on.
Or
quote:
Susannah, your are my hero-ine....
Wink