Presentation is loading. Please wait.

Presentation is loading. Please wait.

Debugging Techniques Walter F. Blood Technical Director, FOCUS Division June, 2008.

Similar presentations


Presentation on theme: "Debugging Techniques Walter F. Blood Technical Director, FOCUS Division June, 2008."— Presentation transcript:

1 Debugging Techniques Walter F. Blood Technical Director, FOCUS Division June, 2008

2 FOCUS Debugging Techniques Agenda When and Why? Debugging Itself The 5 Key Questions – General Techniques Reporting Issues - TABLE Integrity Code Performance

3 FOCUS Debugging Techniques Debugging Itself When will you need debugging?  You don’t get the results you expect  Your old report stops working in a new release  You get a FOCUS error message – FOCnnn  Your report never comes back.  Your systems person calls you to complain about your activity.  FOCUS abends or you get a -12 from the server.

4 FOCUS Debugging Techniques Debugging Itself What can you expect from debugging?  To get the report working now  To find a workaround for the problem if necessary  To have the problem fixed by IBI if required

5 FOCUS Debugging Techniques General Techniques The Five Key Questions 1. Is the machine plugged in? 2. What is the first sign of trouble? 3. Can I make the problem occur with less code? 4. What is FOCUS actually doing? 5. What can FOCUS tell me?

6 FOCUS Debugging Techniques General Techniques 1. Is the machine plugged in? Check the obvious— Spelling and punctuation File existence FILEDEFs or ALLOCations Interface availability Security issues Sink Machine/FDS availability

7 TABLE FILE CAR PRINT COUNTRY CAR MODEL AND COMPUTE SALES='$ ' | EDIT(SALES,'999$'); END TABLE FILE CAR PRINT COUNTRY CAR MODEL AND COMPUTE SALES='$ ' | EDIT(SALES,'999$'); END TABLE FILE CAR PRINT COUNTRY CAR MODEL AND COMPUTE SALES='$ ' | EDIT(SALES,'999$'); END > ERROR AT OR NEAR LINE 3 IN PROCEDURE DBG1 FOCEXEC (FOC282) RESULT OF EXPRESSION IS NOT COMPATIBLE WITH THE FORMAT OF FIELD: SALES (FOC009) INCOMPLETE REQUEST STATEMENT BYPASSING TO END OF COMMAND > TABLE FILE CAR PRINT COUNTRY CAR MODEL AND COMPUTE SALES='$ ' | EDIT(SALES,'999$'); END > ERROR AT OR NEAR LINE 3 IN PROCEDURE DBG1 FOCEXEC (FOC282) RESULT OF EXPRESSION IS NOT COMPATIBLE WITH THE FORMAT OF FIELD: SALES (FOC009) INCOMPLETE REQUEST STATEMENT BYPASSING TO END OF COMMAND > FOCUS Debugging Techniques General Techniques 2. What is the first sign of trouble?  FOCUS error message  Check description to determine nature of problem

8 FOCUS Debugging Techniques General Techniques 2. What is the first sign of trouble?  FOCUS error message  Multiple FOCUS error messages SET ECHO ON; DEFINE FILE CAR CONTINENT/A4=IF COUNTRY = FRANCE OR ENGLAND OR ITALY OR 'W GERMANY' THEN EUROPE ELSE ASIA; PROFIT/D12.2CML%=RETAIL_COST - DEALER_COST / DEALER_COST*100; END TABLE FILE CAR SUM RETAIL_COST DEALER_COST PROFIT BY CONTINENT BY COUNTRY ON TABLE HOLD AS HOLDCAR FORMAT FOCUS INDEX COUNTRY END -RUN TABLE FILE ABCHOLD PRINT SALES PROFIT BY CONTINENT END SET ECHO ON; DEFINE FILE CAR CONTINENT/A4=IF COUNTRY = FRANCE OR ENGLAND OR ITALY OR 'W GERMANY' THEN EUROPE ELSE ASIA; PROFIT/D12.2CML%=RETAIL_COST - DEALER_COST / DEALER_COST*100; END TABLE FILE CAR SUM RETAIL_COST DEALER_COST PROFIT BY CONTINENT BY COUNTRY ON TABLE HOLD AS HOLDCAR FORMAT FOCUS INDEX COUNTRY END -RUN TABLE FILE ABCHOLD PRINT SALES PROFIT BY CONTINENT END

9 FOCUS Debugging Techniques General Techniques > (FOC209) THE DATA VALUE EXCEEDS ITS LENGTH SPECIFICATION: ECHO ON; ERROR AT OR NEAR LINE 3 IN PROCEDURE DBG2 FOCEXEC (FOC258) FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED: FRANCE ERROR AT OR NEAR LINE 5 IN PROCEDURE DBG2 FOCEXEC (FOC253) INVALID FORMAT SPECIFICATION ON LEFT HAND SIDE: D12.2CML% ERROR AT OR NEAR LINE 8 IN PROCEDURE DBG2 FOCEXEC (FOC003) THE FIELDNAME IS NOT RECOGNIZED: PROFIT BYPASSING TO END OF COMMAND (FOC009) INCOMPLETE REQUEST STATEMENT ERROR AT OR NEAR LINE 14 IN PROCEDURE DBG2 FOCEXEC (FOC205) THE DESCRIPTION CANNOT BE FOUND FOR FILE NAMED: ABCHOLD BYPASSING TO END OF COMMAND > (FOC209) THE DATA VALUE EXCEEDS ITS LENGTH SPECIFICATION: ECHO ON; ERROR AT OR NEAR LINE 3 IN PROCEDURE DBG2 FOCEXEC (FOC258) FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED: FRANCE ERROR AT OR NEAR LINE 5 IN PROCEDURE DBG2 FOCEXEC (FOC253) INVALID FORMAT SPECIFICATION ON LEFT HAND SIDE: D12.2CML% ERROR AT OR NEAR LINE 8 IN PROCEDURE DBG2 FOCEXEC (FOC003) THE FIELDNAME IS NOT RECOGNIZED: PROFIT BYPASSING TO END OF COMMAND (FOC009) INCOMPLETE REQUEST STATEMENT ERROR AT OR NEAR LINE 14 IN PROCEDURE DBG2 FOCEXEC (FOC205) THE DESCRIPTION CANNOT BE FOUND FOR FILE NAMED: ABCHOLD BYPASSING TO END OF COMMAND  2. What is the first sign of trouble?  FOCUS error message  Multiple FOCUS error messages  FOCUS errors compound  Solve the earliest exposed problem first!

