0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are...

50
0. Part 3 Adventure Preparation 0. Part 3 Adventure Preparation 0. Part 3 Adventure Preparation 0. Part 3 Adventure Preparation Welcome to Part 3! Employers view contestants that make a time investment in Part 3 as contestants with an interest in pursuing a career involving mainframe computing technology. Experience and chances of being a top place finisher increases with each year a contestant participates in Part 3. Progression through Part 3 challenges will result in acquiring technology skills used by large enterprises. The challenges are excellent interview discussion points when a company wants to talk to you as a result of your name listed on the prestigious Part 3 Wall of Fame. You may observe while the "Background" writeups are informative in some of the later challenges, they are related to the challenge but do not directly assist with completing the challenge. Why ? If you are among the few that are invited to participate in the Master the Mainframe World Championship, then this information will prove useful in becoming one of the Master Mainframe World Championship winners. Skills and experience you will acquire as a result of Part 3 participation include: REXX, unsung hero of z/OS and z/VM System Programmers 1. Let's Communicate 2. System of Record, highly secure and accurate 3. 47F0 Machine Code for "Just Do It" 4. Where Performance is Paramount, z/TPF 5. DB2 for z/OS Relational Database Navigation 6. SQL, Structured Query Language 7. DB2 for z/OS utility used to load high volume of data 8. Complex SQL 9. Simple computer language - critical to many businesses 10. COBOL & DB2 as a data source 11. Java & DB2 for z/OS, a powerful combination 12. rs.get...(1) get column based on column index 13. Systems of Engagement, z hypervisors, and Linux 14. The Big Picture 15. Putting it all together 16. Ready to begin your Part 3 adventure! SUBMIT 'Y2015.PUBLIC.JCL(P3)' SUBMIT 'Y2015.PUBLIC.JCL(P3)' SUBMIT 'Y2015.PUBLIC.JCL(P3)' SUBMIT 'Y2015.PUBLIC.JCL(P3)' The above JCL will allocate Part 3 data sets. Part 3 assumes z/OS navigation skills aquired in Part 1 and Part2 such as: PDS, Partitioned Data Set, where a PDS is a data set name with members PDS members can be JCL to be submitted for execution Connectivity Guide Part One Part Two Part Three Frequently Asked Questions Wall of Fame IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/ 1 of 50 6/28/2016 11:26 AM

Transcript of 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are...

Page 1: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

0. Part 3 Adventure Preparation0. Part 3 Adventure Preparation0. Part 3 Adventure Preparation0. Part 3 Adventure Preparation

Welcome to Part 3!

Employers view contestants that make a time investment in Part 3 as contestants with an interest in pursuing

a career involving mainframe computing technology. Experience and chances of being a top place finisher

increases with each year a contestant participates in Part 3.

Progression through Part 3 challenges will result in acquiring technology skills used by large enterprises. The

challenges are excellent interview discussion points when a company wants to talk to you as a result of your

name listed on the prestigious Part 3 Wall of Fame.

You may observe while the "Background" writeups are informative in some of the later challenges, they are

related to the challenge but do not directly assist with completing the challenge. Why ? If you are among the

few that are invited to participate in the Master the Mainframe World Championship, then this information

will prove useful in becoming one of the Master Mainframe World Championship winners.

Skills and experience you will acquire as a result of Part 3 participation include:

REXX, unsung hero of z/OS and z/VM System Programmers1.

Let's Communicate2.

System of Record, highly secure and accurate3.

47F0 Machine Code for "Just Do It"4.

Where Performance is Paramount, z/TPF5.

DB2 for z/OS Relational Database Navigation6.

SQL, Structured Query Language7.

DB2 for z/OS utility used to load high volume of data8.

Complex SQL9.

Simple computer language - critical to many businesses10.

COBOL & DB2 as a data source11.

Java & DB2 for z/OS, a powerful combination12.

rs.get...(1) get column based on column index13.

Systems of Engagement, z hypervisors, and Linux14.

The Big Picture15.

Putting it all together16.

Ready to begin your Part 3 adventure!

SUBMIT 'Y2015.PUBLIC.JCL(P3)'SUBMIT 'Y2015.PUBLIC.JCL(P3)'SUBMIT 'Y2015.PUBLIC.JCL(P3)'SUBMIT 'Y2015.PUBLIC.JCL(P3)'

The above JCL will allocate Part 3 data sets.

Part 3 assumes z/OS navigation skills aquired in Part 1 and Part2 such as:

PDS, Partitioned Data Set, where a PDS is a data set name with members

PDS members can be JCL to be submitted for execution

Connectivity Guide Part One Part Two Part Three

Frequently Asked Questions Wall of Fame

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

1 of 50 6/28/2016 11:26 AM

Page 2: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

PDS members can be Programming Language Source code

PDS members can be data records

ISPF Panel Navigation

Using Data Set List Utility

ISPF Editor

Modify JCL

Modify Source code

SDSF to view JCL job output

View JCL job output

View System Log

Enter System Display commands

Submit JCL for execution

From any ISPF panel command line

TSO SUBMIT pds_name(member_name)

TSO SUBMIT 'Y2015.pds_name(member_name)'

From ISPF =6 panel

SUBMIT pds_name(member_name)

SUBMIT 'Y2015.pds_name(member_name)'

From ISPF Edit primary command line

SUBMIT

While using ISPF to view JCL pds member names

SUB to the left of the JCL member name in the list

If you are interested in using Rational Developer for System z, you can download a 90 day trial from IBM

developerWorks.

The Master the Mainframe contest team cannot assist you with any questions or problems you may

experience when using RDz.

Have fun learning about this industrial strength operating system used by the largest corporations and

governments.

Back to Top (Collapse All)

1. REXX, unsung hero of z/OS and z/VM System Programmers1. REXX, unsung hero of z/OS and z/VM System Programmers1. REXX, unsung hero of z/OS and z/VM System Programmers1. REXX, unsung hero of z/OS and z/VM System Programmers

Background: If you are hired by a large enterprise as a mainframe Systems Programmer or administrator,

chances are high that you will encounter REXX code used for systems automation and adminstration tasks.

Over 2,000 computer languages exist, and relatively few are widely used. An unsong hero of computer

languages on the mainframe is REXX.

Your challenge: A fun REXX routine has a few minor errors that will need to be corrected. Once corrected, the

REXX routine requires input that you can figure out by reading the code. The professional REXX

documentation will be referrenced to help you resolve the minor REXX code problems.

REXX computer language:

simple and flexible1.

used to automate administrative and operational tasks2.

runs on a wide variety of operating systems3.

widely used on mainframe operating systems such as z/OS and z/VM4.

interpretative execution or compiled into machine executable5.

It is common to start learning a new computer language with a Hello World.

REXX is about as simple as it gets

/* REXX */

say 'Hello World'

exit 0

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

2 of 50 6/28/2016 11:26 AM

Page 3: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

This challenge requires reading, understanding, and correcting REXX code

From ISPF command line enter the following:

====> tso ex 'cc#####.source(slots)'====> tso ex 'cc#####.source(slots)'====> tso ex 'cc#####.source(slots)'====> tso ex 'cc#####.source(slots)'

where cc##### must be replaced with your personal ID

This REXX routine is a simulated slot machine with 3 display borders.

A type of fruit is displayed in each border following enter. If all window borders have the same fruit type, you

win.

The 3rd display border shows VIEW.3 every time you initiate a new roll using enter key.

Therefore, you can never win.

Enter any keyboard character to stop play.

To win, the REXX code must be fixed. The fix is a single character change.

3 REXX professional manuals are:

TSO/E REXX Reference (SA32-0972-00)1.

TSO/E REXX User's Guide (SA32-0982-00)2.

Using REXX and z/OS UNIX System Services (SA23-2283-00)3.

The REXX code to be fixed is located in ID.SOURCE(SLOTS)

Download the TSO/E REXX User's Guide (SA32-0982-00) from the internet.

Review the following to understand the REXX syntax required to apply the fix.

Chapter 7. Manipulating Data

Using Compound Variables and Stems

Once fixed, then continue to enter until you win. This could take up to 50 tries.

Now the second problem with REXX routine appears.

Error running SLOTS, line 72: WHEN or OTHERWISE expected

Carefully read the message above the error message for a big hint or read

TSO/E REXX Reference (SA32-0972-00)

Chapter 3

SELECT Keyword instruction

Once the second minor code syntax is fixed and you win, then a safety_deposit_box_key must be entered to

deposit your winnings. The only way you are going to get the safety_deposit_box_key is from the REXX

routine.

Have Fun & Good Luck!

Back to Top (Collapse All)

2. Let's Communicate2. Let's Communicate2. Let's Communicate2. Let's Communicate

Terminology:

NETWORK: The inter-Connection of Computers that allows exchange of data.

IP ADDRESS: A numerical label that represents a particular device in a computer network using IP (Internet

Protocol) communications

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

3 of 50 6/28/2016 11:26 AM

Page 4: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

TCP: aka Transmission Control Protocol. The most widely used Transport protocol provided by TCP/IP. It is a

connection based protocol that provides data reliability

PORT: a representation of a connection endpoint on a host using an IP Transport protocol to transfer data

SOCKET: a network endpoint made up of local/remote port, local/remote IP Address and Protocol

PACKET: A network unit of data that provides delivery of application data from one Computer to another

using a specific communications protocol

NETSTAT: A utility to display networking related status.

In a z/OS Communications Server environment, NETSTAT command can be:

issued from TSO/ISPF1.

from the USS (UNIX) environment2.

via the MVS DISPLAY interface3.

REXX (REstructured eXtended eXecutor) – A high-level programming language designed for ease of learning

and reading developed by IBM

LOOPBACK: An enviroment where the local and remote peers (client and server ) reside on the same physical

hardware not traversing a network. Each peer uses a reserved IP address of 127.0.01 to represent loopback

Background:

Networking fundamentals on z/OS using TCP sockets.

The z/OS operating system includes a software component called z/OS Communications Server. z/OS

Communications Server implements the VTAM/SNA and TCP/IP protocols.

z/OS Communications Server TCP/IP provides a set of communications protocols that support connectivity

functions for both local and wide-area networks, including the Internet.

Applications take advantage of these services by using AF_INET (IPv4) or AF_INET6 (IPv6) sockets to

communicate between two peers across an IP infrastructure.

In TCP/IP, the unit that is transferred through the network is called a packet.

A packet is comprised of, IP and Protocol (TCP/UDP/ICMP) headers used to route the packet and manage the

session, as well as the data (payload). In order for an application to take advantage of the TCP/IP protocols it

must use the various socket API languages included as part of z/OS.

The REXX socket api is one of these APIs provided.

The challenge:

Use the z/OS Communications Server TCP/IP REXX socket API to complete an IPv4 TCP protocol server

application and client application. These applications will be used to send and receive data between each

other in a loopback environment. Execute the client and server REXX applications in the UNIX (OMVS)

environment.

Various NETSTAT commands using filters will be executed to display information about client and server

applications.

Modify the REXX socket application skeletons.

A Link to the z/OS Communications Server REXX Socket API documentation has also been provided:

See - http://pic.dhe.ibm.com/infocenter/zos/v2r1

/index.jsp?topic=%2Fcom.ibm.zos.v2r1.hala001%2Fipapirxa.htm

Starting OMVS sessions:

Open three (3) OMVS sessions from ISPF to run the

server1.

client2.

netstat commands3.

From ISPF panel

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

4 of 50 6/28/2016 11:26 AM

Page 5: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

tso omvs sessions(3)tso omvs sessions(3)tso omvs sessions(3)tso omvs sessions(3)

Create three individual OMVS command sessions which are numbered 1-3 and identified by the <n> in the

lower right hand corner of the OMVS session above the PF keys.

PF9 enables “jump” between these three sessions

Modifying the REXX Server Application using OMVS session #1:

From OMVS session #1, modify server application using REXX socket API calls.

The REXX server and client programs are located in Y2015.P3.SOURCE

Copy the rexx programs as follows by issuing the following commands from the OMVS Unix Prompt:

cp '//source(myserver)' MyServer.rexxcp '//source(myserver)' MyServer.rexxcp '//source(myserver)' MyServer.rexxcp '//source(myserver)' MyServer.rexx

cp '//source(myclient)' MyClient.rexxcp '//source(myclient)' MyClient.rexxcp '//source(myclient)' MyClient.rexxcp '//source(myclient)' MyClient.rexx

Edit and modify the programs to make them work.

From the command prompt in OMVS session #1 issue the oedit command to start modifying the Rexx Server

program as follows:

oedit MyServer.rexxoedit MyServer.rexxoedit MyServer.rexxoedit MyServer.rexx

INITIALIZE Function:

The REXX socket API requires the application to initialize a set of sockets to be used. This is done using the

REXX socket INITIALIZE function. The INITIALIZE Function has already been completely coded.

The INITIALIZE function is done in the INIT_TCP routine included in the skeleton. Once the INITIALIZE

function is complete, the application now needs to allocate a socket descriptor.

SOCKET function:

Now that the REXX socket api environment is initialized, a socket needs to be created. A socket (aka. file

descriptor) is used for any reading/writing of data as well as accepting new connections from clients, in the

case of a server application. Basically, program is incapable of I/O without a socket!

Create an IPv4 (AF_INET) Stream TCP socket in REXX server application. Locate the routine GET_SOCK in

MyServer.rexx to code the required parameters. Find the GET_SOCK routine in the program.

f get_sock:f get_sock:f get_sock:f get_sock:

Observe:

GET_SOCK: rc = Socket(** parameters required **)

Modify the rexx socket function from :

rc = Socket(** parameters required **)

to

rc = Socket("SOCKET",af_inet,STREAM,0)

The REXX socket api socket function returns three values as output, one of which is the socket number that

was allocated. The skeleton uses variable socknum as the value of the socket number that was created. This

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

5 of 50 6/28/2016 11:26 AM

Page 6: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

socknum will be used in subsequent REXX socket API functions by the server.

BIND Function:

Now that a socket descriptor created, the application is working. The application needs to do is BIND a new

socket to a TCP port and IPv4 address.

For the most part, servers have port numbers that are known to client applications that want to use their

services. These are often referred to as “well known port”, but in our case, the application will use a random

port to Listen.

To get a random port number assigned, the server skeleton has defined local port (L_PORT = 0) so that the

TCPIP address space will provide a random port. The local IP address (L_IPADDR) has also been defined for

use. Notice the address is 127.0.0.1 (aka. LOOPBACK).

More on LOOPBACK coming up!

To summarize, The input parameters to our Server's REXX socket API BIND function, are a socket descriptor

