Pages

Wednesday, February 26, 2014

PDM user defined options

pdm user defined options defaults wrkmbrpdm wrkobjpdm wrklibpdm

When using PDM have you ever wanted to have your option do something different from the default way of doing it. For example if you want to use your own values in certain parameters for creating a RPGLE program. You can do so using without changing the command by using PDM’s user defined options.

IBM announced when IBM i 7.1 6.1 was launched that PDM and SEU would no longer be updated, they are still very popular (for more details see here). Over the years I have found that many developers do not use the options within PDM. In this post I am going to describe how to change the defaults for your PDM and how to configure user-defined options.

A large number of PDM users access PDM by typing: STRPDM and pressing enter, and then taking the option from menu to work with libraries, objects, or members. You can skip the menu by using one of the following commands:

  • WRKLIBPBM - to work with libraries. For example if I want to view all the members that start with the letter A I type WRKLIBPDM A* and press Enter.
  • WRKOBJPDM - to work with the objects within a library. For example if I want to display all of the objects in my library, MYLIB, I type WRKOBJPDM MYLIB and press Enter.
  • WRKMBRPDM - to work with members within a source file. This is the PDM command I use the most. I have all my source members in one source file in my library in a source file called DEVSRC, you can read why I do this in Source files one or many. Therefore, if want to see all of the members I have that start with OTD, regardless of source type, I type WRKMBRPDM DEVSRC OTD* and press Enter, this assumes I have the library MYLIB in my library list.

All of these commands can be prompted, by using the F4 key, to use the other parameters I have not mentioned above.

PDM defaults

I have found that the easiest way to work with your PDM defaults is to use one of the commands I have mentioned. For example if I want to work with mine I can: WRKOBJPDM and press Enter. Regardless of which objects are displayed I press F18 to view and change my defaults. Below are the standard defaults:

                                Change Defaults

 Type choices, press Enter. 

   Object library . . . . . . .   *SRCLIB      Name, *CURLIB, *SRCLIB
   Replace object . . . . . . .   N            Y=Yes, N=No
   Compile in batch . . . . . .   Y            Y=Yes, N=No
   Run in batch . . . . . . . .   N            Y=Yes, N=No
   Save session defaults  . . .   Y            Y=Yes, N=No
   Save/Restore option  . . . .   1            1=Single, 2=All
   Job description  . . . . . .   QBATCH        Name, *USRPRF, F4 for
     Library  . . . . . . . . .     *LIBL       Name, *CURLIB, *LIBL
   Change type and text . . . .   Y            Y=Yes, N=No
   Option file  . . . . . . . .   QAUOOPT       Name
     Library  . . . . . . . . .     QGPL        Name, *CURLIB, *LIBL
   Member . . . . . . . . . . .   QAUOOPT       Name
   Full screen mode . . . . . .   N           Y=Yes, N=No
                                                              More...

Options on the second screen:

   Log option commands . . . . .  N            Y=Yes, N=No
   Exit lists on ENTER   . . . .  N            Y=Yes, N=No
   Display informational messages N            Y=Yes, N=No

Feel free to change and “play” with these defaults until you find what you are happy with. Below are my defaults compared to the standard ones.

Default Standard My preference
Object library *SRCLIB *SRCLIB
Replace object N N
Compile in batch Y N – As I work on a development server compiling interactively does not adversely affect business processing
Run in batch N N
Save session defaults Y Y
Job description QBATCH MYJOBD – I use my own job description
Job description library *LIBL MYLIB – My job description is in my library
Change type and text Y N – I have changed this to prevent me from accidentally changing the object type or text. I use F13 to change the type and text
Option file QAUOOPT PDMOPTIONS – I have my own copy of the file. I explain later in this post why
Option file library QGPL MYLIB – I have the PDM option file in my own library
Option file member QAUOOPT PDMOPTIONS - I will explain later
Full screen mode N Y – I prefer not to see what the options and function keys are as I am familiar with them. This also increases the number of member visible
Log option commands N N
Exit list on ENTER Y N - I do not want to exit PDM when I press Enter
Display informational messages N N

For an explanation of what each parameter does see here.

User defined options

Before you start making your own PDM option I strongly recommend that you make your own copy of the default PDM options file into your library. Then any options you make you will be able to use and they will not be changed or deleted by others.

As I have shown above the PDM option file is called QAUOOPT and is in the library QGPL. If I wanted to make my own copy of the file in my library I would execute the following commands:

   CRTDUPOBJ OBJ(QAUOOPT) FROMLIB(QGPL) OBJTYPE(*FILE) TOLIB(MYLIB) 
               NEWOBJ(PDMOPTIONS) CST(*NO) TRG(*NO)

   RNMM FILE(MYLIB/PDMOPTIONS) MBR(QAUOOPT) NEWMBR(PDMOPTIONS)

