04
Mon, Nov
1 New Articles

TechTalk: Easy Access to SEU

General
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

When I work at a client's location, I am often restricted to only one display device. If I am editing a source member and realize I forgot to create a printer file, for example, my choices for creating the new member are limited: I can exit the source member I am currently working on and start a new edit session for the new member, I can press the F21 key to get a command line and start SEU or PDM, or I can use the System Request menu to start a second display session and start SEU from there.

No matter which way I go, it's easy to get distracted and forget where I was in the first edit session while I'm taking care of the problem in the second. When I am exceptionally busy, I sometimes forget I even had a previous SEU edit session going and attempt to start SEU on the same member I am already editing.

To avoid this problem, I created the Edit Source (EDTSRC) utility. It allows me to run multiple SEU sessions from a command line. As I am editing one member, I can press the F21 key to get a command line, run this utility, and start editing a second member. When I exit the second member, my session resumes at the command line activated in the first member.

The EDTSRC command (Figure 9) prompts for the name of a source file, the library, the source member, the member type, and an SEU option. This utility lets me edit, browse, or print a source member. EDTSRC's command processing program (CPP), EDT01C, is shown in Figure 10.

If the member name I enter does not exist in the source file, a new member is added to the source file, and SEU starts with a blank member. If the member name I enter is already in use, SEU starts in BROWSE mode.

When I exit the SEU session, the Create Object (CRTOBJ) command is called. Source code for CRTOBJ and its CPP, CRT01C, is in Figures 11 and 12.

The relevant source file, library, and member name are passed to CRTOBJ, and I am prompted to create the object. If I specify *NO on the create parameter, control returns to EDTSRC and

then back to the original edit session. If I specify *YES on the create parameter, the appropriate CRTOBJ command, based on the source member type, is executed and sent to batch.

I added only the most commonly used CRTOBJ commands to this utility. You can easily expand this utility if you need to create other object types, such as panel groups.

Both CL programs use the Forward Program Message (FWDPGMMSG) utility, which was presented in "How to Forward Messages in CL," MC, January 1998.

- Shannon O'Donnell

This email address is being protected from spambots. You need JavaScript enabled to view it.

Figure 9: The Edit Source (EDTSRC) command

/*==============================================================*/

/* To Compile: */
/* */
/* CRTCMD CMD(XXX/CRTOBJ) PGM(XXX/CRT01C) + */
/* SRCFILE(XXX/QCLSRC) */
/* */
/*==============================================================*/

CMD PROMPT('Create Object')

PARM KWD(OBJECT) TYPE(QUAL1) MIN(1) +

PROMPT('Object Lib/Name')
PARM KWD(SRCFIL) TYPE(QUAL1) MIN(1) +

PROMPT('Source File')
PARM KWD(MEMBER) TYPE(*NAME) MIN(1) +