number (socknum), and a socket structure (L_NAME) that includes the address family, a local port number of

0 (zero) indicating a port number is to be assigned, and a local IP address 127.0.0.1 (aka LOOPBACK).

Find the routine where the REXX socket api Bind function is to be coded, which is named DO_BIND.

f do_bindf do_bindf do_bindf do_bind

Observe:

DO_BIND:

rc = Socket(** parameters required **)

Change

rc = Socket(** parameters required **)

to

rc = Socket("BIND",socknum,l_name)

GETSOCKNAME Function:

Since the the BIND passed a port number of zero, query which port number TCPIP assigned to the server

socket so that the client will be able to connect to the server's port.

This is done using the GETSOCKNAME function call.

Fill in the required parameters for the GETSOCKNAME, which is in routine DO_GETSOCKNAME in the

skeleton.

f do_getsocknamef do_getsocknamef do_getsocknamef do_getsockname

Observe:

DO_GETSOCKNAME:

rc = Socket(** parameters required **)

change

rc = Socket(** parameters required **)

to

rc = Socket("GETSOCKNAME",socknum)

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

6 of 50 6/28/2016 11:26 AM

Page 7: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

After the GETSOCKNAME is completed the following message indicates local port and local IP address socket

binding

socket x is bound to AF_INET yyyy 127.0.0.1

Observe the message after completing the Listen portion in the server program. At that time make a note of

this local server port. It will be needed when to modify the client program’s CONNECT function call a bit later.

The client can't connect to the server without the correct port number.

Programs created a socket and bound that socket to a port number and IP address (127.0.0.1). The next step

is to use the LISTEN function call to let TCPIP know that the server is ready to accept new connections from

clients.

LISTEN Function:

The LISTEN function call has two parameters, the socket descriptor (socknum) as expected , and a listen

backlog value. This backlog defines a queue used by TCPIP to hold new connection requests from clients that

are waiting for the server to accept them. This backlog and accepting new connections will be covered later

in the lab.

We will use the default backlog value of 10.

The REXX socket api LISTEN function is executed in the DO_LISTEN routine.

f do_listenf do_listenf do_listenf do_listen

Observe:

DO_LISTEN:

rc = Socket(** parameters required **)

change

rc = Socket(** parameters required **)

to

rc = Socket("LISTEN",socknum)

ACCEPT Function:

Server's REXX socket api LISTEN function is complete, but it is not yet ready for PrimeTime! A server needs to

be coded to handle new client connections that request its services, ie; connect to it. This is done by using the

ACCEPT function call. The accept function will cause TCPIP to present any new client connections that are

waiting in the listen backlog queue to a server.

An example of a connection waiting to be accepted by the server while on the TCP Listen backlog will be

shown in a bit....

Complete finishing up the server REXX api socket function coding, which is the ACCEPT function. After coding

the accept the server should now be able to handle a new connection from a client (which will present an

opportunity to run shortly), but let's not get ahead of ourselves!

Find the do_accept routine in the server program (MyServer.rexx)

f do_acceptf do_acceptf do_acceptf do_accept

Observe:

DO_ACCEPT:

rc = Socket(** parameters required **)

change

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

7 of 50 6/28/2016 11:26 AM

Page 8: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

rc = Socket(** parameters required **)

to

rc = Socket("ACCEPT",socknum)

Now would be a good time to save server code using PF3 to save/exit. Then execute the server program by

typing the name of the rexx server file at the OMVS command prompt.

./MyServer.rexx./MyServer.rexx./MyServer.rexx./MyServer.rexx

If the server program fails to execute with the message below, do the following:

NOTE: Observe similar messages as seen below if the server source file is not set as executable in UNIX.

Change mode to be executable by issuing

chmod 700 fileNamechmod 700 fileNamechmod 700 fileNamechmod 700 fileName

command below:

./MyServer.rexx./MyServer.rexx./MyServer.rexx./MyServer.rexx

MyServer: cannot execute

ls -l MyServer.rexx -rwx------ls -l MyServer.rexx -rwx------ls -l MyServer.rexx -rwx------ls -l MyServer.rexx -rwx------

chmod 700 MyServer.rexx

ls -l MyServer.rexx -rwx------ls -l MyServer.rexx -rwx------ls -l MyServer.rexx -rwx------ls -l MyServer.rexx -rwx------

Otherwise.... ..observe these messages

HERE WE GO - press <ENTER> to continue

socket x is bound to AF_INET yyyy 127.0.0.1

ISSUE NETSTAT IN OMVS SESSION 3 TO VERIFY LISTEN

- press <ENTER> to continue

RC = PROMPT("Waiting, Press Enter to continue")

The 2nd message tells what socket the server application is using and also what assigned TCP/IP port the

server is bound to (Take note of the port (yyyy) number ), and 3rd message indicates that the Listen

completed.

Don't press enter after the 3rd message at this time, the program is in a wait.

Just Jump over (PF9) to OMVS session #3:

Netstat from OMVS session #3:

hint remember to use PF9 to jump between sessions!

From OMVS session #3 issue a netstat command to see the state of the server application from the view point

of TCPIP.

netstat -c -P yyyy > netstat.listennetstat -c -P yyyy > netstat.listennetstat -c -P yyyy > netstat.listennetstat -c -P yyyy > netstat.listen

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

8 of 50 6/28/2016 11:26 AM

Page 9: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

where -c represents the connection function of netstat and the yyyy is the port number that the server

application is listening on. Observe the series of messages that were generated when executing the server

program.

The '>' will cause the netstat output to be redirected to a file named netstat.listen.

obrowse netstat.listenobrowse netstat.listenobrowse netstat.listenobrowse netstat.listen

Observe the state of the server from a TCPIP perspective. Observe it in a LISTEN state, with a USER id or

Jobname, representing the TSO userid with an additional character appended to it. The server was launched

from the OMVS session so it inherits the userid as the basis for the jobname associated with the server

application.

The local socket should indicate 127.0.0.1 and port bound to TCP socket.

Remember the User Id value from this output as it will be used later in the lab exercises!

Modifying the REXX socket program (MyClient.rexx) in OMVS session #2 Jump (PF9) to OMVS session #2 and

edit client program MyClient.rexx

CONNECT Function:

At this point a working server in TCP LISTEN state exists. Server applications are worthless without client

applications to use them. Prepare to run a client application that will be used to connect, receive data from

the server, send data to the server, and close the connection between the two.

As with the Server, use the REXX socket API to modify the the client application we provided. Notice that the

first few calls that the REXX client application makes are exactly like the server. The REXX socket API

function calls including the REXX socket API SOCKET allocation has already been completed.

The only function that needs to be modified is the api CONNECT function. The CONNECT function is what

TCP protocol client applications use to request services of a server application. For example, a web browser

using Firefox or Chrome, are clients requesting services of a WEB Server.

Take notice that the CONNECT function requires not only a socket descriptor, but it requires the server's IP

address and port number that it is listening on. These values are included as a variable named F_NAME in the

client program (MyClient.rexx).

Modify the F_PORT field in F_NAME to represent the server's port that is listening for connection.

Remember the port the server program is using was randomly assigned. That port number to be connected

should be displayed in a message in OMVS session #1 where the server program is waiting.

Insert the port number that the Server is listening on in variable F_PORT in MyClient.rexx.

f f_portf f_portf f_portf f_port

Observe:

f_port = 'xxxx' /* foreign/remote port */

Replace the xxxx with the port number the server is listening on. Note the single quotes need to be included

as well.

Complete the CONNECT function in the client program

Find the DO_CONNECT routine in MyClient.rexx

f do_connectf do_connectf do_connectf do_connect

Observe:

DO_CONNECT:

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

9 of 50 6/28/2016 11:26 AM

Page 10: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

/* rc = Socket(** parameters required **) */

change the

/* rc = Socket(** parameters required **) */

to

rc = Socket("CONNECT",socknum,f_name)

IP address of 127.0.0.1 is used. This is known as the loopback and local host IP address.

Since we are running the server and client applications on the same host (zOS LPAR) this address will be used

as the server's destination address, it will also be the client's source IP address.

Using LOOPBACK is a great testing method for applications before trying to run them across a “real” network!

Gotcha: Remember to make sure the server port number is changed in the client program (f_port) to match

the port number the server is listening on!

If not the connect function call wail fail

Save the changes in MyClient.rexx with PF3 and execute the client program from OMVS session #2 as

follows:

./MyClient.rexx./MyClient.rexx./MyClient.rexx./MyClient.rexx

If the programs fails to execute with messages similar to these below, do the following:

Observe similar messages as seen below if the client source file is not set as executable in UNIX. Change

mode to be executable by issuing the

chmod 700 fileNamechmod 700 fileNamechmod 700 fileNamechmod 700 fileName

command below:

./MyClient.rexx./MyClient.rexx./MyClient.rexx./MyClient.rexx

MyClient: cannot execute

ls -l MyClient.rexx -rwx------ls -l MyClient.rexx -rwx------ls -l MyClient.rexx -rwx------ls -l MyClient.rexx -rwx------

chmod 700 MyClient.rexxchmod 700 MyClient.rexxchmod 700 MyClient.rexxchmod 700 MyClient.rexx

ls -l MyClient.rexx -rwx------ls -l MyClient.rexx -rwx------ls -l MyClient.rexx -rwx------ls -l MyClient.rexx -rwx------

Otherwise, see the following messages issued in OMVS session #2

HERE WE GO - press to continue

CONNECTED!,GO TO OMVS SESSION #1 TO CONTINUE,THEN ENTER -

DON'T PRESS ENTER AT this time!

At this point the client is connected to the server and and should have a connection waiting in the servers

TCP listener backlog queue pending acceptance by the Server

Jump (PF9) to OMVS session #1. Observe message :

ISSUE NETSTAT IN OMVS SESSION 3 TO VERIFY LISTEN - press to continue

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

10 of 50 6/28/2016 11:26 AM

Page 11: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

Press enter and the following message will be displayed:

ISSUE NETSTAT IN OMVS SESSION 3 TO CHECK BACKLOG - press to continue

DON'T PRESS ENTER yet, instead....!

Jump (PF9) to OMVS Session #3 and Issue Netstat see loopback connections created between client and

server application :

netstat -c -P yyyy > netstat.connectnetstat -c -P yyyy > netstat.connectnetstat -c -P yyyy > netstat.connectnetstat -c -P yyyy > netstat.connect

where yyyy is the SERVER port number that is LISTEN state, which should be the same port number that the

client REXX application is connected to.

obrowse netstat.connectobrowse netstat.connectobrowse netstat.connectobrowse netstat.connect

Hopefully, 3 separate TCP connections in the netstat -c output. One will be the server session in LISTEN state,

using the first socket descriptor created for the server.

Observe two additional connections - one connection from both the server and client perspective since they

running on the same host.

The local socket and foreign socket information provided will assist in identifying which connection belongs

to the client and which belongs to the server. Notice the server actually has two connections, one

representing the LISTEN state and the other representing an established TCP connection. While the client

only has a single TCP connection between it's local port /ip address and the server's foreign port / ip address.

The key is that the server has not accepted this connection, but it is still in a TCP established state!

Notice the userid is a bit different for the established connections, the source & destination ports are

swapped in each. The connection with the server port number, as the foreign host, represents the clients TCP

connection. Conversely, the other, with the server’s port, as the local host represents this new connection

owned by the server. The server does not know that a new connection exists for it until it accepts it using an

ACCEPT function call.

Accepts it, what is that all about? Well at this point the connection from the client is in the server's LISTEN

backlog queue, remember that??

So let's just look at the TCP connections related to the server to see this backlog :

netstat -A -E uuuu > netstat.backlognetstat -A -E uuuu > netstat.backlognetstat -A -E uuuu > netstat.backlognetstat -A -E uuuu > netstat.backlog

where uuuu is the User Id value from earlier, which is in the netstat.listen file.

obrowse netstat.backlogobrowse netstat.backlogobrowse netstat.backlogobrowse netstat.backlog

Observe the two connections for the server, they are each identified by the Client Id value. Look at the TCP

connection in LISTEN state. There are two fields representing the Listen backlog. The MaximumBacklog

represents the maximum number of connections that TCPIP can put in the queue for the SERVER.

This value comes from the backlog parameter passed on the LISTEN function call, or 10 in this case (default).

The CurrentBacklog field represents the number of connections waiting to be accepted by the listener. This

should be 1, representing the client connect that just completed. So how does it get removed from the

backlog?

This is up to the server application. It has to issue an ACCEPT function call. A connection must be accepted by

a server before any I/O activity can occur with the client. So let's switch back to OMVS session #1 and have

the server accept this new connection from the client.

Exit out of any obrowse to use the PF9 keys to jump between sessions and remember to save using PF3

Jump (PF9) to OMVS session #1 to ACCEPT the new connection from the client by the server

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

11 of 50 6/28/2016 11:26 AM

Page 12: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

The following message should still be displayed in OMVS session #1 where the server is waiting to accept

this new client connection.

ISSUE NETSTAT IN OMVS SESSION 3 TO CHECK BACKLOG

- press <ENTER> to continue

Observe messages similar to these: socket 4: listening Socket that Server is Listening on

socket 5: connected indicates new connection accepted ENTER DATA TO SEND - press <ENTER> to continue

Notice that a new socket was created once the ACCEPT completed successfully, this new socket number will

be used in subsequent I/O between the client and server, while socket 4 will be used as the “Listening”

socket.

The new accepted socket indicates that the connection was removed from the TCP listen backlog and given

to the server to process. The new connection from the client is now ready to do I/O.

Follow the on screen instructions to send data from the server to the client.

PRESS Enter

This should have caused the server to issue a SEND function call to send data to the client . Observe the

following messages:

sent 43 bytes

default message for socket send from server

ISSUE NETSTAT IN OMVS SESSION 3 TO CHECK CLIENT'S RECVQ

- press <ENTER> to continue

This indicates that the server has sent 43 bytes to the client using the newly accepted socket. However, this

doesn't mean that the client application has actually read this data.

DON'T PRESS ENTER yet, instead Jump (PF9) to OMVS Session #3 to verify data is unread by the client

Remember the previous netstat -c output showed 3 separate sessions, one of which represents the CLIENT

end of things, the one with the slightly different jobname in file netstat.connect.

Let's take a look at that session.

netstat -A -E #### > netstat.dataunreadnetstat -A -E #### > netstat.dataunreadnetstat -A -E #### > netstat.dataunreadnetstat -A -E #### > netstat.dataunread

where uuuu is the userid representing the Client connection

obrowse netstat.dataunreadobrowse netstat.dataunreadobrowse netstat.dataunreadobrowse netstat.dataunread

