<<

Open Source on IBM i Webinar Series Day 2 ERWIN EARLEY ([email protected]), SR. SOLUTIONS CONSULTANT, PERFORCE, NOVEMBER 2019 2 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Day 1 Review • Introduction to Open Source on IBM i

• Why is Open Source on IBM i Important

• Understanding the PASE environment as the enabler of Open Source on IBM i

• Getting Familiar with the PASE environment

2 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 3 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Day 2 Agenda • Setting up OSS EcoSystem on IBM i – ACS version

• Exploring Containers on IBM i

• Managing Open Source on IBM i

• Exploring Open Source Programming Languages ▪ Integration with Db2 and ILE

• After-Hours Lab: Containers & Setting up Development Environment

• After-Hours Lab: Open Source Programming Languages

3 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com IBM Systems Technical University © 3 4 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com

Setting up OSS Ecosystem on IBM i – ACS Version

4 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 5 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com The directory structure Before installing the Open Source ecosystem /

dev home lib sbin tmp usr var

Directory Contents bin Commands dev Device Files etc Configuration files home User Home Directories lib Libraries pkgs Package files / commands sbin Privileged commands tmp Temporary files usr Utilities & Applications var Variable files

5 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 5 6 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Bootstrapping OSS • Bootstrapping is the process of installing utilities and repository definitions to enable the system with the necessary commands for managing open source packages

Version 1.1.8 Connect to the or later of system via ACS SSH

NOTE: An alternate installation method would be to download the SQL bootstrap script from Supports management of packages in separate containers ftp://public.dhe.ibm.com/software/ibmi/ Bootstrap not products/pase/rpms/bootstrap. and currently installed run it against your IBM i

6 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 7 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Repository Definition • One of the tasks that the bootstrap accomplished was setting up a repository definition • The RPM packages reside in a repository that is publicly accessible • The definition of the repository is located in the /QOpenSys/etc/yum/repos.d directory • The repository file for the IBM RPM pile is ibm.repo [ibm] name=ibm baseurl=http://public.dhe.ibm.com/software/ibmi/products/pase/rpms/repo enabled=1 gpgcheck=0

Note: it is possible to use a local repository by downloading the files from the indicated FTP site and then uploading them to a directory on the system. The 'baseurl' would change to indicate 'file' and the path to the directory of RPMs.

Additional note: ACS has support for cloning the repository to a local server.

7 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 8 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com The directory structure

After installing the Open Source bootstrap

/

dev home lib QOpenSys sbin tmp usr var

bin etc lib pkgs sbin tmp usr var

8 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 8 9 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Install New Software: ACS

yum install

9 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 10 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Check for Updates: ACS

yum list upgrades

10 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 11 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Perform an Update: ACS

yum upgrade

yum upgrade

11 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 12 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Security Vulnerability! Uh Oh!!!

• https://www.cvedetails.com/cve/CVE-2018-1000007/

12 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 13 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com What's installed?: ACS

yum list

yum list '*searchword*'

13 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 14 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com What's available?: ACS

yum list available

14 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 15 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Where does all this information come from?

15 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 16 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Where does all this information come from?

16 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 17 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Where are the RPMs (packages) hosted?

• Open-Source Software team builds .rpm files, then we put them out on the internet for you:

https://public.dhe.ibm.com/software/ibmi/products/pase/rpms/repo

17 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 18 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Not just IBM repositories!! .NET Available on IBM i!!!

• Mono has been ported to IBM i!!

• Community Effort

• Available via third-party RPM repository

https://bitbucket.org/ibmi/opensourc e/src/master/docs/yum/3RD_PART Y_REPOS.md

18 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 19 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com

https://bitbucket.org/ibmi/opensource/src/master/docs/yum/3RD_PARTY_REPOS.md

19 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 20 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Automating the Process

“How can I limit the RPMs available?” • You need to host your own private RPM repository “My systems can’t access the internet!” • You need to host your own private RPM repository on your company’s intranet “I need to distribute to many systems” • Easy to do with Yum – Script or Schedule a Job

“That sounds really hard” • Yes it does. But it is actually very easy. Let me show you...

20 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 21 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Managing your RPMs company wide

IBM .rpm repo

Your IBM i(s) Or Chroots

Your private repo Host server

21 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 22 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Managing your RPMs company wide

IBM .rpm repo

Your IBM i(s) Or Chroots

Your private repo Host server

ACS

22 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 23 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Distributing updates in 4 easy steps

1) Clone the IBM OSS repo to your Host server 2) Create your own repo 3) Point your IBM i systems to your repo 4) Automate…

23 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 24 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Step 1: Clone IBM i OSS repo (using ACS)

24 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 25 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Step 2: Create your own repo (with ACS)

Copy from source repo

Create repo

Make repo accessible

25 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 26 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Step 3: Point your IBM i systems to your repo

 Now, onto your IBM i systems…

 We have to set up our systems to point to our new repository

 NOTE: I use ssh to connect to my IBM i, and run bash script. Some bash commands may be different than QP2TERM commands!

26 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 27 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Step 3: Point your IBM i systems to your repo

 This is where the ACS and non-ACS paths meet…

 On your IBM i, run the following command to point yum to the repo

yum-config-manager --add-repo /ibm yum-config-manager --add-repo

27 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 28 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Step 3: Point your IBM i systems to your repo

 When you run yum repolist, you should see your new, privately hosted repo!

28 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 29 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Step 3: Point your IBM i systems to your repo

Summary:

 We created a .repo file in /QOpenSys/etc/yum/repos.d

 We can now get our RPMs on our IBM i directly from our own repository

29 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 30 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Automating updates

IBM .rpm repo

Your IBM i(s)

Your private repo Host server

30 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 31 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Utilities • Various utilities are available for working in PASE including editors, package management tools, and source code control systems

• By installing the open source bootstrap (shown earlier) tools such as yum and rpm are available for manage other software packages

Function yum command Install a package yum install Remove a package yum remove Search for a package yum search List installed packages yum list installed List available packages yum list available List all packages yum list all

31 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 32 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Utilities – Installing an Editor (example)

• Once the bootstrap has been installed, the yum command along with the repository definition are available to be used for installation of additional packages • The 'yum repolist' command can be used to validate the availability of the repository:

# yum repolist repo id repo name status ibm ibm 231 repolist: 231

• A check can be made to see if a package with nano is available via the 'yum provides' command:

# yum provides nano nano-2.9.0-0.ppc64 : Small and friendly text editor Repo : ibm

32 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 33 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Utilities – Installing an Editor (an example)

• The package can be installed via the 'yum install' command:

# yum install nano Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package nano.ppc64 0:2.9.0-0 will be installed --> Processing Dependency: lib:/Opens/pkgs/lib/libncurses.so.6(shr_64.o)(ppc64) for package: nano-2.9.0-0.ppc64 --> Running transaction check ---> Package libncurses6.ppc64 0:6.0-2 will be installed --> Processing Dependency: ncurses-terminfo for package: libncurses6-6.0-2.ppc64 --> Running transaction check ---> Package ncurses-terminfo.ppc64 0:6.0-2 will be installed  Finished Dependency Resolution

Dependencies Resolved ======Package Arch Version Repository Size ======Installing: nano ppc64 2.9.0-0 ibm 598 k Installing for dependencies: libncurses6 ppc64 6.0-2 ibm 318 k ncurses-terminfo ppc64 6.0-2 ibm 582 k

