<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Na Tian on Medium]]></title>
        <description><![CDATA[Stories by Na Tian on Medium]]></description>
        <link>https://medium.com/@tiantn?source=rss-45f853a0f087------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*tBPY5xBCV0f9UMEsqlipNw.jpeg</url>
            <title>Stories by Na Tian on Medium</title>
            <link>https://medium.com/@tiantn?source=rss-45f853a0f087------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 22:30:16 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tiantn/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Zowe Explorer Extension for FTP]]></title>
            <link>https://medium.com/zowe/zowe-explorer-extension-for-ftp-ab678dad3f52?source=rss-45f853a0f087------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab678dad3f52</guid>
            <category><![CDATA[zowe-explorer]]></category>
            <category><![CDATA[vscode]]></category>
            <category><![CDATA[ftp]]></category>
            <category><![CDATA[z]]></category>
            <category><![CDATA[zowe]]></category>
            <dc:creator><![CDATA[Na Tian]]></dc:creator>
            <pubDate>Thu, 03 Jun 2021 06:53:13 GMT</pubDate>
            <atom:updated>2022-01-21T13:39:23.863Z</atom:updated>
            <content:encoded><![CDATA[<p>{<a href="https://github.com/zowe/community/blob/master/blogging/blog_guidelines.md#zowe-core">Core</a>} <a href="https://www.openmainframeproject.org/">The Open Mainframe Project</a>’s <a href="https://www.zowe.org/">Zowe</a> Explorer provides a Visual Studio Code extension for mainframe developers that includes three new views: z/OS data sets, USS directories, and JES jobs. From these a user can create, view, edit, delete and perform other actions directly against z/OS data and services. Underpinning the function is the Zowe Node SDK which is also shared with the Zowe Command Line Interface (CLI).</p><p>The core Zowe CLI uses z/OSMF REST APIs for its backend z/OS service and makes client server calls within the SDK. One of the nice things in the architecture of Zowe Explorer is that it has an interface abstraction layer that allows alternative back ends to serve data. An example of where this can be used is for customers who do not wish to use z/OSMF as their API backend for Zowe, and are comfortable using z/OS file transfer protocol (FTP) instead. For example, users who just want to do a lot of dataset, uss file and JOB related operations, may not need take much time on configuration z/OSMF.</p><p>The Zowe Explorer Extension for FTP is an extended feature which adds the FTP protocol to the Zowe Explorer VS Code extension. This allows you to use z/OS FTP Plug-in for Zowe CLI profiles to connect and interact with z/OS data sets, USS files, and jobs.</p><p>It is very easy to install and configure. Try it with me!</p><h3>Prerequisites</h3><p><strong>Host-side prerequisites:</strong></p><p>1. Enable FTP or FTPS (FTP over SSL) services on z/OS. The secure FTPS is recommended because FTPS can not only achive business requirements but also security standards . You can enable the FTP service by referring to the following link: <a href="https://www.ibm.com/docs/en/zos/2.4.0?topic=applications-transferring-files-using-ftp">https://www.ibm.com/docs/en/zos/2.4.0?topic=applications-transferring-files-using-ftp</a>.</p><p>2. Ensure the value of the FTP setting JESINTERFACELEVEL is 2.</p><p>To check the value of JESINTERFACELEVEL, you can run command <strong>status</strong> from ftp localhost on USS environment.</p><p>The following is the sample output for the command<strong> status</strong>:</p><pre>Command:<br><br>  status<br><br>  &gt;&gt;&gt; STAT<br><br>  ............<br><br>  211-JESLRECL is 80<br><br>  211-JESRECFM is Fixed<br><br>  <strong>211-JESINTERFACELEVEL is 2</strong><br><br>  211-Server site variable JESTRAILINGBLANKS is set to TRUE<br><br>  ............<br><br>  211-Server site variable LISTLEVEL is set to 0<br><br>  211 *** end of status *** <br><br>  Command:</pre><h3>Installation</h3><p>Search for the keyword ‘zowe’ in VS Code marketplace. You will find Zowe Explorer and Zowe Explorer Extension for FTP. See the picture below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*ZVdsq2PiiKU14C9VKg-ozQ.png" /></figure><p>Then click the Install buttons to install Zowe Explorer and Zowe Explorer Extension for FTP. After you installed them, there is an icon like</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/60/1*iz5oayyQlRUgJVJHbiKkdA.png" /></figure><p>in the left side bar. It indicates you successfully installed them. Let’s create a FTP profile to connect to z/OS now!</p><h3>Create FTP user profile</h3><p>Click the Zowe icon.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/60/1*iz5oayyQlRUgJVJHbiKkdA.png" /></figure><p>You will see three views: DATA SETS, UNIX SYSTEM SERVICES(USS) and JOBS.</p><p>Move your mouse to the plus icon in DATA SETS to add a profile.</p><p>You need to fill in the following contents to create a new connection to z/OS.</p><p><strong>Connection name: </strong>Give a name of the connection profile.</p><p><strong>Profile type: </strong>Choose zftp profile.</p><p><strong>z/OS URL: </strong>Specify the z/OS host domain name or IP address.</p><p><strong>Port number: </strong>The port number of z/OS FTP server.</p><p><strong>Username: </strong>The userid for z/OS.</p><p><strong>Password: </strong>The password for the userid.</p><p><strong>Encryption: </strong>Set to True if FTPS is used.</p><p><strong>Self-signed certificates:</strong> Select whether to reject connections with self-signed certificates,</p><p><strong>Server name for the SNI TLS extension: </strong>Leave this blank if you don’t use it.</p><p><strong>Time: </strong>The time to wait for the connection to be established.</p><p>When the profile created successfully you will receive message ‘Profile <em>profilename</em> was created’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HPpGSffFLWfxxOOdmRfj9A.gif" /></figure><p>You can also add the created profile to UNIX SYSTEM SERVICES(USS) and JOBS by clicking the plus icons for those views.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y-HwsHmEy_n_IOuIBT7VgA.gif" /></figure><p>Now you are ready to interact with z/OS datasets, USS files and jobs.</p><h3>What can you do?</h3><p>There are a lot of things you can do through the extension using FTP. The following picture show the functions it supports.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/1*8-6o-KQIZ8kpx6fmTemtBQ.png" /></figure><h3>Try it in a scenario</h3><p>Most of the functions in this extension can be explored easily. Below, we’ll walk through the main functionality in a common scenario. Let’s see the scenario first.</p><p><strong>Scenario:</strong></p><p>Jack (system Z user) wants to run a USS script by submitting a job, and then view the output when the job has finished. This can be broken down into several smaller tasks:</p><p>- Create USS file named demo.sh and write a simple script.</p><p>- Create the dataset member named USSCMD to run demo.sh.</p><p>- Submit the job.</p><p>- Check the job log.</p><p>Now let’s do it step by step.</p><p><strong>Create USS file named demo.sh and write a simple script:</strong></p><p>- Go to the directory /u/tnzsys/demo and list the files and subdirectories. (replace tnzsys with your username)</p><p>- Right click the profile in UNIX SYSTEM SERVICES(USS) and click the Create File.</p><p>- Input the location and file name to create. Press ‘Enter’ to confirm the inputs.</p><p>- Now the file demo.sh has been created successfully.</p><p>- Click demo.sh to open the file in edit mode. Write the simple script and save it.</p><p>The simple script:</p><pre>echo “hello zftp”</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9BlZi08dDA4KQnrJf9wbCQ.gif" /></figure><p><strong>Create the dataset member named USSCMD to run demo.sh:</strong></p><p>- Specify the member name and press ‘ENTER’.</p><p>- Open the member USSCMD and write the JCL.</p><p>- When you finished the JCL, save it, and the member will be uploaded to the mainframe.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*7gxST9yxsvVtvtyC6GtQXw.gif" /></figure><p>Tip: If the content in your saved dataset member conflicts with the member on the mainframe, a conflict message will appear:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/1*WIwZx7-BRr4qK9myn8jLRQ.png" /></figure><p>To resolve the conflict, you just need pull the latest content from mainframe. Then update the member and save it again. <strong>But please notice</strong> that pulling the latest content from the mainframe will overwrite any changes you made locally. So you should copy your local content first, then pull from the mainframe, and then paste your updated parts.</p><p><strong>Submit the job:</strong></p><p>- Right click the member and select Submit Job. The job will be submitted and return a JOBID.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bagGwjyrWBjzfV8Jfr8ECg.gif" /></figure><p><strong>Check the job log:</strong></p><p>- Click the JOBID in the message. It will lead to the JOBS view.</p><p>- Expand the job to list the spool files.</p><p>- Now Jack can view any of the output he wants by clicking on it. For example, view the JESMSGLG to see the return code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rnArJB4kORLTVqbbk-6erQ.gif" /></figure><p>Now Jack finished his simple work by using Zowe Explorer FTP Extension.</p><p>It is easy, right? Try it now!</p><h3>Bonus - Add to Favorites</h3><p>There is a very useful function: Add to Favorites. You can add your frequently used datasets, members, USS directories, USS files, and jobs to the Favorites by click the star icon or the option ‘Add to Favorites’.</p><p>The following example shows the dataset TNZSYS.DEMO.TEST was added to the DATA SETS Favorites, USS file demo.sh was added to the UNIX SYSTEM SERVICES(USS) Favorites and job JOB29240 are added to the JOBS Favorites.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*03Y1_ya4Lqnmr_luWREgwQ.gif" /></figure><h3><strong>Learn more:</strong></h3><p>If you enjoyed this blog checkout more <a href="https://medium.com/zowe">Zowe blogs here</a>. Or, ask a question and join the conversation on the <a href="https://openmainframeproeject.slack.org/">Open Mainframe Project Slack Channel</a> #Zowe-dev, #Zowe-user or #Zowe-onboarding. If this is your first time using the OMP slack channel register <a href="https://slack.openmainframeproject.org/">here</a>.</p><p>Zowe is owned and managed by the <a href="https://www.openmainframeproject.org/">Open Mainframe Project</a> which is a <a href="https://linuxfoundation.org/">Linux Foundation</a> project.</p><h3>Reference:</h3><p><a href="https://github.com/zowe/vscode-extension-for-zowe/tree/master/packages/zowe-explorer-ftp-extension">https://github.com/zowe/vscode-extension-for-zowe/tree/master/packages/zowe-explorer-ftp-extension</a></p><p><a href="https://github.com/zowe/zowe-cli-ftp-plugin#install-the-zos-ftp-plug-in">https://github.com/zowe/zowe-cli-ftp-plugin#install-the-zos-ftp-plug-in</a></p><p><a href="https://docs.zowe.org/stable/user-guide/cli-installcli.html">https://docs.zowe.org/stable/user-guide/cli-installcli.html</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab678dad3f52" width="1" height="1" alt=""><hr><p><a href="https://medium.com/zowe/zowe-explorer-extension-for-ftp-ab678dad3f52">Zowe Explorer Extension for FTP</a> was originally published in <a href="https://medium.com/zowe">Zowe</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[z/OS FTP Plug-in for Zowe CLI]]></title>
            <link>https://medium.com/zowe/z-os-ftp-plug-in-for-zowe-cli-af5630627768?source=rss-45f853a0f087------2</link>
            <guid isPermaLink="false">https://medium.com/p/af5630627768</guid>
            <category><![CDATA[ftp]]></category>
            <category><![CDATA[zowe-cli]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[cli]]></category>
            <category><![CDATA[zowe]]></category>
            <dc:creator><![CDATA[Na Tian]]></dc:creator>
            <pubDate>Fri, 09 Apr 2021 02:34:54 GMT</pubDate>
            <atom:updated>2021-05-18T07:51:20.478Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Zowe and Zowe CLI</strong></p><p>{<a href="https://github.com/zowe/community/blob/master/blogging/blog_guidelines.md#zowe-core">Core</a>} The <a href="https://www.openmainframeproject.org/">Open Mainframe Project</a>’s <a href="https://www.openmainframeproject.org/projects/zowe">Zowe</a> is an open source project for the IBM Z platform. It provides new user interfaces for users to interact with z/OS. It also provides a set of APIs on which users can easily build their applications on z/OS. Zowe’s modern interface allows you to use z/OS to develop and extend your applications in a way similar to what you experience on a cloud platform today. It not only lowered the learning curve of IBM mainframe and made IBM z/OS easy to work with, but also is the product of IBM mainframe embracing open source and entering the cloud era.</p><p>Zowe CLI is an important part of Zowe. It is a command-line interface that you can use on any platform (Windows, MacOS, Linux). It is easy to integrate with common development build tools such as integrated development environments (IDEs), shell commands, bash scripts, build tools, and so on. It can easily interact with the host, obtain z/OS resources, execute and control z/OS jobs, issue system commands and TSO commands. But a significant number of Zowe CLI commands, especially those related to data set and job management, require that z/OSMF be installed and configured before use. This can be potentially limiting on systems where z/OSMF has not been installed and configured for use with Zowe. So, without z/OSMF, wouldn’t we be able to experience the fun of Zowe CLI? This is where the z/OS FTP plug-in for Zowe CLI comes to the rescue, as FTP on z/OS provides access to services for working with datasets, uss and jobs. By using FTP on z/OS (instead of z/OSMF REST APIs) for these z/OS services users can still enjoy the CLI and use it for scriptable orchestration and automation of their mainframe. FTP is not a full replacement for z/OSMF REST API services, because while it covers the core function needed for data sets, USS and JES access, it doesn’t provide the ability to do workflows or provisioning.</p><p><strong>z/OS FTP Plug-in for Zowe CLI</strong></p><p>z/OS FTP plug-in for Zowe CLI (zftp) uses the zos-node-accessor package and z/OS FTP service to interact with z/OS. So there is no need for z/OSMF as the back-end support. It is as consistent as possible with the Zowe CLI core in terms of the command syntax and response so that you don’t have to learn any additional syntax knowledge when using it. The following will show you how to install and use it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/395/0*CX9AKw8i6s4KO-_6.png" /></figure><p><strong>Prerequisites</strong></p><p>1. Enable FTP or FTPS(FTP over SSL) services on z/OS. The secure FTPS is recommended and ensure the value of FTP setting, JESINTERFACELEVEL is 2. You can enable the FTP service by referring to the link: <a href="https://www.ibm.com/docs/en/zos/2.4.0?topic=applications-transferring-files-using-ftp">https://www.ibm.com/docs/en/zos/2.4.0?topic=applications-transferring-files-using-ftp</a>.<br>2. Install Node.JS v8 or above version(v10/v12) on your workstation.</p><p>Tips: you can run command status to check JESINTERFACELevel from ftp localhost on USS environment.</p><p>The following is the sample output for command status</p><pre>Command:<br>status<br>&gt;&gt;&gt; STAT<br>............<br>211-JESLRECL is 80<br>211-JESRECFM is Fixed<br><strong>211-JESINTERFACELEVEL is 2</strong><br>211-Server site variable JESTRAILINGBLANKS is set to TRUE<br>............<br>211-Server site variable LISTLEVEL is set to 0<br>211 *** end of status *** <br>Command:</pre><p><strong>Installation</strong></p><p>1. Install Zowe CLI</p><p>Run the following commands to install Zowe CLI .</p><pre>npm install -g @zowe/cli@zowe-v1-lts</pre><p>2. Install Zowe Secure Credential Store(optional)</p><p>The Secure Credential Store is an optional plugin and used to store passwords more securely than plain text profiles. To learn more about it please refer to <a href="https://docs.zowe.org/stable/user-guide/cli-scsplugin.html#secure-credential-store-plug-in-for-zowe-cli">https://docs.zowe.org/stable/user-guide/cli-scsplugin.html#secure-credential-store-plug-in-for-zowe-cli</a></p><pre>zowe plugins install @zowe/secure-credential-store-for-zowe-cli@zowe-v1-lts</pre><p>3. Install z/OS FTP Plug-in for Zowe CLI</p><pre>zowe plugins install @zowe/zos-ftp-for-zowe-cli@zowe-v1-lts</pre><p>When you finished the installation, the following message will show up: ‘This plugin was successfully validated. Enjoy the plugin.’</p><p>4. Create User Profile</p><p>Using the following command to create a user profile：</p><pre>zowe profiles create zftp profilename -u username -p password -H hostname --secure-ftp true/false</pre><p>Change profilename, username, password and hostname to fit your system. If FTPS (FTP over SSL) enabled, set — secure-ftp to be true. Otherwise, set it false. Example:</p><pre>zowe profiles create zftp p21 -u ibmuser -p xxxxxxxx -H 9.12.34.56 --secure-ftp false</pre><p>5. Verify</p><p>You can run a simple zowe zftp command to verify this plugin. Example:</p><pre>zowe zftp list ds “SYS1.**”</pre><p>Now you can follow me to go through the simple but useful commands to learn more about zowe zftp plugin.</p><p><strong>Datasets</strong></p><p>The most data on z/OS are stored in dataset, like the sequential dataset and partition dataset. z/OS FTP plug-in for Zowe CLI allows you to list datasets, view their contents, download, upload or delete them from command line easily.</p><p>First, you can list dataset with“list data-set” command:</p><pre>$ zowe zos-ftp list data-set &quot;SYS1.**.*EXEC&quot;<br>SYS1.SAXREXEC<br>SYS1.SBPXEXEC</pre><p>Then, you can view the dataset contents with “view data-set” command, as you do from ISPF. Reminder: Only text data is supported to view.</p><pre>$ zowe zos-ftp view data-set &quot;TNZSYS.ZFTP.TEST(HELLO)&quot;<br>//HELLO    JOB ,NOTIFY=&amp;SYSUID,CLASS=A,MSGCLASS=H,MSGLEVEL=1     <br>//STEP0001 EXEC PGM=IEBGENER                                     <br>//SYSIN    DD DUMMY                                           <br>//SYSPRINT DD SYSOUT=*                                                                       <br>//SYSUT1   DD *                                                                                      <br>  Hello World                                                                                             <br>/*                                                                                                         <br>//SYSUT2   DD SYSOUT=*</pre><p>You can also download the text dataset to the local machine with “download data-set” command:</p><pre>$ zowe zos-ftp download data-set &quot;TNZSYS.ZFTP.TEST(HELLO)&quot;<br>Data set downloaded successfully.<br>Destination: tnzsys/zftp/test/hello</pre><p>Or download the dataset in binary mode by adding “ — binary”:</p><pre>$ zowe zos-ftp download data-set &quot;TNZSYS.ZFTP.TEST(HELLO)&quot; --binary<br>Data set downloaded successfully.<br>Destination: tnzsys/zftp/test/hello</pre><p>You can also allocate sequential or partitioned dataset with “allocate data-set” command:</p><pre>$ zowe zos-ftp allocate data-set &quot;TNZSYS.ZFTP.DS1&quot; --dcb &quot;RECFM=FB DSORG=PO PRIMARY=10 SECONDARY=20 DIRECTORY=10&quot;<br>Allocated dataset TNZSYS.ZFTP.DS1 successfully!</pre><p>The “ — dcb” option specify DCB parameters for dataset allocation. It’s space separated like “RECFM=FB LRECL=326 BLKSIZE=23472”.</p><p>There are two ways to upload the local changes to the dataset on z/OS.</p><p>There are two ways to upload the local changes to the dataset on z/OS.</p><p>1) You do some changes in the local file and then upload it to z/OS with “upload file-to-data-set” command:</p><pre>$ zowe zos-ftp upload file-to-data-set hello &quot;TNZSYS.ZFTP.TEST.HELLO&quot;<br>Uploaded from local file &#39;hello&#39; to TNZSYS.ZFTP.TEST.HELLO</pre><p>The target dataset will be allocated, if it does not exist, or overwritten if existent. In the former case, the target dataset is allocated with the default allocation configuration. You can specify the allocation configuration with the dataset control block option, — dcb. Please note the configuration parameters are separated by space character, requiring double quotes enclosing them usually. For example:</p><pre>$ zowe zos-ftp upload file-to-data-set hello &quot;TNZSYS.ZFTP.TEST.HELLO.DCB&quot; --dcb &quot;RECFM=VB LRECL=326 BLKSIZE=23472&quot;<br>Uploaded from local file &#39;hello&#39; to TNZSYS.ZFTP.TEST.HELLO.DCB</pre><p>Also if you want to upload a file to dataset in binary mode just add “ — binary” option.</p><p>2) z/OS FTP Plug-in also supports to upload dataset from stdin with “upload stdin-to-data-set” command. You just need write your contents in a new line and when you finished the contents using “Control + D” to end the command. The message like “Uploaded from stdin to TNZSYS.ZFTP.TEST(HELLO1)” indicates the success.</p><pre>$ zowe zos-ftp upload stdin-to-data-set &quot;TNZSYS.ZFTP.TEST(HELLO1)&quot;<br>//HELLO    JOB ,NOTIFY=&amp;SYSUID,CLASS=A,MSGCLASS=H,MSGLEVEL=1<br>//STEP0001 EXEC PGM=IEBGENER                                <br>//SYSIN    DD DUMMY                                         <br>//SYSPRINT DD SYSOUT=*                                      <br>//SYSUT1   DD *                                             <br> Hello World                                                <br>/*                                                          <br>//SYSUT2   DD SYSOUT=*                                      <br>^D<br>Uploaded from stdin to TNZSYS.ZFTP.TEST(HELLO1)</pre><p>Finally, you can rename the dataset with “rename data-set” command.</p><pre>$ zowe zos-ftp rename data-set &quot;TNZSYS.ZFTP.TEST.HELLO&quot; &quot;TNZSYS.ZFTP.TEST.HELLO.NEW&quot;<br>Successfully renamed data set from &#39;TNZSYS.ZFTP.TEST.HELLO&#39; to &#39;TNZSYS.ZFTP.TEST.HELLO.NEW&#39;</pre><p>And delete the dataset or the member of partition dataset with “delete data-set” command. Don’t forget to add “ — force” option to confirm that action.</p><pre>$ zowe zos-ftp delete data-set &quot;TNZSYS.ZFTP.TEST.HELLO.DCB&quot; --force<br>Successfully deleted data set file TNZSYS.ZFTP.TEST.HELLO.DCB</pre><p><strong>USS File/Directory</strong></p><p>z/OS FTP plug-in for Zowe CLI also allows to operate another set of data in z/OS, USS file and directory. You can do the same things from command line, like list USS files under one directory, view file contents, download, upload or delete them.</p><p>First, you can use “list uss-files” to list USS files in a directory:</p><pre>$ zowe zos-ftp list uss-files &quot;/u/tnzsys/test&quot;<br>mytest     8192 TNZSYS TESTER drwxr-xr-x<br>syscmd.txt 224  TNZSYS TESTER -rw-r-----<br>test.txt   21   TNZSYS TESTER -rw-r--r--<br>test2      21   TNZSYS TESTER -rwx------<br>testfile   224  TNZSYS TESTER -rw-r-----</pre><p>Have a quick view of the USS file contents with “view uss-file” command:</p><pre>$ zowe zos-ftp view uss-file &quot;/u/tnzsys/test/test.txt&quot;<br>this is a test file.</pre><p>Download the USS file with “download uss-file” command:</p><pre>$ zowe zos-ftp download uss-file &quot;/u/tnzsys/testfile.txt&quot;<br>Successfully downloaded USS file &#39;/u/tnzsys/testfile.txt&#39; to local file &#39;testfile.txt&#39;</pre><p>You can also upload the local file to the USS file by using “upload file-to-uss-file” command:</p><pre>$ zowe zos-ftp upload file-to-uss-file hello &quot;/u/tnzsys/test/hello.txt&quot;<br>Uploaded from local file &#39;hello&#39; to /u/tnzsys/test/hello.txt</pre><p>Like dataset, you can upload a USS file from stdin as well, using “upload stdin-to-uss-file” command:</p><p>You can also make a USS directory using “make uss-directory” command:</p><pre>$ zowe zos-ftp  make uss-directory &quot;/u/tnzsys/newdir&quot; <br>Make USS directory /u/tnzsys/newdir successfully!</pre><p>Finally, you can rename the USS file or directory with “rename uss-file”.</p><p>Finally, you rename the USS file or directory with “rename uss-file”.</p><pre>$ zowe zos-ftp rename uss-file &quot;/u/tnzsys/test/hello1.txt&quot; &quot;/u/tnzsys/test/hello2.txt&quot;<br>Successfully renamed USS file or directory from &#39;/u/tnzsys/test/hello1.txt&#39; to &#39;/u/tnzsys/test/hello2.txt&#39;</pre><p>And delete the USS file with “delete uss-file” command. The option “ — force” is required to confirm this action.</p><pre>$ zowe zos-ftp delete uss-file &quot;/u/tnzsys/test/hello2.txt&quot; --force<br>Successfully deleted USS file /u/tnzsys/test/hello2.txt</pre><p>If you want to delete whole directory the option “ — recursive” is required.</p><pre>$ zowe zftp delete uss &quot;/u/tnzsys/test&quot; --force --recursive<br>Deleted /u/tnzsys/test/hello.txt<br>Deleted /u/tnzsys/test/mytest<br>Deleted /u/tnzsys/test/syscmd.txt<br>Deleted /u/tnzsys/test/test.txt<br>Deleted /u/tnzsys/test/test2<br>Deleted /u/tnzsys/test/testfile<br>Deleted /u/tnzsys/test<br>Successfully deleted USS file /u/tnzsys/test</pre><p><strong>Jobs</strong></p><p>In z/OS system, job is a common way to perform tasks. You can use z/OS FTP Plug-in to submit job, list job, query job status, view job spool output and delete job easily.</p><p>First, you can submit job with the JCL stored on dataset by using “submit data-set” command:</p><pre>$ zowe zos-ftp submit data-set &quot;TNZSYS.ZFTP.TEST(HELLO)&quot;<br>jobid:   JOB16841<br>jobname: HELLO<br>owner:   TNZSYS<br>status:  OUTPUT</pre><p>The job can also be submit with the JCL from the local file by using “submit local-file” command:</p><pre>$ zowe zos-ftp submit local-file hello<br>jobid:   JOB16842<br>jobname: HELLO<br>owner:   TNZSYS<br>status:  OUTPUT</pre><p>Or the JCL from stdin by using “submit stdin” command:</p><pre>$ zowe zos-ftp submit stdin<br>//HELLO    JOB ,NOTIFY=&amp;SYSUID,CLASS=A,MSGCLASS=H,MSGLEVEL=1     <br>//STEP0001 EXEC PGM=IEBGENER                                     <br>//SYSIN    DD DUMMY                                              <br>//SYSPRINT DD SYSOUT=*                                            <br>//SYSUT1   DD *                                                  <br> Hello World                                                     <br>/*                                                               <br>//SYSUT2   DD SYSOUT=*<br>^D<br>jobid:   JOB16843<br>jobname: HELLO<br>owner:   TNZSYS<br>status:  OUTPUT</pre><p>You can use “list jobs” command to list the jobs with the specified prefix. By default, you can only list jobs which owned by yourself.</p><pre>$ zowe zos-ftp list jobs --prefix &quot;sys*&quot;<br>  SYSTES2 JOB16798 TNZSYS<br>  SYSTES1 JOB16797 TNZSYS<br>  SYSTEST JOB16796 TNZSYS</pre><p>If you want to list jobs owned by others the option “ — owner” is supported.</p><pre>$ zowe zftp list jobs --prefix &quot;sys*&quot; --owner &quot;*&quot;<br>  SYSTES2 JOB16798 TNZSYS <br>  SYSTES1 JOB16797 TNZSYS <br>  SYSTEST JOB16796 TNZSYS <br>  SYSLOG           STC16646</pre><p>After submitting job, you can query for the job status with the specified job ID, using “view job-status-by-jobid” command. The “rc: 0” means the job completes successfully. If the job is running the status will show “ACTIVE” in the second example.</p><pre>$ zowe zos-ftp view job-status-by-jobid JOB16843<br>jobname: HELLO<br>jobid:   JOB16843<br>owner:   TNZSYS<br>status:  OUTPUT<br>rc:      0</pre><pre>$ zowe zos-ftp view job-status-by-jobid STC16646<br>jobname: SYSLOG<br>jobid:   STC16646<br>owner:   +MASTER+<br>status:  ACTIVE</pre><p>If you need more job information, there are some commands related to JES spool to help you view details about the job.</p><p>You can list spool files with the specified job ID by using “list spool-files-by-jobid” command:</p><pre>$ zowe zos-ftp list spool-files-by-jobid JOB16843<br>1 JESMSGLG N/A JES2   <br>2 JESJCL   N/A JES2   <br>3 JESYSMSG N/A JES2   <br>4 SYSPRINT N/A STEP0001<br>5 SYSUT2   N/A STEP0001</pre><p>You can also view the specified spool file by using “view spool-file-by-id” command with jobid and spool file id. The spool file id is the first number in the above output.</p><pre>$ zowe zos-ftp view spool-file-by-id JOB16843 5<br> Hello World</pre><p>You can view all spool files by using “view all-spool-by-jobid” command:（Some of the output has been omitted in the following example）</p><pre>$ zowe zos-ftp view all-spool-by-jobid JOB16843</pre><pre>1                    J E S 2  J O B  L O G  --  S Y S T E M  P 2 1    --  N O D E  P K P A T 2 1        <br>0<br> 01.19.47 JOB16843 ---- SATURDAY,  04 APR 2020 ----<br> 01.19.47 JOB16843  IRR010I  USERID TNZSYS   IS ASSIGNED TO THIS JOB.<br> …… ……</pre><pre>1 //HELLO    JOB ,NOTIFY=&amp;SYSUID,CLASS=A,MSGCLASS=H,MSGLEVEL=1            JOB16843<br>          IEFC653I SUBSTITUTION JCL - ,NOTIFY=TNZSYS,CLASS=A,MSGCLASS=H,MSGLEVEL=1<br>        2 //STEP0001 EXEC PGM=IEBGENER</pre><pre>PROCESSING ENDED AT EOD</pre><pre>Hello World</pre><p>Or download them by using “download all-spool-by-jobid” command:</p><pre>$ zowe zos-ftp download all-spool-by-jobid JOB16843<br>Successfully downloaded 5 spool files to ./output/</pre><p>If you want to delete the job in the spool you can use “delete job” command:</p><pre>$ zowe zos-ftp delete job JOB16843<br>Successfully deleted job JOB16843</pre><p>The above examples are commonly used and you can find the cheetsheet at the end of this article. Or use “zowe zftp — help” command to get more help and instructions.</p><p>Before we finish it, let’s have a look at a complete example.</p><p><strong>Complete Example</strong></p><p>This script defines allocFun function which does the following things:</p><p>First, updates the JCL which is downloaded from z/OS and saved to the local file, ALLOCDS.JCL. <br>Then, submits ALLOCDS.JCL. and checks the job status every 3 seconds until the job finishes. <br>Lastly, get the job return code to confim it finishes successfully.</p><p>At the end of this script, invoke allocFun function two times to allocate dataset IBMUSER.ZFTP.DS1 and IBMUSER.ZFTP.DS2.</p><p><strong>Script:</strong></p><pre>#!/bin/bash<br>  <br># download JCL from z/OS system<br>zowe zos-ftp download data-set &quot;TNZSYS.ZFTP.TEST(ALLOCDS)&quot; -f ./ALLOCDS</pre><pre># allocFun function<br>allocFun()<br>{<br>  echo &quot;allocate dataset $1&quot;<br>  # update JCL<br>  sed &quot;s/DSN=.*,/DSN=$1,/&quot; ALLOCDS&gt;ALLOCDS.JCL</pre><pre># submit job<br>  jobid=$(zowe zos-ftp submit local-file ALLOCDS.JCL --rff jobid --rft string)<br>  echo &quot;Submitted job ALLOCDS, JOB ID is $jobid&quot;</pre><pre># check job status every three seconds<br>  status=&quot;UNKNOWN&quot;<br>  while [[ &quot;$status&quot; != &quot;OUTPUT&quot; ]]; do<br>    echo &quot;Checking status of job $jobid&quot;<br>    status=$(zowe zos-ftp view job-status-by-jobid &quot;$jobid&quot; --rff status --rft string)<br>    echo &quot;Current job status is $status&quot;<br>    sleep 3s<br>  done;</pre><pre># check return code<br>  rc=$(zowe zos-ftp view job-status-by-jobid &quot;$jobid&quot; --rff rc --rft string)<br>  echo &quot;$jobid is return $rc&quot;<br>}</pre><pre># invoke allocFun to allocate dataset<br>allocFun IBMUSER.ZFTP.DS1<br>allocFun IBMUSER.ZFTP.DS2</pre><pre>echo &quot;all datasets are allocated successfully!&quot;</pre><p>The option “ — rff” is stand for “ — response-format-filter”. Filter (include) fields in the response. In the example, the filter field is jobid. Accepts an array of field/property names to include in the output response. You can filter JSON objects properties OR table columns/fields.</p><p>The option “ — rft” is stand for “ — response-format-type”. Specified the command response output format type. The allowed value are table,list,object and string.</p><p>You can use these two options to reduce the output of a command to a single field/property or a list of a single field/property.</p><p><strong>JCL:</strong></p><pre>//ALLOCDS JOB  MSGLEVEL=(1,1),NOTIFY=&amp;SYSUID,MSGCLASS=A                 <br>//CRT01 EXEC PGM=IEFBR14                                                       <br>//STEP10   EXEC PGM=IEFBR14                                             <br>//SYSPRINT DD SYSOUT=*                                                  <br>//SYSOUT   DD SYSOUT=*                                                  <br>//SYSDUMP  DD SYSOUT=*                                                  <br>//DD1      DD DSN=IBMUSER.ZFTP.DS0,                                      <br>//            DISP=(NEW,CATLG,DELETE),                                  <br>//            SPACE=(TRK,(1,1),RLSE),                                   <br>//            UNIT=SYSDA,                                               <br>//            DCB=(DSORG=PS,RECFM=FB,LRECL=23,BLKSIZE=230)</pre><p>The above script and JCL are for reference only. Please change the name according to your system condition.</p><p>Hope you can go through above introduction and enjoy using it to help you on your daily work. If you encounter any problems in use it, please contact us or present your ideas and requirements. Thank you very much!</p><p><strong>Contact: </strong><a href="/service/mailto:tiantn@cn.ibm.com">tiantn@cn.ibm.com</a>, <a href="/service/mailto:liangqi@cn.ibm.com">liangqi@cn.ibm.com</a></p><p>At the end of the article list some common used commands and useful links that you can reference. Enjoy it!</p><p><strong>Commands</strong></p><p>profile related commands:</p><pre>zowe profiles create zftp-profile myprofile -u ibmuser -p ibmp4ss -H sys123<br>zowe profiles delete zftp-profile profilename<br>zowe profiles list zftp-profiles --sc<br>zowe profiles delete zftp-profile profilename<br>zowe profiles update zftp-profile profilename</pre><p>delete commands:</p><pre>zowe zos-ftp delete data-set &quot;ibmuser.cntl&quot; --force<br>zowe zos-ftp delete job j123<br>zowe zos-ftp delete uss-file &quot;/u/ibmuser/myfile.txt&quot; --force</pre><p>download commands:</p><pre>zowe zos-ftp download all-spool-by-jobid j123<br>zowe zos-ftp download data-set &quot;ibmuser.loadlib(main)&quot;<br>zowe zos-ftp download uss-file &quot;/u/users/ibmuser/main.obj&quot;</pre><p>list commands:</p><pre>zowe zos-ftp list data-set &quot;ibmuser.**.cntl&quot;<br>zowe zos-ftp list jobs --prefix &quot;ibmu*&quot;<br>zowe zos-ftp list spool-files-by-jobid job00123<br>zowe zos-ftp list uss-files &quot;/u/users/ibmuser&quot;</pre><p>rename commands：</p><pre>zowe zos-ftp rename data-set ibmuser.jcl ibmuser.cntl<br>zowe zos-ftp rename uss-file &quot;/u/users/ibmuser/hello.txt&quot; &quot;/u/users/ibmuser/hello2.txt&quot;</pre><p>submit commands：</p><pre>zowe zos-ftp submit data-set &quot;ibmuser.cntl(iefbr14)&quot;<br>zowe zos-ftp submit local-file &quot;my_build_jcl.txt&quot;<br>zowe zos-ftp submit stdin</pre><p>upload commands：</p><pre>zowe zos-ftp upload file-to-data-set iefbr14.txt &quot;ibmuser.cntl(iefbr14)&quot;<br>zowe zos-ftp upload file-to-uss-file iefbr14.txt &quot;/u/users/ibmuser/iefbr14.txt&quot;<br>owe zos-ftp upload stdin-to-data-set &quot;ibmuser.cntl(iefbr14)&quot;<br>zowe zos-ftp upload stdin-to-uss-file &quot;/u/users/ibmuser/iefbr14.txt&quot;</pre><p>view commands：</p><pre>zowe zos-ftp view all-spool-by-jobid j123<br>zowe zos-ftp view data-set &quot;ibmuser.cntl(iefbr14)&quot;<br>zowe zos-ftp view job-status-by-jobid j123<br>zowe zos-ftp view spool-file-by-id JOB00123 4<br>zowe zos-ftp view uss-file &quot;/u/users/ibmuser/myfile.txt&quot;</pre><p><strong>Reference link:</strong></p><p><a href="https://docs.zowe.org/stable/Zowe_Documentation.pdf">https://docs.zowe.org/stable/Zowe_Documentation.pdf</a></p><ul><li><a href="https://github.com/zowe/zowe-cli-ftp-plugin">zowe/zowe-cli-ftp-plugin</a></li><li><a href="https://github.com/IBM/zos-node-accessor">IBM/zos-node-accessor</a></li></ul><h3>Finding out more</h3><p>If you enjoyed this blog checkout more <a href="https://medium.com/zowe">Zowe blogs here</a>. Or, ask a question and join the conversation on the <a href="https://openmainframeproeject.slack.org/">Open Mainframe Project Slack Channel</a> #Zowe-dev, #Zowe-user or #Zowe-onboarding. If this is your first time using the OMP slack channel register <a href="https://slack.openmainframeproject.org/">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=af5630627768" width="1" height="1" alt=""><hr><p><a href="https://medium.com/zowe/z-os-ftp-plug-in-for-zowe-cli-af5630627768">z/OS FTP Plug-in for Zowe CLI</a> was originally published in <a href="https://medium.com/zowe">Zowe</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[z/OS FTP Plug-in for Zowe CLI]]></title>
            <link>https://medium.com/zowe/z-os-ftp-plug-in-for-zowe-cli-7a5ff19b6791?source=rss-45f853a0f087------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a5ff19b6791</guid>
            <category><![CDATA[zowe-cli]]></category>
            <category><![CDATA[command-line-interface]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[z]]></category>
            <category><![CDATA[ftp]]></category>
            <dc:creator><![CDATA[Na Tian]]></dc:creator>
            <pubDate>Fri, 10 Apr 2020 09:04:37 GMT</pubDate>
            <atom:updated>2021-05-18T07:52:00.765Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Zowe and Zowe CLI</strong></p><p>{Core} The <a href="https://www.openmainframeproject.org/">Open Mainframe Project</a>’s <a href="https://www.openmainframeproject.org/projects/zowe">Zowe</a> is an open source project for the IBM Z platform. It provides new user interfaces for users to interact with z/OS. It also provides a set of APIs on which users can easily build their applications on z/OS. Zowe’s modern interface allows you to use z/OS to develop and extend your applications in a way similar to what you experience on a cloud platform today. It not only lowered the learning curve of IBM mainframe and made IBM z/OS easy to work with, but also is the product of IBM mainframe embracing open source and entering the cloud era.</p><p>Zowe CLI is an important part of Zowe. It is a command-line interface that you can use on any platform (Windows, MacOS, Linux). It is easy to integrate with common development build tools such as integrated development environments (IDEs), shell commands, bash scripts, build tools, and so on. It can easily interact with the host, obtain z/OS resources, execute and control z/OS jobs, issue system commands and TSO commands. But a significant number of Zowe CLI commands, especially those related to data set and job management, require that z/OSMF be installed and configured before use. This can be potentially limiting on systems where z/OSMF has not been installed and configured for use with Zowe. So, without z/OSMF, wouldn’t we be able to experience the fun of Zowe CLI? Of course, because z/OS FTP plug-in for Zowe CLI can partially alternate z/OSMF, such as some operations for dataset, uss file and jobs. But still have some abilities zftp can’t support, such as workflow, provisioning.</p><p><strong>z/OS FTP Plug-in for Zowe CLI</strong></p><p>z/OS FTP plug-in for Zowe CLI (zftp) uses the zos-node-accessor package and z/OS FTP service to interact with z/OS. So there is no need for z/OSMF as the back-end support. It is as consistent as possible with the Zowe CLI core in terms of the command syntax and response so that you don’t have to learn any additional syntax knowledge when using it. The following will show you how to install and use it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/395/0*CX9AKw8i6s4KO-_6.png" /></figure><p><strong>Prerequisites</strong></p><p>1. Enable FTP or FTPS(FTP over SSL) services on z/OS. The secure FTPS is recommended and ensure the value of FTP setting, JESINTERFACELEVEL is 2. You can enable the FTP service by referring to the link: <a href="https://www.ibm.com/docs/en/zos/2.4.0?topic=applications-transferring-files-using-ftp">https://www.ibm.com/docs/en/zos/2.4.0?topic=applications-transferring-files-using-ftp</a>.<br>2. Install Node.JS v8 or above version(v10/v12) on your workstation.</p><p>Tips: you can run command status to check JESINTERFACELevel from ftp localhost on USS environment.</p><p>The following is the sample output for command status</p><pre>Command:<br>status<br>&gt;&gt;&gt; STAT<br>............<br>211-JESLRECL is 80<br>211-JESRECFM is Fixed<br><strong>211-JESINTERFACELEVEL is 2</strong><br>211-Server site variable JESTRAILINGBLANKS is set to TRUE<br>............<br>211-Server site variable LISTLEVEL is set to 0<br>211 *** end of status *** <br>Command:</pre><p><strong>Installation</strong></p><p>1. Install Zowe CLI</p><p>Run the following commands to install Zowe CLI .</p><pre>npm install -g @zowe/cli@zowe-v1-lts</pre><p>2. Install Zowe Secure Credential Store(optional)</p><p>The Secure Credential Store is an optional plugin and used to store passwords more securely than plain text profiles. To learn more about it please refer to <a href="https://docs.zowe.org/stable/user-guide/cli-scsplugin.html#secure-credential-store-plug-in-for-zowe-cli">https://docs.zowe.org/stable/user-guide/cli-scsplugin.html#secure-credential-store-plug-in-for-zowe-cli</a></p><pre>zowe plugins install @zowe/secure-credential-store-for-zowe-cli@zowe-v1-lts</pre><p>3. Install z/OS FTP Plug-in for Zowe CLI</p><pre>zowe plugins install @zowe/zos-ftp-for-zowe-cli@zowe-v1-lts</pre><p>When you finished the installation, the following message will show up: ‘This plugin was successfully validated. Enjoy the plugin.’</p><p>4. Create User Profile</p><p>Using the following command to create a user profile：</p><pre>zowe profiles create zftp profilename -u username -p password -H hostname --secure-ftp true/false</pre><p>Change profilename, username, password and hostname to fit your system. If FTPS (FTP over SSL) enabled, set — secure-ftp to be true. Otherwise, set it false. Example:</p><pre>zowe profiles create zftp p21 -u ibmuser -p xxxxxxxx -H 9.12.34.56 --secure-ftp false</pre><p>5. Verify</p><p>You can run a simple zowe zftp command to verify this plugin. Example:</p><pre>zowe zftp list ds “SYS1.**”</pre><p>Now you can follow me to go through the simple but useful commands to learn more about zowe zftp plugin.</p><p><strong>Datasets</strong></p><p>The most data on z/OS are stored in dataset, like the sequential dataset and partition dataset. z/OS FTP plug-in for Zowe CLI allows you to list datasets, view their contents, download, upload or delete them from command line easily.</p><p>First, you can list dataset with“list data-set” command:</p><pre>$ zowe zos-ftp list data-set &quot;SYS1.**.*EXEC&quot;<br>SYS1.SAXREXEC<br>SYS1.SBPXEXEC</pre><p>Then, you can view the dataset contents with “view data-set” command, as you do from ISPF. Reminder: Only text data is supported to view.</p><pre>$ zowe zos-ftp view data-set &quot;TNZSYS.ZFTP.TEST(HELLO)&quot;<br>//HELLO    JOB ,NOTIFY=&amp;SYSUID,CLASS=A,MSGCLASS=H,MSGLEVEL=1     <br>//STEP0001 EXEC PGM=IEBGENER                                     <br>//SYSIN    DD DUMMY                                           <br>//SYSPRINT DD SYSOUT=*                                                                       <br>//SYSUT1   DD *                                                                                      <br>  Hello World                                                                                             <br>/*                                                                                                         <br>//SYSUT2   DD SYSOUT=*</pre><p>You can also download the text dataset to the local machine with “download data-set” command:</p><pre>$ zowe zos-ftp download data-set &quot;TNZSYS.ZFTP.TEST(HELLO)&quot;<br>Data set downloaded successfully.<br>Destination: tnzsys/zftp/test/hello</pre><p>Or download the dataset in binary mode by adding “ — binary”:</p><pre>$ zowe zos-ftp download data-set &quot;TNZSYS.ZFTP.TEST(HELLO)&quot; --binary<br>Data set downloaded successfully.<br>Destination: tnzsys/zftp/test/hello</pre><p>You can also allocate sequential or partitioned dataset with “allocate data-set” command:</p><pre>$ zowe zos-ftp allocate data-set &quot;TNZSYS.ZFTP.DS1&quot; --dcb &quot;RECFM=FB DSORG=PO PRIMARY=10 SECONDARY=20 DIRECTORY=10&quot;<br>Allocated dataset TNZSYS.ZFTP.DS1 successfully!</pre><p>The “--dcb” option specify DCB parameters for dataset allocation. It’s space separated like “RECFM=FB LRECL=326 BLKSIZE=23472”.</p><p>There are two ways to upload the local changes to the dataset on z/OS.</p><p>There are two ways to upload the local changes to the dataset on z/OS.</p><p>1) You do some changes in the local file and then upload it to z/OS with “upload file-to-data-set” command:</p><pre>$ zowe zos-ftp upload file-to-data-set hello &quot;TNZSYS.ZFTP.TEST.HELLO&quot;<br>Uploaded from local file &#39;hello&#39; to TNZSYS.ZFTP.TEST.HELLO</pre><p>The target dataset will be allocated, if it does not exist, or overwritten if existent. In the former case, the target dataset is allocated with the default allocation configuration. You can specify the allocation configuration with the dataset control block option, — dcb. Please note the configuration parameters are separated by space character, requiring double quotes enclosing them usually. For example:</p><pre>$ zowe zos-ftp upload file-to-data-set hello &quot;TNZSYS.ZFTP.TEST.HELLO.DCB&quot; --dcb &quot;RECFM=VB LRECL=326 BLKSIZE=23472&quot;<br>Uploaded from local file &#39;hello&#39; to TNZSYS.ZFTP.TEST.HELLO.DCB</pre><p>Also if you want to upload a file to dataset in binary mode just add “ — binary” option.</p><p>2) z/OS FTP Plug-in also supports to upload dataset from stdin with “upload stdin-to-data-set” command. You just need write your contents in a new line and when you finished the contents using “Control + D” to end the command. The message like “Uploaded from stdin to TNZSYS.ZFTP.TEST(HELLO1)” indicates the success.</p><pre>$ zowe zos-ftp upload stdin-to-data-set &quot;TNZSYS.ZFTP.TEST(HELLO1)&quot;<br>//HELLO    JOB ,NOTIFY=&amp;SYSUID,CLASS=A,MSGCLASS=H,MSGLEVEL=1<br>//STEP0001 EXEC PGM=IEBGENER                                <br>//SYSIN    DD DUMMY                                         <br>//SYSPRINT DD SYSOUT=*                                      <br>//SYSUT1   DD *                                             <br> Hello World                                                <br>/*                                                          <br>//SYSUT2   DD SYSOUT=*                                      <br>^D<br>Uploaded from stdin to TNZSYS.ZFTP.TEST(HELLO1)</pre><p>Finally, you can rename the dataset with “rename data-set” command.</p><pre>$ zowe zos-ftp rename data-set &quot;TNZSYS.ZFTP.TEST.HELLO&quot; &quot;TNZSYS.ZFTP.TEST.HELLO.NEW&quot;<br>Successfully renamed data set from &#39;TNZSYS.ZFTP.TEST.HELLO&#39; to &#39;TNZSYS.ZFTP.TEST.HELLO.NEW&#39;</pre><p>And delete the dataset or the member of partition dataset with “delete data-set” command. Don’t forget to add “ — force” option to confirm that action.</p><pre>$ zowe zos-ftp delete data-set &quot;TNZSYS.ZFTP.TEST.HELLO.DCB&quot; --force<br>Successfully deleted data set file TNZSYS.ZFTP.TEST.HELLO.DCB</pre><p><strong>USS File/Directory</strong></p><p>z/OS FTP plug-in for Zowe CLI also allows to operate another set of data in z/OS, USS file and directory. You can do the same things from command line, like list USS files under one directory, view file contents, download, upload or delete them.</p><p>First, you can use “list uss-files” to list USS files in a directory:</p><pre>$ zowe zos-ftp list uss-files &quot;/u/tnzsys/test&quot;<br>mytest     8192 TNZSYS TESTER drwxr-xr-x<br>syscmd.txt 224  TNZSYS TESTER -rw-r-----<br>test.txt   21   TNZSYS TESTER -rw-r--r--<br>test2      21   TNZSYS TESTER -rwx------<br>testfile   224  TNZSYS TESTER -rw-r-----</pre><p>Have a quick view of the USS file contents with “view uss-file” command:</p><pre>$ zowe zos-ftp view uss-file &quot;/u/tnzsys/test/test.txt&quot;<br>this is a test file.</pre><p>Download the USS file with “download uss-file” command:</p><pre>$ zowe zos-ftp download uss-file &quot;/u/tnzsys/testfile.txt&quot;<br>Successfully downloaded USS file &#39;/u/tnzsys/testfile.txt&#39; to local file &#39;testfile.txt&#39;</pre><p>You can also upload the local file to the USS file by using “upload file-to-uss-file” command:</p><pre>$ zowe zos-ftp upload file-to-uss-file hello &quot;/u/tnzsys/test/hello.txt&quot;<br>Uploaded from local file &#39;hello&#39; to /u/tnzsys/test/hello.txt</pre><p>Like dataset, you can upload a USS file from stdin as well, using “upload stdin-to-uss-file” command:</p><p>You can also make a USS directory using “make uss-directory” command:</p><pre>$ zowe zos-ftp  make uss-directory &quot;/u/tnzsys/newdir&quot; <br>Make USS directory /u/tnzsys/newdir successfully!</pre><p>Finally, you can rename the USS file or directory with “rename uss-file”.</p><p>Finally, you rename the USS file or directory with “rename uss-file”.</p><pre>$ zowe zos-ftp rename uss-file &quot;/u/tnzsys/test/hello1.txt&quot; &quot;/u/tnzsys/test/hello2.txt&quot;<br>Successfully renamed USS file or directory from &#39;/u/tnzsys/test/hello1.txt&#39; to &#39;/u/tnzsys/test/hello2.txt&#39;</pre><p>And delete the USS file with “delete uss-file” command. The option “ — force” is required to confirm this action.</p><pre>$ zowe zos-ftp delete uss-file &quot;/u/tnzsys/test/hello2.txt&quot; --force<br>Successfully deleted USS file /u/tnzsys/test/hello2.txt</pre><p>If you want to delete whole directory the option “ — recursive” is required.</p><pre>$ zowe zftp delete uss &quot;/u/tnzsys/test&quot; --force --recursive<br>Deleted /u/tnzsys/test/hello.txt<br>Deleted /u/tnzsys/test/mytest<br>Deleted /u/tnzsys/test/syscmd.txt<br>Deleted /u/tnzsys/test/test.txt<br>Deleted /u/tnzsys/test/test2<br>Deleted /u/tnzsys/test/testfile<br>Deleted /u/tnzsys/test<br>Successfully deleted USS file /u/tnzsys/test</pre><p><strong>Jobs</strong></p><p>In z/OS system, job is a common way to perform tasks. You can use z/OS FTP Plug-in to submit job, list job, query job status, view job spool output and delete job easily.</p><p>First, you can submit job with the JCL stored on dataset by using “submit data-set” command:</p><pre>$ zowe zos-ftp submit data-set &quot;TNZSYS.ZFTP.TEST(HELLO)&quot;<br>jobid:   JOB16841<br>jobname: HELLO<br>owner:   TNZSYS<br>status:  OUTPUT</pre><p>The job can also be submit with the JCL from the local file by using “submit local-file” command:</p><pre>$ zowe zos-ftp submit local-file hello<br>jobid:   JOB16842<br>jobname: HELLO<br>owner:   TNZSYS<br>status:  OUTPUT</pre><p>Or the JCL from stdin by using “submit stdin” command:</p><pre>$ zowe zos-ftp submit stdin<br>//HELLO    JOB ,NOTIFY=&amp;SYSUID,CLASS=A,MSGCLASS=H,MSGLEVEL=1     <br>//STEP0001 EXEC PGM=IEBGENER                                     <br>//SYSIN    DD DUMMY                                              <br>//SYSPRINT DD SYSOUT=*                                            <br>//SYSUT1   DD *                                                  <br> Hello World                                                     <br>/*                                                               <br>//SYSUT2   DD SYSOUT=*<br>^D<br>jobid:   JOB16843<br>jobname: HELLO<br>owner:   TNZSYS<br>status:  OUTPUT</pre><p>You can use “list jobs” command to list the jobs with the specified prefix. By default, you can only list jobs which owned by yourself.</p><pre>$ zowe zos-ftp list jobs --prefix &quot;sys*&quot;<br>  SYSTES2 JOB16798 TNZSYS<br>  SYSTES1 JOB16797 TNZSYS<br>  SYSTEST JOB16796 TNZSYS</pre><p>If you want to list jobs owned by others the option “ — owner” is supported.</p><pre>$ zowe zftp list jobs --prefix &quot;sys*&quot; --owner &quot;*&quot;<br>  SYSTES2 JOB16798 TNZSYS <br>  SYSTES1 JOB16797 TNZSYS <br>  SYSTEST JOB16796 TNZSYS <br>  SYSLOG           STC16646</pre><p>After submitting job, you can query for the job status with the specified job ID, using “view job-status-by-jobid” command. The “rc: 0” means the job completes successfully. If the job is running the status will show “ACTIVE” in the second example.</p><pre>$ zowe zos-ftp view job-status-by-jobid JOB16843<br>jobname: HELLO<br>jobid:   JOB16843<br>owner:   TNZSYS<br>status:  OUTPUT<br>rc:      0</pre><pre>$ zowe zos-ftp view job-status-by-jobid STC16646<br>jobname: SYSLOG<br>jobid:   STC16646<br>owner:   +MASTER+<br>status:  ACTIVE</pre><p>If you need more job information, there are some commands related to JES spool to help you view details about the job.</p><p>You can list spool files with the specified job ID by using “list spool-files-by-jobid” command:</p><pre>$ zowe zos-ftp list spool-files-by-jobid JOB16843<br>1 JESMSGLG N/A JES2   <br>2 JESJCL   N/A JES2   <br>3 JESYSMSG N/A JES2   <br>4 SYSPRINT N/A STEP0001<br>5 SYSUT2   N/A STEP0001</pre><p>You can also view the specified spool file by using “view spool-file-by-id” command with jobid and spool file id. The spool file id is the first number in the above output.</p><pre>$ zowe zos-ftp view spool-file-by-id JOB16843 5<br> Hello World</pre><p>You can view all spool files by using “view all-spool-by-jobid” command:（Some of the output has been omitted in the following example）</p><pre>$ zowe zos-ftp view all-spool-by-jobid JOB16843</pre><pre>1                    J E S 2  J O B  L O G  --  S Y S T E M  P 2 1    --  N O D E  P K P A T 2 1        <br>0<br> 01.19.47 JOB16843 ---- SATURDAY,  04 APR 2020 ----<br> 01.19.47 JOB16843  IRR010I  USERID TNZSYS   IS ASSIGNED TO THIS JOB.<br> …… ……</pre><pre>        1 //HELLO    JOB ,NOTIFY=&amp;SYSUID,CLASS=A,MSGCLASS=H,MSGLEVEL=1            JOB16843<br>          IEFC653I SUBSTITUTION JCL - ,NOTIFY=TNZSYS,CLASS=A,MSGCLASS=H,MSGLEVEL=1<br>        2 //STEP0001 EXEC PGM=IEBGENER                                                                                                                                                                                                                           </pre><pre> PROCESSING ENDED AT EOD                                                                                                </pre><pre> Hello World</pre><p>Or download them by using “download all-spool-by-jobid” command:</p><pre>$ zowe zos-ftp download all-spool-by-jobid JOB16843<br>Successfully downloaded 5 spool files to ./output/</pre><p>If you want to delete the job in the spool you can use “delete job” command:</p><pre>$ zowe zos-ftp delete job JOB16843<br>Successfully deleted job JOB16843</pre><p>The above examples are commonly used and you can find the cheetsheet at the end of this article. Or use “zowe zftp — help” command to get more help and instructions.</p><p>Before we finish it, let’s have a look at a complete example.</p><p><strong>Complete Example</strong></p><p>This script defines allocFun function which does the following things:</p><p>First, updates the JCL which is downloaded from z/OS and saved to the local file, ALLOCDS.JCL. <br>Then, submits ALLOCDS.JCL. and checks the job status every 3 seconds until the job finishes. <br>Lastly, get the job return code to confim it finishes successfully.</p><p>At the end of this script, invoke allocFun function two times to allocate dataset IBMUSER.ZFTP.DS1 and IBMUSER.ZFTP.DS2.</p><p><strong>Script:</strong></p><pre>#!/bin/bash<br>  <br># download JCL from z/OS system<br>zowe zos-ftp download data-set &quot;TNZSYS.ZFTP.TEST(ALLOCDS)&quot; -f ./ALLOCDS</pre><pre># allocFun function<br>allocFun()<br>{<br>  echo &quot;allocate dataset $1&quot;<br>  # update JCL<br>  sed &quot;s/DSN=.*,/DSN=$1,/&quot; ALLOCDS&gt;ALLOCDS.JCL</pre><pre>  # submit job<br>  jobid=$(zowe zos-ftp submit local-file ALLOCDS.JCL --rff jobid --rft string)<br>  echo &quot;Submitted job ALLOCDS, JOB ID is $jobid&quot;</pre><pre>  # check job status every three seconds<br>  status=&quot;UNKNOWN&quot;<br>  while [[ &quot;$status&quot; != &quot;OUTPUT&quot; ]]; do<br>    echo &quot;Checking status of job $jobid&quot;<br>    status=$(zowe zos-ftp view job-status-by-jobid &quot;$jobid&quot; --rff status --rft string)<br>    echo &quot;Current job status is $status&quot;<br>    sleep 3s<br>  done;</pre><pre>  # check return code<br>  rc=$(zowe zos-ftp view job-status-by-jobid &quot;$jobid&quot; --rff rc --rft string)<br>  echo &quot;$jobid is return $rc&quot;<br>}</pre><pre># invoke allocFun to allocate dataset<br>allocFun IBMUSER.ZFTP.DS1<br>allocFun IBMUSER.ZFTP.DS2</pre><pre>echo &quot;all datasets are allocated successfully!&quot;</pre><p>The option “ — rff” is stand for “ — response-format-filter”. Filter (include) fields in the response. In the example, the filter field is jobid. Accepts an array of field/property names to include in the output response. You can filter JSON objects properties OR table columns/fields.</p><p>The option “ — rft” is stand for “ — response-format-type”. Specified the command response output format type. The allowed value are table,list,object and string.</p><p>You can use these two options to reduce the output of a command to a single field/property or a list of a single field/property.</p><p><strong>JCL:</strong></p><pre>//ALLOCDS JOB  MSGLEVEL=(1,1),NOTIFY=&amp;SYSUID,MSGCLASS=A                 <br>//CRT01 EXEC PGM=IEFBR14                                                       <br>//STEP10   EXEC PGM=IEFBR14                                             <br>//SYSPRINT DD SYSOUT=*                                                  <br>//SYSOUT   DD SYSOUT=*                                                  <br>//SYSDUMP  DD SYSOUT=*                                                  <br>//DD1      DD DSN=IBMUSER.ZFTP.DS0,                                      <br>//            DISP=(NEW,CATLG,DELETE),                                  <br>//            SPACE=(TRK,(1,1),RLSE),                                   <br>//            UNIT=SYSDA,                                               <br>//            DCB=(DSORG=PS,RECFM=FB,LRECL=23,BLKSIZE=230)</pre><p>The above script and JCL are for reference only. Please change the name according to your system condition.</p><p>Hope you can go through above introduction and enjoy using it to help you on your daily work. If you encounter any problems in use it, please contact us or present your ideas and requirements. Thank you very much!</p><p><strong>Contact: </strong><a href="/service/mailto:tiantn@cn.ibm.com">tiantn@cn.ibm.com</a>, <a href="/service/mailto:liangqi@cn.ibm.com">liangqi@cn.ibm.com</a></p><p>At the end of the article list some common used commands and useful links that you can reference. Enjoy it!</p><p><strong>Commands</strong></p><p>profile related commands:</p><pre>zowe profiles create zftp-profile myprofile -u ibmuser -p ibmp4ss -H sys123<br>zowe profiles delete zftp-profile profilename<br>zowe profiles list zftp-profiles --sc<br>zowe profiles delete zftp-profile profilename<br>zowe profiles update zftp-profile profilename</pre><p>delete commands:</p><pre>zowe zos-ftp delete data-set &quot;ibmuser.cntl&quot; --force<br>zowe zos-ftp delete job j123<br>zowe zos-ftp delete uss-file &quot;/u/ibmuser/myfile.txt&quot; --force</pre><p>download commands:</p><pre>zowe zos-ftp download all-spool-by-jobid j123<br>zowe zos-ftp download data-set &quot;ibmuser.loadlib(main)&quot;<br>zowe zos-ftp download uss-file &quot;/u/users/ibmuser/main.obj&quot;</pre><p>list commands:</p><pre>zowe zos-ftp list data-set &quot;ibmuser.**.cntl&quot;<br>zowe zos-ftp list jobs --prefix &quot;ibmu*&quot;<br>zowe zos-ftp list spool-files-by-jobid job00123<br>zowe zos-ftp list uss-files &quot;/u/users/ibmuser&quot;</pre><p>rename commands：</p><pre>zowe zos-ftp rename data-set ibmuser.jcl ibmuser.cntl<br>zowe zos-ftp rename uss-file &quot;/u/users/ibmuser/hello.txt&quot; &quot;/u/users/ibmuser/hello2.txt&quot;</pre><p>submit commands：</p><pre>zowe zos-ftp submit data-set &quot;ibmuser.cntl(iefbr14)&quot;<br>zowe zos-ftp submit local-file &quot;my_build_jcl.txt&quot;<br>zowe zos-ftp submit stdin</pre><p>upload commands：</p><pre>zowe zos-ftp upload file-to-data-set iefbr14.txt &quot;ibmuser.cntl(iefbr14)&quot;<br>zowe zos-ftp upload file-to-uss-file iefbr14.txt &quot;/u/users/ibmuser/iefbr14.txt&quot;<br>owe zos-ftp upload stdin-to-data-set &quot;ibmuser.cntl(iefbr14)&quot;<br>zowe zos-ftp upload stdin-to-uss-file &quot;/u/users/ibmuser/iefbr14.txt&quot;</pre><p>view commands：</p><pre>zowe zos-ftp view all-spool-by-jobid j123<br>zowe zos-ftp view data-set &quot;ibmuser.cntl(iefbr14)&quot;<br>zowe zos-ftp view job-status-by-jobid j123<br>zowe zos-ftp view spool-file-by-id JOB00123 4<br>zowe zos-ftp view uss-file &quot;/u/users/ibmuser/myfile.txt&quot;</pre><p><strong>Reference link:</strong></p><p><a href="https://docs.zowe.org/stable/Zowe_Documentation.pdf">https://docs.zowe.org/stable/Zowe_Documentation.pdf</a></p><ul><li><a href="https://github.com/zowe/zowe-cli-ftp-plugin">zowe/zowe-cli-ftp-plugin</a></li><li><a href="https://github.com/IBM/zos-node-accessor">IBM/zos-node-accessor</a></li></ul><h3>Finding out more</h3><p>If you enjoyed this blog checkout more <a href="https://medium.com/zowe">Zowe blogs here</a>. Or, ask a question and join the conversation on the <a href="https://openmainframeproeject.slack.org/">Open Mainframe Project Slack Channel</a> #Zowe-dev, #Zowe-user or #Zowe-onboarding. If this is your first time using the OMP slack channel register <a href="https://slack.openmainframeproject.org/">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a5ff19b6791" width="1" height="1" alt=""><hr><p><a href="https://medium.com/zowe/z-os-ftp-plug-in-for-zowe-cli-7a5ff19b6791">z/OS FTP Plug-in for Zowe CLI</a> was originally published in <a href="https://medium.com/zowe">Zowe</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>