Look at the client application netstat -A -E uuuu output (netstat.dataunread).

Notice the field “ReceiveDataQueued:” has a value.

Also note that there is a date and time (OldQDate: & OldQTime:)

These fields represent how long the data has been sitting in the T CP receive buffer. Similar to LISTEN

Backlog, incoming application data is placed in TCP owned buffers (TCP Receive Buffers) assigned to an

application. The data sits in these TCP receive buffers until the application actually issues a READ function.

The data is then moved from the TCP owned buffer to the application's buffer so it can be processed by the

application. This netstat output is showing that the client application has n bytes of unread application data,

which TCP is holding for it to read. This also shows that the data was delivered from the server TCP (point A)

to the client TCP (point B), it just hasn't been read yet by the client application.

Let's have the client read the data, send something back to the server, close the connections and finish the

lab, YIPPIE!!! :

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

12 of 50 6/28/2016 11:26 AM

Page 13: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

Jump(PF9) to OMVS session #2 : Observe client application message

CONNECTED!,GO TO OMVS SESSION #1 TO CONTINUE,THEN ENTER

- press <ENTER> to continue

PRESS ENTER

After pressing enter, observe that the client read the data that was sent from the server, indicated by the

number of bytes read, and the actual data received 43 bytes

default message for socket send from server¨

ENTER DATA TO SEND

- press <ENTER> to continue

PRESS ENTER

causes the client to send data to the server, indicated by these messages:

sent 43 bytes default message for socket send from client¨ Processing completed without errors

Read data sent from client on Server side (OMVS session #1)

Jump(PF9) to OMVS session #1 representing the server, the following message should still be displayed:

ISSUE NETSTAT IN OMVS SESSION 3 TO CHECK CLIENT'S RECVQ - press <ENTER> to continue

pressing enter results in... ..

received 43 bytes

default message for socket send from client¨

This indicates that the server has also read the data sent from the client , indicated by the number of bytes

read and the actual data that was processed

DO IT AGAIN? Y OR N - press <ENTER> to continue

Respond N to terminate the TCP connection between the client and server

Saving the output to validate completion zOS Communications Server Challenge

Files need to be copied as follows:

Observe the following 4 files created...

netstat.listen1.

netstat.connect2.

netstat.backlog3.

netstat.dataunread4.

Jump (PF9) to OMVS session #3

issue the following command to copy these 4 files into a single file named netstat:

cat netstat.listen netstat.connect netstat.backlog netstat.dataunreadcat netstat.listen netstat.connect netstat.backlog netstat.dataunreadcat netstat.listen netstat.connect netstat.backlog netstat.dataunreadcat netstat.listen netstat.connect netstat.backlog netstat.dataunread

> netstat> netstat> netstat> netstat

Enter command to copy netstat output file to p3.output data set:

cp netstat '//p3.output($002)'cp netstat '//p3.output($002)'cp netstat '//p3.output($002)'cp netstat '//p3.output($002)'

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

13 of 50 6/28/2016 11:26 AM

Page 14: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

Exit out of each of the OMVS sessions by entering EXIT at each of the three session's command prompts “

===>”

Hope you learned something and also enjoyed the Challenge!!!!

Here is an illustration that helps explain what you were seeing:

“Normally” a client and server are running on separate hosts in a network, for example:

local server from remote client

However in a LOOPBACK environment, you are seeing this:

netstat collected from z/OS will show:

local client to local server1.

local server from local client2.

connection representing local server3.

Back to Top (Collapse All)

3. System of Record, highly secure and accurate3. System of Record, highly secure and accurate3. System of Record, highly secure and accurate3. System of Record, highly secure and accurate

Background:

While Systems of Engagement manage internet connected device transmissions, a connection to a highly

secure and accurate end point system is needed for the critical data such as a bank balance, inventory of

merchandise, airplane seats, hotel rooms, history of a persons average health vitals, etc. This highly secure

and designated single source of truth for critical data is known as a System of Record.

The IBM mainframe was built from the ground up for handling massive data throughput securely and

accurately. This includes the most important data of the world wide economy. The care takers of this data

need your help. Many highly experienced technicians grew up with the mainframe. These technicians with

approximately 40 years of experience are beginning to retire. As a result, some extremely important jobs

need to be filled by younger technicians that will learn from the senior technicians before they leave the

workforce.

If you are employed into one of this critical positions, you will quickly learn that locating and navigating

professional manuals are fundamental to advancing your skill and experience. It is common for a senior

technician to direct you toward a manual to acquire specific knowledge, complete a task, or diagnose and

resolve a problem.

Challenge Preparation

z/OS Professional Manuals

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

14 of 50 6/28/2016 11:26 AM

Page 15: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

See - http://www.ibm.com/systems/z/os/zos/library/bkserv/

The z/OS Internet Library includes professional manuals in a choice of formats:

HTML, z/OS Information in IBM Knowledge Center1.

Mobile, z/OS Information in IBM Knowledge Center Mobile Edition2.

PDF, Download z/OS book in PDF format3.

This site includes links to other z operating system professional manuals such as z/VM, z/TPF, and z/VSE.

The contest z/OS is Version 2 Release 1

Under 'Search z/OS Information in IBM Knowledge Center', click on 2.1

IBM z/OS V2R1 documentation is displayed as follows:

Scroll forward to z/OS MVS, then click on z/OS MVS twisty to expand

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

15 of 50 6/28/2016 11:26 AM

Page 16: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

Scroll forward under z/OS MVS Collection until the following information is available

Observe z/OS MVS System Commands and the z/OS MVS System Messages Volume 1 thru 10 organized in

alphabetic order by z/OS MVS Message ID.

IBM Redbook are a supplement to the professional manuals. Below is reference to a specfic section of a

Redbook that provides a brief summary of z/OS MVS Message IDs. Reviewing this will help complete the

challenge.

See - https://www.youtube.com/watch?v=uAOHV_KNxzM

Review section 3.10

Understanding system and product messages located in the following IBM Redbook:

http://www.redbooks.ibm.com/redbooks/pdfs/sg246366.pdf

See - http://www.redbooks.ibm.com

Your challenge:

Answer a series of questions. The z/OS MVS System Commands and z/OS MVS System Message manuals will

be needed to answer the questions. Enter the following from the ISPF command line to execute routine that

will present questions and prompt for answers.

tso p3@3tso p3@3tso p3@3tso p3@3

Upon completion P3.OUTPUT($003) can be browsed. $003 has a single line with the numbered answers.

Back to Top (Collapse All)

4. 47F0 - Machine Code for "Just Do It"4. 47F0 - Machine Code for "Just Do It"4. 47F0 - Machine Code for "Just Do It"4. 47F0 - Machine Code for "Just Do It"

Background:

Software program execution depends upon hardware.

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

16 of 50 6/28/2016 11:26 AM

Page 17: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

Hardware architectures consist of complex electronic circuits.

Computer hardware uses binary representation at the lowest level.

Formatted binary strings exist for software programs to use the complex electronic circuits.

Hardware architectures differ. Therefore, a hardware architecture's formatted binary strings will differ.

Hardware architectures' formatted binary strings are "machine code".

It is not practical to write a software program in "machine code" just like it is not practical to enter data as

binary strings.

Each hardware architectue includes an "Assembler" with "Assembler Language instruction mnemonics" that

translate into architecture dependent binary strings.

Assembler mnemonics generate "machine code".

Most software programs are written in "High-Level Languages" which are "compiled" into assembler

mnemonics which in turn generate the hardware dependent machine code.

Java is an exception. Java is compiled into "byte code". A Java Virtual Machine, JVM, exists to execute the "byte

code". Each hardware architecture has a machine dependent JVM available to process the Java "byte code".

This is why Java executable code can be considered portable between hardware architectures without the

need to compile into native machine code.

Reasons exist to learn about hardware architecture assembler

enable a technician to debug complex system and application programming failures1.

writing applications were execution performance is paramount2.

writing high level compilers and JVMs3.

Understanding assembler provides deep machine insight that can prove valuable to clearly identify root

cause of software failure.

High volume business applications can include assembler code which is used to redirect request for a specific

application service to the appropriate program written in a high level language.

Someone must write and maintain high level language compilers and machine architecture JVMs.

Your challenge:

Answer a series of multiple choice questions about machine code execution. A low level machine code debug

facility (to inspect instruction execution, register content, and memory storage content) accompanied by

assembler compiler output is used in preparation for answering the questions.

What is a computer register?

A register is one of a small set of data holding places that are part of a computer processor. A register may

hold a computer instruction, a storage address, or any kind of data (such as a bit sequence or individual

characters). Some instructions specify registers as part of the instruction.

What is a memory storage address?

A number that is assigned to each byte in a computer's memory that the CPU uses to track where data and

instructions are stored in RAM. Each byte is assigned a storage memory address whether or not it is being

used to store data.

TSO TEST debug environment navigation

Several programs were compiled in Part 2.8. An assembler Hello World program executable, PGMASM, exists

in ID.LOAD(PGMASM). TSO TEST will be used to load, execute, and inspect PGMASM.

Exit ISPF panels to TSO READY command line interface

=x=x=x=x

An intermediate panel ISPF panel might appear - enter 2 to delete the log and proceed to TSO READY

NOTE: us09999 must be replaced with your personal logon userid in all instruction examples that follow

Enter TSO command line interface commands below:

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

17 of 50 6/28/2016 11:26 AM

Page 18: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

READY

alloc da(*) fi(recdd) shr reusealloc da(*) fi(recdd) shr reusealloc da(*) fi(recdd) shr reusealloc da(*) fi(recdd) shr reuse

READY

test 'us09999.load(pgmasm)'test 'us09999.load(pgmasm)'test 'us09999.load(pgmasm)'test 'us09999.load(pgmasm)'

TEST

gogogogo

Assembler Hello World!

PROGRAM UNDER TEST HAS TERMINATED NORMALLY+

endendendend

READY

Enter TSO TEST commands below to view deep details about PGMASM execution.

READY

test 'us09999.load(pgmasm)'test 'us09999.load(pgmasm)'test 'us09999.load(pgmasm)'test 'us09999.load(pgmasm)'

TEST

listpswlistpswlistpswlistpsw

PSW LOCATED AT 7CBFA8

XRXXXTIE KEY XMWP AS CC PROGMASK EA BA INSTR ADDR

00000111 8 1101 00 01 0000 0 0 0000FE78

TEST

list 0r:15rlist 0r:15rlist 0r:15rlist 0r:15r

0R 0000CC4C 1R 0000EF60 2R FFFFFFFF 3R FFFFFFFF

4R FFFFFFFF 5R FFFFFFFF 6R FFFFFFFF 7R FFFFFFFF

8R FFFFFFFF 9R FFFFFFFF 10R FFFFFFFF 11R FFFFFFFF

12R FFFFFFFF 13R 0000EF68 14R 007BDB6C 15R 0000FE78

TEST

list fe78. length(32)list fe78. length(32)list fe78. length(32)list fe78. length(32)

0000FE78. 47F0F014 C8C5D3D3 D6404040 F0F861F0

F461F1F5 90ECD00C 05C041F0 C0F650D0

TEST

list fe78. length(32) clist fe78. length(32) clist fe78. length(32) clist fe78. length(32) c

0000FE78. .00.HELLO 08/04/15.......0.6&.

TEST

list fe78. ilist fe78. ilist fe78. ilist fe78. i

0000FE78. BC 15,20(,R15)

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

18 of 50 6/28/2016 11:26 AM

Page 19: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

TEST

list fe78.+14 ilist fe78.+14 ilist fe78.+14 ilist fe78.+14 i

0000FE8C. STM R14,R12,12(R13)

list fe78.+14 i length(76)list fe78.+14 i length(76)list fe78.+14 i length(76)list fe78.+14 i length(76)

0000FE8C. STM R14,R12,12(R13)

0000FE90. BALR R12,0

0000FE92. LA R15,246(,R12)

0000FE96. ST R13,4(,R15)

0000FE9A. ST R15,8(,R13)

0000FE9E. LR R13,R15

0000FEA0. BAS R1,22(,R12)

0000FEA4. SLDA R0,3880(R15)

0000FEA8. SVC 19

0000FEAA. MVC 70(80,R12),318(R12)

0000FEB0. LA R1,150(,R12)

0000FEB4. LA R0,70(,R12)

0000FEB8. SLR R15,R15

0000FEBA. ICM R15,7,49(R1)

0000FEBE. BASR R14,R15

0000FEC0. BAS R1,54(,R12)

0000FEC4. SSM 3880(R15)

0000FEC8. SVC 20

0000FECA. L R13,4(,R13)

0000FECE. L R14,12(,R13)

0000FED2. LM R0,R12,20(R13)

0000FED6. BCR 15,R14

Some key pieces of information in the above details

The program-status word (PSW) includes the instruction address, condition code, and other information used

to control instruction sequencing and to determine the state of the CPU.

Observe INSTR ADDR is at memory location FE78.

15 registers are listed, 0r:15r. Observe that FE78 is loaded in register 15. PGMASM was loaded at memory

storage address FE78. but not executed yet.

A list of address FE78. displays the beginning of PGMASM execution. Observe, it begins with 47F0, the name

of this challenge section.

47 is a z/Architecture assembler mnemonic (BC), Branch Conditional.

However, when the BC instruction 4-bit mask is x'F', 1111, followed by x'0', 0000, to "ignore" index register,

the result is an unconditional branch to target memory storage address - "Just Do It" unconditionally.

47F0F014 is the complete instruction.

47F0F014

47 - Branch Conditional

F - operand 4-bit mask settings

0 - index register

F - base register

014 - displacement (offset) into executable code

......where displacement is always within 4096 bytes of the value of some base register

Explanation of Memory Storage Base-Displacement Addressing

Every byte of a computer's memory has a unique address, which is a non-negative integer

This means that a memory address can be held in a general purpose register

When it serves this purpose, a register is called a base register

The contents of the base register, the base address of the program, depends on where in memory the

program is loaded

But locations relative to one another within a program don't change, so displacements are fixed when the

program is assembled

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

19 of 50 6/28/2016 11:26 AM

Page 20: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

z/Architecture uses what is called base-displacement addressing for many instruction operands

A relative displacement is calculated at assembly time and is stored as part of the instruction, as is the base

register number

The base register's contents are set at execution time, depending upon where in memory the program is

loaded

The sum of the base register contents and the displacement gives the operand's effective address in memory

For example: If the displacement is 4 and the base register contains 00000000 000A008C The operand's

effective address is 00000000 000A0090

When an address is coded in base-displacement form – it is called an explicit address

When coding base and displacement as part of an assembler instruction, the format is often D(B), depending

on the instruction

D is the displacement, expressed as a decimal number in the range 0 to 4096 (hex 000-FFF).

B is the base register number, except that 0 (register zero) means "no base register," not "base register 0"

Some examples of explicit addresses:

---- 4(1) 20(13) 0(11)

---- In 0(11), the base register gives the desired address without adding a displacement

---- When the base register is omitted, a zero is supplied by the assembler - so coding 4 is the same as coding

4(0)

Some instructions allow for another register to be used to compute an effective address. The additional

register is called an index register

---- In this case, the explicit address operand format is D(X,B) or D(,B) if the index register is omitted

---- D and B are as above. X is the index register number

Instruction Mnemonic

While hexadecimal 47F0F014 represents the machine code bit string generated from ASMCNT source

statement ( B SETUP ), the compiler creates assembler mnemonics with numerical displacements. Example:

ASMCNT source code label is at code displacement hexadecimal +14 or decimal +20. The compiler generated

assembler mnemonic code replaces source code labels, such as SETUP with decimal displacements. However,

the machine code is generated with hexidecimal displacements. To repeat, machine code registers and

displacements are in hexadecimal and the assembler mnemonics in the compiled output use decimal values

for registers and displacements. This is just one of those skills an assembler programmer must understand.

Also, while the ASMCNT source code reads ( B SETUP ), the compiler substituted assembler mnemonic BC

BC 15,20(,R15) is the compiled Assembler Language code - where:

BC ...assembler mnemonic for machine code 47(hex)

15 .. .contains conditional mask 0000

20 .. .branch decimal (20) from beginning of code to find next instruction, the displacement branch address

(, .. .no index register specified

R15 ..base register x'F' used to compute target storage memory address

Assembler on all hardware platforms is relatively difficult compared to high level languages. The language

compilers make these details transparent to the application developers by translating the high level

computer language code into machine code.

Branching to a memory storage address

TEST command

list fe78.+14 ilist fe78.+14 ilist fe78.+14 ilist fe78.+14 i

results in taking the content of register 15 (15r or x'F') which is FE78 and adding the offset/displacement of

x'14' yielding target address is x'FE8C' which contains STM assembler mnemonic instruction.

list fe78.+14 i length(76)list fe78.+14 i length(76)list fe78.+14 i length(76)list fe78.+14 i length(76)

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

20 of 50 6/28/2016 11:26 AM

Page 21: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

results in listing the assembler mnemonic instructions beginning at that memory storage address.

TSO TEST facility break points enable ability to look at register content at points of code execution.

READY

test 'us09997.load(pgmasm)'test 'us09997.load(pgmasm)'test 'us09997.load(pgmasm)'test 'us09997.load(pgmasm)'

TEST

list 0r:15rlist 0r:15rlist 0r:15rlist 0r:15r

0R 0000CC4C 1R 0000EF60 2R FFFFFFFF 3R FFFFFFFF

4R FFFFFFFF 5R FFFFFFFF 6R FFFFFFFF 7R FFFFFFFF

8R FFFFFFFF 9R FFFFFFFF 10R FFFFFFFF 11R FFFFFFFF

12R FFFFFFFF 13R 0000EF68 14R 007BDB6C 15R 0000FE78

TEST

at feb0.at feb0.at feb0.at feb0.

TEST

gogogogo

AT FEB0.

TEST

list 0r:15rlist 0r:15rlist 0r:15rlist 0r:15r

0R 00000950 1R 007B96B0 2R FFFFFFFF 3R FFFFFFFF

4R FFFFFFFF 5R FFFFFFFF 6R FFFFFFFF 7R FFFFFFFF

8R FFFFFFFF 9R FFFFFFFF 10R FFFFFFFF 11R FFFFFFFF

12R 5000FE92 13R 0000FF88 14R 007BDB6C 15R 00000000

TEST

list fe92.+13e length(32) clist fe92.+13e length(32) clist fe92.+13e length(32) clist fe92.+13e length(32) c

0000FFD0. Assembler Hello World!

TEST

gogogogo

Assembler Hello World! :

PROGRAM UNDER TEST HAS TERMINATED NORMALLY+

TEST

list 0r:15rlist 0r:15rlist 0r:15rlist 0r:15r

0R 0000CC4C 1R 0000EF60 2R FFFFFFFF 3R FFFFFFFF

4R FFFFFFFF 5R FFFFFFFF 6R FFFFFFFF 7R FFFFFFFF

8R FFFFFFFF 9R FFFFFFFF 10R FFFFFFFF 11R FFFFFFFF

12R FFFFFFFF 13R 0000EF68 14R 007BDB6C 15R 00000000

TEST

Several observations about the above TEST facility commands

A break point was set 'at FEB0' offset. Observe in the previous TEST facility execution that FEB0. is

immediately after MVC assembler mnemonic. MVC, Move Character, is getting the memory storage location of

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

21 of 50 6/28/2016 11:26 AM

Page 22: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

the literal 'Assembler Hello World!" to write to output. Once AT FEB0., the registers are listed. The computed

storage address of literal "Assembler Hello World!" is 318(R12) from MVC 70(80,R12),318(R12).

Decimal(318) is x'13E'. Therefore, list fe92.+13e length(32) c results in adding content of base register 12,

x'FE92' to x'13E' offset, then list characters (c) starting at that memory storage address for a length of 32

bytes.

Reading system dumps and being able to determine root cause of highly complex software failures require

these skills. For most, just having an appreciation for what happens behind the scenes is enough familiarity.

Others in the tech field take to assembler like fish in water.

Upon entering 'go' to proceed from the break point, the program successfully completes. You might recall the

memory storage address of PGMASM first instruction, ie program entry point, was stored in register 15 as a

result of the PGMASM being loaded for TEST execution. Register 14 is often used as the return address for

the program to exit back to the caller or the operating system. Therefore, if register 14 is used by the

program during execution, then the program must save content of register 14 and restore content of register

14 when done. Observe, register 15 contains 00000000 upon successfully completion of the program.

Register 15 is used to store the completion code when control is being passed back to calling program or

operating system.

End TEST session and return to ISPF

TEST

endendendend

ispfispfispfispf

Assembler Program Source Compile Details

Browse ID.SOURCE(ASMCNT) assembler program, then compile the ASMCNT source code.

submit jcl(asmcnt)submit jcl(asmcnt)submit jcl(asmcnt)submit jcl(asmcnt)

Review ASMCNT compile output. Observe the column headings:

Loc Object Code Addr1 Addr2 Stmt Source Statement

Loc

Program relative memory storage address location starting at 0, the beginning of the program

Object Code

Machine code

Addr1 Addr2

Effective addresses (each the result of adding base register value and displacement/offset)

.. .while object code has displacement addresses in decimal, Addr# has displacement addresses in hex

Based on previous navigatio and explanation of the TSO TEST facility, the information in the assembler

compile output will make more sense now. Study the details in the compile output

Observe ASMCNT compile output locations - under the LOC column

    LOOPINIT label at +32 location

    LOOP label at +3C location

=x=x=x=x

READY

test 'us09999.load(asmcnt)'test 'us09999.load(asmcnt)'test 'us09999.load(asmcnt)'test 'us09999.load(asmcnt)'

TEST

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

22 of 50 6/28/2016 11:26 AM

Page 23: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

listmaplistmaplistmaplistmap

list 0r:15rlist 0r:15rlist 0r:15rlist 0r:15r

at +3C (list 0r:15r; list fee4. length(8); list fec2.)at +3C (list 0r:15r; list fee4. length(8); list fec2.)at +3C (list 0r:15r; list fee4. length(8); list fec2.)at +3C (list 0r:15r; list fee4. length(8); list fec2.)

gogogogo

Continue to enter 'go' to loop through 5 times.

Observe the result of the at +3C TEST command

..program register 2 contains the loop count value to be decremented

..program register 3 has 1 added to register with each loop

..contents from memory storage address in registers, 0, 1, and 14 are listed each time break point is

encountered

Technique to capture ASMCNT execution state and list registers 0 to 15 at specific breakpoints, printing to

ID.DEBUG.TESTLIST sequential data set.

alloc da(*) file(prtline) shr reusealloc da(*) file(prtline) shr reusealloc da(*) file(prtline) shr reusealloc da(*) file(prtline) shr reuse

test 'us09999.load(asmcnt)'test 'us09999.load(asmcnt)'test 'us09999.load(asmcnt)'test 'us09999.load(asmcnt)'

listpsw print(debug)listpsw print(debug)listpsw print(debug)listpsw print(debug)

list 0r:15r print(debug)list 0r:15r print(debug)list 0r:15r print(debug)list 0r:15r print(debug)

at +14 (listpsw print(debug); list 0r:15r print(debug); go)at +14 (listpsw print(debug); list 0r:15r print(debug); go)at +14 (listpsw print(debug); list 0r:15r print(debug); go)at +14 (listpsw print(debug); list 0r:15r print(debug); go)

at +32 (listpsw print(debug); list 0r:15r print(debug); go)at +32 (listpsw print(debug); list 0r:15r print(debug); go)at +32 (listpsw print(debug); list 0r:15r print(debug); go)at +32 (listpsw print(debug); list 0r:15r print(debug); go)

at +3c (listpsw print(debug); list 0r:15r print(debug); go)at +3c (listpsw print(debug); list 0r:15r print(debug); go)at +3c (listpsw print(debug); list 0r:15r print(debug); go)at +3c (listpsw print(debug); list 0r:15r print(debug); go)

gogogogo

PROGRAM UNDER TEST HAS TERMINATED NORMALLY+

listpsw print(debug)listpsw print(debug)listpsw print(debug)listpsw print(debug)

list 0r:15r print(debug)list 0r:15r print(debug)list 0r:15r print(debug)list 0r:15r print(debug)

gogogogo

PROGRAM UNDER TEST HAS TERMINATED +

endendendend

If interested in explanation of the TEST subcommand syntax, then download

IBM z/OS TSO/E Command Reference

- search for SA32-0975 - includes TEST facility command syntax and explanation

Edit ID.SOURCE(ASMCNT)

Observe line 4000 - L 5,=C'loop' - is a comment line as a result of * in column 1

Space over the * to include this assembler mnemonic instruction in program execution, then f3 to save and

exit.

tso submit jcl(asmcnt)tso submit jcl(asmcnt)tso submit jcl(asmcnt)tso submit jcl(asmcnt)

Note: Assembler program writes to PRTLINE filename. Therefore, PRTLINE filename needs to be allocated to

the terminal as follows:

alloc da(*) file(prtline) shr reusealloc da(*) file(prtline) shr reusealloc da(*) file(prtline) shr reusealloc da(*) file(prtline) shr reuse

If this is NOT done, then the result of TEST shows:

ASMCNT ENDED DUE TO ERROR+

To verify the newly compile ASMCNT is ready:

=x=x=x=x

alloc da(*) file(prtline) shr reusealloc da(*) file(prtline) shr reusealloc da(*) file(prtline) shr reusealloc da(*) file(prtline) shr reuse

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

23 of 50 6/28/2016 11:26 AM

Page 24: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

test 'us09999.load(asmcnt)'test 'us09999.load(asmcnt)'test 'us09999.load(asmcnt)'test 'us09999.load(asmcnt)'

runrunrunrun

Result should be

00000001

00000002

00000003

00000004

00000005

READY

A REXX routine must be executed to record your answers to the questions the are below to get credit

Jump to ISPF Command Shell

=6=6=6=6

Execution of x47f0 asks questions requiring answer from multiple choice selections

x47f0x47f0x47f0x47f0

IMPORTANT NOTE:

All questions are related to compiled output of ASMCNT together with TSO TEST facility of ASMCNT compile

and execution that includes L 5,=C'loop' as a valid executable instruction.

Question #1

What is the first ASMCNT instruction address reported by TSO TEST facility?

Enter the number of your answer

1) 0000FE78

2) 0000FE58