10 FOCUS Debugging Techniques General Techniques 2. What is the first sign of trouble?  FOCUS error message  Multiple FOCUS error messages  Incorrect or unexpected results  Work backwards from incorrect results  Look for  Logic errors  Incorrect assumptions  FOCUS errors

11 FOCUS Debugging Techniques General Techniques 2. What is the first sign of trouble?  FOCUS error message  Multiple FOCUS error messages  Incorrect or unexpected results PAGE 1 COUNTRY RETAIL_COST DEALER_COST PROFITMARGIN ENGLAND 45,319 37, FRANCE 5,610 4, ITALY 51,065 41, JAPAN 6,478 5, W GERMANY 64,732 54, PAGE 1 COUNTRY RETAIL_COST DEALER_COST PROFITMARGIN ENGLAND 45,319 37, FRANCE 5,610 4, ITALY 51,065 41, JAPAN 6,478 5, W GERMANY 64,732 54, DEFINE FILE CAR PROFITMARGIN/D7=((RETAIL_COST - DEALER_COST)/DEALER_COST)*100; END TABLE FILE CAR SUM RETAIL_COST DEALER_COST PROFITMARGIN BY COUNTRY END DEFINE FILE CAR PROFITMARGIN/D7=((RETAIL_COST - DEALER_COST)/DEALER_COST)*100; END TABLE FILE CAR SUM RETAIL_COST DEALER_COST PROFITMARGIN BY COUNTRY END

12 FOCUS Debugging Techniques General Techniques 2. What is the first sign of trouble?  FOCUS error message  Multiple FOCUS error messages  Incorrect or unexpected results TABLE FILE CAR SUM RETAIL_COST DEALER_COST PROFITMARGIN COMPUTE PM/D7= ((RETAIL_COST - DEALER_COST)/DEALER_COST)*100; BY COUNTRY END TABLE FILE CAR SUM RETAIL_COST DEALER_COST PROFITMARGIN COMPUTE PM/D7= ((RETAIL_COST - DEALER_COST)/DEALER_COST)*100; BY COUNTRY END PAGE 1 COUNTRY RETAIL_COST DEALER_COST PM ENGLAND 45,319 37, FRANCE 5,610 4, ITALY 51,065 41, JAPAN 6,478 5, W GERMANY 64,732 54, PAGE 1 COUNTRY RETAIL_COST DEALER_COST PM ENGLAND 45,319 37, FRANCE 5,610 4, ITALY 51,065 41, JAPAN 6,478 5, W GERMANY 64,732 54,563 19

13 FOCUS Debugging Techniques General Techniques 2. What is the first sign of trouble?  FOCUS error message  Multiple FOCUS error messages  Incorrect results  Abend  Traces help identify FOCUS errors  Dumps may be required

14 FOCUS Debugging Techniques General Techniques 2. What is the first sign of trouble?  FOCUS error message  Check description to determine nature of problem  Multiple FOCUS error messages  FOCUS errors compound  Solve the earliest exposed problem first!  Incorrect results  Work backwards from incorrect results  Look for FOCUS errors  Abend  Traces help identify FOCUS errors  Dumps may be required

15 FOCUS Debugging Techniques General Techniques 3. Will the problem occur with less code?  Simplify the problem.  Remove code not related to the problem  Segment code to facilitate testing Problem: User had a problem with a line FOCEXEC. Solution: Use -GOTO in Dialogue Manager, and GOTO in MODIFY, to skip blocks of code. Checkpoint and rerun from last successful step. Problem: User had a problem with a line FOCEXEC. Solution: Use -GOTO in Dialogue Manager, and GOTO in MODIFY, to skip blocks of code. Checkpoint and rerun from last successful step.

16 TABLE FILE ABC SUM F1 F2 F3/A4 FST.F4 BY S1 NOPRINT BY S2 BY HIGHEST 3 S3 SUBTOTAL PLUS-OTHERS WHERE ((W1 GE W2 AND W1 LE W3) AND (W4 LT W5 OR W6 LT W7)) OR (W5*24 GE W9 +W1); ON S1 SUBHEAD “ TOTALS FOR

17 FOCUS Debugging Techniques General Techniques  Segment TABLE request to isolate the problem -DEFAULTS START=STEP1, STOP=STEP99,ECHO=OFF -SET ECHO=&ECHO; -GOTO &START -STEP1 TABLE FILE … lots of code -GOTO NOSTY ON TABLE SET STYLE * TYPE = REPORT, … ENDSTYLE -NOSTY END -DEFAULTS START=STEP1, STOP=STEP99,ECHO=OFF -SET ECHO=&ECHO; -GOTO &START -STEP1 TABLE FILE … lots of code -GOTO NOSTY ON TABLE SET STYLE * TYPE = REPORT, … ENDSTYLE -NOSTY END

