souce file listing

Application development
hi all! i wanna know how can i retrieve the names of the components of a Source Physical File i.e. the names of the souce code (members) within a particular Source Physical File...i want ot retrieve the names and store in a database file and later use them for subfile operations. kindly help me out!!!!!! ...SR

Answer Wiki

Thanks. We'll let you know when a new response is added.


Or, more elegantly, use this API: QUSLMBR.


The simple answer above is correct. But why would you want to store the list in a database file? The connection to a “subfile” doesn’t provide any useful information since you can build a subfile from a *MBRLIST member list ‘on the fly’ or from the API whenever it’s needed.

I also generate files from member lists, so I realize there are reasons. I’m asking mostly to get you thinking about potential alternatives. Building subfiles isn’t sufficient reason (IMO) to add new database files.


Discuss This Question: 5  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • astradyne
    Use the DSPFD command and specify *MBRLIST for the type of information that you want to retrieve DSPFD FILE(library/srcfile) TYPE(*MBRLIST) OUTPUT(*OUTFILE) OUTFILE(QTEMP/MEMBERS) Will create a database file called MEMBERS in QTEMP that contains all of the members in the specified source file. This file can then be read in your subfile program. Jonathan
    370 pointsBadges:
  • Sairolla
    thanks a lot!! for the help... but meanwhile i have got another my project- i have to use COMPILE commands such as CRTPF, CRTCLPPGM, CRTRPGPGM and so a program and this has to be transparent to the user. in CL these programs cannot be used... how can i do this? plz help me out!
    0 pointsBadges:
  • astradyne
    Hi I'm a little confused - there's nothing stopping you from using compilation commands, e.g. CRTPF, CRTCLPGM, etc, or indeed any command from within a CL program. Actually, that's not entirely true, there are some commands that aren't allowed to be used from within programs, but the compilation commands aren't any of them. In your CL program just code the command with the appropriate parameters, For example: CRTPF FILE(QTEMP/WORKFILE) RCDLEN(80) or whatever. In RPG you can run commands by using either the QCMDEXC or QCAPCMD system API's. The QCMDEXC is easier to code, but doesn't return any completion status to the program whereas the QCAPCMD does. To use the QCAPCMD you need to include the following in your RPG program: *----------------------------------------------------- * Common API Error Structure *----------------------------------------------------- D/IF NOT DEFINED(API_ERROR) D/DEFINE API_ERROR D ApiError DS D ApiBytes 10I 0 Inz(%Size(ApiError)) D ApiBytesOut 10I 0 D ApiErrID 7A D ApiReserved 1A D ApiErInDta 256A D/ENDIF *----------------------------------------------------- * Process Command API *----------------------------------------------------- D QcaPCmd Pr ExtPgm('QCAPCMD') D aCmd 32767a Const Options(*VarSize) D aCmdLen 10i 0 Const D aCtlBlk 32767a Const Options(*VarSize) D aCtlBlkLen 10i 0 Const D aCtlBlkFmt 8a Const D aRtnCmd 32767a Options(*VarSize) D aRtnCmdAvl 10i 0 Const D aRtnCmdLen 10i 0 D aApiError Like(ApiError) D CPOP0100 Ds D capPrcType 10i 0 Inz(0) D capDBCS 1a Inz('0') D capPrompt 1a Inz('0') D capSyntax 1a Inz('0') D capMsgKey 4a D capReserved 9a Inz(*Allx'00') D CmdFailed c Const('3') D CmdSuccessful c Const('4') D iCmd 32767a Options(*VarSize) D wCmd s 32767a D wCmdLen s 10i 0 And then to call it use something like: C CallP(e) QcaPCmd(iCmd : C %Len(%Trim(iCmd)) : C CPOP0100 : C %Len(CPOP0100) : C 'CPOP0100' : C wCmd : C 32767 : C wCmdLen : C ApiError) Hope it helps. Jonathan
    370 pointsBadges:
  • MTharp
    I use the C procedure (binding directory QC2LE) called system to execute commands within an RPG program. This takes less lines of code and is extremely flexible. Here is how it can be used: H bnddir('QC2LE') D System pr 10i 0 ExtProc('system') D * Value Options(*string) D MsgId s 7a Import('_EXCP_MSGID') /free If System('CRTPF FILE(QTEMP/PF1) RCDLEN(80)') 0 ; ErrorMsg = 'Error ' + %trim(MsgId) + ' received.' ; EndIf ; /end-free
    0 pointsBadges:
  • TomLiotta
    BTW, if you have a second question, then create a new question. Don't bury it in the discussion of an unrelated question. That does a disservice to those come later looking for solutions. Tom
    125,585 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: