ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

iSeries Navigtor Tip : Running a CL Command

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

  • iSeries Navigtor Tip : Running a CL Command

    Did you know you could run CL Commands from the "Run SQL Script" screen?

    Try This:

    From the SQL Script Screen in iSeries Navigator --

    Type:

    PHP Code:
    CL:DSPOBJD OBJ(<Lib>/<FileName>) OBJTYPE(*FILEOUTPUT(*OUTFILEOUTFILE(QTEMP/FILELIST);

    SELECT *
      
    FROM QTEMP.FILELIST
    Then Highlight and press Ctl-Y or click on Run. This will show you the Object Descriptions of the DSPOBJD output and allow you to work with it.

  • #2
    Re: iSeries Navigtor Tip : Running a CL Command

    I actually just saw this for the first time last week. But since I try to avoid CL in coding I mostly just ignored it But I can see how your example could be useful
    Your future President
    Bryce

    ---------------------------------------------
    http://www.bravobryce.com

    Comment


    • #3
      Re: iSeries Navigtor Tip : Running a CL Command

      Here is a good example

      Code:
      cl: DSPOBJD OBJ(pwc/*ALL)        
              OBJTYPE(*ALL)             
              OUTPUT(*OUTFILE)          
              OUTFILE(QTEMP/DSPOBJ)     
              OUTMBR(*FIRST *REPLACE);  
      
      
      SELECT ODLBNM "Library", ODOBNM "Object", ODOBTP "Type", ODOBAT "Attribute", ODOBTX 
       "Description",odobow "Owner",oducnt "# Used" ,
      date(case when substr(ODcDAT,5,2)>40 then '19' else '20' end 
      ||substr(ODcDAT,5,2) || '-' || substr(ODcDAT,1,2) || '-' || substr(ODcdAT,3,2)) "Created" ,
      date(case when substr(ODlDAT,5,2)>40 then '19' else '20' end 
      ||substr(ODlDAT,5,2) || '-' || substr(ODlDAT,1,2) || '-' || substr(ODldAT,3,2)) "Changed" ,
      date(case when substr(ODuDAT,5,2)>40 then '19' else '20' end 
      ||substr(ODuDAT,5,2) || '-' || substr(ODuDAT,1,2) || '-' || substr(ODudAT,3,2)) "Used" ,
      date(case when substr(ODtDAT,5,2)>40 then '19' else '20' end 
      ||substr(ODtDAT,5,2) || '-' || substr(ODtDAT,1,2) || '-' || substr(ODtdAT,3,2)) "Used Reset"
      FROM qtemp/dspobj ORDER BY "Used" asc  ;
      Denny

      If authority was mass, stupidity would be gravity.

      Comment


      • #4
        Re: iSeries Navigtor Tip : Running a CL Command

        Originally posted by FaStOnE
        Did you know you could run CL Commands from the "Run SQL Script" screen?
        Beginning with one of the last relases (6.1 or 7.1 I can't remember which one) it is even possible to include CL commands in this way in source members and run them through RUNSQLSTM.

        Birgitta

        Comment


        • #5
          Re: iSeries Navigtor Tip : Running a CL Command

          Originally posted by B.Hauser View Post
          Beginning with one of the last relases (6.1 or 7.1 I can't remember which one) it is even possible to include CL commands in this way in source members and run them through RUNSQLSTM.

          Birgitta
          Every time I try to kill CL, IBM goes and updates the thing to make it more interesting.

          Seriously, CL has almost received more updates in the past few releases than RPG.
          Michael Catalani
          IS Director, eCommerce & Web Development
          Acceptance Insurance Corporation
          www.AcceptanceInsurance.com
          www.ProvatoSys.com

          Comment


          • #6
            Re: iSeries Navigtor Tip : Running a CL Command

            Originally posted by B.Hauser View Post
            Beginning with one of the last relases (6.1 or 7.1 I can't remember which one) it is even possible to include CL commands in this way in source members and run them through RUNSQLSTM.
            it's 6.1
            Patrick

            Comment


            • #7
              Re: iSeries Navigtor Tip : Running a CL Command

              Hey Jamie...
              Now we can do CL in even more places
              Regards

              Kit
              http://www.ecofitonline.com
              DeskfIT - ChangefIT - XrefIT
              ___________________________________
              There are only 3 kinds of people -
              Those that can count and those that can't.

              Comment


              • #8
                Re: iSeries Navigtor Tip : Running a CL Command

                @#%@#%@#%@#% I could have looked cleverer years ago

                I often use this to repeat tests. Use SQL to set a value in a file then use the CL: syntax to call my RPG program and do some processing. Then use SQL to query the results. Nice and simple then to rerun the steps over and over quickly.

                As an idea...
                PHP Code:
                update myFile set myQty 0 where myType 'A';
                clcall myProgram ('A' '2010');
                select sum(myQtyfrom myFile
                I read CL as Command Line rather than Control Language so that is the way I thought of it. Makes it just a little bit more acceptable to use .

                There are some examples in the Run SQL drop down examples list which clued me on to using this ages ago.

                /* Display Dependent Files */
                CL: DSPDBR FILE(library1/table1) OUTPUT(*OUTFILE) OUTFILE(qtemp/dspdbr);
                SELECT * FROM qtemp.dspdbr;

                /* Display Program References */
                CL: DSPPGMREF PGM(qtemp/(*ALL)) OUTPUT(*OUTFILE) OBJTYPE(*ALL) OUTFILE(qtemp/dsppgmref);
                SELECT * FROM qtemp/dsppgmref;
                the smoking gnu

                Comment

                Working...
                X