Transaction Summary ======Install 3 Packages Total download size: 1.5 M Installed size: 4.9 M Is this ok [y/N]:

33 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 34 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com

Exploring Containers on IBM i

34 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 35 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Overview • Containers allow for the isolation of directories such that different users can have different environments that are dedicated to their usage. • IBM i has the 'chroot' capability available to enable establishing of what is often referred to as a 'chroot jail' – an isolation of directories and files. • The following diagram provides a high-level view of chroot jail:

• In the above example there are two ‘chroot’ jails that sit on top of the host and the system infrastructure. • Each “jail” can have their own software installed

35 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 36 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Installing chroot support

CLI: yum install ibmichroot

Select install

36 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 37 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com

Prompt with Actions to take

37 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 38 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Building the Container

• Requirements:

▪ Location of the chroot jail has to be ##### # # ###### ####### ####### ####### under the /QOpenSys directory # # # # # # # # # # # # # # # # # # # # # ▪ The person running the 'chroot_setup' # ####### ###### # # # # # # # # # # # # # # # command needs to have *IOSYSCFG and # # # # # # # # # # # *ALLOBJ ##### # # # # ####### ####### #

##### ####### ####### # # ###### # # # # # # # # # # # # # # # • Command to create the container: ##### ##### # # # ###### ▪ chroot_setup /QOpenSys/ minimal nls ##### ####### # ##### #

********************** Live IBM i session (changes made). ********************** /QOpenSys/team30 /QOpenSys/team30 Does not Exist

38 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 39 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com The directory structure

After creating a container

/

dev home lib QOpenSys sbin tmp usr var

bin etc lib pkgs sbin tmp usr var

container

bin dev home QOpenSys lib sbin tmp usr var

bin etc lib pkgs sbin tmp usr var

39 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 39 40 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Install Packages into Container (CLI)

The shell will be used for CLI Install a shell yum –-installroot=/QOPenSys/ install bash

Determine package name: yum provides nano Install an editor yum –-installroot=/QOpenSys/ install nano

Install the open source yum –-installroot=/QOpenSys/ install nodejs language

chroot /QOpenSys/ /QOpenSys/pkgs/bin/bash Enter container

Install db2 connector install idb-connector npm install toolkit and toolkit (ILE)

40 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 41 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Install Packages into Container (ACS)

Specify path for Container on connect

Select package from Available Packages tab

Select

41 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 42 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Work in the Container

• The 'chroot' command can be used to enter the container: chroot /QOpenSys/ /QOpenSys/usr/bin/bash ▪ The first argument is the path to the container. ▪ The second argument is the path (inside the container) of the first program to execute (typically a shell)

• Configure user profile to automatically enter the container: CHGUSRPRF USRPRF() HOMEDIR('/QOpenSys//./home/')

42 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 43 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com The directory structure

Effect of entering the container

/

dev home lib QOpenSys sbin tmp usr var

bin etc lib pkgs sbin tmp usr var

container/

bin dev home QOpenSys lib sbin tmp usr var

bin etc lib pkgs sbin tmp usr var

43 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 43 44 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com

Managing Open Source on IBM i

44 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 45 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Package Management Overview

• Common Tasks: ▪ Install New Software ▪ Check for Updates ▪ Perform an Update ▪ What's installed? Am I exposed to a CVE? ▪ See What's Available

• Techniques ▪ Access Client Solutions ▪ CLI

45 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 46 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com rpm and yum Package Managers

• RPM: RPM ▪ Installs and manages individual packages ▪ Works with .rpm files directly ▪ Maintains the RPM database

• yum: Yellowdog Updater, Modified ▪ Acts as a wrapper around RPM ▪ Manages packages and dependencies automatically

46 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 47 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com RPM Primary Commands

Command Usage rpm -i or rpm –-install Install a package rpm –U or rpm –-upgrade Upgrade a package rpm –e or rpm –erase Remove a package rpm –q Query the rpm database rpm -V Verify a package

NOTE: In most cases, yum will be used as a front-end to rpm.

47 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 48 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com yum Primary Commands Command Usage yum install Install a package yum update Remove a package yum search Search repository for a package yum list List packages yum info Show details about a package yum provies Find package that delivers command

48 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 49 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Managing Packages from inside a Container

• Install 'rpm' and 'yum' into the container: ▪ yum –-installroot=/QOpenSys/ install rpm yum • Install 'yum-utils' into the container: ▪ yum –-installroot=/QOpenSys/ install yum-utils From inside the container • Establish a repository definition: yum-config-manager –-add-repo http://public.dhe.ibm.com/software/ibmi/products/pase/rpms/repo • At this point you can use the typical package management commands (including ACS) from within the container

49 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 50 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com

Building Packages – an Example

50 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 51 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Pre-Build Steps • Install Open Source boot strap • Install container support yum install ibmichroot • Establish container to perform the build in chroot_setup /QOpenSys/phpbuild minimal nls • Install headers into container chroot_setup /QOpenSys/phpbuild chroot_includes • Install bash into the container yum install --installroot=/QOpenSys/phpbuild install bash • Install yum and rpm into the container yum install –installroot=/QOpenSys/phpbuild install yum rpm • Install developer tools group into the container yum group –installroot=/QOpenSys/phpbuild groups install "Developer Tools" • Configure repository inside container yum-config-manager –-add-repo http://public.dhe.ibm.com/software/ibmi/products/pase/rpm s/repo

51 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 52 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Additional Installs • bzip2-devel • curl-devel • freetype-devel • libiconv-devel • libintl-devel • libjpeg-turbo-devel Packages can be installed from inside • libpng-devel or outside of the container • libsodium-devel • libwebp-devel • libxml2-devel • libxslt-devel • sqlite3-devel • unixODBC-devel • xz-devel • gzip • tar-gnu

52 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 53 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Performing the actual build • Enter the container chroot /QOpenSys/phpbuild /QOpenSys/pkgs/bin/bash

• Install the source rpm –Uvh -7.3.6-0.src.rpm ▪ NOTE: The above command will create a SOURCES and SPECS directory in the user's home directory

• Perform the build ▪ cd SPECS ▪ rpmbuild –ba php.spec

• Copy the resulting RPMs to the repository

53 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 54 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com

Exploring Open Source Programming Languges

54 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 55 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Exploring Open Source Languages – Sub Agenda • The Big Four: ▪ Node.js ▪ PHP ▪ Python ▪ Ruby • Toolkits • Other "Open Source" and "Open Standards" languages on IBM i • Futures • Closing Thoughts

55 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 56 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com

• Definition: An open-source language refers to a that falls within the parameters of open-source protocol. ▪ This basically means that the language is not proprietary, and with certain provisions (depending on the open source language), can be modified or built in a manger that is open to the public

• Explained: As computers and programming languages evolved, many computer and software development communities began to see a potential for non-proprietary software and coding languages ▪ This led to the foundations of the open-source movement. Out of the open-source movement both open source languages and open source standards evolved, ▪ The rules for open source languages include: − Source code must be open and accessible − Derived works must also be open source − The languages must be freely distributed − The integrity of the source code must be maintained − Licenses must not restrict other software − There can be no discrimination against fields of endeavor

56 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 57 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com

Node.js

