ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Retrieve Command Defaults ?

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

  • Retrieve Command Defaults ?

    Does anyone have any tool that will allow me to retrieve the defaults for a command.

    We are looking at moving from V5R3 to V6R1 and we want to preserve the command defaults for the IBM shipped commands as they have been changed locally over the last 10 years. But I don't want to have to go into every command manually and see how they differ from the shipped options. (I inherited this undocumented situation)

    So I'd like a utility I can point to a library and parse all the commands in it and output the defaults to a file.

    I haven't come up with anything so far on google.

    There are a couple of references to the QCDRCMDD API (see here) I coult "try" to build on, but I'd rather not re-invent it if someone already has it.
    Greg Craill: "Life's hard - Get a helmet !!"

  • #2
    Re: Rerieve Command Defaults ?

    might be able to pull some code from here


    found this @ http://www.think400.dk/apier_1.htm#eks0037
    PHP Code:
    Here's a sample program you can place in debug and have a look at the API output:


         **-- API Error Data Structure:  -----------------------------------------**
         D ApiError        Ds
         D  AeBytPro                     10i 0 Inz(%Size(ApiError))
         D  AeBytAvl                     10i 0
         D                                1a
         D  AeExcpId                      7a
         D  AeExcpDta                   126a
         **-- Global variables:  -------------------------------------------------**
         D OutStrLenRt     s             10i 0
         D NotSup          s             10i 0
         D FB              s             10i 0 Dim( 3 )
         **-- Command return variable:  ------------------------------------------**
         D CdCmdd0100      Ds
         D  CdBytRtn                     10i 0
         D  CdBytAvl                     10i 0
         D  CdCmdXml                  10240a
         **-- Retrieve Command Text:  --------------------------------------------**
         D RtvCmdTxt       Pr                  ExtPgm( '
    QCDRCMDD' )
         D  RcCmdNamQ                    20a   Const
         D  RcDst                        10i 0 Const
         D  RcDstFmt                      8a   Const
         D  RcRcvVar                  32767a         Options( *VarSize )
         D  RcRcvFmt                      8a   Const
         D  RcError                   32767a         Options( *VarSize )
         **-- Convert String: ----------------------------------------------------**
         D CvtString       Pr                  ExtPgm( '
    QTQCVRT' )
         D  CsInpCcsId                   10i 0 Const
         D  CsInpStrTyp                  10i 0 Const
         D  CsInpStr                  32767a   Const Options( *VarSize )
         D  CsInpStrSiz                  10i 0 Const
         D  CsOutCcsId                   10i 0 Const
         D  CsOutStrTyp                  10i 0 Const
         D  CsOutCvtAlt                  10i 0 Const
         D  CsOutStrSiz                  10i 0 Const
         D  CsOutStr                  32767a         Options( *VarSize )
         D  CsOutStrLenRt                10i 0
         D  CsNotSup                     10i 0
         D  CsFB                         10i 0 Dim( 3 )
         **
         **-- Mainline:  ---------------------------------------------------------**
         **
         C                   CallP     RtvCmdTxt( '
    WRKJOB    QSYS      '
         C                                      : %Size( CdCmdd0100 )
         C                                      : '
    DEST0100'
         C                                      : CdCmdd0100
         C                                      : '
    CMDD0100'
         C                                      : ApiError
         C                                      )
         **
         C                   CallP     CvtString( 1208
         C                                      : 0
         C                                      : CdCmdXml
         C                                      : CdBytRtn
         C                                      : 37
         C                                      : 0
         C                                      : 0
         C                                      : CdBytRtn
         C                                      : CdCmdXml
         C                                      : OutStrLenRt
         C                                      : NotSup
         C                                      : FB
         C                                      )
         **
         C                   Return

    Thanks to Carsten Flensburg 
    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


    • #3
      Re: Rerieve Command Defaults ?

      I had already run that one from think400.dk in debug mode but it truncated the xml output. So it was a but frustrating. I am not sure how to entend the output ? I didn't count but it seemed to only show 1000 chars or so of the output.
      Greg Craill: "Life's hard - Get a helmet !!"

      Comment


      • #4
        Re: Rerieve Command Defaults ?

        Access to this web page is restricted at this time - websense has nailed the other link ...
        Greg Craill: "Life's hard - Get a helmet !!"

        Comment


        • #5
          Re: Rerieve Command Defaults ?

          Originally posted by gcraill View Post
          I had already run that one from think400.dk in debug mode but it truncated the xml output. So it was a but frustrating. I am not sure how to entend the output ? I didn't count but it seemed to only show 1000 chars or so of the output.
          did you check the actual output file or only view the output in debug? debug will only display the first 1024 bytes of large fields. (you can view more using eval myfield:1024 ... note syntax might not be exactly accurate since i don't have debug available at the moment but you get the idea). i would check the actual output, chances are it's there you're just hitting the debug view limitation...
          I'm not anti-social, I just don't like people -Tommy Holden

          Comment


          • #6
            Re: Rerieve Command Defaults ?

            Hey Greg:

            Do you have an old version of TAATOOL on your system?
            Check out CHKCMDDFT


            Best of Luck
            GLS
            The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

            Comment


            • #7
              Re: Rerieve Command Defaults ?

              debug just shows a preset amount of data....

              i assure you that the length of 10,240 *char is enough

              try this (below)
              this could be modified so that it would list *all commands on system then add
              records to a table... then they could be shot to the IFS as XML web pages..

              It would take some time but doable.

              PHP Code:
                   **-- API Error Data Structure:  -----------------------------------------**
                   
              D ApiError        Ds
                   D  AeBytPro                     10i 0 Inz
              (%Size(ApiError))
                   
              D  AeBytAvl                     10i 0
                   D                                1a
                   D  AeExcpId                      7a
                   D  AeExcpDta                   126a
                   
              **-- Global variables:  -------------------------------------------------**
                   
              D OutStrLenRt     s             10i 0
                   D NotSup          s             10i 0
                   D FB              s             10i 0 Dim
              )
                   **-- 
              Command return variable:  ------------------------------------------**
                   
              D CdCmdd0100      Ds
                   D  CdBytRtn                     10i 0
                   D  CdBytAvl                     10i 0
                   D  CdCmdXml                  10240a
                   
              **-- Retrieve Command Text:  --------------------------------------------**
                   
              D RtvCmdTxt       Pr                  ExtPgm'QCDRCMDD' )
                   
              D  RcCmdNamQ                    20a   Const
                   
              D  RcDst                        10i 0 Const
                   
              D  RcDstFmt                      8a   Const
                   
              D  RcRcvVar                  32767a         Options( *VarSize )
                   
              D  RcRcvFmt                      8a   Const
                   
              D  RcError                   32767a         Options( *VarSize )
                   **-- 
              Convert String: ----------------------------------------------------**
                   
              D CvtString       Pr                  ExtPgm'QTQCVRT' )
                   
              D  CsInpCcsId                   10i 0 Const
                   
              D  CsInpStrTyp                  10i 0 Const
                   
              D  CsInpStr                  32767a   Const Options( *VarSize )
                   
              D  CsInpStrSiz                  10i 0 Const
                   
              D  CsOutCcsId                   10i 0 Const
                   
              D  CsOutStrTyp                  10i 0 Const
                   
              D  CsOutCvtAlt                  10i 0 Const
                   
              D  CsOutStrSiz                  10i 0 Const
                   
              D  CsOutStr                  32767a         Options( *VarSize )
                   
              D  CsOutStrLenRt                10i 0
                   D  CsNotSup                     10i 0
                   D  CsFB                         10i 0 Dim
              )
                   **
                   **-- 
              Mainline:  ---------------------------------------------------------**
                   **
                   
              C                   CallP     RtvCmdTxt'WRKJOB    QSYS      '
                   
              C                                      : %SizeCdCmdd0100 )
                   
              C                                      'DEST0100'
                   
              C                                      CdCmdd0100
                   C                                      
              'CMDD0100
                   C                                      : ApiError
                   C                                      )
                   **
                   C                   CallP     CvtString( 1208
                   C                                      : 0
                   C                                      : CdCmdXml
                   C                                      : CdBytRtn
                   C                                      : 37
                   C                                      : 0
                   C                                      : 0
                   C                                      : CdBytRtn
                   C                                      : CdCmdXml
                   C                                      : OutStrLenRt
                   C                                      : NotSup
                   C                                      : FB
                   C                                      )
                   **
              **                                                                
               /free                                                            
                    exec sql                                                    
                    declare global temporary table xmlout                       
                    (thexml  char(10240))                                       
                    with replace;                                               
                                                                                
                                                                                
                    Exec SQL   INSERT INTO xmlout                               
                               VALUES(: CdCmdXml );                             
                                                                                
               /end-free                                                        
                   C                   Return 
              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


              • #8
                Re: Rerieve Command Defaults ?

                Just curious -- I have a CL program that is nothing but CHGCMDDFT commands. Is this how many people do this? Never thought of this before, but it's possible that a dft could be changed but not put into the "change default pgm." Next thing you know, you're running a command thinking it's going to do one thing, but it won't because you didn't know there was a change to the default.

                It's been a long time, do you lose your changes to the defaults when you upgrade to a new release?
                http://www.linkedin.com/in/chippermiller

                Comment


                • #9
                  Re: Rerieve Command Defaults ?

                  Originally posted by Chipper View Post
                  Just curious -- I have a CL program that is nothing but CHGCMDDFT commands. Is this how many people do this? Never thought of this before, but it's possible that a dft could be changed but not put into the "change default pgm." Next thing you know, you're running a command thinking it's going to do one thing, but it won't because you didn't know there was a change to the default.

                  It's been a long time, do you lose your changes to the defaults when you upgrade to a new release?
                  yep. you'll have to change the defaults after the upgrade.
                  I'm not anti-social, I just don't like people -Tommy Holden

                  Comment


                  • #10
                    Re: Rerieve Command Defaults ?

                    Thought so -- I remember one shop where we didn't allow Interactive Query/400 and it was available again after the V5R1 upgrade.
                    http://www.linkedin.com/in/chippermiller

                    Comment


                    • #11
                      Re: Rerieve Command Defaults ?

                      Sorry - been away in meetings. Yep we're upgrading and I know the defaults will change on me, so i need to get a list of them now.

                      @Tom:Jamie - yep I was hitting the debug limit at 1024.

                      I found these links which helped also. ted Holt created a CL program using the other format DEST0200, which outputs straight to the IFS as an XML file. Then Steven gray came up with a plugin .xslt file that reformatted it to be very similar to the command source.

                      CL program by Ted Holt - http://www.itjungle.com/mgo/mgo090503-story02.html
                      PHP Code:
                      pgm

                         dcl  
                      &cmd      *char     20
                         dcl  
                      &destinfo *char     64
                         dcl  
                      &destfmt  *char      8  value('DEST0200')
                         
                      dcl  &rcvvar   *char      1
                         dcl  
                      &rcvfmt   *char      8  value('CMDD0100')
                         
                      dcl  &error    *char     16  value(x'00000000')
                         
                      dcl  &null2    *char      2  value(x'0000')
                         
                      dcl  &null3    *char      3  value(x'000000')
                         
                      dcl  &null10   *char     10  value(x'00000000000000000000')

                         
                      chgvar  &cmd                  value('GENDDL    *LIBL')
                         
                      chgvar  %bin(&destinfo  1  4value(0)       /* CCSID         */
                         
                      chgvar  %sst(&destinfo  5  2value(&null2)  /* country       */
                         
                      chgvar  %sst(&destinfo  7  3value(&null3)  /* language      */
                         
                      chgvar  %sst(&destinfo 10  3value(&null3)  /* reserved      */
                         
                      chgvar  %bin(&destinfo 13  4value(0)       /* path type     */
                         
                      chgvar  %bin(&destinfo 17  4value(22)      /* path name len */
                         
                      chgvar  %sst(&destinfo 21  2value('/')     /* delimiter     */
                         
                      chgvar  %sst(&destinfo 23 10value(&null10/* reserved      */
                         
                      chgvar  %sst(&destinfo 33 32value('/home/xxx/xxx.xml')

                         
                      call qcdrcmdd (&cmd &destinfo &destfmt +
                                        &
                      rcvvar &rcvfmt &error)

                      endpgm 
                      stylesheet converter by Steven Gray - http://www.itjungle.com/mgo/mgo100803-story01.html

                      Following Steven's instructions made it work quite well, at that point. I am seeing where I can take it from here as this process only does 1 command at a time. Best thing will probably be to bend Jamie's offerin to write multiple command retrieves to the same XML outfile, which will have to be parsed to rip out the data required.

                      @GLS - sorry no TAATOOLs here.

                      GC
                      Last edited by jamief; February 15, 2011, 06:52 AM. Reason: shhh...
                      Greg Craill: "Life's hard - Get a helmet !!"

                      Comment


                      • #12
                        Re: Retrieve Command Defaults ?

                        Hi

                        To get all changed commands from specific library use:

                        DSPOBJD OBJ(MYLIB/*ALL) OBJTYPE(*CMD) DETAIL(*FULL)
                        OUTPUT(*OUTFILE) OUTFILE(QTEMP/CMDS)

                        then with SQL extract:

                        SELECT * FROM CMDS WHERE ODUMOD = '1'

                        You will get all cmd's that were changed by user.
                        LP Zdenko

                        Comment


                        • #13
                          Re: Retrieve Command Defaults ?

                          Originally posted by Zdenko View Post
                          Hi

                          To get all changed commands from specific library use:

                          DSPOBJD OBJ(MYLIB/*ALL) OBJTYPE(*CMD) DETAIL(*FULL)
                          OUTPUT(*OUTFILE) OUTFILE(QTEMP/CMDS)

                          then with SQL extract:

                          SELECT * FROM CMDS WHERE ODUMOD = '1'

                          You will get all cmd's that were changed by user.
                          Just ran but did OBJ(*ALL/*ALL) instead of just one libr. Looks like all my user written commands were included. QSYS did work correctly -- only listed the ones where I changed the defaults.
                          http://www.linkedin.com/in/chippermiller

                          Comment


                          • #14
                            Re: Retrieve Command Defaults ?

                            Hi

                            The field description for field ODUMOD: User modified: 0=Not modified, 1=Modified
                            LP Zdenko

                            Comment


                            • #15
                              Re: Retrieve Command Defaults ?

                              Originally posted by Zdenko View Post
                              Hi

                              To get all changed commands from specific library use:

                              DSPOBJD OBJ(MYLIB/*ALL) OBJTYPE(*CMD) DETAIL(*FULL)
                              OUTPUT(*OUTFILE) OUTFILE(QTEMP/CMDS)

                              then with SQL extract:

                              SELECT * FROM CMDS WHERE ODUMOD = '1'

                              You will get all cmd's that were changed by user.
                              Nice - thanks for that ...

                              I ran that, and I ran the API to retrieve all command defaults for the QSYS library.
                              I noticed that approx 210 out of 2001 commands do NOT return anything from the API, I even ran in debug mode, no errors it just returns blank from the API. The commands that return blank for the API are in both the modified and not modified groups according to the ODUMOD flag.

                              (See sample listing of the commands with ODUMOD='1' ran through the API)

                              Click image for larger version

Name:	CmdDfts.jpg
Views:	1
Size:	365.1 KB
ID:	126357

                              Can anyone suggest why the API is returning blank in these instances ?
                              Greg Craill: "Life's hard - Get a helmet !!"

                              Comment

                              Working...
                              X