Programming / CL
2015 Guide to Manufacturing SoftwareFor all manufacturing industries, growth remains top of mind. Post-recession cautiousness has given way to confidence and more ambitious business goals. From automotive to fashion, more manufacturing leaders are ready to take bigger risks in the hopes of bigger payoffs, and optimism is the highest itâ€™s been in years. To help manufacturers choose the right software in a rapidly changing industry landscape, this guide will explore four key technologies that are essential to any successful manufacturing operation:&nÂ &nÂ nterprise Resource Planning (ERP)&nÂ &nÂ nterprise Asset Management (EAM)&nÂ &nÂ onfigure Price Quote (CPQ)&nÂ &nÂ upply Chain Management (SCM) See Moreâ€¦
2016 IBM i Marketplace Survey ResultsNow in its second year, HelpSystems surveyed over 800 IBM i users from around the world to produce the IBM i Marketplace Survey Results. The expanded 2016 survey builds on last yearâ€™s results to provide even greater insight into the IBM i marketplace.From manufacturing and retail to finance and healthcare, IBM i professionals from around the world reported their plans and concerns for their IT environments, revealing how IBM i is being used and how it relates to their broader IT objectives.Download the survey results to see how over 800 of your peers on the platform address:&nÂ &nÂ odernization &a&obile applications&nÂ &nÂ ardware &a&perating systems&nÂ &nÂ T concerns &a&nitiatives&nÂ &nÂ ata growth, storage, &a&ecurity&nÂ &nÂ he future of IBM iâ€¦
2016 State of IBM i Modernization White PaperAfter surveying 400+ IBM i professionals, we discovered:Â -Â The state of IBM i modernization in today's businesses and their goals for the futureÂ -Â The effect legacy applications have on the businesses' internal and external processesÂ -Â The #1 concern upper managers have with the IBM i, and how to combat it ...and much much more! Download your copy of The 2016 State of IBM i Modernization today.â€¦
2016 State of IBM i Security StudyDrawing participants from healthcare, communication, transportation, finance, and many other industries, the 2016 State of IBM i Security Study analyzed 177 servers and partitions. Now in its 13th year, the study provides compelling insight into security weaknesses affecting many IBM i systems. Some of the most dangerous defects include:Â -Â Unmonitored network accessÂ -Â Lax system auditingÂ -Â Dangerous default security settings The alarming results show improperly configured servers where users are allowed to keep default passwords and traffic passes through exit points like FTP and SQL unmonitored.â€¦
3 Compelling Drivers for Implementing an HA Solution on an IBM i Cloud with MIMIX1. Affordable Cloud Solutions 2. Efficiencies of MIMIX 3. Rising Cost of Downtime This white paper is a collaborative effort between Connectria Hosting, a pioneer in the development of the IBM i Cloud, and Vision Solutions, the leader in High Availability and Disaster Recovery solutions including MIMIXÂ®, the standard for complete, scalable HA/DR protection for the IBM i.It will provide a review of the core causes and costs of both planned and unplanned downtime and will then provide a detailed discussion of current options for IBM i High Availability and Disaster Recovery in the Cloud.Most importantly, as you read you will learn why true HA and DR protection are now within reach of even the smallest of businesses.â€¦
5 Ways to Control Access using Application AdministrationNever heard of Application Administration? Donâ€™t be surprised. Although itâ€™s full of function, itâ€™s one of little-known features of IBM i. Application Administration (or App Admin as itâ€™s commonly called) has been around for a while but the additional features provided in the latest releases as well as recent Technology Releases makes this a feature worth exploring again. Carol Woodbury, President of SkyView Partners, has written a white paper describing how you can use Application Administration (a feature of i Navigator) to control access to various client functions as well as functions available on the IBM i and network features such as ODBC and FTP access.â€¦
5 Winning Strategies to Combat Information OverloadTodayâ€™s businesses must be available 24/7 with fewer people having to manage more complex systems and processes. IT departments receive a constant bombardment of information from a diverse variety of operating systems, business applications, and critical processes and support a complex array of servers and devices running across their entire network. With tight resources and the need to keep costs in check, more and more is expected of IT operational staff to handle this information efficiently. They need to ensure a swift response with appropriate actions, that essential data is received at the right time, prove service levels are maintained, that contingency and high availability strategies are fully operational, and that vital busiâ€¦
8 Very Good Reasons to Use Your Power i For ShippingLearn how companies are reducing shipping costs by Centralizing all of their Shipping Systems and Transportation Management Systems (TMS) on One Platform with One Vendor. See how companies deployed an enterprise-wide, multi-carrier shipping solution to manage both their Parcel and Freight shipments directly from their IBM i, and seamlessly integrated it to their back end IBM i ERP and WMS. This Whitepaper examines eight reasons for centralizing standalone shipping solutions on the IBM i. In addition, you will see how a Modular TMS Solution integrated with ERP has driven significant efficiencies and cost reductions in companies shipping and transportation operation.â€¦
Automate IBM i Operations using Wireless DevicesDownload the technical whitepaper on MANAGING YOUR IBM i WIRELESSLY and (optionally) register to download an absolutely FREE software trail. This whitepaper provides an in-depth review of the native IBM i technology and ACO MONITOR's advanced two-way messaging features to remotely manage your IBM i while in or away from the office. Notify on-duty personnel of system events and remotely respond to complex problems (via your Smartphone) before they become critical-24/7. Problem solved!â€¦
DR Strategy Guide from Maxava: Brand New Edition - now fully updated to include Cloud!PRACTICAL TOOLS TO IMPLEMENT DISASTER RECOVERY IN YOUR IBM i ENVIRONMENT CLOUD VS. ON-PREMISE? - COMPREHENSIVE CHECKLISTS - RISK COST CALCULATIONS - BUSINESS CASE FRAMEWORK - DR SOLUTIONS OVERVIEW - RFP BUILDER Download your free copy of DR Strategy Guide for IBM i today. The DR Strategy Guide for IBM i is brought to you by Maxava â€“ innovative global leaders in High Availability and Disaster Recovery solutions for IBM i.â€¦
IBM i Security: Event Logging & Active MonitoringA Step by Step GuideActive monitoring is one of the most critical and effective security controls that an organization can deploy. Unlike many Windows and Linux server deployments, the IBM i can host a complex mix of back-office applications, web applications, and open source applications and services - leaving millions of security events to actively monitor.This eBook discusses: - Real-time security event logging and monitoring - Security architecture and logging sources on the IBM i - Creating the IBM security audit journal QAUDJRN - Enabling IBM security events through system values - File integrity monitoring (FIM) - A step by step checklist begin collecting and monitoring IBM i security logsâ€¦
Mobile Computing and the IBM iMobile computing is rapidly maturing into a solid platform for delivering enterprise applications. Many IBM i shops today are realizing that integrating their IBM i with mobile applications is the fast path to improved business workflows, better customer relations, and more responsive business reporting. The ROI that mobile applications can produce for your business is substantial. This ASNA whitepaper takes a look at mobile computing for the IBM i. It discusses the different ways mobile applications may be used within the enterprise and how ASNA products solve the challenges mobile presents. It also presents the case that you already have the mobile programming team your projects need: that team is your existing RPG development team!â€¦
Overcoming Common IBM i Mobile Development ChallengesCreating mobile applications for IBM i on Power Systems doesn't have to be difficult! Mobile applications can take your business to new levels of engagement, customer support and competitiveness. By making your ERP, Sales, Line of Business, and other applications mobile, you empower your workforce to get more done - from anywhere, at any time.If your business runs on IBM i (formerly known as AS400 or iSeries) there's no need to worry. You can easily make your RPG applications available on any mobile device! Read this free white paper, and learn how you can overcome the most common challenges to mobile for IBM i shops, including: - How to go mobile with limited staff or budget - How to make any RPG developer a mobile superstar - Whether to câ€¦
PCI and What it means to IBM iWhile one may think that PCI is a thing of the past and that itâ€™s already been implemented, major breaches (most notably of the Target PoS systems) have brought it back into focus. Some retailers are just now understanding how PCI applies to them and other organizations have started to accept credit cards when they didnâ€™t in the past. To refresh everyoneâ€™s memory, hereâ€™s an overview of what PCI means to the IBM i community and what organizations that use an IBM i to store, process or access cardholder data need to be aware of.â€¦
Robot in Modern IBM i EnvironmentsAs hardware and software technologies evolve, so too does the complexity of the data center.IBM i often serves as the backbone for business-critical applications, including ERP packages, leaving other servers to run email, print serving, and the websiteâ€”but users and other computing technologies still draw data from the transactional database on IBM i. Robot systems management solutions have been helping customers manage IBM i operations for over 30 years. This white paper is intended primarily for IT management and attempts to explain, in plain English, the components of modern IBM i environments and how Robot can be deployed to maximize business objectives. See Moreâ€¦
Virus Got You Down?Does a virus have your server down? Perhaps itâ€™s the latest worm, Trojan horse, buffer overflow or denial of service attack thatâ€™s got you or one of your servers down. While one of these bugs may be affecting one or more of your servers in your enterprise, it is highly unlikely that the server affected is a Power server running IBM i. IBM i may be running your core business applications or it may be hosting your website or running Domino. Whatever its function within your enterprise IBM i has remained unaffected by virus and malware attacks. Why is that? Viruses and other ailments spread by infecting a host that is vulnerable. Letâ€™s take a look at how IBM i and the applications running on it can remain unscathed by the viruses and malwarâ€¦
When Management Turns its Back on Security: The Business EffectsIn this white paper we hope to explain why the decision to secure- or not secure â€“ data on the IBM i needs to be a business decision ... not a technical decision. Something is preventing management from understanding the need to secure the electronic data. So letâ€™s explore why we think this happens....â€¦
IBM i Security Administration and Compliance
ORDER YOUR COPY
Click for this Month's
Deck: Handling quotes in CL concatenation
Handling character strings can be confusing in CL, especially when you're splicing several pieces together with the concatenation operators. One has only to browse through the AS/400 message base in OpenBBS to realize that this topic confuses many would-be OPNQRYF users.
In this article, I'll break down string manipulation in CL in order to do away with the mystery and so you can exploit OPNQRYF to your benefit. Throughout this text I'll call the ' character a single quote (which is also referred to as an apostrophe).
As long as there are no embedded single quote characters in the strings, you'll never have a problem with them. For example:
CHGVAR VAR(&TITLE) VALUE('Quote and Unquote')
The CHGVAR command listed above assigns the value 'Quote and Unquote' to variable &TITLE. However, most assignments are more complicated and usually involve the concatenation and substring functions.
This type of assignment, however common, doesn't take advantage of the concatenation operators or the substring function. Let's define them briefly:
*CAT: Takes two strings and concatenates them, or pastes them together. For example:
DCL VAR(&FIRST) TYPE(*CHAR) LEN(10) VALUE('Johnny') DCL VAR(&LAST) TYPE(*CHAR) LEN(15) VALUE('Weissmuller') DCL VAR(&NAME) TYPE(*CHAR) LEN(30) CHGVAR VAR(&NAME) VALUE(&FIRST *CAT &LAST)
The CHGVAR command assigns the value 'Johnny Weissmuller' to variable &NAME, including five blanks in the middle. This is so because *CAT concatenates the variables in their entirety. &FIRST is 10 characters long, but only the first six characters are used. Too bad! *CAT includes all 10 characters.
*BCAT: Concatenates two strings, (and leaves just a single blank in between). To do this, all trailing blanks are removed from the first value, and then a single blank space is placed in the middle. Changing the above example to use *BCAT,
CHGVAR VAR(&NAME) VALUE(&FIRST *BCAT &LAST)
assigns the value 'Johnny Weissmuller' (with only one blank in the middle) to &NAME. That seems more sensible.
*TCAT: Concatenates two strings, removing all trailing blanks from the first string and placing no blanks in between. For example:
DCL VAR(&LIB) TYPE(*CHAR) LEN(10) VALUE('QGPL') DCL VAR(&FILE) TYPE(*CHAR) LEN(10) VALUE('QCLSRC') DCL VAR(&QUAL) TYPE(*CHAR) LEN(21) CHGVAR VAR(&QUAL) VALUE(&LIB *TCAT '/' *CAT &FILE)
Variable &QUAL will have the value 'QGPL/QCLSRC' (without any embedded spaces), which is how it should be. Notice that the second *CAT could have been replaced with another *TCAT without changing the result.
%SST: Substring function, used to extract a portion of a character string. %SST must be immediately followed by an opening parenthesis, three values separated by spaces and a closing parenthesis. The first value is the original string from which we'll do the extracting. The second value indicates in what position to start extracting (byte number). The third value indicates how many characters to extract. Example:
DCL VAR(&TITLE) TYPE(*CHAR) LEN(20) + VALUE('QUOTE UNQUOTE') DCL VAR(&PORTION) TYPE(*CHAR) LEN(5) CHGVAR VAR(&PORTION) VALUE(%SST(&TITLE 2 6))
Variable &PORTION will have the value 'UOTE U' (six characters beginning with the second character).
Back to Embedded Quotes
Nothing prevents a character string from containing a single quote character somewhere. Try the following example of the CHGVAR command on for size:
CHGVAR VAR(&PHRASE) VALUE('It''s here')
Golden Rule Number One: When surrounding a character string with single quotes, you must double up any single quotes embedded in the string. The string we want to assign to variable &PHRASE is simply the following:
You can also use the double quote character instead of two consecutive single quotes. Thus, the CHGVAR command could have been coded as follows:
CHGVAR VAR(&PHRASE) VALUE('It"s here')
IBM manuals often use the single and double quotes next to one another, like this:
CHGVAR VAR(&TITLE) VALUE('Don"' *CAT 't do this.')
Personally, I think this confuses more than it helps. It confuses because it introduces a character as a synonym of two others. But, you should use whatever method makes more sense to you.
You can easily compare two variables using the IF command's COND parameter. When performing a comparison, both sides of the comparison operator (*EQ, *NE, etc.) must be of the same type; that is, both must be character or both must be decimal. Here are two examples:
IF COND(&STATE *EQ 'CA') THEN(...)
IF COND(&ZIP *EQ 92008) THEN(...)
Variable &STATE is of type character, so it must be compared to a character string like 'CA' (always surrounded by single quotes). Variable &ZIP is of type decimal, so it must be compared to a decimal value like 92008, which by not having single quotes, is automatically considered decimal.
OPNQRYF and Quotes
OPNQRYF has a parameter, QRYSLT, where you must code a character string that represents what records are to be selected from the database file.
In contrast, the IF command's COND parameter doesn't use a character string, but an actual logical expression consisting of (at least) two values separated by a comparison operator such as *EQ.
OPNQRYF, let me emphasize it, uses a single character string in the QRYSLT parameter, meaning that whatever you code in the QRYSLT parameter must be enclosed in single quotes.
Let's try to code the QRYSLT parameter to select all records that have a state of California and a ZIP code of 92008:
OPNQRYF FILE(...) QRYSLT('STATE *EQ CA *AND ZIP *EQ 92008')
This quickly produces an error message, because the first *EQ tries to compare field STATE to field CA. That's right--OPNQRYF assumes that CA is the name of a field because it's not surrounded by single quotes. So let's try this:
OPNQRYF FILE(...) QRYSLT('STATE *EQ 'CA' *AND ZIP *EQ 92008')
This produces a different error message, even sooner, because we're breaking Golden Rule Number One. The single quotes surrounding CA must be doubled, as in:
OPNQRYF FILE(...) QRYSLT('STATE *EQ ''CA'' *AND ZIP *EQ 92008')
Notice that the second *EQ has never been in error; we're comparing field ZIP and the decimal constant 92008.
Representing a Single Quote
Many times it becomes necessary to concatenate a single quote to longer strings. How do you code a single quote constant in CL?
Because it's going to be a character string, it must be enclosed in single quotes, so it's only natural to think that it would be:
Doing this, however, violates Golden Rule Number One. The single quote must be doubled because it's surrounded by single quotes, so you end up with the following:
That's how you code a single quote, believe it or not. It makes sense, if you think about it. For simplicity, I recommend you create a variable, "E, that contains this value:
DCL VAR("E) TYPE(*CHAR) LEN(1) VALUE('''')
This DCL command declares variable "E as a one-byte character string, and it initializes it to a single quote. From then on you can simply use variable "E anywhere you need a single quote. We'll use this variable in the next section.
Using Variables in QRYSLT
OPNQRYF provides much flexibility by allowing variables and constants to be concatenated in the QRYSLT parameter. When you combine variables and constants, you'll have to concatenate them since--I repeat--since QRYSLT must have a single character string only.
Let's say that, in order to add flexibility, we want to change the previous QRYSLT parameter so that the state and the zip code are given in variables. The OPNQRYF command, then, will select all the records of the database file that have the state and the zip code that match those you enter in the variables:
DCL VAR(&STATE) TYPE(*CHAR) LEN(2) DCL VAR(&ZIP) TYPE(*DEC) LEN(5 0) DCL VAR(&ZIPCHAR) TYPE(*CHAR) LEN(5) DCL VAR("E) TYPE(*CHAR) LEN(1) VALUE('''') CHGVAR VAR(&ZIPCHAR) VALUE(&ZIP) OPNQRYF FILE(...) QRYSLT('STATE *EQ' *BCAT "E + *CAT &STATE *CAT + "E *BCAT '*AND ZIP *EQ' *BCAT &ZIPCHAR)
Assume we've entered a value of 'NY' for &STATE and a value of 10012 for &ZIP. Somehow we need to concatenate the ZIP code of 10012 (which is a decimal value) to the rest of the string. Since decimal values can't be concatenated, we first convert it to character with the CHGVAR command, receiving the value of &ZIP (decimal variable) into &ZIPCHAR (character value).
Let's analyze the QRYSLT string now. I'll pull out the first half and start evaluating it, pretending that I'm the computer. Each consecutive line has an intermediate result after each evaluation. The last line contains the final string shown in 1.
Let's analyze the QRYSLT string now. I'll pull out the first half and start evaluating it, pretending that I'm the computer. Each consecutive line has an intermediate result after each evaluation. The last line contains the final string shown in Figure 1.
The second half evaluates even more easily:
'*AND ZIP *EQ' *BCAT &ZIPCHAR
*AND ZIP *EQ 10012
*AND ZIP *EQ 10012
Putting them together, we obtain the final QRYSLT string:
STATE *EQ 'NY' *AND ZIP *EQ 10012
If you think that doubling quotes is where it all ends, think again. Quotes can be quadrupled, as many S/38 programmers using SBMJOB with RQSDTA will confirm.
As an example, suppose you want to send the system operator the following message:
Paying tribute to Golden Rule Number One, you'd code the SNDMSG command as follows:
SNDMSG MSG('I''m here!') TOMSGQ(QSYSOPR)
But wait. Now we need to submit this job to batch, which is done with the SBMJOB command. You can use either the CMD or the RQSDTA parameters. The difference is that the CMD parameter expects a command string, while RQSDTA expects a character string (there we go again!).
Let's use the RQSDTA parameter. We'll need to enclose the entire command string in single quotes in order to make it a character string. According to Golden Rule Number One, all single quotes are doubled. Guess what happens when you already have doubled single quotes? You've got it--they're doubled again:
'SNDMSG MSG(''I''''m here!'') TOMSGQ(QSYSOPR)'
Therefore, the SBMJOB command looks like this, shown in 2.
Therefore, the SBMJOB command looks like this, shown in Figure 2.
When doubling quotes time after time, only the sky's the limit. If you wanted to run the above SBMJOB command from within an RPG program, you'd have to use QCMDEXC to run the command.
QCMDEXC requires the command string as a character string in its first parameter. Well, here we go again! The first parameter for QCMDEXC would be as shown in 3.
QCMDEXC requires the command string as a character string in its first parameter. Well, here we go again! The first parameter for QCMDEXC would be as shown in Figure 3.
I suspect there are cases when you'd need 16 or 32 single quotes in a row. If you find one, give yourself a pat on your back. As teachers love to say, I'll leave that as an exercise for the student.
Quote...unquote: Help with CL String Manipulation
Figure 1 Evaluation of QRYSLT string
Figure 1: Evaluation of QRYSLT string 'STATE *EQ' *BCAT "E *CAT &STATE *CAT "E STATE *EQ ' NY ' STATE *EQ 'NY'BLOG COMMENTS POWERED BY DISQUS
Quote...unquote: Help with CL String Manipulation
Figure 2 Example of quadruple quotesFigure 2: Example of Quadruple Quotes SBMJOB RQSDTA('SNDMSG MSG(''I''''m here!'') TOMSGQ(QSYSOPR)') + JOBQ(QBATCH)
Quote...unquote: Help with CL String Manipulation
Figure 3 Example of octuple quotesFigure 3: Example of Octuple Quotes 'SBMJOB RQSDTA(''SNDMSG MSG(''''I''''''''m here!'''') TOMSGQ(QSYSOPR)'') JOBQ(QBATCH)'