Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

ANSB2 BEFORE YOU BEGIN

THE CHALLENGE

Hitting The Playbooks With your environment set up, you're now able to take charge of Hopefully you didn't skip right to
these Ansible playbooks and really make things happen. In this the end, because there's a LOT of
challenge, we'll learn about EBCDIC and ASCII character information about the mainframe
encodings, as well as the commands used to convert between you need to do… pretty much
Bring together more modules and decode some text them, then string together a few commands in a slightly more anything in here. If you've arrived
complex playbook to handle the completion of this chapter in here by doing all of the previous
what has hopefully been an exciting series of challenges. challenges, then you're in the right
9 steps 2 hours place. Welcome.

Insert Screenshot Here Insert Screenshot Here Insert Screenshot Here

1. REVISIT YOUR WORK 2. POWERING UP YOUR VS CODE 3. TALK TO ME


You probably ended up with a single-entry playbook that You may have run into problems getting your YAML file
Ever wish you could get just a little more information about
executed a command, similar to the screenshot above. formatted correctly, and learned that indentation matters.
what's happening while a playbook is executing? I mean, it's
There's a YAML extension by Red Hat that can detect errors
nice when things just work and don't bother you, but
In addition to knowing it should look in the zos_core before you submit playbooks, give greater visibility of document
sometimes you just want some more clues to help solve a
collection, we also need to spell out where ZOAU is. Leaving structure, and provide autocompletion where supported. Not
problem. Throw in a -v after your command to make it a little
these out will cause the command to fail, but if you made it required, but may be helpful.
more verbose. Throw in a few more v's to make it a little more
this far, you probably figured that out. verbose. Use –vvvvv to get the most information.
In fact, there's extensions for Ansible, and even Ansible
specifically on Z that you might want to check out as you go
forward. They can drastically cut down on development time as
you move along (as long as they don't conflict with one another)

Want to talk? Join our Slack Tweet about it!


ibm.biz/mtm_slack #MasterTheMainframe
ANSB2 Advanced Playbooks for Advanced Players

Insert Screenshot Here Insert Screenshot Here

4. USE THOSE EXAMPLES 5. SYNTAX HINTS 6. ENCODING MATTERS


Remember how we said examples are good documentation? The design philosophy for ansible tasks is to describe what A long time ago, IBM came up with a way of representing
That definitely applies here. The examples in the z/OS core needs to be done as succinctly as possible without it being characters in computer memory called EBCDIC (IBM-1047).
collection have examples where you're most likely going to use confusing. If you look at the zos_data_set module, the key Another standard came around later called ASCII (also
them. In most cases, you can just copy/paste these from the difference between a create and a delete is the "state" referred to as ISO8859-1). They're both equally capable,
page into your code, and then adjust to meet your specific needs. parameter, which is set to present for create and absent for although if you're looking at text on a mainframe, there's a
delete. You're basically writing what you would describe as an good chance it's EBCDIC, whereas text you're looking at from
ideal outcome of that step. You'll find similar phrasing and the internet, or in an app is likely ASCII, or UNICODE.
approaches in the non-z/OS modules as well.
The world of character encoding is a wild one, and if you're in
need of some bedtime reading material, there are plenty of
videos and articles written on the topic. Just know this: Data
TELL ME MORE ABOUT THIS WHOLE CHARACTER ENCODING THING
sets on Z are EBCDIC by default, and we need to convert or
I'm so glad you asked. Picture a single bit of memory, which can either be a 1 or a 0, on or off. With translate ASCII if we want to read that.
that one bit, you can represent two numbers, Zero or One. Put another bit next to it, and you've
doubled the amount of numbers you can represent, now 4. Add another, you're up to 8, then 16, and
so on. Remember how we talked about Hexadecimal back in Part 1? That's why it goes from 0-15.

With letters and characters, things get a lot more confusing. We want to allow for a large set of
characters, while also being efficient. Consider that certain characters only appear in certain spoken
and written languages, and other characters are rarely seen outside of a computer. Character
encoding is simply an attempt at representing a set of characters electronically. Some encoding favor Want to talk? Join our Slack Tweet about it!
efficiency, others flexibility. It pays to not take the encoding of the text you're using for granted. ibm.biz/mtm_slack #MasterTheMainframe
ANSB2 Advanced Playbooks for Advanced Players

Insert Screenshot Here Insert Screenshot Here Insert Screenshot Here

7. CONVERT AND TRANSFORM 8. FOLLOW THOSE STEPS 9. DON'T STOP HERE


The instructions to finish out ANSB2 are in that text, which you Your gears should be spinning right now, and that's a good
Take a look at MTM2020.PUBLIC.INPUT(ASCMSG). This is not can see if you succeeded in translating it. Read them carefully,
Dothraki. This is what happens when you try to open ASCII- thing. The last thing you need is for us to tell you what to do,
and begin crafting yet another Ansible playbook. This one will because you've probably got a list of things you *want* to try.
encoded text in an EBCDIC environment. be a little bit more complicated, and use a little bit of logic, but Maybe you can automate some of that nice ASCII art we got
by now, we know that you're up to the challenge. from REXX a while back? Perhaps there's a better way of
Fortunately, there' a whole module to deal with encoding
transformation, zos_encode. running one of those Luhn Algorithm checkers that involves a
To file this for completion, fire off CHK3 from and make it count. few less manual steps. You're done with the main challenges
Put together a new Ansible playbook to convert this from ASCII for Part 3, now it's time to show us what you can really do.
to EBCDIC and put its output somewhere in your WORK data
set. Then open it up and meet us in Step 8.
NICE JOB! LET’S RECAP NEXT UP…
As you can see, integrating z/OS into Ansible isn't so much If you've saved these Ansible
about all of the new things you can do, but how much you challenges for last, then you're
can simplify or automate tasks that typically require a great done with all of the spelled-out
deal of manual steps or deep institutional knowledge. If we challenges. Congratulations! All
started you off right from here, you would likely get that's left (aside from a quick
absolutely stuck after seeing your first error message, and victory dance) is to read up on the
you also wouldn't have an understanding of what's Grand Challenge, and start writing
happening behind the scenes. Now that you know both your First Prize acceptance
Want to talk? Join our Slack Tweet about it! sides, there's really no limit to what you can accomplish. speech. (always stay optimistic)
ibm.biz/mtm_slack #MasterTheMainframe

You might also like