LIST XREF output to a dataset

I am a NATURAL/ADABAS user.

Is it possible to write the output of LIST XREF (L X) to a file or dataset?
If so, what is the best way of doing so?

What platform are you asking for?

For mainframe (zOS), you would run a job step like this:

//XREF     EXEC NATBT,...
//*CMPRINT  DD SYSOUT=*
//CMPRINT   DD DSN=xref.listing,
//             DISP=(NEW,CATLG,CATLG),
//             UNIT=SYSDA,
//             LRECL=133,BLKSIZE=0,RECFM=FBA,
//             SPACE=(TRK,(10,5),RLSE)
//CMSYNIN   DD *
%Q
LOGON yourlib
L X STRUCTURE *R
L X PROG yourprog (*) USING REC * (*) WITH * VIA *
FIN
/*
//

On the Linux/Unix/Windows (LUW) platforms, many commands are not available in batch. I do not have Predict installed, so I cannot say with certainty that L X is acceptable. Nonetheless, here is a .bat file to get you started:

@echo off
setlocal
set NatLoc=C:\SoftwareAG\Natural\Bin

set mydir=your\output\directory
set job=NatList

set cmsynin="%mydir%\%job%.in"

echo logon lib  > %cmsynin%
echo l x ...   >> %cmsynin%
echo fin       >> %cmsynin%

set cmprint="%mydir%\%job%.cmprint.txt"
set cmprt01="%mydir%\%job%.cmprt01.txt"

%NatLoc%\natural.exe batchmode parm=devutloc etid=%job% natlog=all ^
                     cmsynin=%cmsynin% ^
                     cmobjin=%cmsynin% ^
                     cmprint=%cmprint%

del %cmsynin%

It worked perfectly (the JCL).
Thank you ever so much

With a bit of reverse engineering :wink: you can access the Predict-File directly via DDM. I found out the following for my purposes (finding fields of ddms which are used in programs etc.):

DB: 00020 FILE: 00004  - FDIC-FILE4-DB20                  DEFAULT SEQUENCE:
TYPE: ADABAS

T L DB Name                              F Leng  S D Remark
- - -- --------------------------------  - ----  - - --------------------
*   Generation started
*   at 2016-11-15 10:53:19
*   by user KBAR
*
M 1 KK P-REFERENCED                      A   65  N D
  1 KS PLFD-AREA                         A   26  N
  1 KT AREA-USAGE                        A    1  N
  1 KZ DDM-NAME                          A   32  N D
M 1 JC DDM-FIELD                         A   35  N D
M 1 K4 DFLP-COPYCODE                     A   29  N D
  1 KA DFLP-PROG                         A   32  N D
  1 FV AREA-PROG                         A   52  N S
*        -------- SOURCE FIELD(S) -------
*        PLFD-AREA(1-26)
*        DFLP-PROG(1-26)
  1 AA DIC-RECORD-TYPE                   A   10  N
  1 AR DIC-FILENO                        N    5  N D
M 1 DI DIC-FILEID                        N    6  N D
  1 DD DIC-OBJ                           A   32  N D
M 1 DB DIC-CHILDREN                      A   32  N
  1 CC DIC-FILE                          A   32  N
  1 BB DIC-FIELD                         A   32  N
  1 FO DIC-SUP2                          A   64  N S
*        -------- SOURCE FIELD(S) -------
*        DIC-FILE(1-32)
*        DIC-FIELD(1-32)
  1 BI DIC-LEVEL                         N    1  N
  1 BK DIC-LENGTH                        N  5.2  N
  1 BL DIC-FORMAT                        A    2  N
  1 BM DIC-NU                            A    1  N
  1 BN DIC-MUPE                          A    2  N
  1 BO DIC-OCC                           N    3  N
  1 BP DIC-DESC                          A    1  N 
  1 AI DIC-UQ                            A    1  N
P 1 AL DIC2ADA
  2 DK DIC-ADANAME                       A    2  N
  2 BA DIC-ADA2FILEID                    N    6  N
* OPT=331                                      YY03                YYY NNNNNU7N

FIND FDIC-FILE4-DB20 WITH DDM-NAME = #INPUT-PARAMETER.#DDM-NAME

#USAGE := SUBSTR(FDIC-FILE4-DB20.DDM-FIELD(#I2),1,1) /* N = Store, U = Update etc.
#FIELD := SUBSTR(FDIC-FILE4-DB20.DDM-FIELD(#I2),2)
FDIC-FILE4-DB20.DFLP-PROG /* contains DB + File + Lib + Prog

There are a number of interface subprograms to retrieve / maintain PRD data in SYSEXT, for example USR4101N for accessing XREF data, so it might not always be necessary to reinvent the wheel.

There’s no USR41* on our System.
To be honest: Our National Version for Open Systems is quite old. NAT 6.3.14

Hi Matthias,

Do you have the Natural LIST XREF facility in your environment? If so, you can run that facility in batch mode. When executing in online mode, the direct command is listed at the top of the screen for each xref report you are reviewing. That direct command can be issued in batch after logging into the application library. Precede the list xref direct command with ‘list xref’ or the abbreviated form ‘l x’.

When run in batch on a mainframe, it looks like the following examples, where the xref direct command is the part listed after the ‘l x’:

LOGON libraryname

L X VIEW * REF PROG * (*) USAGE * SAVE N

Or

LOGON libraryname

L X PROG XASTATP1 () REF PROG * () WITH * VIA * SAVE Y

Good luck! I hope you have the LIST XREF facility in your environment and have a way to run this in batch.

Kathy Jackson

IT Mainframe Technical Support/Natural Administrator

Texas Comptroller of Public Accounts

Matthias,

Your version may be ancient, but those exits don’t exist in version 9 for LUW, either. Dumisani, the OP, might make use of them, though. He’s on the mainframe.

These PRD related USR routines are there on LUW 9.1.n, they are not listed on the menu, though …

Perhaps they are installed by Predict, which I do not have, because they are not in my 9.1.2 FNAT.

That sounds very reasonable, and, so I assume, is the reason for them not being listed on the menu.

We got (on old version of) predict and the command “l x” is working of course. But USR41* is not there.

@Kathy_Jackson1 I know that I can run l x in batch mode on Open Systems as well. But then I have to read a workfile to read the data with another program. So for me using the DDM is the best solution. But maybe USR4101N works for Dumisani…

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.