18 FOCUS Debugging Techniques General Techniques MODIFY FILE … GOTO TWO CASE ONE … ENDCASE CASE TWO … ON MATCH/NOMATCH GOTO END ENDCASE CASE THREE … ENDCASE DATA END MODIFY FILE … GOTO TWO CASE ONE … ENDCASE CASE TWO … ON MATCH/NOMATCH GOTO END ENDCASE CASE THREE … ENDCASE DATA END  Use GOTO to exclude MODIFY cases

19 FOCUS Debugging Techniques General Techniques 4. What is FOCUS/WebFOCUS actually doing?  Expose what is happening.  In TABLE:  Use LET NOPRINT = ; to show complete request  Use SET DEFECHO to show variable substitution  Use –TYPE to expose system variable values LET NOPRINT = ; TABLE FILE CAR SUM RETAIL_COST BY COUNTRY NOPRINT … LET NOPRINT = ; TABLE FILE CAR SUM RETAIL_COST BY COUNTRY NOPRINT … SET DEFECHO=ALL TABLE FILE CAR SUM … WHERE COUNTRY EQ &VAR1 … SET DEFECHO=ALL TABLE FILE CAR SUM … WHERE COUNTRY EQ &VAR1 … TABLE FILE CAR … END -RUN -TYPE RECORDS &RECORDS TABLE FILE CAR … END -RUN -TYPE RECORDS &RECORDS

20 FOCUS Debugging Techniques General Techniques 4. What is FOCUS/WebFOCUS actually doing?  Expose what is happening.  In MODIFY:  Use MODIFY FILE xxx TRACE to locate CASE  Use TYPE IN CASE xxx to indicate position inside case **** START OF TRACE **** TRACE ===> AT CASE TOP DATA FOR TRANSACTION 1 EMP_ID => CURR_SAL => TRACE ===> AT CASE HIGHSAL YOU ENTERED A SALARY ABOVE $50000 … **** START OF TRACE **** TRACE ===> AT CASE TOP DATA FOR TRANSACTION 1 EMP_ID => CURR_SAL => TRACE ===> AT CASE HIGHSAL YOU ENTERED A SALARY ABOVE $50000 … MODIFY FILE EMPLOYEE … CASE ONE TYPE IN CASE ONE MATCH EMP_ID TYPE AFTER MATCH ON MATCH UPDATE CURR_SAL MODIFY FILE EMPLOYEE … CASE ONE TYPE IN CASE ONE MATCH EMP_ID TYPE AFTER MATCH ON MATCH UPDATE CURR_SAL

21 FOCUS Debugging Techniques General Techniques 4. What is FOCUS/WebFOCUS actually doing?  Expose what is happening.  In Dialogue Manager:  Use SET &ECHO and SET DEFECHO to expose the actual flow of commands  Use –TYPE to expose local and global variables -DEFAULT &TEST = OFF SET PRINTPLUS = ON -RUN -? SET PRINTPLUS &PRINTPLUS -SET &EVT = IF TEST EQ ‘OFF’ THEN ‘*’ ELSE ‘TYPE’; -&EVT.EVAL VALUE OF PRINTPLUS IS &PRINTPLUS -DEFAULT &TEST = OFF SET PRINTPLUS = ON -RUN -? SET PRINTPLUS &PRINTPLUS -SET &EVT = IF TEST EQ ‘OFF’ THEN ‘*’ ELSE ‘TYPE’; -&EVT.EVAL VALUE OF PRINTPLUS IS &PRINTPLUS SET DEFECHO=ALL -SET &ECHO=ON … EX pgm2 ECHO=&ECHO SET DEFECHO=ALL -SET &ECHO=ON … EX pgm2 ECHO=&ECHO

22 FOCUS Debugging Techniques General Techniques 4. What is FOCUS/WebFOCUS actually doing?  Expose what is happening.  In SQL Translator:  Use ECHO to show the generate FOCUS code  Use FILE nnn to create focexec with FOCUS code SQL SELECT BODYTYPE, AVG(MPG), SUM(SALES) FROM CAR WHERE RETAIL_COST > 5000 GROUP BY BODYTYPE; ECHO TABLE END SQL SELECT BODYTYPE, AVG(MPG), SUM(SALES) FROM CAR WHERE RETAIL_COST > 5000 GROUP BY BODYTYPE; ECHO TABLE END > SET COUNTWIDTH=ON -SET SQLERRNUM = 0; TABLE FILE CAR WRITE MIN.BODYTYPE AS 'BODYTYPE' AVE.MPG SUM.SALES BY BODYTYPE NOPRINT WHERE ( RETAIL_COST GT 5000 ) ; ON TABLE SET CARTESIAN ON ON TABLE SET ASNAMES ON ON TABLE SET HOLDLIST PRINTONLY END -RUN > SET COUNTWIDTH=ON -SET SQLERRNUM = 0; TABLE FILE CAR WRITE MIN.BODYTYPE AS 'BODYTYPE' AVE.MPG SUM.SALES BY BODYTYPE NOPRINT WHERE ( RETAIL_COST GT 5000 ) ; ON TABLE SET CARTESIAN ON ON TABLE SET ASNAMES ON ON TABLE SET HOLDLIST PRINTONLY END -RUN

