Many developers shy away from writing against SYSDIC-XREF directly but due to limitations of what’s been supplied by the vendor we have. Once you gain a basic understanding of how SYSDIC-XREF is laid out, It’s not that difficult. After the prereqs of having XREF data turned on and generating a SYSDIC-XREF DDM, I would suggest the following:
- SYSDIC-XREF is driven by a key N-LIB-PGM (A32) PRD441 may be (A20) if you have an older version. I’m assuming to make it compatible across platforms they got rid of the binarys. The layout of the field is:
DBID and FNR reflect which FUSER your objects are cataloged on.
LIBRARY and PROGRAM well you know what they are
REC-TYPE defines what type of XREF data is stored on that record. The types can be found in the extended description of the file SYSDIC-XREF in Predict.
SEQ defines the number of records you may have for a rec-type. For example you may be accessing a file that has 70 fields being used. Each record may only hold 60 fields so you would have 2 records for that type.
If you browse through the fields in SYSDIC-XREF in PREDICT they are loaded with info. To do this go to direct command ‘MA EL’ and select browse function and enter field N-PGM and file SYSDIC-XREF.
N-PGM is a MU field and kind of like a superdesc. It’s made up of the first byte being a usage type and the rest is the used program. So if you wanted to see all the programs that used subprogram XYZ you would write the following:
FIND SYSDIC-XREF with N-PGM = ‘PXYZ’
this would give you all the Natural objects that have a CALLNAT to XYZ in them.
In order to get use to what you have on SYSDIC-XREF I would suggest running this program and you can pick and choose different fields to look at. Keep in mind that this is not all the fields on the file but gives you an idea.
FORMAT PS=24 LS=80
RESET #N-LIB-PGM( A32 )
REDEFINE #N-LIB-PGM(#DBID(N5) #FNR(N5) #LIBRARY( A8 ) #PROGRAM( A8 )
#DBID = 6
#FNR = 18
#LIBRARY = ‘X’
#PROGRAM = ‘YYYYYYYY’
#REC-TYPE = ?
#REC-SEQ = ?
READ SYSDIC-XREF WITH N-LIB-PGM = #N-LIB-PGM
REDEFINE N-LIB-PGM(#D(N5) #F(N5) #LIB( A8 ) #PGM( A8 ) #R(N3) #S(N3))
- IF #PGM NE #PROGRAM
DISPLAY #D / #F #LIB / #PGM #R #S
- DA-VIEW( 1:3 )
- N-VIEW /
N-PGM( 1:8 )
- N-FIELD( 1:60 )
I don’t mention this to bring up a long discussion around accessing the SYSDIC-XREF file directly but just want you to know that it’s not as hard as some make it out to be. You just need the basic understanding of the record layout and how to access which PREDICT documentation does a pretty good job at giving you what you need.
This will give you a start if you want to take this direction.