Rocket DevOps (formerly Aldon)

 View Only

Tips & Techniques : Managing a file in LMi that is created by a program in QTEMP

  • 1.  Tips & Techniques : Managing a file in LMi that is created by a program in QTEMP

    Posted 07-15-2022 14:24
    One of the first tricks I learned as a newbie System/38 developer was from Jim Sloan at a COMMON conference in the 80's  ( about "way back"!). The tip was this: "If you need a program to process a database file that just needs to exist for the life of the job, create that file in library QTEMP. Once the job ends, the OS automatically deletes this library as well".  Super-slick. 

    So, what's the challenge? The challenge is compiling this program. You have to create the file in your interactive session's QTEMP and then compile your program interactively (not in batch) in order to find that file in that same job's QTEMP library. 

    That's not an impossible challenge, but what if you have LMi and you need to move your program up the workflow using LMi's promotion? These all get submitted to batch! We get this question quite often, so I thought I'd give everyone some ideas. 

    My best idea it this: create all of your "QTEMP files" in a special library, e.g. LMIQTEMP. Now add that library to the release's job description somewhere towards the bottom. Now when you compile your program it will find that file in LMIQTEMP. Remember that all the compiler needs is a version of the file to get the structure, it doesn't need any data. 

    An even better idea is to add these files to LMi itself! That way you get all of the advantages of managing the object in LMi, e.g. Dependency information, standard ownership and authority, custom overrides, tracking, reporting, managing changes, on and on.

    Here are some tips on doing this: 
    • Create a new Library Group to identify these "temporary files". Let's say you used Library Group 5. 
    • When you add a QTEMP file to LMi's inventory, add it to LG5 and select "source file *NONE. Then you create the file in your development library with whatever method you need and push the object only up the line. 
    • You can promote these "LG5" objects up to your normal libraries that are controlled by promotion into ITG, QUA, PDN. Since you never execute any programs in these controlled libraries, having the temporary file permanently stored there won't hurt. 
    • However, you should NOT deploy any object stamped with "LG5".  You would NOT want a QTEMP file to be found in your production database library on your live production system, you'd want it found way down in the last library, where the executing program created it, in QTEMP. 

    Jim Sloan would be so proud!

    Joe Baumgarten
    Senior CSE
    Rocket Internal - All Brands
    Ames IA US