Debugging Natural Applications
Debugging Natural Applications
applications
Debugging Natural
applications.
What is “Debugging”?
• Discovering reason for response code or abend.
• Locating performance problem
• Finding logic errors
• Resolving data anomalies
Parameter conflicts
No-record-found conditions
– Avoid assumptions
Which version of module was executing?
– Use INFO, or L DIR, compare against BP info.
Which input datasets were used?
Environment parameter settings.
– USR1005P (Shows Nat. session parms. See Lib SYSEXT)
– GETUPARM (lShows dynam parms. See Lib SYSEXTP)
– //CMPRMIN or EXEC (may have override parms specified)
Response code checking (or lack of) in Non-Natural.
Debugging.
Monitoring Tools
TEST The facility
SYSRDC
SYSTP
– SYSMON (performance statistics)
Additional non-invasive tools
– DUMP
– TECH
– LASTMSG (if error handler lost last error).
– List Xref (where is that variable modified?).
SMH (SAG’s system management hub).
Omegamon or Sysview type tools.
Insight/Review for ADABAS monitoring.
Debugging
Debugging
Altered source tools
FETCH RETURN
– To BUS, TECH, or other Natural facilities for
point-in-time statistics.
Debugging
Altered source
Write/Display/Print
– Send output to another terminal session)
DEFINE PRINTER (1) OUTPUT `TID100`
OR…
DEFINE DATA LOCAL
ELSE
MOVE ALL *INIT-ID TO MSG UNTIL 8 /* SEND TO A TERMINAL ID
Online session PC
Read/write Work workstation
Online session
Display
NAF is not needed
for this, if you have
Jes ESS.
spool TSO
Or COM-PLETE
Note:
Writing to a work file that is set to SYSOUT=(B,SMTP), and sending
lines with proper data formatting for SMTP will send email messages.
Debugging
Altered source
NATPAGE
%I=Capture Current Screen
%E=Display Screen Captures
%O=Deactivate Screen Capturing
%P=Capture Screen Sequence
%S=Resume Screen Capturing
Commands:
%GON : Switch on film mode.
IO=1976,AIO=1644,L=0,C=0,LS=80,PS=42,PLS=80,PCS=24
,FLD=62,CLS=0,ADA=0
Debugging
Performance Problems
New System Variable *CPU-TIME
– Batch or TSO only.
SETTIME & *TIMD
– Clock time, not CPU time.
Infoline (see %XI)
DBLOG or INSIGHT or REVIEW
NOCOPT MCGEN to see generated code.
Debugging
Reading Dumps
Debugging
Reading dumps
S0C1 = Instruction Exception (exec data)
Sometimes done intentionally by vendor.
S0C2 = Privileged instruction (not APF)
System level command attempt w/o auth.
S0C3 = Execute Exception (asm EX failed)
Rare. May be intentional by vendor.
S0C4 = Address Exception (protected)
Common. Storage corrupted, RSA lost, etc.
S0C6 = Spec. Exception (bndry, reg pair)
Rare. Storage corrupted, etc.
S0C7 = Data exception (non numeric)
Common. Packed/numeric fields have invalid data.
Debugging
DUMPS
DUMPs: conventions & concepts
– PSW = Program Status Word
Address of executing instruction [at time of error].
– R14 = Return address if “performing” a routine
– R15 = Address of current module’s entry point,
or return-code when module is done.
– R13 = Register Save Area from “upper” module.
RSA = STM 14,12,12(13)
Debugging
Down in the dumps
TRANSACTION: KSON PROGRAM: UTD223 TASK: 0000145 APPLID: WRGSCICS DISPLAY: 00
STATUS: AN ABEND HAS OCCURRED
COMMAREA = '..!...*...;.' = X'0E9B5A040E9B5C048E9B5E04'
EIBTIME = 112500
EIBDATE = 0105201
EIBTRNID = 'KSON'
EIBTASKN = 145
EIBTRMID = 'S001'
EIBCPOSN = 1387
EIBCALEN = 12
EIBAID = X'7D' AT X'001400EA'
EIBFN = X'7408' CHANGE AT X'001400EB'
EIBRCODE = X'000000460000' AT X'001400ED'
EIBDS = '........'
+ EIBREQID = '........'
ABEND : AEY7
~~~~~~~~~~~~~~~~~~~~~~~~~
Debugging
Down in the dumps
ADDRESS: 0E9B5A04
0E9B5A00 000000 0E9B501E 0E9B502A 0E9B5008 ......&...&...&.
0E9B5A10 00000C 8E9B48AF 00000000 00000000 00000000 ................
ADDRESS: 0E9B5010
0E9B5010 000000 F0F0F0F0 F0F3C3D3 C5C1D940 4040E2C9 000003CLEAR SI
0E9B5020 000010 C7D5D6D5 40404040 40400000 0000F0F0 GNON ....00
0E9B5030 000020 F0F00040 40404040 40404040 40404040 00.
ADDRESS: 8E9B48AF
8E9B48A0 000000 C4 ...............D
8E9B48B0 000001 D4C4E2C1 C3F1F200 005D4040 40D6D7E3 MDSAC12..) OPT
8E9B48C0 000011 C9D6D5C1 D3404040 40404040 40404040 IONAL
8E9B48D0 000021 40400000 4DF5F0F9 5D40F3F3 F560F3F6 ..(509) 335-36
8E9B48E0 000031 F6F36060 6E404000 00404040 40404040 63--> ..
PF5 shows your working storage where the RSA is the first section.
UTD223 DSA:
ADDRESS: 001406E8 WORKING STORAGE
001406E0 000000 00000000 0014005C ...............*
001406F0 000008 00000000 8DEC1782 00000000 0014093C .......b........
00140700 000018 00140750 000CC540 00000000 0E9B501E ...&..E ......&.
00140710 000028 0E9B502A 0E9B5008 8E9B48AF 00000000 ..&...&......... IOCB
00140720 000038 001400D0 8DEC1388 0E7C3D00 001406E8 ...}[email protected]
00140730 000048 00000000 00000000 00000000 00140468 ................
00140740 000058 009BD000 001400D0 0E900EB4 00000000 ..}....}........
00140750 000068 0DEC1EC7 00000000 00140916 0014091E ...G............
00140760 000078 00140926 00000000 00140940 00000000 ........... ....
00140770 000088 00000000 00000000 00000000 8014093C ................
Debugging
DUMPS
DUMP (the Natural command)
– Helpful Options
ABEND (lists basic abend information)
BB+300 (points to session info [user id, prog, line).
IOCB (Input/Output control block)
– Other sub commands
_ AFB System File Table
_ BB User area
_ CST Command Stack
_ DDR ENTIRE Buffer
_ DIR Directories
_ EPL Entry Points Table
_ FUL Editor Work Area
_ GAA Graph. Array area
_ GDA Graphics Data Area
_ GLC Global Area (Com.)
Debugging
Reading Dumps
_ GLS Global Area (Sys.)
_ IOB I/O Control Block
_ KEY PF-Key Table
_ PAR Parameter Area
_ PCB Program CB
_ PGF GDDM/PGF Work Area
_ PRT Printer Table
_ QUT Source Table
_ RAS Retain CID Table
_ SFB System File Buffer
_ SRS Subroutine Stack
_ SSB Source Side Buffer
_ WFB Work File Buffer
_ SVAR System Variables
Debugging
Reading Dumps
Other Sub commands (continued)
_ AZAP Driver AZAP Address
_ DRV Driver Start Address
_ ECSA ECSA Address
_ EPT Entry Points Vector
NUC Get Load point of nucleus xxx
_ PARM Active NATPARM
PGE Program Entry Point
PGM Program Load Point
_ SWAP Swap Pool Address
Debugging
Reading Dumps
Other Sub commands (continued)
CICS information
_ CSA Common System Area
_ CBX Directory Extension
_ OPF Optional Features
_ PAM Page Allocation Map
_ PRM NCI Generation Parms
_ RCB Roll Fac. Cntrl Blk.
_ SIR Session Info Record
_ SCB System Directory
_ SIT System Init. Table
_ SRT System Recovery Tab.
_ STR System Trace Table
_ TCB Thread Control Block
_ TGD Thread Group Defins.
_ TGH Thread Group Header
Debugging
Reading Dumps
CICS information (continued)
_ THD Thread Load Point
_ TRH Trace Table Header
_ TRT Current Trace Entry
_ TSM Temp. Storage Map
_ TST Temp. Storage Table
_ COM Communication Area
_ DCA Dispatch Cntrl Area
_ DCT Destination Control
_ DSA Dynamic Storage Area
_ EIB Exec Interface Block
_ FCT File Control Table
_ PCT Program Control Tab.
_ PLT Program List Table
_ PPT Proc. Program Table
_ TCA Task Control Block
_ TCT Terminal Control Tab
_ TWA Transaction Workarea
Debugging
Dumps
My program to cause an example dump:
Code S0C4 ILC 0006 PSW 078D10 00 9585C2F0 Disp 000014D8 Csect CMZUL
R0-7 00000000 16117FA6 00000000 80000000 16117E28 00000000 00000000 1585C2EA
R8-F 16117E28 16103E60 16100708 1585B0C2 16116AD8 1585AF7E 16117E34 1585B0C2
System Abend Code (hex) 0C4 Abend Reason Code (hex) 00000000