23 FOCUS Debugging Techniques General Techniques 4. What is FOCUS/WebFOCUS actually doing?  Expose what is happening.  With Interfaces:  Use SET XRETRIEVAL=OFF to suppress data access SET XRETRIEVAL=OFF TABLE FILE DB2FILE SUM RETAIL_COST DEALER COST BY COUNTRY WHERE SALES GT 5000 END SET XRETRIEVAL=OFF TABLE FILE DB2FILE SUM RETAIL_COST DEALER COST BY COUNTRY WHERE SALES GT 5000 END...RETRIEVAL KILLED NUMBER OF RECORDS IN TABLE= 0 LINES= 0...RETRIEVAL KILLED NUMBER OF RECORDS IN TABLE= 0 LINES= 0

24 FOCUS Debugging Techniques General Techniques 4. What is FOCUS/WebFOCUS actually doing?  Expose what is happening.  With Interfaces:  Use SET XRETRIEVAL=OFF to suppress data access  Use Traces to expose interface activity SET TRACEUSER=ON SET TRACEOFF=ALL SET TRACEON=STMTRACE/CLIENT SET TRACEON=STMTRACE/FSTRACE SET TRACEUSER=ON SET TRACEOFF=ALL SET TRACEON=STMTRACE/CLIENT SET TRACEON=STMTRACE/FSTRACE SQLDI - Records SQL, RDBMS return codes, cursor operations SQLAGGR - Displays data adapter-to-RDBMS aggregation & join analysis STMTRACE - SQL generated by the data adapter, Direct SQL Passthru SQLDI - Records SQL, RDBMS return codes, cursor operations SQLAGGR - Displays data adapter-to-RDBMS aggregation & join analysis STMTRACE - SQL generated by the data adapter, Direct SQL Passthru

25 01 S1 ************** *EMP_ID ** *LAST_NAME ** *FIRST_NAME ** *HIRE_DATE ** * ** *************** ************** I I I I I I I FUNDTRAN I PAYINFO I ADDRESS I SALINFO I ATTNDSEG 02 I U 03 I SH1 07 I S1 08 I SH1 10 I KM ************** ************** ************** ************** *BANK_NAME * *DAT_INC ** *TYPE ** *PAY_DATE ** :DATE_ATTEND :: *BANK_CODE * *PCT_INC ** *ADDRESS_LN1 ** *GROSS ** :EMP_ID ::K *BANK_ACCT * *SALARY ** *ADDRESS_LN2 ** * ** : :: *EFFECT_DATE * *JOBCODE ** *ADDRESS_LN3 ** * ** : :: * * * ** * ** * ** : :: ************** *************** *************** *************** : :: ************** ************** ************** : 01 S1 ************** *EMP_ID ** *LAST_NAME ** *FIRST_NAME ** *HIRE_DATE ** * ** *************** ************** I I I I I I I FUNDTRAN I PAYINFO I ADDRESS I SALINFO I ATTNDSEG 02 I U 03 I SH1 07 I S1 08 I SH1 10 I KM ************** ************** ************** ************** *BANK_NAME * *DAT_INC ** *TYPE ** *PAY_DATE ** :DATE_ATTEND :: *BANK_CODE * *PCT_INC ** *ADDRESS_LN1 ** *GROSS ** :EMP_ID ::K *BANK_ACCT * *SALARY ** *ADDRESS_LN2 ** * ** : :: *EFFECT_DATE * *JOBCODE ** *ADDRESS_LN3 ** * ** : :: * * * ** * ** * ** : :: ************** *************** *************** *************** : :: ************** ************** ************** : FOCUS Debugging Techniques General Techniques 5. What can FOCUS tell me?  Use CHECK FILE to determine PATHs if you get -- FOC144 – Testing on independent paths of data FOC All verb objects must be in the same path as their sort fields CHECK FILE EMPLOYEE PICTURE

26 FOCUS Debugging Techniques General Techniques 5. What can FOCUS tell me?  Use CHECK FILE HOLD to determine PATHs if you get -- CHECK FILE EMPLOYEE HOLD FILE=FOCMAST,SUFFIX=FIX,$ SEGMENT=FILEATTR,$ FIELD=RECTYPE,FLE,A4,A4,$ FIELD=FILENAME,FILN64,A64,A64,$ FIELD=SUFFIX,FILN34,A8,A8,$ …. SEGMENT=SEGATTR,PARENT=FILEATTR,$ FIELD=RECTYPE,SEG,A4,A4,$ FIELD=SEGNO,SEGNUM,I2S,I4,$ FIELD=LEVEL,LLEVEL1,I2S,I2,$ …. SEGMENT=FLDATTR,PARENT=SEGATTR,$ FIELD=RECTYPE,FLD,A4,A4,$ FIELD=FLDNO,FLDNUM,I4S,I4,$ FIELD=FIELDNAME,FIELD,A66,A66,$ FILE=FOCMAST,SUFFIX=FIX,$ SEGMENT=FILEATTR,$ FIELD=RECTYPE,FLE,A4,A4,$ FIELD=FILENAME,FILN64,A64,A64,$ FIELD=SUFFIX,FILN34,A8,A8,$ …. SEGMENT=SEGATTR,PARENT=FILEATTR,$ FIELD=RECTYPE,SEG,A4,A4,$ FIELD=SEGNO,SEGNUM,I2S,I4,$ FIELD=LEVEL,LLEVEL1,I2S,I2,$ …. SEGMENT=FLDATTR,PARENT=SEGATTR,$ FIELD=RECTYPE,FLD,A4,A4,$ FIELD=FLDNO,FLDNUM,I4S,I4,$ FIELD=FIELDNAME,FIELD,A66,A66,$ TABLE FILE HOLD PRINT SEGNAME SEGNO FIELDNAME/A30 PATH WHERE FIELDNAME EQ ….. END TABLE FILE HOLD PRINT SEGNAME SEGNO FIELDNAME/A30 PATH WHERE FIELDNAME EQ ….. END