PROMPT('Source Member')
PARM KWD(TYPE) TYPE(QUAL2) MIN(1) PROMPT('Object +

Type')
PARM KWD(CREATE) TYPE(*CHAR) LEN(4) RSTD(*YES) +

VALUES(*YES *NO) MIN(1) PROMPT('Create +
Object')

QUAL1: QUAL TYPE(*NAME)

QUAL TYPE(*NAME) LEN(10) DFT(*LIBL) +

SPCVAL((*LIBL)) CHOICE('Name, *LIBL, +
*CURLIB') PROMPT('Library name')

QUAL2: QUAL TYPE(*NAME) RSTD(*YES) SPCVAL((RPG) (CLP) +

(CBL) (RPGLE) (CBLLE) (PF) (LF) (CMD) (DSPF)) /*==================================================================*/

/* To Compile: */
/* */
/* CRTCLPGM PGM(XXX/CRT01C) SRCFILE(XXX/QCLSRC) */
/* */
/*==================================================================*/

PGM PARM(&OBJ_LIB &SRC_LIB &MEMBER &TYPE &CREATE)

DCL VAR(&CREATE) TYPE(*CHAR) LEN(4)
DCL VAR(&SRC_LIB) TYPE(*CHAR) LEN(20)
DCL VAR(&OBJ_LIB) TYPE(*CHAR) LEN(20)
DCL VAR(&MEMBER) TYPE(*CHAR) LEN(10)
DCL VAR(&OBJNAM) TYPE(*CHAR) LEN(10)
DCL VAR(&OBJLIB) TYPE(*CHAR) LEN(10)
DCL VAR(&SRCFIL) TYPE(*CHAR) LEN(10)
DCL VAR(&SRCLIB) TYPE(*CHAR) LEN(10)
DCL VAR(&TYPE) TYPE(*CHAR) LEN(10)

MONMSG MSGID(CPF0000 MCH0000) EXEC(GOTO CMDLBL(ERROR))

Figure 10: The Edit Source (EDTSRC) command processor, EDT01C

/*===================================================================*

/* Extract Object Name and Object Library From Command Parms */

/*===================================================================*

CHGVAR VAR(&OBJNAM) VALUE(%SST(&OBJ_LIB 1 10))
CHGVAR VAR(&OBJLIB) VALUE(%SST(&OBJ_LIB 11 10))

/*===================================================================*

/* Extract Source File and Library Name From Command Parms */

/*===================================================================*

CHGVAR VAR(&SRCFIL) VALUE(%SST(&SRC_LIB 1 10))
CHGVAR VAR(&SRCLIB) VALUE(%SST(&SRC_LIB 11 10))

/*===================================================================*

/

/

/

/

/

/

/* Create Object If Selected */

/*===================================================================*

IF COND(&CREATE *EQ '*YES') THEN(DO)

IF COND(&TYPE *EQ 'RPG') THEN(SBMJOB +

CMD(CRTRPGPGM PGM(&OBJLIB/&OBJNAM) +
SRCFILE(&SRCLIB/&SRCFIL) SRCMBR(&MEMBER) +
REPLACE(*YES)) JOB(&MEMBER))

IF COND(&TYPE *EQ 'RPGLE') THEN(SBMJOB +

CMD(CRTBNDRPG PGM(&OBJLIB/&OBJNAM) +
SRCFILE(&SRCLIB/&SRCFIL) SRCMBR(&MEMBER) +
REPLACE(*YES)) JOB(&MEMBER))

IF COND(&TYPE *EQ 'CBL') THEN(SBMJOB +

CMD(CRTCBLPGM PGM(&OBJLIB/&OBJNAM) +
SRCFILE(&SRCLIB/&SRCFIL) SRCMBR(&MEMBER) +
REPLACE(*YES)) JOB(&MEMBER))

IF COND(&TYPE *EQ 'CBL') THEN(SBMJOB +

CMD(CRTBNDCBL PGM(&OBJLIB/&OBJNAM) +
SRCFILE(&SRCLIB/&SRCFIL) SRCMBR(&MEMBER) +
REPLACE(*YES)) JOB(&MEMBER))

IF COND(&TYPE *EQ 'CLP') THEN(SBMJOB +

CMD(CRTCLPGM PGM(&OBJLIB/&OBJNAM) +
SRCFILE(&SRCLIB/&SRCFIL) SRCMBR(&MEMBER) +
REPLACE(*YES)) JOB(&MEMBER))

IF COND(&TYPE *EQ 'PF') THEN(SBMJOB CMD(CRTPF +

FILE(&OBJLIB/&OBJNAM) +
SRCFILE(&SRCLIB/&SRCFIL) SRCMBR(&MEMBER)) +
JOB(&MEMBER))

IF COND(&TYPE *EQ 'LF') THEN(SBMJOB CMD(CRTLF +

FILE(&OBJLIB/&OBJNAM) +
SRCFILE(&SRCLIB/&SRCFIL) SRCMBR(&MEMBER)) +
JOB(&MEMBER))

IF COND(&TYPE *EQ 'DSPF') THEN(SBMJOB +

CMD(CRTDSPF FILE(&OBJLIB/&OBJNAM) +
SRCFILE(&SRCLIB/&SRCFIL) SRCMBR(&MEMBER) +
REPLACE(*YES)) JOB(&MEMBER))

IF COND(&TYPE *EQ 'PRTF') THEN(SBMJOB +

CMD(CRTPRTF FILE(&OBJLIB/&OBJNAM) +
SRCFILE(&SRCLIB/&SRCFIL) SRCMBR(&MEMBER) +
REPLACE(*YES)) JOB(&MEMBER))

ENDDO

RETURN /* Normal end of program */

/*===================================================================*

/*==============================================================*/

/* To compile: */
/* */
/* CRTCMD CMD(XXX/EDTSRC) PGM(XXX/EDT01C) + */
/* SRCFILE(XXX/QCMDSRC) */
/* */
/*==============================================================*/

CMD PROMPT('Edit Source Member')

PARM KWD(SRCFIL) TYPE(QUAL1) MIN(1) +

PROMPT('Source File')
PARM KWD(MEMBER) TYPE(*CHAR) LEN(10) MIN(1) +

PROMPT('Source Member')
PARM KWD(TYPE) TYPE(*CHAR) LEN(10) RSTD(*YES) +

VALUES('CMD' 'CLP' 'RPG' 'RPGLE' 'CBL' +
'CBLLE' 'DSPF' 'PF' 'LF') MIN(1) +
EXPR(*YES) CHOICE('Member Type') +
PROMPT('Source Member Type')

PARM KWD(OPTION) TYPE(*CHAR) LEN(1) RSTD(*YES) +

VALUES('2' '5' '6') MIN(1) EXPR(*YES) +
PROMPT('Edit Option')

QUAL1: QUAL TYPE(*NAME) LEN(10) RSTD(*NO)

QUAL TYPE(*NAME) LEN(10) DFT(*LIBL) +

SPCVAL((*LIBL)) CHOICE('Name, *LIBL, +
*CURLIB') PROMPT('Library name') /*==================================================================*/

/* To Compile: */
/* */
/* CRTCLPGM PGM(XXX/EDT01C) SRCFILE(XXX/QCLSRC) */
/* */
/*==================================================================*/

PGM PARM(&SRC_LIB &MEMBER &TYPE &OPTN)

DCL VAR(&CREATE) TYPE(*CHAR) LEN(4)
DCL VAR(&SRC_LIB) TYPE(*CHAR) LEN(20)
DCL VAR(&OBJ_LIB) TYPE(*CHAR) LEN(20)
DCL VAR(&OBJNAM) TYPE(*CHAR) LEN(10)
DCL VAR(&OBJLIB) TYPE(*CHAR) LEN(10)
DCL VAR(&SRCFIL) TYPE(*CHAR) LEN(10)
DCL VAR(&SRCLIB) TYPE(*CHAR) LEN(10)
DCL VAR(&MEMBER) TYPE(*CHAR) LEN(10)
DCL VAR(&TYPE) TYPE(*CHAR) LEN(10)
DCL VAR(&OPTION) TYPE(*CHAR) LEN(6)
DCL VAR(&OPTN) TYPE(*CHAR) LEN(1)

MONMSG MSGID(CPF0000 MCH0000) EXEC(GOTO CMDLBL(ERROR))

/*===================================================================*

/* EXTRACT SOURCE FILE AND LIBRARY NAME FROM COMMAND PARMS. */

/*===================================================================*

CHGVAR VAR(&SRCFIL) VALUE(%SST(&SRC_LIB 1 10))
CHGVAR VAR(&SRCLIB) VALUE(%SST(&SRC_LIB 11 10))

/*===================================================================*

/

ERROR: FWDPGMMSG
MONMSG MSGID(CPF0000 MCH0000)

EXIT:

ENDPGM

Figure 11: The Create Object (CRTOBJ) command

Figure 12: The Create Object (CRTOBJ) command processor, CRT01C

/

/

/

/

/

/* VERIFY EXISTENCE OF SOURCE LIBRARY/SOURCE FILE */

/*===================================================================*

CHKOBJ OBJ(&SRCLIB/&SRCFIL) OBJTYPE(*FILE)

/*===================================================================*

/* VERIFY EXISTENCE OF SOURCE LIBRARY/SOURCE FILE/MEMBER */

/*===================================================================*

CHKOBJ OBJ(&SRCLIB/&SRCFIL) OBJTYPE(*FILE) +

MBR(&MEMBER)
MONMSG MSGID(CPF9815) EXEC(DO)

ADDPFM FILE(&SRCLIB/&SRCFIL) MBR(&MEMBER)
ENDDO

/*===================================================================*

/* EDIT SOURCE MEMBER */

/*===================================================================*

/

CHGVAR VAR(&OPTION) VALUE(&OPTN)

STRSEU:

STRSEU SRCFILE(&SRCLIB/&SRCFIL) SRCMBR(&MEMBER) +
TYPE(&TYPE) OPTION(&OPTION)
MONMSG MSGID(EDT9007) EXEC(DO) /* +

Source Member In Use. Use Browse Mode. */
CHGVAR VAR(&OPTION) VALUE('5')

GOTO CMDLBL(STRSEU)
ENDDO

/*===================================================================*

/

/

IF COND(&OPTION *EQ '2') THEN(DO)

CRTOBJ ??OBJECT(&SRCLIB/&MEMBER) +

??SRCFIL(&SRCLIB/&SRCFIL) +
??MEMBER(&MEMBER) ??TYPE(&TYPE) +
??CREATE(*YES) /* Only Prompt For +
Create Object If Source Member Was In +
Edit Mode.' */

ENDDO
RETURN

ERROR:

FWDPGMMSG
MONMSG MSGID(CPF0000 MCH0000)

EXIT:

ENDPGM

/* PROMPT FOR CREATE OBJECT */

/*===================================================================*

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: