• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Use Your PDM Options with RSE

    August 4, 2004 Hey, Ted

    Like many other iSeries programmers and operations people, I have for years created PDM options to improve my work life. I was delighted to learn that the WebSphere Development Studio client, which I now use for program development, includes a counterpart to PDM options. In WDSc, they’re known as user actions. Here’s an illustration.

    One of my common tasks is creating a backup copy of a source physical file member before making any modifications to it. I usually rename the member, then copy it to a new member of the original name. In this way, the backup member keeps the time stamp of last modification.

    To carry out the backup, I threw together a simple CL program (NEWVERC) and a command (NEWVERSION). This utility is not robust, but it serves my purpose. Here is the source code for NEWVERC.

    /* This program renames a file member, then creates a new */
    /* copy under the original name.                          */
    
    /* CRTCLPGM PGM(xxx/NEWVERC)                              */
    /*          SRCFILE(xxx/QCLSRC)                           */
    /*          SRCMBR(NEWVERC)                               */
    
                 PGM        PARM(&FILE &MBR &NEWNAME)
    
                 DCL        VAR(&FILE) TYPE(*CHAR) LEN(20)
                 DCL        VAR(&MBR) TYPE(*CHAR) LEN(10)
                 DCL        VAR(&NEWNAME) TYPE(*CHAR) LEN(10)
                 DCL        VAR(&FILENAME) TYPE(*CHAR) LEN(10)
                 DCL        VAR(&FILELIB) TYPE(*CHAR) LEN(10)
    
                 DCL        VAR(&ABENDING) TYPE(*LGL)
                 DCL        VAR(&MSGDTA) TYPE(*CHAR) LEN(256)
                 DCL        VAR(&MSGF) TYPE(*CHAR) LEN(10)
                 DCL        VAR(&MSGFLIB) TYPE(*CHAR) LEN(10)
                 DCL        VAR(&MSGID) TYPE(*CHAR) LEN(7)
                 DCL        VAR(&MSGKEY) TYPE(*CHAR) LEN(4)
                 DCL        VAR(&MSGTYPE) TYPE(*CHAR) LEN(10)
                 DCL        VAR(&PGMNAME) TYPE(*CHAR) LEN(10)
                 DCL        VAR(&RTNTYPE) TYPE(*CHAR) LEN(2)
                 DCL        VAR(&SENDER) TYPE(*CHAR) LEN(80)
    
                 MONMSG     MSGID(CPF0000) EXEC(GOTO CMDLBL(ABEND))
    
    /* Determine the name of this program. */
                 SNDPGMMSG  MSG('Dummy message') TOPGMQ(*SAME) +
                              MSGTYPE(*INFO) KEYVAR(&MSGKEY)
                 RCVMSG     PGMQ(*SAME) MSGTYPE(*INFO) MSGKEY(&MSGKEY) +
                              RMV(*YES) SENDER(&SENDER)
                 CHGVAR     VAR(&PGMNAME) VALUE(%SST(&SENDER 27 10))
    
    /* Split the qualified name */
                 CHGVAR     VAR(&FILENAME) VALUE(%SST(&FILE 1 10))
                 CHGVAR     VAR(&FILELIB) VALUE(%SST(&FILE 11 10))
    
    /* Rename the member to the backup name */
                 RNMM       FILE(&FILELIB/&FILENAME) MBR(&MBR) +
                              NEWMBR(&NEWNAME)
    
    /* Create a new version of the member */
                 CPYF       FROMFILE(&FILELIB/&FILENAME) +
                              TOFILE(&FILELIB/&FILENAME) +
                              FROMMBR(&NEWNAME) TOMBR(&MBR) MBROPT(*ADD)
    
    /* Normal end of program. Send a completion message. */
                 SNDPGMMSG  MSGID(CPF9898) MSGF(QCPFMSG) +
                              MSGDTA('Program' *BCAT &PGMNAME *BCAT +
                              'completed normally') MSGTYPE(*COMP)
                 RETURN
    
    /* * Routine to handle unexpected errors */
    
    ABEND:
    
    /* Don't let this program go into a loop here. */
                 IF         COND(&ABENDING) THEN(RETURN)
                 CHGVAR     VAR(&ABENDING) VALUE('1')
    
    /* Look for an error message to send back to the caller.      */
                 RCVMSG     MSGTYPE(*LAST) MSGDTA(&MSGDTA) MSGID(&MSGID) +
                              RTNTYPE(&RTNTYPE) MSGF(&MSGF) +
                              SNDMSGFLIB(&MSGFLIB)
    
    /* Resend an error message to the caller as a diagnostic message. */
                 IF         COND((&RTNTYPE *EQ '02') *OR (&RTNTYPE *EQ +
                              '15') *OR (&RTNTYPE *EQ '17')) THEN(DO)
                 SNDPGMMSG  MSGID(&MSGID) MSGF(&MSGF) MSGDTA(&MSGDTA) +
                              MSGTYPE(*DIAG)
                 ENDDO
    
    /* Send an escape message to end the program abnormally */
                 SNDPGMMSG  MSGID(CPF9898) MSGF(QCPFMSG) +
                              MSGDTA('Program' *BCAT &PGMNAME *BCAT +
                              'ended abnormally') MSGTYPE(*ESCAPE)
    
                 ENDPGM
    

    Here is the command source code.

    ..+....2....+....3....+....4....+....5....+....6....+....7....+....8....+
    /* =================================================================== */
    /* CREATE A NEW VERSION OF A FILE MEMBER                               */
    /* =================================================================== */
    /* CRTCMD CMD(XXX/NEWVERSION)                                          */
    /*        PGM(*LIBL/NEWVERC)                                           */
    /*        SRCFILE(XXX/QCMDSRC)                                         */
    /*        SRCMBR(NEWVERSION)                                           */
    /* =================================================================== */
                                                                             
                 CMD        PROMPT('New version of a file member')           
                 PARM       KWD(FILE) TYPE(QUALFILE) MIN(1) PROMPT('File')   
                 PARM       KWD(MBR) TYPE(*CHAR) LEN(10) MIN(1) +            
                              PROMPT('Existing member')                      
                 PARM       KWD(NEWNAME) TYPE(*CHAR) LEN(10) MIN(1) +        
                              PROMPT('New name of existing member')          
     QUALFILE:   QUAL       TYPE(*NAME) MIN(1) EXPR(*YES)                    
                 QUAL       TYPE(*NAME) MIN(1) EXPR(*YES) PROMPT('Library')  
    

    To run this command within PDM, I created PDM option NV.

    Option Command
    NV ?NEWVERSION FILE(&L/&F) MBR(&N)

    When I began to develop with the Remote Systems Explorer, I did not lose this utility, because I was able to create a user action to run the NEWVERSION command.

    There are several places from which you can create a user action. One way is to right-click a member name under a member filter and choose User Actions, then Work with User Actions. You will be presented with the Work with User Actions dialog box. Since this user action is to work with file members, click Member action, under the New subtree. Fill in the entry blanks, and click the Create button.

    If you are familiar with PDM substitutions, you will recognize the &F, &L, and &N tokens, which stand for file, library, and name. Using these substitutions causes RSE to pass the proper values for your selection to the NEWVERSION command when you run the user action.

    Notice the Prompt first and Refresh after options. You need to check the Prompt first option in order to be prompted for the new member name. Clicking Refresh after causes RSE to refresh lists in which this member appears in the Remote systems navigation pane.

    To execute the user action, right-click the name of the member to be backed up and choose User Actions. The defined user actions will appear in the top portion of the expanded menu. When you select the New version action, you will be prompted to fill in the parameters of the NEWVERSION command. You will be allowed to continue execution or to cancel.

    Isn’t it nice to know that all that effort to create useful PDM options isn’t lost when moving development to RSE?

    –Lynn

    Dear Readers:

    Thanks to Lynn for yet another tip for those of us whose WDSc skills aren’t yet what they need to be. Here are links to Lynn’s two previous tips.

    • “Using Member Filters in Remote Systems Explorer”

    • “Using Filters in the Remote Systems LPEX Editor”

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags:

    Sponsored by
    Focal Point Solutions Group

    Comprehensive Data Protection from Focal Point SG

    Your organization needs to be thinking differently about your backup & disaster recovery strategy

    Concerns of the Industry

    • Inefficient manual backup processes
    • Effectively storing data offsite
    • Developing and testing a concrete disaster recovery plan
    • Efficient access to data in a disaster scenario for necessary users
    • Risk of cyber security attack
    • Declining IT staff and resources

    The true cause of the above concerns is an organization’s status quo – 80% of IBM i users currently backup to tape and 40% of companies have no DR plan at all. Don’t wait for a disaster to take action.

    The new way to ensure cost-effective safety

    • Automated cloud backup
    • Two (2) remote sites – redundant storage, power, internet pipe, firewalls, etc.
    • Data encryption at all times – in-flight and at-rest
    • Fully managed remote hardware DR, including remote VPN access for necessary users
    • Regularly simulated phishing tests and cyber security training

    Potential “landmines” in solutions to avoid

    • Single point of storage – no redundancy
    • Misleading data analysis, compression/de-dup ratios, sizing of necessary computer resources for backup and DR
    • Large-scale cloud storage with difficult recovery
    • Inability to meet RTO/RPO

    Don’t get caught like the many organizations we’ve seen with inefficient exposed backup data and no DR plan!

    What VAULT400 has to offer

    Backup

    • Native software agent schedules backups to the Focal Point SG cloud based on your retention scheme
    • Client data is backed up to two data centers in US or two data centers in Canada
    • 256-bit AES encryption in-flight and at rest – only the client has the encryption key
    • Detailed data analysis to ensure proper sizing

    Disaster Recovery as a Service (DRaaS)

    • Focal Point SG provides “hands-off” DR – fully managed recovery
    • 60 days of remote VPN access available to unlimited users in event of a disaster
    • Documented reports to ensure defined SLAs are met

    Managed Service Cyber Security Training

    • Fully managed phishing tests
    • Detailed reporting of results
    • Fully managed administration of custom online cyber security training

    VAULT400 Cloud Backup & DRaaS is an IBM Server Proven Solution.

    VAULT400.com/proposal for FREE analysis & proposal

    813.513.7402 | ContactUs@FocalPointSg.com

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Archiving System Saves Time and Money At Warner/Chappell IBM Launches New IxA Cards to Link to Nocona Servers

    Leave a Reply Cancel reply

Content archive

  • The Four Hundred
  • Four Hundred Stuff
  • Four Hundred Guru

Recent Posts

  • IBM i Has a Future ‘If Kept Up To Date,’ IDC Says
  • When You Need Us, We Are Ready To Do Grunt Work
  • Generative AI: Coming to an ERP Near You
  • Four Hundred Monitor, March 22
  • IBM i PTF Guide, Volume 25, Number 12
  • Unattended IBM i Operations Continue Upward Climb
  • VS Code Is The Full Stack IDE For IBM i
  • Domino Runs on IBM i 7.5, But HCL Still Working on Power10
  • Four Hundred Monitor, March 6
  • IBM i PTF Guide, Volume 25, Number 11

Subscribe

To get news from IT Jungle sent to your inbox every week, subscribe to our newsletter.

Pages

  • About Us
  • Contact
  • Contributors
  • Four Hundred Monitor
  • IBM i PTF Guide
  • Media Kit
  • Subscribe

Search

Copyright © 2023 IT Jungle