27 FOCUS Debugging Techniques General Techniques 5. What can FOCUS tell me?  Use FOCUS Query Facilities to find hidden conditions ? FILEDEF - Check for expected file allocations ? TSO DDNAME – Check the file characteristics ? TSO DDNAME MULTVOL DDNAME = MULTVOL DSNAME = USER1.FOCTST.MULTVOL DISP = NEW DEVICE = DISK VOLSER = MFOC02,MFOC01 DSORG = PS RECFM = F SECONDARY = 4 ALLOCATION = TRACKS BLKSIZE = 4096 LRECL = 4096 TRKTOT = 92 EXTENTSUSED = 23 BLKSPERTRK = 12 TRKSPERCYL = 15 CYLSPERDISK = 2227 BLKSWRITTEN = 1104 FOCUSPAGES = 1059 ? TSO DDNAME MULTVOL DDNAME = MULTVOL DSNAME = USER1.FOCTST.MULTVOL DISP = NEW DEVICE = DISK VOLSER = MFOC02,MFOC01 DSORG = PS RECFM = F SECONDARY = 4 ALLOCATION = TRACKS BLKSIZE = 4096 LRECL = 4096 TRKTOT = 92 EXTENTSUSED = 23 BLKSPERTRK = 12 TRKSPERCYL = 15 CYLSPERDISK = 2227 BLKSWRITTEN = 1104 FOCUSPAGES = 1059

28 FOCUS Debugging Techniques General Techniques 5. What can FOCUS tell me?  Use FOCUS Query Facilities to find hidden conditions ? LET – Find active alternative command meanings Identify deactivated commands Identify abbreviated commands Validate your commands ? LET OTH ON TABLE HOLD AS PR PRINT S SUM TF TABLE FILE SCAN END > ? LET OTH ON TABLE HOLD AS PR PRINT S SUM TF TABLE FILE SCAN END >

29 FOCUS Debugging Techniques General Techniques 5. What can FOCUS tell me?  Use FOCUS Query Facilities to find hidden conditions ? DEFINE [filename] Show virtual fields available – focexec/master Identify unexpected duplicates Validate type, length and source ? DEFINE FILE FIELD NAME FORMAT SEGMENT VIEW TYPE EMPLOYEE FCONCAT A26 1 MASTER EMPLOYEE FARITH I9S 2 MASTER EMPLOYEE FIFTHEN I1 1 MASTER CAR PROFIT D CAR MARGIN D5.2 4 CAR CONTINENT A10 1 EMPLOYEE WKSAL D ? DEFINE FILE FIELD NAME FORMAT SEGMENT VIEW TYPE EMPLOYEE FCONCAT A26 1 MASTER EMPLOYEE FARITH I9S 2 MASTER EMPLOYEE FIFTHEN I1 1 MASTER CAR PROFIT D CAR MARGIN D5.2 4 CAR CONTINENT A10 1 EMPLOYEE WKSAL D12.2 1

30 FOCUS Debugging Techniques General Techniques 5. What can FOCUS tell me?  Use FOCUS Query Facilities to find hidden conditions ? USE – Display file usage including SU/FDS usage Check file concatenation Verify read/write status ? USE DIRECTORIES IN USE ARE: CAR FOCUS A CAR1 FOCUS A AS CAR CAR2 FOCUS A AS CAR EMPLOYEE FOCUS A ON SINK1 JOBFILE FOCUS A READ > ? USE DIRECTORIES IN USE ARE: CAR FOCUS A CAR1 FOCUS A AS CAR CAR2 FOCUS A AS CAR EMPLOYEE FOCUS A ON SINK1 JOBFILE FOCUS A READ >

31 FOCUS Debugging Techniques General Techniques 5. What can FOCUS tell me?  Use FOCUS Query Facilities to find hidden conditions ? SET - Display most common parameters and values ? SET ALL - Display all parameters and values ? SET - Display single parameter and value ? SET FOR – Display allowed set contexts  Display FOCUS settings in effect  Check for expected settings at time of error  Check when using ON TABLE SET  PROFILEs change them, cumulative effect

