実践編(15.Mainframeスクリプト言語、Rexx)

★厳選オススメ記事!

予備知識

経験豊富なメインフレーマーは、多くのプラットフォームでインストールされているにもかかわらず有名でないスクリプト言語を利用しています。多くのワークステーションシェルスクリプト言語がインストールされているのと同様に、メインフレームにもREXXというスクリプト言語がインストールされています。
REstructured eXtended eXecutor (REXX)は名前の割に学習と読解が簡単にできるようにデザインされています。
もし、あなたが多くの企業でz/OSプログラマーシステムアドミニストレータとして仕事をしてきたのであれば、REXXになれるのもはやいでしょう。
このスクリプト言語はパワフルでありながあら、学習しやすく容易に使用することが出来ます。
すべてのREXXコマンドや機能、可能性を覚える必要はありません。
レファレンスやサンプルコードはインターネット上のどこでも転がっています。
以下は、REXXに関するウェブサイトです。
REXX:
・Oxford Computer Science
The REXX Tutorial
・The American Programmer
The American Programmer.com REXX Language Programming: REXX Boolean operators
IBM DeveloperWorks
Rexx for everyone
REXX Book
http://www.rexxla.org/rexxlang/Rexx_Programmers_Reference.pdf
・Magazine Article
www.ibmsystemsmag.com
IBM Technical Manuals
IBM REXX Family - IBM publications

"REXX"のスキルを付けることは、"COBOL"、"JCL"と同様に注意を引くものになります。レジュメ上の"REXX"の記述を見つけた社員は、メインフレームシステムアドミニストレータとしてのポテンシャルがあると考えるでしょう。

実践

ISPFコマンド TSO XTBLを入力して実行して下さい。
jokeと実行して、helpと実行してください。そしてすべてを実行して下さい。


注意)このプログラムのソースコードは、CC#####.REXX.CLIST(XTBL)にあります。このコードを正しいREXX syntaxのサンプルとして見ることに加えて、インターネットで検索することはこのチャレンジを完了するのに役立ちます。

REXXコードを確認し、誤りを正して下さい。the data set list utility panel (=3.4) へ移動し、CC#####.REXX.CLISTを編集モードで開いて下さい。数多くのメンバがいることがわかります。
XTBLの左がわにEXを入力しREXXプログラムを実行して下さい。
f:id:kenta_everyday:20170430204644p:plain
これは、TSOコマンドで前に実行したものと同じプログラムです。XTBLを抜けるにはexitを入力して下さい。
メンバ:HOROSCOPの左側にEXを入力しREXXプログラムを実行して下さい。このプログラムは、解決する必要がある様々な問題があります。
The second screen immediately shows a problem:

COMMAND SA NOT FOUND
16 *-* sa 'When where your born? '
+++ RC(-3) +++



However, the routine continued to function.
Enter 1 and observe another problem. This one causes the program to abend.
Execute the HOROSCOP program again. This time enter 13. Yes, there's a third problem.
Execute the HOROSCOP program again. Choose option 4 and observe yet another problem. Go ahead and end the HOROSCOP program now.
Edit the HOROSCOP member and correct all the problems. REXX syntax is easy to understand, take your time and read the source code carefully. Do not forget the reference links we gave you at the start of this challenge, and you can use the XTBL program as a reference as well.
Each time you attempt a correction, use F3 to save the HOROSCOP member and return to the directory listing. Then enter EX next to HOROSCOP to try out your modification.
Once you have corrected all the problems, observe the horoscope for selection 1 and 2 are identical. This is another problem to correct. A hint to help you debug your REXX code can be found in the 2 lines of selection 1 output.
Note: In the event you want to restore HOROSCOP to it's original state, you can find a copy in 'ZOS.PUBLIC.P2.REXX.CLIST(HOROSCOP)'. Feel free to take a copy!
Once these problems are corrected, enter TSO SUBMIT JCL(HOROSCOP). This JCL will execute your HOROSCOP program in batch and create P2.OUTPUT(#15). Upon successful execution, member #15 will have the Aquarius and Taurus horoscopes contained within.
Helpful Hint #1: Close examination of the REXX routine shows that the Horoscope text message are PDS members in 'ZOS.PUBLIC.DATA'. This is significant to correcting the the problem with TAURUS horoscope. Do NOT edit 'ZOS.PUBLIC.DATA' - Only view or browse 'ZOS.PUBLIC.DATA'. The system will not permit any changes to this data set.
Helpful Hint #2: REXX return statement is significant to execution flow.
Just one more challenge to go! Stay frosty!