3) FFFFFFFF

4) 0000EF68

5) 0000FE60

6) 0000CC4C

Question #2

What is the PSW KEY value of ASMCNT reported by TSO TEST facility?

Enter the number of your answer

1) 0000111

2) 8

3) 1101

4) 00

5) 01

6) 0000

Question #3

What is the content of register 15 when TEST of ASMCNT is invoked and before 'go' or 'run' TEST

subcommands?

Enter the number of the best answer

1) 8000FE58

2) 007BDB6C

3) 0000EF68

4) FFFFFFFF

5) 0000FE60

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

24 of 50 6/28/2016 11:26 AM

Page 25: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

6) 0000FEEC

Question #4

What is the first ASMCNT "compiler generated" mnemonic instruction displayed by TSO TEST?

Enter the number of the best answer

1) B SETUP

2) BC 15,20(,R15)

3) STM R14,R12,12(R13)

4) 47F0F014

5) CSECT

6) USING CNT,ENTRYREG

Question #5

What is the first ASMCNT machine code instruction to be executed by ASMCNT?

Enter the number of your answer

1) B SETUP

2) CSECT

3) BC 15,20(,R15)

4) STM R14,R12,12(R13)

5) USING CNT,ENTRYREG

6) 47F0F014

Question #6

ASMCNT address FE5C. displays what character literal string?

Enter the number of your answer

1) &SYSDATE

2) STM

3) BCT

4) DC

5) loop

6) CNT

Question #7

What is ASMCNT return address?

Enter the number of your answer

1) 0000CC4C

2) 8000FE58

3) 0000EF60

4) 007BDB6C

5) FFFFFFFF

6) 0000EF68

Question #8

What ASMCNT displacement has the program compile date?

Enter the number of your answer

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

25 of 50 6/28/2016 11:26 AM

Page 26: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

1) +A

2) +B

3) +C

4) +D

5) +F

6) +14

Question #9

What is the ASMCNT hex displacement of the source code SETUP label containing STM assembler

mnemonic?

Enter the number of your answer

1) +0

2) +C

3) +F

4) +14

5) +18

6) +32

Question #10

What is the machine code instruction located at the ASMCNT return address?

Enter the number of your answer

1) 007BDB6C

2) 93969697

3) 47F0F014

4) 0A610A03

5) 8000FE72

6) 0000FE78

Question #11

What is the hex value in register 5 at displacement +32?

Enter the number of your answer

1) 00000005

2) FFFFFFFF

3) 007BDB6C

4) 00000000

5) 93969697

6) 8000FE72

Question #12

What is the hex value in register 5 at displacement +40?

Enter the number of your answer

1) 00000005

2) FFFFFFFF

3) 007BDB6C

4) 00000000

5) 93969697

6) 8000FE72

Question #13

