IBM i Global

IBM i 

A space for professionals working with IBM’s integrated OS for Power systems to exchange ideas, ask questions, and share expertise on topics like RPG and COBOL development, application modernization, open source integration, system administration, and business continuity.


#Power


#IBMi
#Power
#Operatingsystems
#Servers
 View Only
  • 1.  Vs code - how to compile a program with a file defined in QTEMP for the compiling purpose

    Posted 06/24/26 09:51 AM

    Hello All.

    I'm currently having this issue.

    ... I'm trying to compile via Vs code a program (in this case it is a CLLE) using a file that is located in QTEMP just for compiling puropses.

    Basically here is what I have in the CL:

                 DCLF       FILE(QTEMP/ALLDATAXX) RCDFMT(QLIDOBJD)

    /* The process creates a temp file in QTEMP */

                 DSPOBJD    OBJ(&LIBL/*ALL) OBJTYPE(*ALL) +
                              OUTPUT(*OUTFILE) OUTFILE(QTEMP/ALLDATAXX) +
                              OUTMBR(*FIRST *REPLACE)


    The point is that I'm not able to find out how to compile it.

    How can I do that? Could you please suggest?

    Thanks

    PS: Currently to workaround it, I use RDI as I have the command prompt in the GUI that allows me to create the temporary file and then I'm able to run the compile command.



    ------------------------------
    Andrea
    ------------------------------


  • 2.  RE: Vs code - how to compile a program with a file defined in QTEMP for the compiling purpose

    Posted 06/24/26 10:08 AM
    Hi,

    our solution is, to have an empty outfile of the correct format and name in a library somewhere in the compile *LIBL. 

    And then either have QTEMP in front of that library in the *LIBL during runtime, or do a OVRDBF in the CL program before opening the file. 

    HTH and kind regards,
    Daniel





  • 3.  RE: Vs code - how to compile a program with a file defined in QTEMP for the compiling purpose

    Posted 06/24/26 10:44 AM

    Hello

    For this particular purpose, because you are using an output file based on DSPOBJD command, I would do the following:

    DCLF FILE(QSYS/QADSPOBJ)

    DSPBJD OBJ(&LIBL/*ALL) OBJTYPE(*ALL) OUTPUT(*OUTFILE) OUTFILE(QTEMP/ALLDATAXX) OUTMBR(*FIRST *REPLACE)

    OVRDBF FILE(QADSPOBJ) TOFILE(QTEMP/ALLDATAXXX) MBR(*FIRST)

    /***  read the file and process records ***/

    DLTOVR FILE(QADSPOBJ)

    DSPOBJD output file is a copy of QSYS/QADSPOBJ one. No need to create the file prior to compile. This way to proceed may be used each time you use a command which produces an output file. And you would have the same issue if you compile out of VS Code, in batch from PDM for instance.



    ------------------------------
    Marc Rauzier
    ------------------------------



  • 4.  RE: Vs code - how to compile a program with a file defined in QTEMP for the compiling purpose

    Posted 06/25/26 08:37 AM

    That's a good idea. I use the same trick for the EXTDESC keyword for RPG files.


    The file to use at compile time is documented in the F1 help for the OUTFILE parameter of the command. 

    Some commands have more than one. For example, DSPUSRPRF says this for the OUTFILE parameter:

    Note:  If a new file is created and *BASIC is specified on the       
    Type of information (TYPE) TYPE parameter, the system uses QADSPUPB  
    in QSYS with a format name QSYDSUPB as a model.
    
    If a new file is created and *OBJAUT is specified on the TYPE  
    parameter, the system uses QADSPUPA in QSYS with a format name 
    QSYDSUPA as a model.
    
    If a new file is created and *OBJOWN is specified on the TYPE  
    parameter, the system uses QADSPUPO in QSYS with a format name 
    QSYDSUPO as a model.
    
    If a new file is created and *OBJPGP is specified on the TYPE  
    parameter, the system uses QADSPUPG in QSYS with a format name 
    QSYDSUPG as a model.


    ------------------------------
    Barbara Morris
    ------------------------------



  • 5.  RE: Vs code - how to compile a program with a file defined in QTEMP for the compiling purpose

    Posted 06/25/26 09:30 AM

    Rewrite the program in RPG... just my two cents.

    I've never been a fan of those CL masterpieces that juggle with files.



    ------------------------------
    Paul Nicolay
    Architect
    Cegeka
    ------------------------------



  • 6.  RE: Vs code - how to compile a program with a file defined in QTEMP for the compiling purpose

    Posted 06/25/26 11:52 AM

    Thanks all for your answers. I think I will adopt Marc's suggestion.

    In any case, I have to say that RDI functionality (the GUI command prompt that let you prepare your temporary environment that can interact with compile commands) it's simply powerful.

    What do you think if VS code could adopt the same logic that has RDI to run the commands in its GUI, and those results (probably written in a QTEMP VS session) can be used with compile commands that are run in the same VS place?

    Do you think there is a site where to submit this improvement for Vs code?



    ------------------------------
    Andrea Da Dalt
    ------------------------------



  • 7.  RE: Vs code - how to compile a program with a file defined in QTEMP for the compiling purpose

    Posted 06/25/26 07:27 PM
    Edited by Allister Jenks 06/25/26 07:28 PM

    It is precisely this kind of problem that leads to many shops building their own 'compile processor'.

    We have a fairly mature one which enables optional use of any of these:

    • Run an arbitrary command before or after compiling.
    • Specify compile command parameters.
    • Run a command based on the existence (or not) of objects.
    • Apply standard authorities to the resulting object.
    • Distribute the object to other LPARs/servers.

    It also sets some default parameters on the compile commands based on our policies.

    I recently enhanced it to allow compiling from stream files, including types not natively supported by the OS. This added the need for additional directives such as providing description text (seeing as there is no member text to use).

    The problem described here is a common one which we would solve with the following comment:

    /*@ PRE: DSPOBJD OBJ(*LIBL/*ALL) OBJTYPE(*ALL) OUTPUT(*OUTFILE) OUTFILE(QTEMP/ALLDATAXX) OUTMBR(*FIRST *REPLACE) */

    We have our processor defined as a command which is registered to RDi and VSCode as the compile command to use for all object types.

    I know this doesn't solve the problem for you now, but there may be products on the market to do this sort of thing, or there is no time like the present to start building your own. In the latter case, start simple and build it over time. You could begin with only CL support and pre-commands. Adding stream file support to ours was a big undertaking but made much easier by having a mature base to start with.



    ------------------------------
    Allister Jenks
    ------------------------------



  • 8.  RE: Vs code - how to compile a program with a file defined in QTEMP for the compiling purpose

    Posted 06/26/26 08:03 AM

    Marc's suggestion is good.  But may I offer an alternative?

    Instead of rewriting in RPG I would suggest rewriting in SPL or Stored Procedure Language.  It's easy to pick up.  Looks good on a resume.  And it's easy to teach to newbies.  But, best of all, you can use SQL services like QSYS2.OBJECT_STATISTICS() https://www.ibm.com/support/pages/node/1128549 I find file processing in SPL much better than CL.



    ------------------------------
    Robert Berendt IBMChampion
    Business Systems Analyst, Lead
    Dekko
    Fort Wayne
    ------------------------------