32 FOCUS Debugging Techniques General Techniques 5. What can FOCUS tell me?  ? SET PARAMETER SETTINGS ALL. OFF FOCALLOC OFF PRINTPLUS OFF ASNAMES FOCUS FOCCREATELOC OFF QUALCHAR. AUTOINDEX ON FOCSTACK SIZE 8 QUALTITLES OFF AUTOPATH ON FOCTRANSFORM OFF REBUILDMSG 1000 BINS 64 FOC2GIGDB OFF RECAP-COUNT OFF BLKCALC NEW HDAY SAVEMATRIX OFF BUSDAYS _MTWTF_ HIPERFOCUS OFF SCREEN ON BYPANELING OFF HOLDATTRS FOCUS SHADOW PAGE OFF CACHE 0 HOLDLIST ALL SMARTMODE OFF CARTESIAN OFF HOLDSTAT OFF SPACES AUTO CDN OFF HOTMENU OFF SQLENGINE COLUMNSCROLL OFF IBMLE ON SUMPREFIX LST DATEDISPLAY OFF INDEX TYPE NEW TCPIPINT OFF DATEFNS ON LANGUAGE AMENGLISH TEMP DISK Z DATETIME STARTUP/RESET LINES/PAGE 66 TERMINAL IBM3270 DEFCENT 19 LINES/PRINT 57 TESTDATE TODAY DEFECHO OFF MESSAGE ON TITLES ON EMPTYREPORT OFF MODE CMS VIEWNAMESIZE 18 EXCELRELEASE 2000 MULTIPATH SIMPLE WIDTH 130 EXL2KLANG 1 NODATA. WINPFKEY OLD MORE... IBIVM PARAMETER SETTINGS ALL. OFF FOCALLOC OFF PRINTPLUS OFF ASNAMES FOCUS FOCCREATELOC OFF QUALCHAR. AUTOINDEX ON FOCSTACK SIZE 8 QUALTITLES OFF AUTOPATH ON FOCTRANSFORM OFF REBUILDMSG 1000 BINS 64 FOC2GIGDB OFF RECAP-COUNT OFF BLKCALC NEW HDAY SAVEMATRIX OFF BUSDAYS _MTWTF_ HIPERFOCUS OFF SCREEN ON BYPANELING OFF HOLDATTRS FOCUS SHADOW PAGE OFF CACHE 0 HOLDLIST ALL SMARTMODE OFF CARTESIAN OFF HOLDSTAT OFF SPACES AUTO CDN OFF HOTMENU OFF SQLENGINE COLUMNSCROLL OFF IBMLE ON SUMPREFIX LST DATEDISPLAY OFF INDEX TYPE NEW TCPIPINT OFF DATEFNS ON LANGUAGE AMENGLISH TEMP DISK Z DATETIME STARTUP/RESET LINES/PAGE 66 TERMINAL IBM3270 DEFCENT 19 LINES/PRINT 57 TESTDATE TODAY DEFECHO OFF MESSAGE ON TITLES ON EMPTYREPORT OFF MODE CMS VIEWNAMESIZE 18 EXCELRELEASE 2000 MULTIPATH SIMPLE WIDTH 130 EXL2KLANG 1 NODATA. WINPFKEY OLD MORE... IBIVM  ? SET ? SET HOLDLIST HOLDLIST ALL >  ? SET FOR

33 FOCUS Debugging Techniques General Techniques 5. What can FOCUS tell me?  Use FOCUS Query Facilities to find hidden conditions ? && - Global variables in effect and their values Check that the values are expected Unexpected values can point to other focexecs &Vars can be seen with -? &var Insert into focexec followed by -RUN ? && &&ECHO OFF &&MAXIMUM &&MINIMUN &&ONE FIRST > ? && &&ECHO OFF &&MAXIMUM &&MINIMUN &&ONE FIRST >

34 FOCUS Debugging Techniques General Techniques 5. What can FOCUS tell me?  Use FOCUS Query Facilities to find hidden conditions ? JOIN - List JOINs in effect Verify the path generated by multiple JOINs Check JOIN details ? JOIN JOINS CURRENTLY ACTIVE HOST CROSSREFERENCE FIELD FILE TAG FIELD FILE TAG AS ALL WH COUNTRY CAR COUNTRY CONTNENT J1 N N JOBCODE EMPLOYEE JOBCODE JOBFILE J2 N N ID_NUM SALES EMP_ID EDUCFILE J3 Y N BODYTYPE CAR EMP_ID EMPLOYEE J4 Y Y > ? JOIN JOINS CURRENTLY ACTIVE HOST CROSSREFERENCE FIELD FILE TAG FIELD FILE TAG AS ALL WH COUNTRY CAR COUNTRY CONTNENT J1 N N JOBCODE EMPLOYEE JOBCODE JOBFILE J2 N N ID_NUM SALES EMP_ID EDUCFILE J3 Y N BODYTYPE CAR EMP_ID EMPLOYEE J4 Y Y >

35 FOCUS Debugging Techniques General Techniques 5. What can FOCUS tell me?  Use FOCUS Query Facilities to find hidden conditions ? FILTER – Show filters in effect Display active hidden screening conditions Validate total screening being done If filtering used as DBA, check user access ? FILTER SET FILE FILTER NAME DESCRIPTION CAR HIMARGIN CAR MDMARGIN * CAR LOMARGIN ? FILTER SET FILE FILTER NAME DESCRIPTION CAR HIMARGIN CAR MDMARGIN * CAR LOMARGIN

36 FOCUS Debugging Techniques General Techniques 5. What can FOCUS tell me?  Use FOCUS Query Facilities to find hidden conditions ? COMBINE – Display files grouped together for MODIFY ? LOAD – Display focexecs compiled and loaded into memory Validate that compiled environment is the same as the run environment Check JOINs, ALLOCs and FILEDEFs ? COMBINE FILE=ALLONE TAG PREFIX CAR EMPLOYEE JOBFILE EDUCFILE ? COMBINE FILE=ALLONE TAG PREFIX CAR EMPLOYEE JOBFILE EDUCFILE

37 FOCUS Debugging Techniques General Techniques 5. What can FOCUS tell me?  Use FOCUS Query Facilities to find hidden conditions ? STYLE – Style settings currently in effect ? STYLE ONLINE-FMT OFFLINE-FMT STANDARD STYLESHEET ON SQUEEZE OFF PAGESIZE Letter ORIENTATION PORTRAIT UNITS INCHES LABELPROMPT OFF LEFTMARGIN.250 RIGHTMARGIN.250 TOPMARGIN.250 BOTTOMMARGIN.250 STYLEMODE FULL TARGETFRAME FOCEXURL BASEURL ? STYLE ONLINE-FMT OFFLINE-FMT STANDARD STYLESHEET ON SQUEEZE OFF PAGESIZE Letter ORIENTATION PORTRAIT UNITS INCHES LABELPROMPT OFF LEFTMARGIN.250 RIGHTMARGIN.250 TOPMARGIN.250 BOTTOMMARGIN.250 STYLEMODE FULL TARGETFRAME FOCEXURL BASEURL