57 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 58 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Fact Sheet Language Node.js Open Source? Yes (MIT) Inception Date 27-May-2009 Original Developer Ryan Dahl Predecessor / Influencer Java Origin of the name Installable on IBM i Yes via RPM Typical Usage Scalable network applications Beware of Web Site Nodejs.org Repository .com/nodejs/node Current ranking on 7 (javascript) TIOBE As of: 20-Nov-2019

58 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 59 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Node.js Overview

• Created by Ryan Dahl in 2009 (originally only supported on Linux) to address concurrency issues. • Built on Chrome’s V8 JavaScript engine. • Single-threaded asynchronous event driven JavaScript framework. In-progress tasks can easily be checked for completion. • Vertical scaling can be achieved by adding CPU cores and adding a worker to each core. This means resources (e.g. sockets and IPC) can be shared (via the cluster module and child_process.fork(…)). • Using JavaScript on the browser as well as the server minimizes the mismatch between the environments. Example: Form validation code does not have to be duplicated on both client and server. • Node.js objects maintain a list of registered subscribers and notifies them when their state changes (Observer design pattern).

59 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 60 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Quick Overview • The language ▪ Curly-brace style language (/C++/Java) ▪ Prototype-based, not class-based (no inheritance) ▪ Highly asynchronous, event-driven

• Pros ▪ Use same language for frontend and backend − This can help avoid mismatch between environments ▪ Lots of buzz around Node.js right now ▪ Incredible growth. Lots of corporate investment ▪ Node.js uses JIT, not interpreted (good performance)

JIT  Just In Time compiler

60 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 61 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Quick Overview • Cons: ▪ Syntax is "awful" (projects to compile to JS: CoffeeScript, TypeScript, …) − Getting better via Promises ▪ Asynchronous more difficult than synchronous, requires different mindset, "Callback hell" (Promises improves things) − Getting better via Promises ▪ Not as many turnkey solutions available (often you need to do some piecing together) ▪ Event-driven I/O not unique to Node, see EventMachine (Ruby), Twisted (Python), … ▪ Not as popular outside of web ▪ CPU intensive jobs (sorting, data transmission, data aggregation)

Promises  alternative to callbacks when dealing with asynchronous code.

61 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 62 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Overview (continued) Pros Cons • Lightweight: Low memory footprint • 1.7GB memory limit (64-bit) • Cross-platform environment. Server • Vertical scaling challenge (but and client-side can be written in workarounds exist) JavaScript • Module versions can get confusing • Fast: Asynchronous and event • Open source governance is not driven flawless • Popularity – Rage-quit: Coder unpublished • Concurrency implementation is 17 lines of JavaScript and abstract (handled behind the scenes) “broke the Internet”: http://arstechnica. • Full Stack Web Development: Front- com/information- end developers can code on the technology/2016/03/rage-quit- backend coder-unpublished-17-lines-of- • Extensibility -and-broke-the- internet/

62 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 63 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Overview (continued)

• From Wikipedia: Node.js is a packaged compilation of Google's V8 JavaScript engine, the libuv platform abstraction layer, and a core library, which is itself primarily written in JavaScript.

• Ryan Dahl, the creator of Node.js, was aiming to create real-time web-sites with push capability.

• Node.js provides the tools for working in a non-blocking, event-driven I/O paradigm.

• Node.js moves away from the stateless request-response paradigm to web- applications with real-time two-way connections where both the client and server can initiate communication ▪ Client and server are able to exchange data freely  contrast this with the typical web response paradigm where the client always initiates communication. • Node.js is based on the open web stack (HTML, CSS and JS) running over the standard port 80

63 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 64 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Node.js Overview • What can Node.js be used for? • RESTful Services • Real-time Multiplayer Games: Handles web-socket connections between players. • Web Services • Web-Based Applications • Instant Messaging (Rocket.Chat) • Who uses Node.js? • Netflix • Yahoo! • PayPal • LinkedIn • eBay • Dow Jones • Microsoft • Uber

64 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 65 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Node.js use cases • Highly concurrent server-side applications • Creating real-time web apps ▪ Ruby and Python can do these as well however it is viewed by the community that Node.js does this exceptionally well in terms of performance and ease of development • Building APIs ▪ Node.js is good at handling lots of requests that are I/O driven (ex: operations on database) and scales well • Building streaming applications • RESTful Services • Real-time Multiplayer Games  Handles web-socket connections between players • Instant Messaging (Rocket.Chat)

65 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 66 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Node.js

• Node.js facilitates the running Proxy of server-side Javascript [NGINX] • Node is designed to build scalable network applications Framework [Node.JS] • Node.js supports high- performance web transactions by handling many connections concurrently.

• Along with Nginx, server less nodes can now be implemented on IBM i

66 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 67 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Differences From Traditional JavaScript •Both traditional and Node.js JavaScript implement a superset of the ECMAScript standard. They are syntactically equivalent ▪ Node.js translates Javascript code using the browser's built-in interpreter. ▪ Node.js can be run on both the client and server where traditional JavaScript runs only on the client ▪ Node.js adds a different set of libraries and run-time environment ▪ Node.js gives the developer the ability to access the file system ▪ Node.js does not include the browser API to get to the (DOM). − You could add this to Node.js by using a library such as https://github.com/tmpvar/jsdom)

67 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 68 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Install Node.js

• First let's determine which package needs to be installed: yum provides node

# yum provides node ibm | 1.5 kB 00:00:00 ibm/primary | 86 kB 00:00:00 ibm 231/231 nodejs-8.9.3-0.ppc64 : Node.js JavaScript Programming Language Repo : ibm Matched from: Filename : /QOpenSys/pkgs/bin/node

nodejs8-8.10.0-0.ppc64 : Node.js JavaScript Programming Language Repo : ibm Matched from: Filename : /QOpenSys/pkgs/bin/node

• The yum install command is used to install Node.js yum install nodejs

68 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 69 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Node.js Installation Summary

# yum install nodejs Setting up Install Process Package nodejs is obsoleted by nodejs8, trying to install nodejs8-8.10.0-0.ppc64 instead Resolving Dependencies --> Running transaction check ---> Package nodejs8.ppc64 0:8.10.0-0 will be installed --> Processing Dependency: lib:/QOpenSys/pkgs/lib/libstdc++.so.6(shr_64.o)(ppc64) for package: nodejs8-8.10.0-0.ppc64 --> Running transaction check ---> Package libstdcplusplus6.ppc64 0:6.3.0-14 will be installed --> Processing Dependency: lib:/QOpenSys/pkgs/lib/libgcc_s.a(shr.o)(ppc64) for package: libstdcplusplus6-6.3.0-14.ppc64 --> Running transaction check ---> Package libgcc-aix.fat 0:6.3.0-14 will be installed --> Finished Dependency Resolution

Dependencies Resolved

======Package Arch Version Repository Size ======Installing: nodejs8 ppc64 8.10.0-0 ibm 20 M Installing for dependencies: libgcc-aix fat 6.3.0-14 ibm 471 k libstdcplusplus6 ppc64 6.3.0-14 ibm 2.8 M

Transaction Summary ======Install 3 Packages

Total download size: 23 M Installed size: 92 M Is this ok [y/N]: y Downloading Packages: (1/3): libgcc-aix-6.3.0-14.ibmi7.1.fat.rpm | 471 kB 00:00:00 (2/3): libstdcplusplus6-6.3.0-14.ibmi7.1.ppc64.rpm | 2.8 MB 00:00:02 (3/3): nodejs8-8.10.0-0.ibmi7.2.ppc64.rpm | 20 MB 00:00:15 ------Total 1.1 MB/s | 23 MB 00:21 Running Transaction Check Running Transaction Test Transaction Test Succeeded Running Transaction Installing : libgcc-aix-6.3.0-14.fat 1/3 Installing : libstdcplusplus6-6.3.0-14.ppc64 2/3 Installing : nodejs8-8.10.0-0.ppc64 3/3

Installed: nodejs8.ppc64 0:8.10.0-0

Dependency Installed: libgcc-aix.fat 0:6.3.0-14 libstdcplusplus6.ppc64 0:6.3.0-14

Complete!

69 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 70 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Create a node.js Application

• A simple Hello World application will be used to showcase Node.js ▪ The application will return "Hello World" to any HTTP requests • Use the nano editor to create the hello.js file

• Add the execution permission to the hello.js file – chmod +x ./hello.js

70 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 71 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Test the node.js application

• Attempt to execute the hello world node.js script ▪ ./hello.js

# ./hello.js Server running at http://localhost:8080/

The above way of running a node.js application will cause additional commands to be blocked until the application is terminated by pressing the key combination.

• The curl application can be used from another terminal session to test the application by connection to localhost

71 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 72 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Installing curl • Check to see if curl is installed: which curl

# which curl no curl in /QOpenSys/pkgs/bin /QOpenSys/usr/bin /usr/ccs/bin /QOpenSys/usr/bin/X11 /usr/sbin . /usr/bin

• Find out which package provides curl: yum provides curl

# yum provides curl curl-7.58.0-0.ppc64 : command line tool and library for transferring data with URLs Repo : ibm

• Install curl: yum install curl

curl is a utility/command for transferring data using various protocols.

72 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 73 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Install curl – Installation Summary

# yum install curl Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package curl.ppc64 0:7.58.0-0 will be installed --> Finished Dependency Resolution

Dependencies Resolved

======Package Arch Version Repository Size ======Installing: curl ppc64 7.58.0-0 ibm 99 k

Transaction Summary ======Install 1 Package

Total download size: 99 k Installed size: 286 k Is this ok [y/N]: y Downloading Packages: curl-7.58.0-0.ibmi7.1.ppc64.rpm | 99 kB 00:00:00 Running Transaction Check Running Transaction Test Transaction Test Succeeded Running Transaction Installing : curl-7.58.0-0.ppc64 1/1

Installed: curl.ppc64 0:7.58.0-0

Complete!

73 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 74 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Test the application locally

Node.js application running

Client accessing application

74 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 75 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Daemonize the Application

•Recall that the way the application is currently run causes the terminal session to be locked for further command input •The '' application can be used to daemonize node.js applications •'pm2' is installed with the node package manager (npm): ▪ npm install –g pm2

NOTE: Applications/commands installed with npm are typically placed in the '/QOpenSys/pkgs/lib/nodejs8/bin' directory The directory will have to either added to the search PATH or included in the command line.

75 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 76 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Daemonize the Application

• Start the application in daemon mode: ▪ /QOpenSys/pkgs/lib/nodejs8/bin/pm2 start hello.js

# /QOpenSys/pkgs/lib/nodejs8/bin/pm2 start hello.js [PM2] Starting /home/QSECOFR/hello.js in fork_mode (1 instance) [PM2] Done. ┌──────────┬────┬──────┬──────┬────────┬─────────┬────────┬─────┬────────┬─────────┬──────────┐ │ App name │ id │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │ ├──────────┼────┼──────┼──────┼────────┼─────────┼────────┼─────┼────────┼─────────┼──────────┤ │ hello │ 0 │ fork │ 5843 │ online │ 0 │ 0s │ 0% │ 0 B │ qsecofr │ disabled │ └──────────┴────┴──────┴──────┴────────┴─────────┴────────┴─────┴────────┴─────────┴──────────┘ Use `pm2 show ` to get more details about an app #

• Test the application

# curl http://localhost:8080 Hello World

76 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 77 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Blocking / Non-Blocking

77 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 78 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com

•Npm is the (node) package manager for Node.js ▪ Enables JavaScript developers to share code to solve common problems which promotes code reuse −Estimated # of JavaScript developers 11,000,000 ▪ Allows developers to take advantage of a large community ▪ Verify active and vibrant community: Over 650,000 packages available via npm

78 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 79 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com IBM i Extensions

• In addition to its core functions, Node.js on IBM i provides the following two IBM i specific extensions: • IBM DB2 for i access library  contains the JavaScript services that can be called to interact with DB2 for i database objects • Node.js toolkit for IBM i enables Node.js programs to access IBM i system resources through the XMLSERVICE. • Includes items such as system status, system values, job information, user spaces, data queues, and object information.

79 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 80 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Node.js for IBM I infrastructure

80 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 81 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Basic Db2 Access Flow