You do not have to rename the member, I just do as I prefer to.

Now change your PDM defaults to use the option file you just created. Type WRKMBRPDM and press Enter. Press F18 to go to the ‘Option file’ parameters and change them to be the name of the file, the library the file is in, and the member name you have just created. When you press Enter you have updated your PDM defaults, but only from this point forward. If you have PDM active on another session it will still use the old settings. To update them just go to each of your sessions exit PDM and then start it again.

To view the user defined options at any PDM screen (WRKLIBPDM, WRKOBJPDM, WRKMBRPDM) and press F16.

                       Work with User-Defined Options                  DEV400

 File . . . . . . . :   PDMOPTIONS       Member . . . . . . :   PDMOPTIONS
   Library  . . . . :     MYLIB          Position to  . . . :       

 Type options, press Enter.
   2=Change         3=Copy         4=Delete         5=Display

 Opt  Option  Command
         AB    STRCODECMD CMD('CODEBRWS "&ZP/&ZL/&ZT/&ZN"')
         AD    STRCODECMD CMD('CODEDSU "&ZP/&ZL/&ZT/&ZN"')
         AE    STRCODECMD CMD('CODEEDIT "&ZP/&ZL/&ZT/&ZN"')
          C    CALL &O/&N
         BC    CRTBNDCL PGM(&O) DBGVIEW(*SOURCE)
         BG    STRDBG PGM(&O/&N) UPDPROD(*YES)
         BR    CRTBNDRPG OPTION(*NODEBUGIO *SRCSTMT) DBGVIEW(*SOURCE)
         CB    STRCODECMD CMD('CODEBRWS "<>&L/&F(&N)"')
         CC    CHGCURLIB CURLIB(&L)
                                                                    More...
 Command                                                                        
 ===>                                                                          
 F3=Exit             F4=Prompt           F5=Refresh       F6=Create
 F9=Retrieve         F10=Command entry                    F24=More keys

The options you see are likely to be different to the ones displayed above.

What you will see are the options that others created in the QAUOOPT file. You have two choices:

  • Clear the file and start afresh with your own options.
  • Keep the existing options and add your own.

In the Command column you will notice that some of the parameters for the commands contain variables that start with the & symbol. These are variables that can be passed to the command. There are many, most of which I have never found a reason to use. The ones I use are:

Variable Description
&F If you are working with members: name of file you are currently in.
If you are working with objects or libraries: *NULL.
&L If you are working with members or objects: Name of the library you are currently in.
If you are working with libraries: QSYS.
&N Name of the item selected.
&T If you are working with members or objects: Type of the object or member.
If you are working with libraries: *LIB.

For a list of all these variables refer to the PDM manual I have provided a link to at the bottom of this post.

In this example let’s create an option to perform the CALL command.

To create a new user defined option press F6.

                        Create User-Defined Option

 Type option and command, press Enter. 

   Option  . . . . . . . . .        Option to create 

   Command . . . . . . . . .                                                  
                                                                              
                                                                              
                                       

The option codes 00 – 99 are reserved, but any other single or double digit code is permissible. I am going to use CA.

I enter CALL in the Command parameter and press F4 to prompt it. In the Program parameter I put &N and in the Library parameter I put &L, then I press Enter.

                        Create User-Defined Option

 Type option and command, press Enter. 

   Option  . . . . . . . . .   CA   Option to create 

   Command . . . . . . . . .   CALL PGM(&L/&N)                                
                                                                              
                                                                              
                                       

What if I want the command to be prompted before it is run? I add a question mark before the command:

                        Create User-Defined Option

 Type option and command, press Enter. 

   Option  . . . . . . . . .   CA   Option to create 

   Command . . . . . . . . .   ? CALL PGM(&L/&N)                              
                                                                              
                                                                              
                                       

By all means this is a very simple example, but I am sure you get the idea for using this with more complex commands. For example:

Option  Command                                                          
  R1    ? RUNQRY QRY(*NONE) QRYFILE((&L/&F &N))                          
  SJ    ? SBMJOB CMD(CALL PGM(&L/&N)) JOB(&N) HOLD(*NO)                  
  SP    WRKSPLF                                                          
  SQ    STRSQL                                                           
  SV    ? SAVRSTOBJ OBJ(&N) LIB(&L) RMTLOCNAME(PROD400) OBJTYPE(&T)       
  S3    ? STRSDA OPTION(3) SRCFILE(&L/&F) SRCMBR(&N) OBJLIB(&L) TSTFILE(*LIBL/&N)
  VQ    ? RTVQMQRY QMQRY(&L/&N) SRCFILE(MYLIB/DEVSRC) ALWQRYDFN(*YES)   

 

