I wanted to extract information about DSECTS from the SYSADATA output from compiling an assembler program on z/OS.
On the whole it was pretty easy – but had some surprises!
I’ve put some Python code up on github. It runs on my z/OS.
Where is the record layout documented?
The record layout is documented in HLASM V1R6 Programmer’s Guide. Dsects for the various types are provided in HLA.SASMMAC1(ASMADATA).
I used record type 0x0042 for symbols. To get a record in this section of the ADATA it needs a label.
For example
DSECT COLIN2
ABCD DS CL8
ABCDE DS CL8
This will not produce a record for the DSECT – because it does not have a label.
ESDID – section names
Each DSECT or CSECT will have an External Symbol Directory ID.
- CSECT start at 1, and increment, so 1,2
- DSECTs start at -1 and decrement 4294967295= 0xffffffff(-1), 4294967294 = 0xfffffffe(-2)
Field order
The order of records seems to be random. The CSECT/DSECT statement is often after some fields in the CSECT/DSECT.
To find the xSECT for each symbol, I saved the SECT name and ESDID, and post processed the list of symbols by adding the xSECT information afterwards from the ESDID.
Field offsets
The offsets in each record seem to be the offset from the first instruction. I had to save the offset from the CSECT statement, then post process the records to calculate (offset of symbol in CSECT) = symbol offset – start_of_CSECT offset.
“Problems”
Missing data
To get a record into the ADATA ensure it has a label.
Output from my code
ESDID Symbol Offset Length TypeA SymType CSECT
4294967295 ABCD 0 8 C OrdinaryLabel COLIN2
4294967295 COLIN2 0 1 J DSECT COLIN2
4294967295 ABCDE 8 8 C OrdinaryLabel COLIN2
1 CSQ6LOGP 0 1 J CSECT CSQ6LOGP
1 LOGP 0 8 D OrdinaryLabel CSQ6LOGP
1 LOGPID 0 2 R OrdinaryLabel CSQ6LOGP
1 LOGPLL 2 2 R OrdinaryLabel CSQ6LOGP
1 LOGPEID 4 4 C OrdinaryLabel CSQ6LOGP
1 LOGPMRTU 8 2 R OrdinaryLabel CSQ6LOGP
1 LOGOPT1 10 1 R OrdinaryLabel CSQ6LOGP
1 LOGOPT2 11 1 R OrdinaryLabel CSQ6LOGP
1 LOGPMCOF 12 2 R OrdinaryLabel CSQ6LOGP
1 LOGPOBPS 16 4 R OrdinaryLabel CSQ6LOGP
1 LOGPIBPS 20 4 R OrdinaryLabel CSQ6LOGP
1 LOGPARCL 24 4 R OrdinaryLabel CSQ6LOGP
1 LOGPWRTH 30 2 R OrdinaryLabel CSQ6LOGP
1 LOGPLVL 32 7 C OrdinaryLabel CSQ6LOGP
1 LOGPLVLN 39 1 R OrdinaryLabel CSQ6LOGP
1 LOGPDMIN 40 2 R OrdinaryLabel CSQ6LOGP
1 LOGPDSEC 42 2 R OrdinaryLabel CSQ6LOGP
1 LOGPCOMP 44 4 R OrdinaryLabel CSQ6LOGP
1 LOGPEND 256 1 U EQU CSQ6LOGP