Establish a connection var db2i = require("idb-connector); var dbconn = new db2i.dbconn(); to the database

Set connector dbconn.setConnAttr… attributes

Build the SQL var stm = new db2i.dbstmt(dbconn); statement var sql = "select …

Execute the SQL stm.exec(sql, function(result) statement

Process the result set result.forEach(function(row)

81 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 82 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Introducing the toolkit & XMLService • The toolkit is a Node.js wrapper over the XMLSERVICE open source project from IBM • So…. How does node.js use XMLService

Allows connections from various languages (PHP, Python, node.js, etc) to ILE objects and IBM i native artifacts

82 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 83 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Basic Toolkit Flow

Establish a var xt = require("itoolkit"); connection to var conn = new xt.iConn("*LOCAL", "USERNAME", "PASSWORD"); XMLSERVICE

Define function for function cbJson(str) { var result = xt.xmlToJson(str); XML to JSON console.log(JSON.stringify(result, " ",2)) conversion }

conn.add(xt.iCmd(… Build the command / conn.add(xt.iSh(… / program var Pgm = new xt.iPGM…. / conn.add(pgm); call / SQL call var sql = new xt.iSQL…. / conn.add(sql);

Run the command list conn.run(cbJsdon);

83 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 84 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com PHP Fact Sheet Language PHP Hypertext Preprocessor Open Source? Yes (PHP License) Inception Date 1995 Original Developer Rasmus Lerdorf Predecessor / Influencer , C, C++, Java, Tcl Origin of the name Personal Home Page Installable on IBM i Yes – Zend Server Typical Usage Web Development Web Site www.php.net Repository github.com/php/php- src.git Current ranking on 8 TIOBE As of: 20-Nov-2019

84 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 85 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com PHP - Quick Overview • The Language ▪ Used to be embedded into HTML ▪ Somewhat C-style syntax (with some differences) ▪ Seen by some as the most developer friendly open source language ▪ Many popular Open Source solutions based on PHP including Joomla, Drupal, and WordPress

• Features ▪ Loosely typed language ▪ Cross platform compatibility ▪ Supports pre-defined variables (super-globals) ▪ Predefined error reporting constants are available ▪ Supports extended regular expressions ▪ Ability to generate dynamic page content ▪ Ability to collect form data and send/receive cookies ▪ Supports server-side file operations (create, delete, open, read, write, close) ▪ Output formats – HTML, PDF, flash, XHTML, XML

85 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 86 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Quick Overview (continued) • Disadvantages ▪ Weak typing: Implicit conversion can lead to unexpected defects. − PHP now supports type declarations in function and method definitions as well as return types ▪ Not suitable for large applications – lacks modularity • Pros: ▪ The "granddaddy" of open source languages on i (stable, mature) ▪ The most IBM i shops running PHP, the most community ▪ Comes with a robust Development Environment ▪ Can get a support contract from Rogue Wave (1 year free) • Cons: ▪ Current not as quickly-moving or quickly-growing ▪ Typically only used for serving up web pages (doesn't have to be used that way)

86 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 87 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com What is PHP • PHP is an easy to use, open source, platform independent ▪ Designed for web application development ▪ 4.5+ Million PHP Developers • PHP is the leading scripting language deployed on the Internet

• Thousands of PHP applications are available ▪ Web applications tied to databases ▪ Content management ▪ Wikis and Blogs Check-Out: www.phpjunkyard.com/ www.phpfreaks.com/

87 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 88 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Accessing DB2/400

1.Server/connection . Fetch . Errors A.db2_bind_param – db2_fetch_array – db2_conn_error B.db2_client_info – db2_fetch_assoc – db2_conn_errormsg C.db2_close – db2_fetch_both – db2_stmt_error D.db2_connect – db2_fetch_object – db2_stmt_errormsg E.db2_cursor_type – db2_fetch_row . Column/Procedure F.db2_exec . Field information – db2_column_privileges – db2_field_display_siz db2_execute e – db2_columns – db2_procedure_columns db2_prepare – db2_field_name – db2_field_num – db2_procedures A.db2_pconnect – db2_special_columns B.db2_server_info – db2_field_precision C.db2_statistics – db2_field_scale . Table information – db2_field_type – db2_num_fields 2.Result – db2_field_width – db2_num_rows A.db2_free_result . Key information – db2_table_privileges B.db2_next_result – db2_foreign_keys – db2_tables C.db2_result – db2_primary_keys . Statement 3.Commit/Rollback – db2_free_stmt A.db2_autocommit All of these APIs are documented online at php.net B.db2_commit  - Preferred db2_ SQL statement execution APIs (performance) C.db2_rollback . - Non-preferred db2_ SQL statement execution API

88 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 89 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com What is PHP • PHP is an easy to use, open source, platform independent scripting language ▪ Designed for web application development ▪ 4.5+ Million PHP Developers • PHP is the leading scripting language deployed on the Internet

• Thousands of PHP applications are available ▪ Web applications tied to databases ▪ Content management ▪ Wikis and Blogs Check-Out: www.phpjunkyard.com/ www.phpfreaks.com/

89 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 90 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Accessing DB2/400

1.Server/connection . Fetch . Errors A.db2_bind_param – db2_fetch_array – db2_conn_error B.db2_client_info – db2_fetch_assoc – db2_conn_errormsg C.db2_close – db2_fetch_both – db2_stmt_error D.db2_connect – db2_fetch_object – db2_stmt_errormsg E.db2_cursor_type – db2_fetch_row . Column/Procedure F.db2_exec . Field information – db2_column_privileges – db2_field_display_siz db2_execute e – db2_columns – db2_procedure_columns db2_prepare – db2_field_name – db2_field_num – db2_procedures A.db2_pconnect – db2_special_columns B.db2_server_info – db2_field_precision C.db2_statistics – db2_field_scale . Table information – db2_field_type – db2_num_fields 2.Result – db2_field_width – db2_num_rows A.db2_free_result . Key information – db2_table_privileges B.db2_next_result – db2_foreign_keys – db2_tables C.db2_result – db2_primary_keys . Statement 3.Commit/Rollback – db2_free_stmt A.db2_autocommit All of these APIs are documented online at php.net B.db2_commit  - Preferred db2_ SQL statement execution APIs (performance) C.db2_rollback . - Non-preferred db2_ SQL statement execution API

90 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 91 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Use Cases

Use Case: Extend reach of DB2 data to the web

Solution: Leverage PHP's 50+ DB2 language extensions to embed DB2 data access inside of HTML. Keep in mind that since PHP is a server-side scripting language the IBM i security aspects of the data access will be enforced Use Case: Provide access to DB2 resident data to mobile applications

Solution: Take advantage of rich mobile application development support to create responsive web applications. Client-side frameworks such as Twitter Bootstrap can be used to provide standard HTML and CSS for designing of the user interface to work on smartphones and tablets.

Use Case: Develop applications against multiple data sources

Solution: Use PHP's support for multiple data sources (such as MySQL/MariaDB, SQL Server, and DB2) to logically process through or join data records from the various data sources.

91 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 92 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com

92 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 93 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com PHP andILE Access

• Leverage existing business logic – no need to re-write • Provide new interfaces for existing data objects and artifacts Use Case: Need to convert an existing RPG application to run in web browsers. Solution: When using PHP as the "vehicle" to "convert" the application it's unlikely that 100% of the application will have to be rewritten. With PHP, the existing RPG code can be encapsulated into smaller programs or service programs containing modules. The programs and modules can be easily called using the ILE Toolkit.

Use Case: Leverage complex pricing routine written in RPG in a new web presence

Solution: Extract code from existing application and create an API in RPG. The resulting API can then be called from the PHP script thereby leveraging the investment in the existing application while using PHP to concentrate on the user interaction portion of the desired solution.

93 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 94 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com The Program Call

• Set parameters based on function ▪ Call program ▪ Output results

C V I L o a n e I m i n m n t / g e v t a n a O h m t e l

94 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 95 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Toolkit – it's about more than just calling RPG • CL Commands $conn->CLCommand('my command'); $conn->CLInteractiveCOmmand('DSP… command'); $conn->CLCommandWithOutput('RTV… command');

95 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 96 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Checking for / Installing (Licensed Program)

GO LICPGM < Option 10>

96 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 97 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Leveraging Subsystems in IBM i

• Different versions of Zend Server run in different ▪ This enables different versions to run side-by-size ▪ Upgrades between subsystems is not supported

Version Licensed Subsystem Management DocRoot Program Directory Ports Program Program Core 1ZCORE ZEND /www/zend/htdocs /usr/local/zend 89 5.X 2ZSVRPI ZENDSVR zendsvr/zsmenu /www/zendsvr/htdocs /usr/local/zendsvr 10088 6.x-8.x 6ZSVRPI ZENDSVR6 zendsvr6/zsmenu /www/zendsvr6/htdocs /usr/local/zendsvr6 10080 - DocRoot 10081 - WebGUI 9.X 7PHPZND ZENDPHP7 zendphp7/zsmenu /www/zendphp7/htdocs /usr/local/zendphp7 10090 –DocRoot 10091 - WebGUI

97 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 98 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Installing Zend Server to get PHP on IBM i

•One way to get PHP on IBM i is to install Zend Server ▪ IBM includes a Zend Server installation file with IBM i OS, but don’t use it. It is almost always out of date. ▪ Download from: http://www.zend.com/en/products/server/downloads#IBM i ▪ Always use the RSTLICPGM installer for new installations or migrations ▪ Always use the APYPTF installer for upgrades ▪ Instructions are included in the download package ▪ Additional tips: https://support.zend.com/hc/en-us/articles/203501993

98 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 99 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com What are IBM i Customer's Doing with PHP?

1. Consolidation: Move PHP applications that are running on Windows or Linux that access data in DB2 to run in IBM i to speed up or reduce complexity of the applications.

2. Modernization: Use PHP to web-enable green screen applications.

3. New application development: Create new applications with PHP on IBM i including applications for the intranet, reporting, websites, and extranets.

4. Leveraging PHP portfolio: Run commercial or opensource PHP applications on IBM i.

99 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 100 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Keep Current – Stay Supported

100 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 101 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com PHP 7 – Significant Performance Gains

• Optimization s to the Zend Engine significantly enhances performance • Performance gains ranging from 20-70% have been seen in real- world applications ▪ No application code changes required!

101 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 102 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Community PHP is Coming to IBM i

• The PHP engine that is built and maintained by the Open Source community is coming to IBM i

• Why? ▪ This has been the subject of RFEs to IBM ▪ Provides choice to IBM i customers ▪ Not seen as a replacement for Zend Server but more as an alternative for those that want to "kick the tires" of PHP

• Isn't the PHP that's delivered with Zend Server "community" PHP ▪ In a sense yes; however, the PHP that is delivered with Zend Server has been tested/certified and includes 80+ extensions that are installed/configured "out-of-the-box"

102 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 103 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Community PHP

Soon, two options for delivery of PHP will be available:

Community OSS PHP (RPM) Zend Server • Installed with 'yum' package • Purchasable support from manager Zend Purchasable IBM TSS ▪ Defect and security patches • past community EOS Support (http://ibm.biz/ibmi-oss- • Includes extra features to support) aid deployment, performance, monitoring, • Grow your own stack etc • Complete web development stack

103 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 104 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Integrated Installation vs. Grow Your Own Community OSS PHP (RPM) Zend Server

Ready to start developing Steps could include: / implementing solutions • Install php • Configure php • Install Apache • Configure Virtual Hosts • Configure docroot • Configure FastCGI • Install ibm_db2 • Install iToolkit • Install Libraries • Install Language Extensions

104 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 105 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Python Fact Sheet Language Python Open Source? Yes (PSF) Inception Date 1989 Original Developer Guido Van Rossum Predecessor / Influencer ABC programming language Origin of the name Monty Python's Fly Circus Installable on IBM i Yes – via RPM Typical Usage Rapid Prototyping Data Manipulation Command automation Beware of Multithreading applications Web Site www.python.org Repository https://github.com/python/ Current ranking on TIOBE 3

As of: 20-Nov-2019

105 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 106 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Quick Introduction • Programming language that is easy and quick to pick up • Typically used as a scripting language • Indentation determines block level (love it or hate it) • Features: ▪ Interpreted and Object-Oriented programming language ▪ Similar to PERL – has gained popularity due to it's clear syntax and readability ▪ Portable ▪ Source code is open for modification and reuse ▪ Easy learning curve ▪ Simple syntax ▪ Does not need compilation to binary ▪ Supports both procedure-oriented as well as object-oriented programming ▪ Can be embedded in C and C++  many packages created

106 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 107 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Quick Introduction (continued) • Pros: ▪ Easy to pick up for RPG/C/Java developers ▪ "Conservative": slow change, compatibility a goal, straight-forward syntax ▪ Many packages available ▪ Has an IBM i toolkit with direct-call capability (LibCall) ▪ Taught in many colleges • Disadvantages ▪ Not as popular for web (but capable: Django, Bottle) ▪ Not best for memory intensive tasks ▪ Interpreted language ▪ Slow compared to C/C++ or Java ▪ Lack of true multiprocessor support ▪ Lack of prepackaged solutions ▪ Language is considered by some to be relatively obscure ▪ Documentation gaps ▪ Lack of GUI and teamwork tools ▪ Python 2 vs. Python 3 incompatibilities (improving)

107 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 108 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Python Uses

• Shell tools ▪ System admin tools, command line programs • Extension-language work • Rapid prototyping and development • Language-based modules #!/usr/local/bin/python ▪ # import systems module Instead of special-purpose parsers import sys • Graphical user interfaces marker = '::::::' for name in sys.argv[1:]: • Database access input = open(name, 'r') print marker + name • Distributed programming print input.read() • Internet scripting

108 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 109 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Checking for / Installing (RPM)

• Check to see if installed: rpm –qa | grep python

$ rpm -qa | grep python python2-2.7.13-14.ppc64 python2-urlgrabber-3.10.2-0.noarch python2-rpm-4.13.0.1-4.ppc64 • Determine Package python2-pycurl-7.43.0-0.ppc64 yum provides python3

$ yum provides python3 ibm | 1.5 kB 00:00:00 python3-3.6.5-0.ppc64 : Python 3 Programming Language Repo : ibm

109 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 110 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Checking for / Installing (RPM)

• Install yum install python3

$ yum install python3 Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package python3.ppc64 0:3.6.5-0 will be installed --> Finished Dependency Resolution

Dependencies Resolved

======Package Arch Version Repository Size ======Installing: python3 ppc64 3.6.5-0 ibm 37 M

Transaction Summary ======Install 1 Package

Total download size: 37 M Installed size: 140 M Is this ok [y/N]:

110 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 111 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Checking for / Installing (RPM)

$ yum install python3 Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package python3.ppc64 0:3.6.5-0 will be installed --> Finished Dependency Resolution

Dependencies Resolved

======Package Arch Version Repository Size ======Installing: python3 ppc64 3.6.5-0 ibm 37 M

Transaction Summary ======Install 1 Package

Total download size: 37 M Installed size: 140 M Is this ok [y/N]:

111 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 112 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Python in action

• Command line (ssh session):

$ python2 --version Python 2.7.13 bash-4.4$ python3 --version Python 3.6.5

112 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 113 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Hello world?

$ python3 Python 3.6.5 (default, Apr 11 2018, 14:32:49) [GCC 6.3.0] on aix6 Type "help", "copyright", "credits" or "license" for more information. >>> print("Hello Workshop Attendees") Hello Workshop Attendees

Example of interactive/ CLI usage

113 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 114 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Hello world….again… • Create a file like Ex01hello.py • Open the file • Key up some code and click save

$ python3 Ex01hello.py Hello Workshop Attendees!!!

114 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 115 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com How is it written • Indentation means EVERYTHING ▪ Don’t use tab (unless good editor) ▪ 4 spaces ▪ Mismatched indents can cause failures. God luck finding… ▪ Mismatched spaces and tabs will cause failures • No need for scope terminators like other languages • Colon introduces start block, then indent • Much more readable than other languages • Get a good editor!!!

115 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 116 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Indentation

# #Indentation example # count = 0 argument = True while count < 2: if argument: print ("This is an argument") else: print ("No, it isn't ") argument = False count = count + 1

$ python3 Ex02Indent.py This is an argument No, it isn't

116 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 117 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Python Use Cases • Natural Language Processing  gain insights from text ▪ Python's Natural Language ToolKit (NLTK) is ideal for this • Automatic Trading  create algorithms in Python that trade automatically ▪ Quantopian can be used to create these algorithms • Data Analysis  Create insights from data ▪ Library Pandas. Provides tools for correlation, , standard deviation, etc. • Other Use Cases Include: ▪ Script Writing and Automation  allows for writing scripts for parsing text files, generating sample inputs to test applications, content scrapping from blogs sites, etc. ▪ Back End Development  Python is good for writing APIs and interacting with databases. Used for integrations and development of such famous sites as Instagram, Quara, and ▪ Data Science and Machine Learning  Python has powerful libraries for data analysis, manipulation, and visualization ▪ Internet of Things  Python is a go-to-language for Raspberry PI and other microprocessors

117 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 118 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Fact Sheet

Language Ruby Open Source? Yes (Ruby, GPLv2, 2-clause BSD) Inception Date 1995 Original Developer Yukihiro Matsumoto Predecessor / Influencer Ada, C++, Python, Lisp, Origin of the name Installable on IBM i Yes Typical Usage General Purpose Web applications () Web Site www.ruby-lang.org Repository https://github.com/ruby/ruby Current ranking on TIOBE 11

As of: 20-Nov-2019

118 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 119 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Quick Introduction • Dynamic, open-source, object-oriented programming language ▪ Everything (yes, everything) is an object • Blocks (closures) integral to the language • Easy to create domain-specific languages

• Features include: ▪ Free format allowing writing of programs from any line or column ▪ Case sensitive ▪ Syntax/infrastructure makes using anonymous blocks easy ▪ Provision of open classes ▪ Seamlessly inherit from any of the standard classes ▪ Provides for clean object hierarchy that makes meta-programming easy ▪ Capable of writing brief one-linters for system administration tasks

119 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 120 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Quick Introduction (Continued) • Pros: ▪ Powerful language ▪ Very expressive, "Beautiful" ▪ Rails very popular for web development • Cons: ▪ Smaller community and support − Not as popular as Python outside of web ▪ Slower processing ▪ Lack of regular updates ▪ Higher learning curve ▪ Language warts not tolerated, will break things to make them better  you have to keep up ▪ Paradigm shift from traditional RPG/C/Java

120 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 121 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com

• Goals of the language: ▪ Syntactically simple ▪ Truly Object-Oriented ▪ Having Iterators and Closures ▪ Exception Handling ▪ Garbage Collection ▪ Portable • Popularity soared in 2005 due to Ruby on Rails ▪ A framework for rapid web development ▪ Ruby on Rails supports the Model-View-Controller (MVC) structure • Prior to Ruby on Rails, Ruby was used primarily for CGI scripts

121 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 122 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Ruby on Rails

• Ruby is a dynamic, open source programming language with a focus on simplicity and productivity. • Ruby is a general-purpose scripting language • Ruby runs in the PASE environment • Ruby can be used for web applications, graphing libraries, picture recognition engines, threaded database servers as well as low-level system utilities. ▪ Another typical use is for developing database-backed web applications according to the Model-View Control (MVC) pattern

PowerRuby is a commercially supported port of the Ruby programming language and the Ruby on Rails Web application framework for IBM i.

https://powerruby.com

122 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 123 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Ruby Overview

• Ruby is the programming language used to manipulate the framework

• Rails is the framework that provides the necessary infrastructure

• Rail is written in Ruby

• Ruby is considered by some to be more powerful than Perl, and more OO than Python Ruby Features • Ruby is an interpreted language (No compile strep) class HelloWorld • Ruby is an Object Oriented Language def initialize(name) @name = name.capitalize end • Every is an object (no primitives) def sayHi puts "Hello #{@name}!" end • Ruby draws from Perl, Smalltalk, and Lisp end hello = HelloWorld.new("World") hello.sayHi

123 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 124 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Ruby is flat out different from other programming languages • Ruby has 'for' loops like other languages:

myarray = [10, 23, 17, 39] double = [] for I in 0…myarray.length double[i] = 2*myarray[i] end puts double

• But it is considered bad form to use them. Instead:

double = myarray.map {|i| 2*i}

• OR:

double = myarray.map do |i| 2*I end

124 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 125 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Notes Page • Both Ruby examples represent blocks ▪ Think of these as functions with no names ▪ |i| is the argument • The array method "map" takes a block as an input, returns the array that is the result of applying the block to each element of the array. [10, 23, 17, 39].map {|i| 2*i }

• If you are going to program in Ruby you will need to get used to this style of coding as it is used throughout Ruby: ["this", "that", "those"].each {|word| print word, " "} 3.upto(6) {|x| puts "#{x}"} 5.times { print "*" }

125 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 126 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Ruby Use Cases • Bloomberg  Uses Open Source Solutions, including Ruby on Rails to power their online news site. ▪ Includes stock information, video content, searchable news, analytics • ZenDesk  provides tools that customers can use to build their own Customer Relationship Management (CRM) applications. Built using Ruby on Rails • Taskrabbit  service that matches people who need work done with people who can do the work. This Ruby on Rails environment supports a multi-step process for describing a task, extrapolating the request for a match, scheduling, and payment. • Craftsy  rewrote their code base using Ruby on Rails when their existing development platform wasn't able to keep up with the 23+ million users. • Hulu  Competitor in the online video market. Ruby on Rails allowed them to remain nimble and keep pace with changes in the video market. ▪ Hulu started with Ruby on Rails and has been growing ever since. ▪ Rails allows Hulu to maintain a large library of content that is easy to navigate across platforms.

126 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 127 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com

Toolkits – IBM i Integration

127 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 128 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com What is the Toolkit?

• Set of classes that access IBM i native artifacts ▪ All program objects − RPG, COBOL, CL, etc. • Others ▪ Command processor Data Queues ▪ Spooled File ▪ More… • Access naturally from PHP code. ▪ No SPs required • Easy to use

128 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 129 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Two Parts

• XML Service ▪ Developed by IBM and contributed to the community as open source ▪ Made up of RPG, CL and DB2 stored procedures (SQL) • Toolkit (the PHP side) ▪ Series of classes that "wrap" the calls to the ILE Toolkit ▪ All PHP but Object Oriented (but easy to learn and use) ▪ Zend built the PHP wrapper ▪ No OO training required to use them

http://yips.idevcloud.com/wiki/index.php/XMLService/XMLService

129 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 130 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Toolkit links • Toolkits provide the ability to integrate with various features/functions/programs of IBM I • Node.js toolkit: ▪ https://bitbucket.org/litmis/nodejs-itoolkit • PHP Toolkit for IBM i: ▪ http://yips.idevcloud.com/wiki/index.php/XMLSERVICE/Python ▪ https://bitbucket.org/litmis/python-itoolkit • Node.js toolkit ▪ https://bitbucket.org/litmis/nodejs-itoolkit • Ruby itoolkit NOTE: Documentation for ▪ https://bitbucket.org/litmis/ruby-itoolkit Ruby, Swift, and .NET is not sufficient to complete the • Swift capability information ▪ https://bitbucket.org/litmis/swift-itoolkit provided on the following • .NET slides ▪ https://github.com/richardschoen/IbmiXmlserviceStd

130 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 131 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Toolkit capabilities – Access DB2

Node.js PHP Python Execute direct SQL statements Yes Yes Prepare SQL statements (place holders to prevent SQL Yes Yes Yes injection) Execute prepared statements Yes Yes Yes Fetch result sets Yes Yes Yes Return the number of fields in a result set No Yes No Retrieve columns and associated privileges for a table No Yes No Retrieve columns and associated metadata for a table No Yes No Fetch return sets with associated column headers No Yes No Retrieve field information No Yes No Retrieve primary keys for a table No Yes No Retrieve stored procedures registered in a database No Yes No Rollback a transaction No Yes No

131 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 132 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Toolkit capabilities – Access DB2

Node.js PHP Python Retrieve properties for a DB2 Server No Yes No Retrieve index and statistics for a table No Yes No Retrieve tables and associated metadata in a database No Yes No Retrieve tables and associated privileges in a database No Yes No

132 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 133 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Toolkit capabilities – Access ILE applications and artifacts

Node.js PHP Python Execute CL Commands Yes Yes Call Programs *PGM Yes Yes Yes Call Service Programs *SRVPGM Yes Yes Execute 'sh' commands (PASE utilities) Yes No Build/create a user space Yes Retrieve information from a command definition object Yes Retrieve information from a program object Yes Retrieve Service Program Information Yes Construct a new data queue object Yes Send data to a data queue Yes Retrieve information from a data queue Yes Clear a data queue Yes

133 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 134 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Toolkit capabilities – Others

Node.js PHP Python Get PTF Information Yes Retrieve TCP/IP attributes Yes Retrieve Network interface information Yes Retrieve user's authority to an object Yes Retrieve information about a user profile Yes Retrieve information about users who are authorized to Yes an object

134 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 135 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com

• From a review of the available documentation one could say: ▪ PHP provides a robust interface/capability for DB2 ▪ Node.js has a wealth of administrative related functions

135 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 136 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com

Other "Open Source" and "Open Standard Languages on IBM i

136 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 137 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Fact Sheet

Language C Open Source? No (Open Standard) Inception Date 1972 Original Developer Dennis Ritchie & Bell Labs Predecessor / Influencer B, Algol 68, , Assembly, PL/1 Origin of the name Follow on to B Installable on IBM i gcc via RPM Typical Usage General purpose Current ranking on 2 TIOBE As of: 20-Nov-2019

137 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 138 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Fact Sheet

Language C++ Open Source? No –Open Standard Inception Date 1985 Original Developer Bjame Stroustrup Predecessor / Influencer Ada, Algol 68, C, CLU, ML, Origin of the name Installable on IBM i Typical Usage General Purpose Web Site isocpp.org Current ranking on 4 TIOBE As of: 20-Nov-2019

138 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 139 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Fact Sheet

Language C# Open Source? No – Open Standard Inception Date 2000 Original Developer Microsoft Predecessor / Influencer C++, .NET Framework, Mono, .NET core Origin of the name Installable on IBM i Typical Usage General Purposes Web Site https://docs.microsoft.com/d otnet/csharp/language- reference/ Current ranking on TIOBE 5

As of: 20-Nov-2019

139 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 140 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Fact Sheet

Language Java Open Source? Yes (Open Standard) – GNU, Java Community Process Inception Date 23-May-1995 Original Developer James Gosling Predecessor / Influencer Ada 83, C++, C#, Modula-3, UCSD Pascal, Object Pascal Origin of the name Java Coffee Installable on IBM i Yes - LPP Typical Usage General purpose Web Site oracle.com/java/ Current ranking on TIOBE 1 As of: 20-Nov-2019

140 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 141 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com

Futures

The future is subject to change at any moment without warning!!

141 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 142 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Fact Sheet

Language Go Open Source? Yes - BSD Inception Date 10-Nov-2009 Original Developer Robert Griesemer, Rob Pike, Ken Thompson Predecessor / Influencer C, CSP, Pascal, Smalltalk Origin of the name Installable on IBM i No Typical Usage Mobile devices, WebAssembly, front-end web development (via GopherJS) Web Site golang.org Repository github.com/golang/go Current ranking on TIOBE 20

As of: 20-Nov-2019

142 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 143 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Fact Sheet

Language Swift Open Source? Yes, Apache License Inception Date 2-Jun-2014 Original Developer Chris Lattner, Doug Gregor, John McCall, Ted Kremenek, Joe Groff, Apple Inc. Predecessor / Influencer Objective-C, Rust, Ruby, Python, C#, Object Pascal Installable on IBM i No Typical Usage General purpose Web Site swift.org Repository github.com/apple/swift Current ranking on TIOBE 10

As of: 20-Nov-2019

143 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 144 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Fact Sheet

Language Rust Open Source? Yes – MIT and Apache License Inception Date 7-Jul-2010 Original Developer Graydon Hoare Predecessor / Influencer C#, C++, Swift Origin of the name Rust family of fungi Installable on IBM i No Typical Usage Highly concurrent and highly safe systems Web Site www.rust-lang.org Repository github.com/rust-lang/rust Current ranking on TIOBE 25 As of: 20-Nov-2019

144 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 145 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com The right answer? • It depends…

• Things to consider: ▪ Popularity/momentum ▪ Packages available ▪ What are you using it for − For instance  Typically wouldn't use Node.JS or PHP for general purpose scripting ▪ Tooling ▪ Skills

145 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 146 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Which Language to Embrace – The Wrong Answer? • There is no wrong answer!!!

• Likely not your last language decision…

And Finally….

• Often, the availability of Open Source languages and tools is used as a way to bring new IT talent into the IBM i organization – There is a right and a wrong way of doing this!! • Wrong  Bring in New Skill and Let them work in a corner by the selves • Right  Integrate the new Skill with the seasoned IBM i skilled resources

https://blog.zend.com/2019/01/08/attract-new-talent-ibm/#.XEjYWs9KiL4

146 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 147 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com The Toolkits – integrating with IBM i

• Each Open Source Language has a toolkit that provides the ability to integrate the language with Db2 as well as ILE programs and artifacts. • Db2 access provides the ability to execute SQL statements from the language against Db2. Examples from Node.js, python, and PHP will be covered in the PASE Yourself session on Thursday afternoon

147 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 148 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Leverage the Community!

125,000 packages Node Package Manager Preferred Installer for $ pip install xlswriter (npm) – package Python (pip/pip3) – Downloading/unpacking xlswriter Downloading Xlswriter-0.7.3-py2.. manager for Javascript package Installing collected packages: management system xlswriter (considered the world's Successfully installed xlswriter to install and manage Cleanup up… largest repository of $ packages) software packages written in Python 650,000 packages 403 packages

Yellow dog Updater, # # yum repolist ibm | 2.2 kB 00:00 Modified (yum) – repo id repo name status ibm ibm package 403 management system to install/manage RPM packages

148 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 149 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com After-Hours Lab Overview • Create a container • Install various packages into the container including: ▪ Editor(s) ▪ Shell ▪ Programming languages ▪ Database Drivers • Explore python ▪ Write a hello world program ▪ Write a Db2 access program • Explore node.js ▪ Write a hello world program ▪ Write a Db2 access program ▪ Use a process manager to manage a node.js program • Establish package management capabilities inside the container

149 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 150 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Hands-on Exercise Hints & Tips • The lab has you go in and out of the container several times. ▪ To ensure that you are in your container perform an 'ls /' comman − If QSYS.LIB is listed then you are not in your container.

• The file system is CaSE SeNsiTive ;-) Make sure to type directories and files as shown in the exercise booklet

150 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 151 | COMMON Webinar Series: Open Source on IBM i | November 2019 zend.com Day 3 Preview • Reviewing the three Pillars of Modernization

• Looking at the IBM i variant of the LAMP stack

• Deploying LAMP-based solutions

• Bonus: Approaches to Rapid Modernization

• After-Hours Lab: Deploying LAMP applications

• Bonus After-Hours Lab: Rapid Modernization

151 | Zend by Perforce © 2019 Perforce Software, Inc. zend.com 151