PDM versus RDp/RDi

At the Technical Release 7 (TR7) presentation I attended when asked by the presenter to raise your hand if you are using PDM and not RDi, the overwhelming majority of attendees raised their hands.

Over the past few weeks I have been running a poll on Facebook as to which editing tool IBM i developers use. The results are:

 

You can learn more about these from the IBM web site:

 

This article was written for IBM i 7.1, and it should work with earlier releases too.

24 comments:

  1. The good news for PDM users is that RDi can use the exact same user options.

    ReplyDelete
  2. Simon it was much before V7R1. It was more like V5R4. It was back in 2007 when I was doing the marketing for the tools. I tried to get it withdrawn completely but all we could do was stabilize it. There are dozens of RPG features that are not supported in SEU!

    ReplyDelete
    Replies
    1. Bob, thank you for the input, and I stand corrected.

      I have done a quick Google and according to the developerWorks web site it looks like SEU was stabilized at IBM i 6.1 .

      Delete
  3. Simon, you can't be serious to bring that up after 25 years of existence.

    Bob, what are the dozens of features? Name at least 12 ....

    ReplyDelete
    Replies
    1. I wrote this post as I have found that I am in a minority of people who use PDM options. Too many people just "14" and change the same parameters of a compile command each time they compile an object, complaining that there must be an easier way.

      Delete
    2. Joe, SEU is indeed frozen at 6.1. Therefore, everything IBM has added in 7.1 is a syntax error as far as SEU goes. I don't think there are dozens of new features that will throw syntax errors in SEU, but there are some, including fully free form RPG, data structure %lookup with a subfield as a key, %scanrpl, data structure ALIAS, procedure RTNPARM and %parmnum, a couple of XML-INTO enhancements, all the new embedded SQL enhancements and SORTA(A/D). This list will never get any smaller.

      Delete
  4. I utilise this all the time in my day job. I have regular options that don't usually change but I also have some set up that I usually modify for a batch of executions. I'd say I mainly use the commands against object lists.. but what's good is that I can use the same option against a source member for the command to work on the object of the same name (assuming library name is appropriate).
    One example (or is it two) I use to reset test files. I have one command to copy from the current file selected, in a "hardcoded" library to the current file selected in the selected library and another to copy from the current selected file/library to the selected file in a "hardcoded" library.
    Another example, I write SQL in a text source member and need to execute the SQL using the command RUNSQLSTM. I have a PDM option to submit the RUNSQLSTM command to batch. Command: sbmjob cmd(RUNSQLSTM SRCFILE(&l/&f) SRCMBR(&n) COMMIT(*NONE) NAMING(*SQL) MARGINS(80) ERRLVL(20)) job(&n) jobq(bau_work); I have another similar option with MARGINS(132).

    ReplyDelete
  5. On RDi 9.0.1 it is called "User Actions". It works the exact same as the PDM Options! Exact same syntax and variables! But, on the Modern I.D.E. called RDi, you can prompt for the variable names too!

    When moving objects around, or checking the creation data. Sadly, I still use the PDM options. But, want to say we have this EXACT same functionality inside of the RDi 9.0.1
    Yeah!!!

    You cannot use a Interactive session in RDi 9.0.1, unless you want to "Assigned" a green screen session to RDI 9.0.1 for that purpose.

    I use my RDi "User Action" to run my third Party Tool Called RGP TOOLBOX, to convert my code to new TR7 Free Format! Without leaving my great editing tool RDi!

    So sad that only 3% of the people use RDi 9.0.1. I guess they haven't tried it, or too lazy to give it a go. Like anything, learning something new takes time and work.

    I certainly did not learn SEU over night, I still remember struggling with it over 24-years ago fresh out of college! How do you insert a line? Oh yeah, type in "i"=Insert in the Sequence number. While in RDi, I just hit ENTER!!! LOL

    ReplyDelete
  6. Simon, the results of your poll are scary, so little apparent adoption of either RDi or shortcuts made available by user action/options.In my college class, I find 100% of students are familiar with a Eclipse

    ReplyDelete
  7. I upgraded to RDi 9.0.1 and was very disappointed with an overabundance of unrecoverable Java errors. I went back to RDp 8.?.?. I like my applications to work relatively flawlessly, a crash every 5 minutes does not meet my definition of relatively flawless.

    ReplyDelete
    Replies
    1. @Neil

      Did I understand you correctly? You installed RDi 9, and then installed the First full Service pack to upgrade to version RDi 9.0.1. I had problems with RDp 8.5, it had a memory leak for me. Which the memory leak is gone on RDi 9.0.1 (With the service pack installed). I had minor problem with the initial release of RDi 9 with no service pack, after the service pack install, everything seemed to go away for me.

      Now for me, I ALWAYS install the new version of RDi into a brand new directory. But, other just use same directory. When you say it crashes? When you type code? When you compile? When you open it up?

      Believe me, I have had issues with RDi, but usually starting with a clean slate works for me. Just for the heck of it, trying creating a fresh new workspace, to eliminate any possible corrections. On Window 7 & above, you need to run the install as "Run as Administrator". I am no expert on the install process. But, would love to see your issues resolved!

      Delete
  8. PDM was the AS/400's killer App. Before that we used the old Programmer Menu (STRPGMMNU). There was never a debate about moving developers off the old programmer menu to PDM.

    ReplyDelete
  9. Installed RDi 9 and upgrade. The crash would happen just editing our largest RPG program, I'd make 2-3 line changes and Java error, close, restart, all changes lost. Problem is our largest program is obviously our most critical and frequently modified - I just don't have the time in the day to figure out the RDi issue. So since I've been on RDp since I started at my current site, I just went back to using it. I much prefer the RD series of editors, and hate going back to SEU when I'm working remotely, but sometimes they just don't install quite right and that can be very frustrating when you're on a deadline.

    And yes, I am slowly, in the process of removing a lot of code from this RPG behemoth, and making a frightening number of new procedures - trying to support legacy and web apps that do the same thing, it just doesn't make sense to have the code duplicated between each support package. This job should see at least me through to retirement :)

    ReplyDelete
    Replies
    1. I've been using PC based editors for RPG for over 20 years. My personal experience is that IBM is VERY interested in hearing about crashes and other bugs. RDi 9 has been very stable for me and my colleagues, but PC software operates in a complex environment where Windows service packs, drivers and antivirus software all interact - not always harmoniously.

      Call IBM and report your issue. It sounds like it's very reproducible, and thus will have an excellent chance of being fixed.

      Delete
  10. @Neil
    We are not aware of a problem with large members. So we would appreciate you opening a PMR so we could fix it for everyone.

    ReplyDelete
  11. @Niel,

    just for the heck of it backup your source, and try resequence all the lines. I have used RDi on some very large programs and no issues. I discovered it works better on windows 64-bit than 32-bit. my pc was upgraded a while back....

    also do a outline refresh Ctrl+F5. I do not have java modernization installed. just hate to see anyone have an issue with RDi 9. I have gotten good support from IBM on PMR. we now have support!

    ReplyDelete
  12. It's a good idea to also include some basic comment in the option definition as well using the /* comment */ format.

    Display User-Defined Option

    Press Enter to continue.

    Option . . . . . . . . : JP

    Command . . . . . . . . : /* Journal physical file */ STRJRNPF FILE(&L/&N)
    JRN(&L/JRN) IMAGES(*BOTH) OMTJRNE(*NONE)

    ReplyDelete
  13. These are the most important for me . . . does stuff like from WRKMBRPDM, take me to WRKOBJPDM for the "name of compiled object"

    MP ? wrkmbrpdm &l/q_rpglesrc &n*
    OP wrkobjpdm &l &n* objtype(*all)
    OT /* object txt */ ? chgobjd &l/&n objtype(&t ) text(&x)

    Unfornately, when some of these bring up the PDM screens, they will not run in RDi . . . Now if IBM would come up with a "replacement/work-around" I would give up PDM . . .

    - John Voris

    ReplyDelete
    Replies
    1. You can set the 'Prompt first' box and have a 5250 screen pop up. You need to associate a 5250 interactive job, but the instructions are given in the pop-up box.

      MP / OP is mostly replaced by filters, but you could certainly implement that if you want. I do things like copy to / from test very similar to your OT, except CPYF instead of CHGOBJD.

      Delete
  14. When CODE 400 first came out I tried it and never got back to SDA or RLU. But I always preferred SEU to LPEX. Now I'm straggling to use screen designer in RDI. I just wish there was a version of a CODE for windows 8.

    ReplyDelete
  15. Hi, i want ask you a question:
    I use AS400, when i do access with a user, i see a menĂ¹, i would want know which is the library that the menĂ¹ is using? Thanks

    ReplyDelete
  16. This is a great post. People do say it is outdated in this 2014 post and i am still using this in 2017. Am i outdated too ! oh god. - J

    ReplyDelete
    Replies
    1. Despite IBM's best efforts I think if you were to poll the IBM i user base I think you would find that most programmers are still using PDM/SEU.

      Not necessarily through choice, just that their employers will not buy everyone a license for RDi.

      Delete

To prevent "comment spam" all comments are moderated.
Learn about this website's comments policy here.

Some people have reported that they cannot post a comment using certain computers and browsers. If this is you feel free to use the Contact Form to send me the comment and I will post it for you, please include the title of the post so I know which one to post the comment to.