× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.




anybody know if there is a template file that i5 uses to create the outfile of the following command?>
DSPFD FILE(MYFILE) TYPE(*MBRLIST) OUTPUT(*OUTFILE) OUTFILE(MY/TEST)

I wrote a quick little CL program called "FINDTMPL" to find these for me (I can never remember them!) To use my program, I do this:

DSPFD FILE(MYFILE) TYPE(*MBRLIST) OUTPUT(*OUTFILE) OUTFILE(QTEMP/FOO)
CALL FINDTMPL PARM('FOO' 'QTEMP')

It will return the results as a completion message. In this case, QWHFDML.

Here's the code for the FINDTMPL program (it's not fancy, or particularly clever, but it works):

PGM  PARM(&FILE &LIB)

     DCL VAR(&FILE)   TYPE(*CHAR) LEN(10)
     DCL VAR(&LIB)    TYPE(*CHAR) LEN(10)
     DCL VAR(&RCDFMT) TYPE(*CHAR) LEN(10)
     DCL VAR(&EOF)    TYPE(*LGL)  VALUE('0')
     DCLF FILE(QAFDRFMT)

       DLTF FILE(QTEMP/XXFINDTMPL)
       MONMSG MSGID(CPF2105)


     /* PUT THE REQUESTED FILE'S RECORD FORMAT INTO THE WORK FILE */

       DSPFD FILE(&LIB/&FILE) +
             TYPE(*RCDFMT) +
             OUTPUT(*OUTFILE) +
             OUTFILE(QTEMP/XXFINDTMPL)


     /* PUT ALL OF THE RECORD FORMATS OF ALL FILES IN QSYS INTO  +
        THE WORK FILE.                                           */

       DSPFD FILE(QSYS/*ALL) +
             TYPE(*RCDFMT) +
             OUTPUT(*OUTFILE) +
             FILEATR(*PF) +
             OUTFILE(QTEMP/XXFINDTMPL) +
             OUTMBR(*FIRST *ADD)

       OVRDBF FILE(QAFDRFMT) TOFILE(QTEMP/XXFINDTMPL)


     /* READ THE REQUESTED FILE'S RECORD FORMAT NAME */

       RCVF
       CHGVAR VAR(&RCDFMT) VALUE(&RFNAME)



     /* LOOK FOR A FILE IN QSYS WITH THE SAME RECORD FORMAT */

LOOP:  RCVF
       MONMSG MSGID(CPF0864) EXEC(CHGVAR &EOF '1')

       IF (&EOF *EQ '0') DO
          IF (&RFNAME *EQ &RCDFMT) DO
               SNDPGMMSG  MSGID(CPF9897)  +
                          MSGF(QCPFMSG)   +
                          MSGDTA(&RFNAME) +
                          MSGTYPE(*COMP)
          ENDDO
          GOTO LOOP
       ENDDO


     /* THAT'S ALL, FOLKS! */

       DLTOVR FILE(QAFDRFMT)

       DLTF FILE(QTEMP/XXFINDTMPL)
       MONMSG MSGID(CPF2105)

ENDPGM

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.