38 FOCUS Debugging Techniques General Techniques 5. What can FOCUS tell me?  Use FOCUS Query Facilities to find hidden conditions ? FILE - Current state of the FOCUS file STATUS OF FOCUS FILE: CAR FOCUS A ON 04/24/2008 AT ACTIVE DELETED DATE OF TIME OF LAST TRANS SEGNAME COUNT COUNT LAST CHG LAST CHG NUMBER ORIGIN 5 04/10/ COMP 10 04/10/ CARREC 18 04/10/ BODY 18 04/10/ SPECS 18 04/10/ WARANT 8 04/10/ EQUIP 25 04/10/ *INDEXES* COUNTRY 04/10/ TOTAL SEGS 102 TOTAL CHAR 3988 TOTAL PAGES 8 LAST CHANGE 04/10/ STATUS OF FOCUS FILE: CAR FOCUS A ON 04/24/2008 AT ACTIVE DELETED DATE OF TIME OF LAST TRANS SEGNAME COUNT COUNT LAST CHG LAST CHG NUMBER ORIGIN 5 04/10/ COMP 10 04/10/ CARREC 18 04/10/ BODY 18 04/10/ SPECS 18 04/10/ WARANT 8 04/10/ EQUIP 25 04/10/ *INDEXES* COUNTRY 04/10/ TOTAL SEGS 102 TOTAL CHAR 3988 TOTAL PAGES 8 LAST CHANGE 04/10/

39 FOCUS Debugging Techniques General Techniques 5. What can FOCUS tell me?  Use FOCUS Query Facilities to find hidden conditions ? FDT - Displays file directory table of FOCUS file Check segment details DIRECTORY:CAR FOCUS A ON 04/24/2008 AT DATE/TIME OF LAST CHANGE: 04/10/ SEGNAME LENGTH PARENT START END PAGES LINKS TYPE 1 ORIGIN COMP CARREC BODY SPECS WARANT EQUIP COUNTRY NEW DIRECTORY:CAR FOCUS A ON 04/24/2008 AT DATE/TIME OF LAST CHANGE: 04/10/ SEGNAME LENGTH PARENT START END PAGES LINKS TYPE 1 ORIGIN COMP CARREC BODY SPECS WARANT EQUIP COUNTRY NEW

40 FOCUS Debugging Techniques General Techniques 5. What can FOCUS tell me?  Use FOCUS Query Facilities to find hidden conditions ? STAT – Statistics for previous request/transaction STATISTICS OF LAST COMMAND RECORDS = 18 SEGS DELTD = 0 LINES = 17 NOMATCH = 0 BASEIO = 3 DUPLICATES = 0 SORTIO = 0 FORMAT ERRORS = 0 SORT PAGES = 0 INVALID CONDTS = 0 READS = 0 OTHER REJECTS = 0 TRANSACTIONS = 0 CACHE READS = 0 ACCEPTED = 0 MERGES = 0 SEGS INPUT = 0 SORT STRINGS = 0 SEGS CHNGD = 0 INDEXIO = 0 INTERNAL MATRIX CREATED: YES AUTOINDEX USED: NO SORT USED: FOCUS AUTOPATH USED: YES AGGREGATION BY EXT.SORT: NO HOLD FROM EXTERNAL SORT: NO STATISTICS OF LAST COMMAND RECORDS = 18 SEGS DELTD = 0 LINES = 17 NOMATCH = 0 BASEIO = 3 DUPLICATES = 0 SORTIO = 0 FORMAT ERRORS = 0 SORT PAGES = 0 INVALID CONDTS = 0 READS = 0 OTHER REJECTS = 0 TRANSACTIONS = 0 CACHE READS = 0 ACCEPTED = 0 MERGES = 0 SEGS INPUT = 0 SORT STRINGS = 0 SEGS CHNGD = 0 INDEXIO = 0 INTERNAL MATRIX CREATED: YES AUTOINDEX USED: NO SORT USED: FOCUS AUTOPATH USED: YES AGGREGATION BY EXT.SORT: NO HOLD FROM EXTERNAL SORT: NO

41 FOCUS Debugging Techniques General Techniques  KNOW the product!  Refer to the doc when in doubt  Search techsupport.informationbuilders.com  Ask questions on Focalpoint Problem: User was getting strange results from a User Written Subroutine. Solution: Check the documentation. User had incorrect arguments. Problem: User was getting strange results from a User Written Subroutine. Solution: Check the documentation. User had incorrect arguments.

42 FOCUS Debugging Techniques General Techniques  Assume nothing! CHECK EVERYTHING! Problem: User was trying to do a segment redefinition, using POSITION. Solution: Fields Were Incorrectly Added Problem: User was trying to do a segment redefinition, using POSITION. Solution: Fields Were Incorrectly Added OCCURS = 5, LENGTH of the segment was 1000 FIELD=POSN1,E15,A50,A50,$ SEGNAME=SEG1,POSITION=POSN1,OCCURS=5 FIELD=FLD1,, A200, A200,$ FIELD=POSN1,E15,A50,A50,$ SEGNAME=SEG1,POSITION=POSN1,OCCURS=5 FIELD=FLD1,, A200, A200,$

43 FOCUS Debugging Techniques General Techniques  Do NOT use defaults! Code what you want to happen. TABLE Put fields referenced in COMPUTEs as verb objects (NOPRINTed). MODIFY Code “ON NOMATCH” condition before “ON MATCH” after EVERY MATCH. TABLE Put fields referenced in COMPUTEs as verb objects (NOPRINTed). MODIFY Code “ON NOMATCH” condition before “ON MATCH” after EVERY MATCH. EFAULT ISASTER both begin with “D”. D

44 FOCUS Debugging Techniques General Techniques  If all else fails, GUESS at the solution, and TEST to verify Problem: Columns in EMR were incorrect or missing. Solution: Eliminated column specifications. Found that FOCUS was adding verb objects for fields referenced in COMPUTEs. Problem: Columns in EMR were incorrect or missing. Solution: Eliminated column specifications. Found that FOCUS was adding verb objects for fields referenced in COMPUTEs.

45 FOCUS Debugging Techniques General Techniques  When problems occur (and they will), eliminate, simplify, and reproduce on standard file (CAR, EMPLOYEE, GGDEMO). Many times, what occurs is a symptom, not a cause. When debugging, COPY the file and start removing a little at a time, until it works. Then see what is affected by the addition of the last removed item. Alternatively, Use –GOTO to eliminate lines, and add back in until it doesn’t work.

46 FOCUS Debugging Techniques Integrity  FOCUS Files Compare ? FDT vs Master File Description Check Physical vs. logical TableF Run VALIDATE FOCEXEC  Sequential Files Compare CHECK FILE (minus GROUPs, POSITION segments) vs LRECL  VSAM Files Compare IDCAMS vs Master File Description Testing database validity

47 FOCUS Debugging Techniques Testing Database Validity *************** *LOGICAL COUNT* *************** STATUS OF FOCUS FILE CAR COUNT OF FIELD OCCURENCES THROUGH A ‘TABLEF’ COMMAND ON 02/08/95 AT ORIGIN COUNT 5 COMP COUNT 10 CARREC COUNT 18 BODY COUNT 18 SPECS COUNT* 18 WARANT COUNT 8 EQUIP COUNT 25 TOTAL 102 NOTE: SEGMENT COUNTS FOLLOWED BY ‘*’ ARE FOR UNIQUE SEGMENTS. THESE COUNTS MAY NOT AGREE WITH THE PHYSICAL COUNT FOR THAT SEGMENT. THIS CAN OCCUR WHEN DEFAULT VALUES ARE SUPPLIED FOR NON-EXISTENT UNIQUE SEGMENTS. Run VALIDATE On the FOCUS CAR file

48 FOCUS Debugging Techniques Testing Database Validity STATUS OF FOCUS FILE: CAR FOCUS A1 ON 02/08/95 AT 19:39:44 ACTIVE DELETED DATE OF TIME OF LAST TRANS SEGNAME COUNT COUNT LAST CHG LAST CHG NUMBER ORIGIN 5 11/16/89 16:18:50 53 COMP 10 11/16/89 16:18:50 53 CARREC 18 11/16/89 16:18:50 53 BODY 18 11/16/89 16:19:05 SPECS 18 11/16/89 16:18:50 53 WARANT 8 11/16/ EQUIP 25 11/16/ ***INDEXES*** COUNTRY 11/16/89 16:18:50 53 TOTAL SEGS 102 TOTAL CHARS 3988 TOTAL PAGES 8 LAST CHANGE 11/16/89 16:19:05 Compare to ? FILE On the FOCUS CAR file

49 FOCUS Debugging Techniques Code - Creating Test Data  Some problems require lots of data to reproduce Specific data not important Problem is volume-related  No one wants to create data  Let FOCUS do it COMPUTE a counter Use EDIT to make alpha fields

50 FOCUS Debugging Techniques Code - Creating Test Data DEFINE FILE realfile CTR/I9 WITH CUSIP = CTR + 1; CUSIP/A9 WITH CUSIP = CTR; AMOUNT/D12.2M WITH AMOUNT = CTR ; … END TABLE FILE realfile PRINT CUSIP AMOUNT … ON TABLE HOLD AS name FORMAT format END DEFINE FILE realfile CTR/I9 WITH CUSIP = CTR + 1; CUSIP/A9 WITH CUSIP = CTR; AMOUNT/D12.2M WITH AMOUNT = CTR ; … END TABLE FILE realfile PRINT CUSIP AMOUNT … ON TABLE HOLD AS name FORMAT format END

51 FOCUS Debugging Techniques Code - Creating Test Data MODIFY FILE xxx COMPUTE TEST/A1=; FIXFORM TEST/1 REPEAT &number NOHOLD COMPUTE CTR/I5=CTR+1; other fields MATCH... ENDREPEAT DATA X END

52 FOCUS Debugging Techniques Performance  Are you using the latest FOCUS efficiencies? BY TOTAL Multi-Path Compiled DEFINES SET SAVEDMASTERS FOCUS 7.6 SET MODCOMPUTE=NATV SET DIRECTHOLD=ON

53 FOCUS Debugging Techniques Performance  FOCUS limits are being raised FOC ERROR WRITING FOCSORT Unlimited FOCSORT (FOCUS 7.6) 2G FOCUS File Limit SET FOCUS2GDB=ON (FOCUS for S390) XFOCUS database with 16GB partition MDI for FOCUS and XFOCUS (FOCUS 7.6)

54 FOCUS D ebugging Techniques Performance  Questions to ask when analyzing performance Should I use DEFINES ? Will COMPUTEs work the same way Why isn’t Screening returning correct results ? SET MULTIPATH ? SET ALL Do I need 2-pass processing Note time for each step.

55 FOCUS D ebugging Techniques Performance


Download ppt "Debugging Techniques Walter F. Blood Technical Director, FOCUS Division June, 2008."

Similar presentations


Ads by Google