What is the hex value in register 5 displacement +86?

Enter the number of your answer

1) 00000005

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

26 of 50 6/28/2016 11:26 AM

Page 27: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

2) FFFFFFFF

3) 007BDB6C

4) 00000000

5) 93969697

6) 8000FE72

Question #14

What is the ASMCNT module length in bytes?

Enter the number of your answer

1) 1A0

2) 1A4

3) 1A8

4) 4069

5) 32

6) 64

Question #15

What ASMCNT displacement is used to store the literal "loop"?

Enter the number of your answer

1) +14

2) +3c

3) +40

4) +88

5) +d8

6) +1a0

Question #16

What register is decemented by 1 during ASMCNT program loop?

Enter the number of your answer

1) 1

2) 2

3) 3

4) 4

5) 5

6) 15

Question #17

What register is incremented by 1 during ASMCNT program loop?

Enter the number of your answer

1) 1

2) 2

3) 3

4) 4

5) 5

6) 15

If these are computer details that intrigue you, employers do need technicians with these skills.

Professional manuals describe the details.

z/Architecture Assembler includes over 30 instruction formats supporting over 720 machine instructions.

z/Architecture is a highly matured, advanced, and flexible environment hosting a variety of operating systems

and hypervisors capable communicating with near zero network delay.

z/OS is a flagship z/Architecture operating system trusted with managing some of the most critical data of

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

27 of 50 6/28/2016 11:26 AM

Page 28: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

the worlds economy.

Other z/Architecture operating systems using z/Architecture Assembler include z/TPF, z/VSE, z/VM, and last

but far from least, Linux.

z/VM is both an operating system and the most function rich hypervisor available.

Other hypervisor technology on z Systems include a hardware hypervisor (PR/SM aka LPAR, Logical PARtion)

and KVM (Kernel Virtual Machine) is scheduled to be available soon.

Linux kernel is Linux kernel with slight modification to gcc compiler. If you know Linux, then you know Linux

on the enterprise grade z Systems environment.

A z System environment, such as the image in the "Big Picture" challenge, is capable of hosting thousands of

operating systems, including Linux, with near zero network delay between them. z Systems is an environment

for thinking very big when it comes to designing new solutions and services. A new Linux on z System can be

created, booted, up and running accessible in the public internet within 1 minute.

Back to Top (Collapse All)

6. DB2 for z/OS Relational Database Navigation6. DB2 for z/OS Relational Database Navigation6. DB2 for z/OS Relational Database Navigation6. DB2 for z/OS Relational Database Navigation

Background:

The most significant business value of z Systems mainframe Operating System, z/OS, is the best Systems of

Record, SOR, possible. A SOR is effectively a massive data server managing and securing the world's most

critical data such as the world's money supply which includes your checking and savings account balance.

Students that believe they know computer technology are mistaken as a result of failing to understanding the

significant hardware, software, and programming language best-fit attributes associated with the Systems of

Record (SOR), Systems of Engagement (SOE), Systems of Insight (SOI), and the client devices such as

browsers, mobile phone, and the wide variety of devices now called the "internet-of-things".

z Systems z/OS is trusted by the world's largest enterprises and governments as the SOR. While numerous

z/OS data management and transaction processing software tools exist, this challenge explores z/OS

relational database as a SOR data source.

Challenge:

This challenge is to develop experience using 3270 text based interface to DB2 for z/OS, relational database

technology. DB2 for z/OS network browser and eclipsed based graphical user interfaces exist. Learning 3270

text based navigation significantly advances a skills, then a GUI makes the skilled person highly productive.

Name that Information Technology related Acronym

Master the Mainframe World Championship will include a series of challenges to determine those that will be

the finalists and winners. One of these challenges being considered is a race to spell out the words

associated with Information Technology acronyms. Contestants will get points for each correct full word

description from a large list of acronyms.

This challenge gives you the opportunity to add to the question and answer database table that will be used

in the Master the Mainframe World Championship.

SQL Processing User Facility Interface (SPUFI)

F8 and F7 to page forward and backward to review inputs and outputs

F3 will save changes and return to SPUFI panel

Enter to continue processing of SQL statements.

DB2 results will be displayed on the screen.

F8 and F7 to page forward and backward to review rows. F11 and F10 to page right and left to review

columns.

F3 to exit output

F3 to exit SPUFI

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

28 of 50 6/28/2016 11:26 AM

Page 29: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

F3 to return to ISPF Primary Option Menu

Navigate to DB2 for z/OS 3270 panels as follows:

TSO/ISPF panels can interactively process SQL. The previous JCL used to execute SQL in batch environment

was executing the same system supplied program that is executed when logging on to TSO.

TSO/ISPF panels include the following:

D2 DB2I Perform DB2 Interactive functions

From TSO/ISPF command line enter

=d2=d2=d2=d2

These ISPF panels are initialized with default values that need to change for the challenges.

Observe the following at top of screen:

DB2I PRIMARY OPTION MENU SSID: DBBG

First time in this panel the SSID value is blank.

If (SSID: DBBG) is not visible in top/right of panel

then do the following:

1 Select D ...... DB2I DEFAULTS

2 Enter DBAG in the DB2 NAME field as follows:

DB2 NAME ..... ===> DBBG

3 Enter presents a second panel..ignore it.

Enter again will return to the DB2I PRIMARY OPTION MENU

SSID: DBBG should be visible in top/right of panel

From DB2I PRIMARY OPTION MENU

1 SPUFI (Process SQL statements)

An input and output data set name is needed.

Modify the panel fields as follows:

1 DATA SET NAME ... ===> SQL(SELECT)

4 DATA SET NAME ... ===> DB2.OUT

ENTER to proceed

Observe on the same panel:

Specify processing options:

5 CHANGE DEFAULTS ===> NO

6 EDIT INPUT ...... ===> YES

YES results in display of panel to change processing defaults

and then proceed to panel to allow edit of input data set.

ENTER to proceed

*******************************************************************

You may encouter the following message which can be ignored.

WARNING: DB2 DATA CORRUPTION CAN RESULT

FROM THIS SPUFI SESSION BECAUSE THE

CCSID USED BY THE TERMINAL IS NOT THE

SAME AS THE CCSID USED BY SPUFI

- TERMINAL CCSID: 0037

- SPUFI CCSID : 1047

NOTIFY THE DB2 SYSTEM ADMINISTRATOR.

ENTER to proceed if the message is displayed.

*******************************************************************

ISPF edit of member SELECT in CC#####.SQL

No need to change anything first time.

*Note: If (--) is in column 1 and 2, then the entire line is treated as a comment.

F3 to save and exit, then enter to execute SQL statements.

SQL execution output includes:

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

29 of 50 6/28/2016 11:26 AM

Page 30: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

Next free question number - remember this number - needed for your DB2 table INSERTs1.

Acronym description - question #12.

Acronym spelled out - answer for question #13.

To view all acronym description/questions, use SPUFI to process SQL(SELECT) again and uncomment (space

over --) the following select statement

--select * from ibmuser.questions;--select * from ibmuser.questions;--select * from ibmuser.questions;--select * from ibmuser.questions;

To view all acronym full word spelling/answers, use SPUFI to process SQL(ACRONYM) again and uncomment

(space over --) the following select statement

--select * from ibmuser.answers;--select * from ibmuser.answers;--select * from ibmuser.answers;--select * from ibmuser.answers;

After review of SQL statement execution output, then F3 to return to DB2I PRIMARY OPTION MENU

Use SPUFI to process SQL(INSERT) to add 2 computing technology technical questions and the respective

answer.

From DB2I PRIMARY OPTION MENU

1 SPUFI (Process SQL statements)

An input and output data set name is needed.

Modify the panel fields as follows:

1 DATA SET NAME ... ===> SQL(INSERT)

4 DATA SET NAME ... ===> DB2.OUT

ENTER to proceed

Observe on the same panel:

Specify processing options:

5 CHANGE DEFAULTS ===> NO

6 EDIT INPUT ...... ===> YES

ENTER to proceed

Observe SQL(INSERT) includes

Question - INSERT INTO statement templates for adding an acronym description1.

Answer - INSERT INTO statement template for adding the acronym full word spelling2.

Question and Answer INSERT INTO statements are tied together with a unique question number3.

Add 2 new acronym descriptions/questions with associate acronym full word answers.)

INSERT INTO QUESTIONS statement changes -

replace 9999 with the number of the "next free question"

replace CC##### with your personal ID

replace 'TLA ....' with an Information Technology acronym description

INSERT INTO ANSWERS statement changes

replace 9999 used for the acronym description (the question)

replace 'Three Letter Acronym' with acronym full word spelling for 9999 (the answer)

INSERT INTO QUESTIONS statement changes

replace 9999 with the number of the "next free question"

replace CC##### with your personal ID

replace 'RFC .. ..' with your choice of an Information Technology acronym description

INSERT INTO ANSWERS statement changes

replace 9999 used for the acronym description (the question)

replace 'Request for Comments' with acronym full word spelling for 9999 (the answer)

F3 to save and exit ISPF edit mode, then enter to execute the SQL INSERTs.

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

30 of 50 6/28/2016 11:26 AM

Page 31: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

Once your 2 questions and answers are added, then SPUFI is available to display your questions and answers

by your uniquely assigned question numbers.

Use SQL 'select' to verify INSERTs are successful. See SQL(SELECT) for example.

*Note: Execute SQL statements SELECT * FROM IBMUSER.QUESTIONS and SELECT * FROM

IBMUSER.QUESTIONS are available in SQL(SELECT) to view example questions and answers from others.

Complete the following to get credit for this challenge

From DB2I PRIMARY OPTION MENU

1 SPUFI (Process SQL statements)

An input and output data set name is needed.

Modify the panel fields as follows:

1 DATA SET NAME ... ===> SQL($006)

4 DATA SET NAME ... ===> DB2.OUT

ENTER to proceed

Observe on the same panel:

Specify processing options:

5 CHANGE DEFAULTS ===> NO

6 EDIT INPUT ...... ===> YES

ENTER to proceed

Change CC##### to your personal ID during the SPUFI Edit session

Enter to proceed with execution.

F3 to return to ISPF Primary Option Menu

Edit db2.output

DSLIST - Data Sets Matching CC#####.DB2.OUT

Command ===>

Command - Enter "/" to select action

-------------------------------------------

e CC#####.DB2.OUT

'Truncation warning' will appear. Enter to acknowledge and ignore.

Copy db2.out content to P3.OUTPUT($006)

The number on line 7 should be 2 or higher. More than 2 acroynm descriptions and answers are welcome.

EDIT CC#####.DB2.OUT

Command ===> rep p3.output($006)

****** ***************************** Top of Data

c99 ---------+---------+---------+---------+--

