ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

retrieving current lib

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Re: retrieving current lib

    This may sound funny...But when cutting my lawn I cant cross my own path and in programming if I can get away from calling/using CL programs I do.

    Just a couple of my many quirks!

    oh yea and did I mention I like RLU

    jamie
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

    Comment


    • #17
      Re: retrieving current lib

      You can still get to LA from Chicago by going to New York as well ... but WHY?

      You guys have WAY too much time on your hands ...

      Comment


      • #18
        My quick solution to retrieving current library only. rest of code is the same this is just a snippet of the main code.
        basically skipping to the current portion of the library list and gabbing the name via subst
        Detail in line 77.01 and 81.01
        Code:
        0074.00 getLibList(ds_job10700:%Size(ds_job10700):'JOBI070 0'
        0075.00 :'*' : *Blanks : ds_Error);
        0076.00
        0077.00 //LibsToSkip = NbrSysLibs + NbrPrdLibs + NbrCurLibs;
        0077.01 LibsToSkip = NbrSysLibs + NbrPrdLibs;
        0078.00 Position = (LibsToSkip * 11) + 81;
        0079.00
        0080.00 LibraryList = %SubSt(ds_job10700:Position:NbrUsrLibs * 11);
        0081.00
        0081.01 currentLib = %SubSt(LibraryList:(1*11)-10:10);
        0081.02
        0082.00 //For idx=1 to NbrUsrLibs;
        0083.00 // Display_String = %SubSt(LibraryList:(idx*11)-10:10);
        0084.00 // Dsply Display_String;
        0085.00 //EndFor;
        0085.02
        0085.03 // set up return parameter
        0085.04 libraryName = %trim(currentLib);
        Last edited by RogerHunt; February 5, 2021, 02:29 PM. Reason: trying to get ride on frown faces in my code

        Comment


        • #19
          This thread is 15! years old!
          May be Jamie just wanted to show a different solution and a way how to work with System APIs ... or just didn't want to create and call a CL program.

          ... today there are also other/better methods.
          For example determining the current library with SQL:

          Code:
          Select System_Schema_Name from Library_List_Info
          Where Type = 'CURRENT'

          Comment

          Working...
          X