{"id":424,"date":"2010-12-03T08:49:49","date_gmt":"2010-12-03T13:49:49","guid":{"rendered":"http:\/\/erics-test-lab.com\/?p=424"},"modified":"2010-12-03T08:49:49","modified_gmt":"2010-12-03T13:49:49","slug":"ftps-mainframe-to-windows-server","status":"publish","type":"post","link":"https:\/\/www.esearing.com\/v2010\/2010\/12\/ftps-mainframe-to-windows-server\/","title":{"rendered":"FTPS mainframe to Windows server"},"content":{"rendered":"<p>This months challenge has been to extract daily files from the mainframe down to an ftp server where we can utilize the data in  SQL Server. The file names changes daily, incrementing by 1 for each generation. The files are also available at different times of the day. <\/p>\n<p>So we broke this task into lots of smaller tasks to get the job done. Below are the steps we took:<br \/>\n1. obtain username and password to login to mainframe<br \/>\n2. get permissions to the datasets for our login name<br \/>\n3. obtain a task server with FTPS connectivity to the mainframe (IT supported)<br \/>\n4. Download\/Install and  FTPS.exe from ipswitch (aka move-it-freely) to our ftps task server<br \/>\n5. Learn and test manual processes for FTPS command line  processing of the files.<br \/>\n6. Write scripts and batch files to replace manual command line entry<br \/>\n7. add scripts to a task scheduler<br \/>\n8. test, test, test<br \/>\n9. write SQL process for extracting data downloaded from mainframe to SQL Server<br \/>\n10. write log files for tracking of files downloaded and processed so we don&#8217;t miss any or process any twice.<\/p>\n<p>Here is a sample of the scripts:<br \/>\n<strong>main.bat<\/strong><br \/>\n:file1<br \/>\nftps -e:on -z -t:600 -s:firstfile.txt <em>mainframeIPaddress<\/em> &GT; logfile.txt<br \/>\nif %errorlevel% == 0 goto file2<br \/>\necho an error occurred %errorlevel%<br \/>\n:file2<br \/>\nftps -e:on -z -t:600 -s:secondfile.txt <em>mainframeIPaddress<\/em> &GT;&GT; logfile.txt<br \/>\nif %errorlevel% == 0 goto done<br \/>\necho an error occurred %errorlevel%<br \/>\n:done<\/p>\n<p><strong>Notes:<\/strong><br \/>\n-e, -z, -t are settings that are used by the mainframe connection. See documentation for FTPS.exe for descriptions<br \/>\n-s:filename points to a script that has the commands that one would enter if they were using command line<br \/>\n>> logfile.txt   writes the connection information to a logfile and displays the errors if any.<br \/>\n%errorlevel% is the error codes generated when a script can not run.<br \/>\ngoto done &#8211; Logic to skip over error messaging<\/p>\n<p><strong>firstfile.txt<\/strong><br \/>\n<em>&nbsp;username<br \/>\n &nbsp;password<\/em><br \/>\n&nbsp;prompt<br \/>\n&nbsp;passive<br \/>\n &nbsp;cd <em>directory<\/em><br \/>\n &nbsp;lcd<em> localdirectory<\/em><br \/>\n &nbsp;mget <em>dataset.filename(0)<\/em><br \/>\n &nbsp;quit<\/p>\n<p><strong>Notes:<\/strong><br \/>\nThe filename(0) gets the latest iteration of the file. (-1) would be the prior days.<br \/>\nUsing MGET returns the full file name to the server vs GET returns filename(0) as the filename.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This months challenge has been to extract daily files from the mainframe down to an ftp server where we can utilize the data in SQL Server. The file names changes daily, incrementing by 1 for each generation. The files are &hellip; <a href=\"https:\/\/www.esearing.com\/v2010\/2010\/12\/ftps-mainframe-to-windows-server\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15,17,19],"tags":[],"class_list":["post-424","post","type-post","status-publish","format-standard","hentry","category-applications","category-ftp","category-mainframe"],"_links":{"self":[{"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/posts\/424","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/comments?post=424"}],"version-history":[{"count":0,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/posts\/424\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/media?parent=424"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/categories?post=424"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/tags?post=424"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}