000002 SELECT COUNT(Q#) FROM IBMUSER.QUESTIONS

000003 WHERE ID = 'CC#####';

000004 ---------+---------+---------+---------+--

000005

000006 ---------+---------+---------+---------+--

000007 2

Back to Top (Collapse All)

7. SQL, Structured Query Language7. SQL, Structured Query Language7. SQL, Structured Query Language7. SQL, Structured Query Language

Background:

SQL is the language of relational databases. SQL can be processed from command line interfaces (CLIs),

Graphical User Interfacess (GUI's), and within programming languages. SQL lesson one is recognizing the 4

SQL command types.

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

31 of 50 6/28/2016 11:26 AM

Page 32: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

DDL - Data Definition Language with commands such as CREATE, ALTER, and DROP

DML - Data Manipulation Language with commands such as SELECT, INSERT, and UPDATE

DCL - Data Control Language with commands such as GRANT, and REVOKE

TCL - Transaction Control Language with commands such as COMMIT, and ROLLBACK

A relational database table consists of rows and columns where each field can contain text, images, code, etc.

Tables can be linked to one another using a variety of schemes. The question and answer tables used in the

previous challenge were linked together by the question number. Lots of professional buzzwords exist to

describe table linkage such as foreign key, composite key, referential integrity, normalization, etc.

Understanding and applying these buzzwords is a valued technical skill. However, Data Manipulation

Language, DML, the primary SQL of application programming, processes against the underlying relational

linkages defined using Data Definition Language, DDL.

2015 population census data by country and infant mortality-life expectancy data by country was download

from the internet, then loaded into DB2 of z/OS tables. This is very easy to do. The next challenge is an

opportunity to learn how. This challenge uses relatively simple DML to extract various result sets from the

following 2 tables.

CENSUS.POPULATION

Column Name Description

REGION "WORLD"

COUNTRY "AGGREGATED" and 228 separate countries

YR "2015"

AGE "Total" and 29 separate age ranges

BOTH_SEXES AGE range number

MALE AGE range number

FEMALE AGE range number

PERCENT_BOTH_SEXES AGE range percent

PERCENT_MALE AGE range percent

PERCENT_FEMALE AGE range percent

SEX_RATIO AGE range ratio

CENSUS.WORLDIMR

Column Name Description

REGION "WORLD"

COUNTRY "AGGREGATED" and 228 separate countries

YR "2015"

IMR Infant Mortality Rate

IMRM Infant Mortality Rate Male

IMRF Infant Mortality Rate Female

IMR1_4 Infant Mortality Rate Ages 1 to 4

IMR1_4M Infant Mortality Rate Ages 1 to 4 Male

IMR1_4F Infant Mortality Rate Ages 1 to 4 Female

IMR_5 Infant Mortality Rate Age 5

IMR_5M Infant Mortality Rate Age 5 Male

IMR_5F Infant Mortality Rate Age 5 Female

LER Life Expectency Rate

LERM Life Expectency Rate Male

LERF Life Expectency Rate Female

From DB2I PRIMARY OPTION MENU

1 SPUFI (Process SQL statements)

Modify the panel fields as follows:

1 DATA SET NAME ... ===> SQL(WORLD)

4 DATA SET NAME ... ===> DB2.OUT

ENTER to proceed

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

32 of 50 6/28/2016 11:26 AM

Page 33: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

Specify processing options:

5 CHANGE DEFAULTS ===> NO

6 EDIT INPUT ...... ===> YES

ENTER to proceed

Remember: -- in column 1 and 2 makes the SQL statement a comment.

Uncomment, execute, and observe result set from SQL statements returning number of rows from

CENSUS.POPULATION and CENSUS.WORLDIMR

Continue to use SPUFI (Process SQL statements) to advance familiarity with SQL as follows:

Comment SQL statements previously uncommented that return number of rows from CENSUS.POPULATION

and CENSUS.WORLDIMR

Uncomment, execute, and observe result set from SQL statements returning all rows and all columns from

CENSUS.POPULATION and CENSUS.WORLDIMR

Paging forward (F8) through the result set. Observe the column names and column content. SPUFI DEFAULTS

setting "MAX SELECT LINES" is much less than the number of lines in the result set. This is fine, because it is

enough output to understand the data.

Observe many commented examples for selecting a variety of results from one or both tables. Try a few of the

more interesting select statements. FYI - SQL statement terminator is a semi colon (;). Many of the SQL

examples span multiple lines.

Note: Sex_Ratio values

Over 100% is more males than females

Under 100% is more females than males

Your challenge:

Use SPUFI to edit, modify, and execute SQL($007)

Complete 3 separate select SQL statements to accomplish the following:

Select average life expectency rate, maximum life expectency rate, and minimum life expectency rate

for all countries.

1.

Select age, total number of males, total number of females, sex_ratio, and country where the country

has the highest number of males from 20-24.

2.

Select sex_ratio value, life expectency rate, and country for all age ranges ('Total') where the life

expectency rate of the country is less than 64 and order the result set by sex_ratio descending.

3.

Hint: copy world SQL example into $007 at the bottom

Observe the 'a' on line 22 to copy world after line 22 as follows:

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

33 of 50 6/28/2016 11:26 AM

Page 34: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

EDIT CC#####.SQL($007)

Command ===> copy world

****** ***************************** Top of Data ***********

000001 --***************************************************

000002 --*** select average life expectency rate,

000003 --*** maximum life expectency rate,

000004 --*** minimum life expectency rate

000005 --***************************************************

000006 --*** select age,

000007 --*** total number of males,

000008 --*** total number of females,

000009 --*** sex_ratio,

000010 --*** country

000011 --*** where the country has the highest number of

000012 --*** males in the 20-24 age range

000013 --***************************************************

000014 --*** select sex_ratio value,

000015 --*** life expectency rate,

000016 --*** country

000017 --*** for all age ranges ('Total')

000018 --*** where the life expectency rate of the country

000019 --*** is less than 64

000020 --*** and

000021 --*** order the result set by sex_ratio descending

a 0022 --***************************************************

****** **************************** Bottom of Data *********

Delete unwanted lines and keep lines to be used as templates to code the 3 separate SQL statements

If need exists to start over, then d999 on line 23, then copy world member content back in $007

Expected output format

1st select

Output column order

1st column - average life expectency rate

2nd column - maximum life expectency rate

3rd column - minimum life expectency rate

Output is 1 row with 3 values

Hint: Average, Maximum, and Minimum are SQL functions - see 'Addition Information' below

2nd select

Output column order

1st column - age range 20-24

2nd column - total number of males

3rd column - total number of females

4th column - sex_ratio (for all age ranges)

5th column - country

Output is 1 row from the country with maximum number of males in the 20-24 range

Hint: Solution requires subselect

3nd select

Output column order

1st column - sex_ratio value

2nd column - life expectency rate

3rd column - country

Output row from individual countries with life expectency rate less than 64 and in sex_ratio descending order.

Hint: Solution requires table join

Additional Information

DB2 for z/OS SQL Reference provides usage details about functions such as average, minimum, descending

order sequence, etc. Those were not included in example SQL statements.

Internet search -

DB2 for z/OS SQL Reference

SC19-4066-06

Successful Completion

Use SPUFI to execute statements writing output to db2.out

Upon completion edit db2.out

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

34 of 50 6/28/2016 11:26 AM

Page 35: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

DSLIST - Data Sets Matching CC#####.DB2.OUT

Command ===>

Command - Enter "/" to select action

-------------------------------------------

e CC#####.DB2.OUT

'Truncation warning' will appear. Enter to acknowledge and ignore.

Copy db2.out content to P3.OUTPUT($007)

EDIT CC#####.DB2.OUT

Command ===> rep p3.output($007)

****** ***************************** Top of Data

c99 ---------+---------+---------+---------+--

Each rep (replace) will overwrite previous P3.OUTPUT($007)

Back to Top (Collapse All)

8. DB2 for z/OS utility used to load data8. DB2 for z/OS utility used to load data8. DB2 for z/OS utility used to load data8. DB2 for z/OS utility used to load data

Background:

As mentioned in the previous challenge, this challenge is an opportunity to load data into DB2 for z/OS

relational database table. The amount of data in this challenge is very small. However, the same procedure

could be used for many millions of rows. It is not uncommom for early career professionals to write routines

generating millions of SQL INSERT statements as the method for loading a new relational database table.

This is very inefficient and time consuming. Then why do they do it? Because SQL is all they learned and no

one every told them that relational database software includes utilities to load data from a wide variety of

data formats. Additionally, it is possible for an application to get data from anywhere, programmatically

create a DB2 table, load data into the table, then use SQL capabilities to perform analysis on the data.

Understanding the low level technology is how to create very innovative solutions.

Economic growth rate data is available for all countries from the internet. The economic growth rate data by

country was transferred to a data set on the contest system in a comma separated value (CSV) format. This

data is a very simple representation of something that could be very large consisting of many fields in a row.

This data is only 228 countries (rows) with respective growth rate separated by a comma. If you want to

browse the data, then use =3.4 to locate Y2015.PUBLIC.GROWTH.CSV and enter 'b' in the column to the left

of Y2015.PUBLIC.GROWTH.CSV

Your challenge:

JCL is provided to process SQL DDL to create the economic growth rate table by country, then load data from

Y2015.PUBLIC.GROWTH.CSV into the relational table. However, modifications are are needed to complete the

task.

Once the relational table exists with data, then SPUFI will be used to select a result set from

CENSUS.WORLDIMR and the new country GROWTH rate table. A SQL SELECT statement must be coded from

instructions below.

tso submit jcl(db2load)tso submit jcl(db2load)tso submit jcl(db2load)tso submit jcl(db2load)

The above JCL fails for several reasons requiring problem identification and resolution.

DB2LOAD includes 3 JCL STEPs meaning 3 program executions to accomplish the following:

STEP1 - Create GROWTH DB2 relational table1.

STEP2 - Load data into GROWTH DB2 relational table2.

STEP3 - Select all rows and columns from GROWTH DB2 relational table3.

The first failure is in STEP2, load data. Review of the DB2LOAD output shows RC 08 for STEP2

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

35 of 50 6/28/2016 11:26 AM

Page 36: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

-STEPNAME PROCSTEP RC

-STEP1 00

-STEP2 DSNUPROC 08

-STEP3 FLUSH

*NOTE: To view all your personal output - SDSF commands - PREFIX *;OWNER CC#####;ST - where CC#####

is your personal ID ? to the left of DB2LOAD will display DDNAMEs. STEP2 SYSPRINT has the error message

that must be resolved.

SDSF JOB DATA SET DISPLAY - JOB DB2JCL

COMMAND INPUT ===>

NP DDNAME StepName ProcStep

JESMSGLG JES2

JESJCL JES2

JESYSMSG JES2

SYSTSPRT STEP1

SYSPRINT STEP1

s SYSPRINT STEP2 DSNUPROC

NOTE: F11 to shift to right and F10 to shift to left when viewing output

Study text following message id DSNU050I and DSNU047I

Remember the name of the data set being loaded? That data set name is in DB2LOAD with an associated

DDNAME.

After correcting STEP2 and submitting job again, then STEP1 fails

-STEPNAME PROCSTEP RC

-STEP1 08

-STEP2 DSNUPROC FLUSH

-STEP3 FLUSH

? to the left of DB2LOAD will display DDNAMEs. STEP1 SYSPRINT has the error message that must be

resolved.

SDSF JOB DATA SET DISPLAY - JOB DB2LOAD

COMMAND INPUT ===>

NP DDNAME StepName

JESMSGLG JES2

JESJCL JES2

JESYSMSG JES2

SYSTSPRT STEP1

s SYSPRINT STEP1

Carefully read entire message following DSNT408I for the reason.

Hint: Observe the STEP1 commented SQL statement input

After correcting STEP1 and submitting job again, then STEP3 fails

-STEPNAME PROCSTEP RC

-STEP1 00

-STEP2 DSNUPROC 00

-STEP3 08

? to the left of DB2LOAD will display DDNAMEs. STEP3 SYSPRINT has the error message that must be

resolved.

SDSF JOB DATA SET DISPLAY - JOB DB2LOAD

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

36 of 50 6/28/2016 11:26 AM

Page 37: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

COMMAND INPUT ===>

NP DDNAME StepName ProcStep

JESMSGLG JES2

JESJCL JES2

JESYSMSG JES2

SYSTSPRT STEP1

SYSPRINT STEP1

SYSPRINT STEP2 DSNUPROC

SYSTSPRT STEP3

s SYSPRINT STEP3

SQL statement must be changed to SELECT all rows and columns from the DB2 relational table created and

loaded in the previous JCL STEPs. When this last SQL syntax issue is resolved, then the JCL executes

successfully.

-STEPNAME PROCSTEP RC

-STEP1 00

-STEP2 DSNUPROC 00

-STEP3 00

STEP3 SYSPRINT DDNAME has GROWTH table data result set upon successful completion.

SDSF JOB DATA SET DISPLAY - JOB DB2LOAD

COMMAND INPUT ===>

NP DDNAME StepName ProcStep

JESMSGLG JES2

JESJCL JES2

JESYSMSG JES2

SYSTSPRT STEP1

SYSPRINT STEP1

SYSPRINT STEP2 DSNUPROC

SYSTSPRT STEP3

s SYSPRINT STEP3

Use SPUFI to process SQL($008)

SQL($008) has a SELECT * FROM GROWTH to produce result set growth rate values for each country in the

table.

Change the SELECT statement to produce a single line result set with the average growth rate value for

countries. Successful Completion

Use SPUFI to execute the SQL statement writing output to db2.out

Upon completion edit db2.out

DSLIST - Data Sets Matching CC#####.DB2.OUT

Command ===>

Command - Enter "/" to select action

-------------------------------------------

e CC#####.DB2.OUT

'Truncation warning' will appear. Enter to acknowledge and ignore.

Copy db2.out content to P3.OUTPUT($008)

EDIT CC#####.DB2.OUT

Command ===> rep p3.output($008)

****** ***************************** Top of Data

c99 ---------+---------+---------+---------+--

Each rep (replace) will overwrite previous P3.OUTPUT($008)

Back to Top (Collapse All)

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

37 of 50 6/28/2016 11:26 AM

Page 38: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

9. Complex SQL9. Complex SQL9. Complex SQL9. Complex SQL

Background:

Complex SQL queries include statements involving join of multiple tables and use of subselects (a select

embedded within a primary select).

Previous challenge SQL examples included

subselect1.

join of multiple tables2.

explicit schema/owner.table.column3.

Subselect example

select ler, country from census.worldimr

where ler = (select max(ler) from census.worldimr);

Join and owner/schema.table.column example

select

census.worldimr.country,

census.worldimr.imr,

census.worldimr.ler,

census.population.both_sexes

from census.worldimr

inner join census.population

on census.worldimr.country=census.population.country

where census.population.age = 'Total';

NOTE: You may have previous observed table GROWTH is not qualified by any schema/owner name. The

reason is that your ID created GROWTH table. Therefore the default schema/owner is your personal ID. Your

schema/owner ID name is assumed when a table is without a qualifing schema/owner name.

2 new result sets are needed to complete this challenge.

A single row with columns that include Infant Mortality Rate (imr), Life Expectency Rate (ler),

growth.rate, and Country (IN THAT COLUMN ORDER) where growth.rate is maximum growth rate from

the list of countries.

1.

A single row with columns that include Infant Mortality Rate (imr), Life Expectency Rate (ler),

growth.rate, and Country (IN THAT COLUMN ORDER) where growth.rate is minimum growth rate from

the list of countries.

2.

This will require 2 separate SELECT SQL constructs. The SELECT SQL constructs will be near identical with

the exception of the maximum vs. minimum growth rate specification. The SELECT SQL construct will require

a table join and a subselect. The world member SQL provides useful templates to complete this challenge.

Edit cc#####.SQL and add new member $009. The following will create empty member $009.

EDIT CC#####.SQL

Command ===> s $009

Copy in world example SELECT SQL constructs.

Observe 'a' (after) line overtype below.

EDIT CC######.SQL($009)

Command ===> copy world

****** ***************************** Top

==MSG> -Warning- The UNDO command is not

==MSG> your edit profile using

a ''''

Delete all the unwanted lines and use the remaining lines to construct SQL statement to write a single row

with columns that include Infant Mortality Rate (imr), Life Expectency Rate (ler), growth.rate, and Country

where growth.rate is maximum growth rate from the list of countries.

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

38 of 50 6/28/2016 11:26 AM

Page 39: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

Use SPUFI to test your SQL syntax until the desired result set is written.

Once the maximum growth.rate result set is written, then replicate the SQL construct, then modify to write

the minimum growth.rate result set following the maximum growth rate.

Successful Completion

Use SPUFI to execute statements writing output to db2.out

Upon completion edit db2.out

DSLIST - Data Sets Matching CC#####.DB2.OUT

Command ===>

Command - Enter "/" to select action

-------------------------------------------

e CC#####.DB2.OUT

'Truncation warning' will appear. Enter to acknowledge and ignore.

Copy db2.out content to P3.OUTPUT($009)

EDIT CC#####.DB2.OUT

Command ===> rep p3.output($009)

****** ***************************** Top of Data

c99 ---------+---------+---------+---------+--

Each rep (replace) will overwrite previous P3.OUTPUT($009)

Internet site explaining complex sql:

See - http://www.toadworld.com/platforms/ibmdb2/w/wiki/7755.complex-sql-guidelines

Back to Top (Collapse All)

10. Simple computer language - critical to many10. Simple computer language - critical to many10. Simple computer language - critical to many10. Simple computer language - critical to many

businessesbusinessesbusinessesbusinesses

Background:

COBOL - Common Business-Oriented Language

COBOL is a very simple language to learn. COBOL was developed for business and with 'English' like code. It

is a mistake to view COBOL as an obsolete language. Billions of lines of COBOL are running the world

economy. COBOL is an attention getter on resumes by large enterprises because the skill can make a new hire

immediately productive.

Many enterprises such as banks, etc. have the core business logic of the daily operation embedded in COBOL.

Ability to read COBOL and apply minor changes is a skill that makes the new hire immediately productive in

many large enterprises.

COBOL code is 'compiled' into machine instruction executable modules. JCL is typically used to compile and

execute COBOL.

A few COBOL syntax fundamentals

COBOL source code syntax is column sensitive.

COBOL code layout is divided into 'areas':

Indicator Area - column 7 ... typically used to comment a line '*'

Area A - columns 8 - 11

Area B - columns 12 - 72

*A B

----+----1----+----2----+----3----+----4

IDENTIFICATION DIVISION.

PROGRAM-ID. Hello.

PROCEDURE DIVISION.

DISPLAY 'COBOL says hello!'.

STOP RUN.

IT professionals become masters at knowing how to locate and navigate professional documentation.

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

39 of 50 6/28/2016 11:26 AM

Page 40: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

See - http://publibfp.boulder.ibm.com/epubs/pdf/igy5lr11.pdf

The above URL is the Enterprise COBOL for z/OS Language Reference manual.

If you do not review it now, remember it exists if you struggle with any of the challenges involving COBOL

syntax.

Challenge Preparation

View the following source code that will be compiled using JCL, then executed interactively.

CC####.SOURCE(CBL1)

CC####.SOURCE(CBL2)

Helpful edit hints:

hilite cobol

cols - display column numbers

Edit member COBOL in JCL data set to compile CBL1 source code as follows:

change (c) source member from CBL# to CBL1

compile (sub) CBL1 source code using this JCL

proceed to ISPF =6 panel

Observe command stacking using semi-colon ; as the command separator

EDIT CC#####.JCL(COBOL)

Command ===> c # 1; sub ; =6

****** ***************************** Top of Data

000001 //COBOL JOB 1,NOTIFY=&SYSUID

000002 //********************************//

000003 //*** COBOL Compile **************//

000004 //********************************//

000005 //COBOL EXEC IGYWCL,MBR=CBL#

****** **************************** Bottom of Data

call load(CBL1) will interactively execute the program machine code that was linked into your LOAD data set.

Assuming you read the CBL1 source code, then you know what will be written as a result of execution.

ISPF Command Shell

Enter TSO or Workstation commands below:

===> call load(CBL1)

Edit member COBOL in JCL data set to compile COBOL source code CBL2 as follows:

change (c) source member from CBL1 to CBL2

compile (sub) CBL2 source code using this JCL

proceed to ISPF =6 panel

Observe command stacking using semi-colon ; as the command separator

EDIT CC#####.JCL(COBOL) - 01.00

Command ===> c CBL1 CBL2; sub ; =6

****** ***************************** Top of Data

000001 //COBOL JOB 1,NOTIFY=&SYSUID

000002 //********************************//

000003 //*** COBOL Compile **************//

000004 //********************************//

000005 //COBOL EXEC IGYWCL,MBR=CBL1

****** **************************** Bottom of Data

call load(CBL2) will interactively execute the program machine code that was linked into your LOAD data set.

Assuming you read the CBL2 source code, then you know what will be written as a result of execution.

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

40 of 50 6/28/2016 11:26 AM

Page 41: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

ISPF Command Shell

Enter TSO or Workstation commands below:

===> call load(CBL2)

Your challenge:

CC#####.SOURCE(CBL3) must be successfully compiled and executed interactively.

The COBOL compile fails with a minor syntax error.

Identify and correct the CBL3 source code error.

SDSF is available to view the CBL3 compiled output to identify the source error.

Once CBL3 creates executable machine code, then interactively execute the program.

Instruction below allocates file p3out to the screen --dataset(*)-- before calling CBL3 machine code.

CBL3 source references file p3out.

Observe command stacking using semi-colon ; as the command separator

ISPF Command Shell

Enter TSO or Workstation commands below:

===> allocate dataset(*) file(p3out) shr reuse; call load(CBL3)

When both questions are answered correctly, the following is written to the screen

I fixed the bug

However, what needs to be written to the screen is the following:

I fixed the bug in this COBOL source

CBL3 MOVE statement is writing a literal string of 36 characters into a 15 character output field.

Hints:

MOVE statement of the literal string into the P3_OUTPUT PICTURE length to hold the entire literal string

Output record is a total of 80 characters

When increasing length of one field of the output record, another field must be decreased accordingly

Once this logic error is fixed, then answering questions correctly will write the following to the screen:

I fixed the bug in this COBOL source

Once satisfied the logic error is fixed, then write the full literal string to P3.OUTPUT($010).

Observe command stacking using semi-colon ; as the command separator

ISPF Command Shell

Enter TSO or Workstation commands below:

===> free file(p3out); allocate dataset(p3.output($010)) file(p3out) shr reuse; call load(CBL3)

P3.OUTPUT($010) should contain record written from CBL3 machine code execution.

Back to Top (Collapse All)

11. COBOL & DB2 as a data source11. COBOL & DB2 as a data source11. COBOL & DB2 as a data source11. COBOL & DB2 as a data source

Background:

COBOL is an excellent Systems of Record (SoR) computer language. COBOL is compiled into machine code

enabling speed. COBOL is relatively easy to maintain. Your COBOL value increases by knowing how COBOL

uses transaction and database services. As an example, COBOL EXEC SQL statements are considered an

application program interface, API, for using DB2 for z/OS as a data source. This challenge will expose you to

skills needed to write COBOL that uses DB2 for z/OS as a data source.

Challenge Preparation

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

41 of 50 6/28/2016 11:26 AM

Page 42: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

CC#####.SOURCE(CBL4) includes:

SQL Communications Area (SQLCA) - collection of variables updated at end of every SQL statement

execution

1.

SQL DECLARE TABLE - describes DB2 table column data types2.

SQL DECLARE CURSOR - set of DB2 table rows with a pointer that identifies a current row3.

EXEC SQL - DB2 statements for COBOL program to interface with DB2 table data source4.

SELECT result set and write to output5.

Review CBL4 source code

Observe PROCESS SQL is the first statement in the source. PROCESS SQL makes the COBOL compiler aware

that EXEC SQL statements must be interpreted and expanded prior to source code compile.

COBOL compile with embedded EXEC SQL produce the following output:

Object module which is input to the subsequent process that results in an executable module1.

DBRM (Database Request Module) which is input to the DB2 package and plan bind process2.

Execution of the COBOL program accessing the DB2 table or tables require several elements.

COBOL program name1.

Data set name containing COBOL executable module2.

DB2 "Plan" name that provides a search chain to find a DB2 "Package" name that is directly related to

the COBOL program name.

3.

A DB2 utility exists to process the Database Request Module, DBRM.

The DBRM is used to build a DB2 'package' followed by DB2 'plan' creation.

The DB2 plan is assigned a name where the plan is a search chain.

The COBOL program and DB2 plan name must be provided to execute the logic.

Jump to ISPF Command Shell panel

=6=6=6=6

DB2 BIND and DB2 RUN control statements are mandatory for this challenge.

The following will generate the mandatory DB2 BIND and DB2 RUN control statements in &SYSUID..CNTL

DB2CNTLDB2CNTLDB2CNTLDB2CNTL

CC#####.JCL(DB2RUN) is available to compile CBL4, create CBL4 executable, create a DB2 PACKAGE, create a

DB2 PLAN, and finally execute CBL4 writing result set to filename P3OUT.

Modify DB2RUN as follows:

EDIT CC#####.JCL(DB2RUN)

Command ===> c # 4 all; sub ; =sd ; st

****** ***************************** Top of Data

000100 //DB2RUN# JOB 1,NOTIFY=&SYSUID,REGION=0M

000110 //*------------------------------------

000200 //COMPILE EXEC DB2COBCL,MBR=CBL#

000210 //*------------------------------------

000220 // IF RC = 0 THEN

000230 //*------------------------------------

000400 //BIND EXEC DB2BIND,MBR=CBL#

000510 //*------------------------------------

001000 //RUN EXEC DB2RUN,MBR=CBL#

001010 //*------------------------------------

001100 // ENDIF

001200 //*------------------------------------

****** **************************** Bottom of Data

Review the jcl output using SDSF. A question mark (?) to the left of the output displays the STEP DDNAMES.

SDSF STATUS DISPLAY ALL CLASSES

COMMAND INPUT ===>

NP JOBNAME JobID Owner Prty Queue

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

42 of 50 6/28/2016 11:26 AM

Page 43: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

? DB2RUN4 JOB02399 US09997 1 PRINT

SYSPRINT COMPILE COMPILE will display the EXEC SQL code expansion.

SYSTSPRT BIND BIND will display the DB2 BIND PLAN messages.

P3OUT RUN DB2RUN will display the CBL4 execution output.

SDSF JOB DATA SET DISPLAY - JOB

COMMAND INPUT ===>

NP DDNAME StepName ProcStep

JESMSGLG JES2

JESJCL JES2

JESYSMSG JES2

s SYSPRINT COMPILE COMPILE

SYSPRINT COMPILE LINK

s SYSTSPRT BIND BIND

SYSTSPRT RUN DB2RUN

s P3OUT RUN DB2RUN

Observations to make about CBL4 source code:

COBOL code below defines variable fields. COBOL can MOVE data into these fields for the purpose of printing

or writing to a data set.

PIC is a COBOL PICTURE clause which assigns a data type to the named field.

Data type descriptor explanations in the COBOL code below include:

ZZZ.99- is Numeric where Z is to suppress leading zeroes, it includes 2 decimal places and the trailing (-)

means write (-) if number is negative.

X(2) is character (X) with a length of 2

FILLER is a COBOL reserved word typically meaning will be filled with spaces.

01 PRTREC.

02 RATE_PRT PIC ZZZ.99-.

02 FILLER PIC X(2).

02 COUNTRY_PRT PIC X(30).

02 FILLER PIC X(41).

EXEC SQL below declares what the table looks like to the COBOL program. In this case, it is a very simple

table loaded in a previous challenge with only 2 columns. COUNTRY column is 20 characters in length, and

RATE column is decimal number with 2 decimal places.

EXEC SQL DECLARE GROWTH TABLE

(COUNTRY CHAR(20) NOT NULL,

RATE DECIMAL(5,2))

END-EXEC.

EXEC SQL below declares a name (SQL1) associated with SQL to be executed in the COBOL PROCEDURE

DIVISION.

EXEC SQL DECLARE SQL1 CURSOR FOR

SELECT * FROM GROWTH

END-EXEC.

COBOL declared variables below are used in this simple program to store the SQL execution result set.

01 DB2_RECORD.

02 COUNTRY PIC X(30).

02 RATE PIC S9(5)V99 COMP-3.

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

43 of 50 6/28/2016 11:26 AM

Page 44: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

COBOL PROCEDURE DIVISION is the logic. A PERFORM statement will locate and execute a section of code in

the logic, then return. Observe the name SQL1 previously declared is executed in the logic. Additionally, the

syntax UNTIL SQLCODE IS NOT EQUAL TO ZERO enables reading all the rows specified by the named SQL1

SELECT * FROM GROWTH.

PROCEDURE DIVISION.

------------------

BEGIN.

OPEN OUTPUT P3OUT.

PERFORM SELECT-ALL.

PROG-END.

CLOSE P3OUT.

STOP RUN.

SELECT-ALL.

EXEC SQL OPEN SQL1 END-EXEC.

EXEC SQL FETCH SQL1 INTO :DB2_RECORD END-EXEC.

PERFORM PRINT-AND-GET1

UNTIL SQLCODE IS NOT EQUAL TO ZERO.

EXEC SQL CLOSE SQL1 END-EXEC.

PRINT-AND-GET1.

PERFORM PRINT-A-LINE.

EXEC SQL FETCH SQL1 INTO :DB2_RECORD END-EXEC.

PRINT-A-LINE.

MOVE RATE TO RATE_PRT.

MOVE COUNTRY TO COUNTRY_PRT.

WRITE PRTREC.

Another important syntax observation (which will be vital to completing the upcoming challenge) is the INTO

:DB2_RECORD. The colon (:) in front of DB2_RECORD identifies the entire string to DB2 as a program Host

Variable.

Host variables are defined directly by statements of the host language (in this case COBOL). A host-variable

in an SQL statement must identify a host variable that is described in the program. FYI - You will see this

again later with SQL embedded in Java code.

A few more COBOL programs with embedded SQL are available for review.

COBOL program source for CBL5, CBL6, and CBL7 is located in CC#####.SOURCE.

CBL5 demonstrates processing of CENSUS.POPULATION DB2 table writing only selected columns from

result set of all rows and all columns.

1.

CBL6 demonstrates processing of CENSUS.POPULATION DB2 table using Host Variables to produce

result set from a program hardcoded COUNTRY value and program hardcoded AGE value.

2.

CBL7 demonstrates the simplest form of embedded SQL in a COBOL program. CBL7 demonstrates

processing of CENSUS.WORLDIMR table.

3.

CC#####.JCL(DB2RUN) is available to compile and run CBL5, CBL6, and CBL7.

See how DB2RUN JCL above was used to compile and run CBL4. Same JCL can be used compile and run other

COBOL/SQL programs with simple change to MBR=

Your challenge:

CBL7 is the simplest form of an embedded SQL in a COBOL program. CBL7 uses SQL MIN function to return a

single row with the minimum life expectency rate among all countries.

Modify CBL7 to return a single row using AVG SQL function to return the average life expectency rate from all

countries that begin with the letter L.

Once the result set includes a single row with average life expectency rate from all countries beginning with

the letter L, then the JCL must be modified to write the result set into P2.OUTPUT($011) as follows:

//DB2RUN7 JOB 1,NOTIFY=&SYSUID,REGION=0M

//*------------------------------------

//COMPILE EXEC DB2COBCL,MBR=CBL7

//*------------------------------------

// IF RC = 0 THEN

//*------------------------------------

//BIND EXEC DB2BIND,MBR=CBL7

//*------------------------------------

//RUN EXEC DB2RUN,MBR=CBL7

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

44 of 50 6/28/2016 11:26 AM

Page 45: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

//DB2RUN.P3OUT DD DSN=&SYSUID..P3.OUTPUT($011),DISP=SHR

//*------------------------------------

// ENDIF

//*------------------------------------

Easy to follow internet site explaining COBOL

See - http://www.tutorialspoint.com/cobol/

Professional COBOL Manuals

Enterprise COBOL for z/OS Language Reference

See - http://publibfp.boulder.ibm.com/epubs/pdf/igy5lr20.pdf

Enterprise COBOL for z/OS Programming Guide

See - http://publibfp.boulder.ibm.com/epubs/pdf/igy5pg20.pdf

Professional DB2 Application Programming Manual

DB2 for z/OS Application Programming and SQL Guide

See - http://publib.boulder.ibm.com/epubs/pdf/dsnapn05.pdf

Back to Top (Collapse All)

12. Java & DB2 for z/OS, a powerful combination12. Java & DB2 for z/OS, a powerful combination12. Java & DB2 for z/OS, a powerful combination12. Java & DB2 for z/OS, a powerful combination

Background:

SQL can be imbedded in Java. Java is a very good Systems of Engagement programming language. Java was

previously used from z hosted Linux to access z/TPF MongoDB data source. This challenge will show how

Java can access DB2 for z/OS data source from anywhere. A single Java program can simultaneously access

data sources hosted by DB2 on z/OS, Linux on z, and z/TPF communicating with smart phones and a wide

variety of internet-of-thing devices (which includes mobile phones)

You may have previously heard reference to the concept known as the law of the instrument, Maslow's

hammer, is an over-reliance on a familiar tool; as Abraham Maslow said, "I suppose it is tempting, if the only

tool you have is a hammer, to treat everything as if it were a nail."

While COBOL is a very effective Systems of Record computer language, Java strength and capabilities include

sending and receiving data over the network. Therefore, Java is a very effective Systems of Engagement

computer language.

The point is understanding what technical tool to use where, when, why and leveraging what works well

instead of thinking it needs to be redesigned or rewritten in a computer language more familiar to you. This is

what makes a good technician and architect and great technician and architect. Both COBOL and Java have a

significant role to play in large enterprise business applications. Exercising good business judgement is an

imperative to be a great (and highly paid) technician and architect, "don't fix something that is not broke".

Spend time leveraging what works well to provide new services.

Billions of lines of COBOL and other procedural computer languages with decades of improvements is very

effectively running the world's economy.

The emergence of object-oriented computer languages, such as Java, has enabled businesses to allow

customer access to critical data sources. Examples are electronically paying bills, transferring money

between accounts, stock trades, government services, placing online orders, immediate access to bank

account balance, last credit card transaction, even building a world wide business as a "managed service

provider" without physical need for any computer hardware and software.

Technical Play Time & Challenge Preparation

Copy CC#####.SOURCE(CENSUS) to /z/cc#####/census.java

tso omvstso omvstso omvstso omvs

===> cp '//source(census)' census.java===> cp '//source(census)' census.java===> cp '//source(census)' census.java===> cp '//source(census)' census.java

===> oedit census.java===> oedit census.java===> oedit census.java===> oedit census.java

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

45 of 50 6/28/2016 11:26 AM

Page 46: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

Observe in the census.java source the need to change the Database credentials to your credentials

F3 to save and exit back to shell prompt Compile the census.java into Java byte code, then invoke the JVM,

Java Virtual Machine. to execute the Java byte code.

===> javac census.java===> javac census.java===> javac census.java===> javac census.java

===> java census===> java census===> java census===> java census

Observe program System.out.println literals and DB2 result set written to the screen. Pretty cool.

Note: Let's Communicate challenge provided details about IP addresses, sockets, and TCP/IP communications.

That is taking place here. You might have observed the source code has the public IP address coded. 127.0.0.1

or localhost could have been substituted because the execution of this Java program is in the same operating

system as the DB2 table.

It is possible to binary FTP the census.class Java byte code to any workstation with a Java runtime

environment and the JDBC Universal Driver for DB2 z/OS in the workstation CLASSPATH, then execute the

code without any need to compile on the workstation. If you decided to install the optional RDz environment,

then you should have everything needed. The following can be entered from a command prompt on your

workstation to determine if Java runtime environment and required JDBC driver is available. (This is totally

optional - not required)

$ java -version

java version "1.7.0"

Java(TM) SE Runtime Environment (build pxa6470sr9fp10-20150708_01(SR9 FP10))

IBM J9 VM (build 2.6, JRE 1.7.0 Linux amd64-64

J9VM - R26_Java726_SR9_20150701_0050_B255667

JIT - tr.r11_20150626_95120.01

GC - R26_Java726_SR9_20150701_0050_B255667_CMPRSS

J9CL - 20150701_255667)

JCL - 20150628_01 based on Oracle jdk7u85-b15

$ java com.ibm.db2.jcc.DB2Jcc -version

IBM DB2 JDBC Universal Driver Architecture 3.65.96

$ ftp 192.86.32.153

Connected to 192.86.32.153 (192.86.32.153).

220-FTPSERVE IBM FTP CS V2R1

Name (192.86.32.153:myWorkstation): CC#####

331 Send password please.

Password:

230 CC##### is logged on. Working directory is "CC#####.".

Remote system type is MVS.

ftp> binary

200 Representation type is Image

ftp> cd /z/cc#####

250 HFS directory /z/cc##### is the current working directory

ftp> get census.class

local: census.class remote: census.class

227 Entering Passive Mode (192,86,32,153,4,33)

125 Sending data set /z/cc#####/census.class

250 Transfer completed successfully.

2633 bytes received in 0.0608 secs (43.30 Kbytes/sec)

ftp> quit

221 Quit command received. Goodbye.

$ java census

Connecting to a selected database...

Connected database successfully...

Creating statement...

Male: 158345038

Country: UnitedStates

Goodbye!

$

Your challenge:

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

46 of 50 6/28/2016 11:26 AM

Page 47: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

Copy census.java to worldimr.java using unix cp command1.

oedit worldimr.java2.

change the internal source class name to worldimr3.

change DB2 table data source to census.worldimr4.

modify SQL result set to include life expectency rate (ler) from countries beginning with letter L5.

compile worldimr.java6.

execute worldimr7.

Once the desired result set is displayed on the screen, then copy the result set to P3.OUTPUT($012) as

follows:

===> java worldimr > '$012'===> java worldimr > '$012'===> java worldimr > '$012'===> java worldimr > '$012'

===> cp '$012' '//p3.output($012)'===> cp '$012' '//p3.output($012)'===> cp '$012' '//p3.output($012)'===> cp '$012' '//p3.output($012)'

Hint: Use ISPF/SPUFI to validate the desired result set from CENSUS.WORLDIMR

See - http://www.tutorialspoint.com/jdbc/viewing-result-sets.htm

See - http://docs.oracle.com/javase/7/docs/api/java/sql/ResultSet.html

Back to Top (Collapse All)

13. rs.get...(1) get column based on column index13. rs.get...(1) get column based on column index13. rs.get...(1) get column based on column index13. rs.get...(1) get column based on column index

Background:

This challenge explores a feature of Java ResultSet interface to return dotted decimal (double) from SQL

arithmetic function.

Your challenge:

Copy worldimr.java to avgLER.java using unix cp command1.

oedit avgLER.java2.

change the internal source class name to avgLER3.

modify SQL result set to include the average life expectency rate (ler) from all rows in the

census.worldimr table

4.

compile avgLER.java5.

execute avgLER6.

Once the desired result set is displayed on the screen, then copy the result set to P3.OUTPUT($013) as

follows:

===> java avgLER > '$013'===> java avgLER > '$013'===> java avgLER > '$013'===> java avgLER > '$013'

===> cp '$013' '//p3.output($013)'===> cp '$013' '//p3.output($013)'===> cp '$013' '//p3.output($013)'===> cp '$013' '//p3.output($013)'

Back to Top (Collapse All)

14. Systems of Engagement, z hypervisors, and Linux14. Systems of Engagement, z hypervisors, and Linux14. Systems of Engagement, z hypervisors, and Linux14. Systems of Engagement, z hypervisors, and Linux

Background:

This challenge and the next challenge are relatively easy system oriented challenges that are insightful into

architecting large enterprise IT solutions. The last challenge will be application oriented challenge using Java

and DB2 for z/OS as a data source.

When using a smartphone for banking, travel reservations, and purchases or using Internet-of-Things (IoT)

devices to monitor home energy consumption, human health vitals, and status reported by an embedded

censor, a computer system needs to accomodate the data transmission to and from all these devices. The

system needs to be fast and capable of massive concurrent input/output throughput managing thousands

and even millions transmissions simultaneously. To "Engage" with all these network devices, Systems of

Engagement are needed.

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

47 of 50 6/28/2016 11:26 AM

Page 48: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

This contest mainframe is running many 100's of independent operating systems. This mainframe being used

for the contest is capable of running many 1000's of independent operating systems. All these operating

systems within a single "main frame" require no extra cables, no extra power supply, and the network

response between operating systems is instanteous. This is a big deal when designing large enterprise

solutions.

The contest has exposed you to three unique mainframe operating system types so far, z/OS, z/TPF, and

Linux on z. This challenge will expose you to a forth operating system, z/VM, the most advanced hypervisor

in existence.

A System of Engagement operating system is traditionally used for interaction with the public. Whenever a

System of Engagement needs to read, update, or write critical data that must be in a secure and central data

source, reducing or eliminating network delay becomes a performance pursuit. A good design is multiple

System of Engagement operating systems connected to a single System of Record operating system for the

common data source.

Use of a "main frame" hypervisor is an excellent way to rapidly create and manage many System of

Engagement Linux on z operating systems.

The z Systems "main frame" has 3 hypervisors

z/VM - an operating system, most technically advanced hypervisor in the industry1.

LPAR - a hardware hypervisor, logical partition2.

KVM on IBM z - (Linux) Kernel Virtual Machine, just became available this year3.

z/VM can virtualize CPUs, I/O devices, and most significant processing memory. It is designed to be a best of

breed processing memory manager to accomodate 1000's of concurrently running operating systems. z/VM is

highly flexible supporting several ways to rapidly create, manage, and monitor guest virtual machines such

as IBM Cloud Manager that is an OpenStack implementation.

LPAR can virtualize CPUs and I/O devices. However processing memory must be dedicated. LPAR is commonly

used for a System of Record operating system such as the flagship z Systems mainframe operating system,

z/OS. z/OS is what you have spent the most amount of time using during this contest. The reason is that

many employers are loosing highly experienced z/OS technicians to retirement and they want to team early

career technicians with them before they retire. These jobs have significant responsibility which can result in

higher pay.

KVM on IBM z is an alternative to z/VM. While KVM on IBM z is not a technically advanced as z/VM, KVM on

IBM z uses libvirt, an open source virtualization API. z Systems IBM mainframe has embraced the open source

community.

So, a mix of these technologies running within a single IBM z System mainframe offers a wide range of

technical tooling to architect large enterprise business solutions.

Challenge Preparation

From TSO/ISPF =6 panel enter the following

===> q cplevel===> q cplevel===> q cplevel===> q cplevel

===> q users===> q users===> q users===> q users

===> q userid===> q userid===> q userid===> q userid

===> q nic===> q nic===> q nic===> q nic

===> q lan===> q lan===> q lan===> q lan

===> netstat dev===> netstat dev===> netstat dev===> netstat dev

===> netstate gate===> netstate gate===> netstate gate===> netstate gate

===> ping 192.86.32.160 (count 5===> ping 192.86.32.160 (count 5===> ping 192.86.32.160 (count 5===> ping 192.86.32.160 (count 5

All query 'q' commands were sent to the hypervisor, z/VM, and the command output was returned to the

screen. The netstat and ping commands were processed by z/OS. z/OS is a classic System of Record

environment used to host the highly secure and 'single source of truth' data sources such as bank accounts,

etc.

Observe the ping response time to 192.86.32.160 which is the contest Linux on z. The response time is either

.0000 or pretty close to it. How is that for eliminating network delay between operating systems! The

throughput of a mainframe is massive. In fact the machine was designed from the ground up to maximize

throughput. The mainframe architecture is superior to all other servers.

TSO program used for an interactive session can be executed in background (batch). The following JCL is an

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

48 of 50 6/28/2016 11:26 AM

Page 49: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

example of executing TSO in the background.

===> submit jcl(tsobatch)===> submit jcl(tsobatch)===> submit jcl(tsobatch)===> submit jcl(tsobatch)

JCL(TSOBATCH) has several DDNAMES

//SYSTSPRT is System Terminal Session Print

//SYSTSIN is System Terminal Session Input

Note: //* is a comment statement in JCL

Your challenge:

Modify JCL(TSOBATCH) to write the following into P3.OUTPUT($014)

netstat dev1.

netstat gate2.

ping 192.86.32.161 (count 53.

Back to Top (Collapse All)

15. Big Picture15. Big Picture15. Big Picture15. Big Picture

Background:

Two famous computer quotes help summarize today's Information Technology landscape.

"Computing is not about computers any more. It is about living."1.

"We're entering a new world in which data may be more important than software."2.

Your challenge: Answer 12 questions with multiple choice answers. You might be unfamiliar with questions

and answers, but everyone is enabled by internet search engines. The questions and answers will provide

Information Technology big picture insight.

====> tso p3@15====> tso p3@15====> tso p3@15====> tso p3@15

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

49 of 50 6/28/2016 11:26 AM

Page 50: 0. Part 3 Adventure Preparation - IBM€¦ · 0. Part 3 Adventure Preparation ... challenges are excellent interview discussion points when a company wants ... /* REXX */ say 'Hello

Upon completion P3.OUTPUT($015) can be browsed. $015 has a single line with the numbered answers.

Back to Top (Collapse All)

16. Putting it all together16. Putting it all together16. Putting it all together16. Putting it all together

Background:

Congratulations! - if you completed all the previous challenges. This is an accomplishment that only a small

fraction of the contestants has achieved. As a member of the contest elite. You are in a position to be invited

to the Master the Mainframe World Championship in 2016.

See - http://www.ibm.com/systems/z/education/academic/masterthemainframe/highlights/

This last challenge shifts attention from system responsibilites back to application development

responsibilities. This final challenge is without detailed instructions. Therefore, the challenge requires review

of previous challenges as a guide to complete the final challenge.

This last challenge is an opportunity to distinguish yourself from others that completed all the challenges as

you have done. As a result, the challenge is without any Java program source template providing you the

opportunity to write the Java code as you see fit.

The output format will be considered when judged. Output that is easy to read and understand can help

distinguish you from others that complete this challenge.

This challenge is reviewed by a panel judges where each judge provides an independent score. The

independent scores are averaged to determine final points. Judging involves output quality and Java code

used to produce the output.

Your challenge:

Write a java program that provides a report from the following DB2 for z/OS tables:

CENSUS.WORLDIMR1.

CENSUS.POPULATION2.

GROWTH3.

Completion Requirements

Java program name must be finalRpt and left in your unix file subdirectory1.

Java program finalRpt output written to your unix file subdirectory as $0162.

Copy $016 to P3.OUTPUT($016)3.

Report output to include:

Country, Growth Rate, Infant Mortality Rate, Life Expectency Rate, and Sex Ratio from countries where the

growth rate is negative.

Remember: Output format is your choice. Java provides control over output format.

Congratulations!

To validate Part 3 is complete:

=6=6=6=6

scorep3scorep3scorep3scorep3

Back to Top (Collapse All)

This page is powered by

and

IBM Master the Mainframe Contest - 2015 http://mtm2015.mybluemix.net/

50 of 50 6/28/2016 11:26 AM