Monday 11 March 2013

FTP(part 6) - Working with Directories on remote server


FTP commands for working with directories on the remote host:

CD/CWD
Changes the working directory.

If remote system is Unix:

ftp> cd test
250 CWD command successful.
ftp> pwd
257 "/home/isaacrdo/M0001/test" is current directory.

If remote system is Mainframe:

250 "M0001." is the working directory name prefix.           
EZA1460I Command: cd test                                     
                                                               
EZA1701I >>> CWD test                                         
250 "M0001.TEST." is the working directory name prefix.      
EZA1460I Command:                                             

ON mainframe TEST is the 2nd node below the HLQ M0001.
PWD
Displays the name of the active working directory on the foreign host.

No parameters for this subcommand.

If remote system is Unix:
ftp> pwd
257 "/home/isaacrdo/M0001" is current directory.

If remote system is Mainframe:

EZA1701I >>> PWD                       
257 "'M0001.'" is working directory.  
EZA1460I Command:                      

CDUP
Used as a special case of the CD subcommand to change the working directory to the next higher directory level.

There are no parameters for this subcommand.

If remote system is Unix:

ftp> pwd
257 "/home/isaacrdo/M0001/test" is current directory.
ftp> cdup
250 CWD command successful.
ftp> pwd
257 "/home/isaacrdo/M0001" is current directory.

If remote system is Mainframe:

EZA1460I Command: cd test                                
                                                         
EZA1701I >>> CWD test                                    
250 "M0001.TEST." is the working directory name prefix.  
EZA1460I Command: cdup                                   
                                                         
EZA1701I >>> CDUP                                        
250 "M0001." is the working directory name prefix.      
EZA1460I Command:                                         

MKDIR
Used to create a directory on remote host

 
>>-MKdir--directory--+--------------------------+--------------><
                     '-(--like--local_directory-' 

Directory : Specifies the name of the directory to be created.
local_directory: Specifies the name of a local directory that is to be a model for the remote directory.

If remote system is Mainframe:

250 "M0001." is the working directory name prefix.     
EZA1460I Command: mkdir level3                          
                                                         
EZA1701I >>> MKD level3                                 
257 "'M0001.LEVEL3'" created.                          
EZA1460I Command:                                       

Note that above command will create the PDS with the name M0001.level3 on remote server.

Command ===>                                                  Scroll ===> CSR 
                                                                              
Command - Enter "/" to select action                  Message           Volume
-------------------------------------------------------------------------------
         M0001.LEVEL3                                                  PCH265
***************************** End of Data Set list ****************************


If remote system is Unix:

ftp> mkdir test2
257 MKD command successful.
ftp> cd test2
250 CWD command successful.
ftp> pwd
257 "/home/isaacrdo/M0001/test2" is current directory.


RMDIR
Used to remove a directory / PDS on the remote host

If remote system is Unix:

ftp> rmdir test2
250 RMD command successful.

If remote system is Mainframe:

EZA1460I Command: rmdir level3       
                                     
EZA1701I >>> RMD level3              
250 M0001.LEVEL3 deleted.           
EZA1460I Command:                    

Since M0001 is already my working directory we need not fully qualify the name. this will delete the PDS M0001.level3

DIR
Used to obtain a list of directory entries or a list of files in a file group on the remote host, or a list of the members of the partitioned data set, as well as auxiliary information about the files.

Example:

If remote system is Mainframe:


We cd to M0001.test and then issue a dir command

EZA1460I Command: dir                                                         
                                                                               
EZA1701I >>> PORT 199,145,86,225,155,176                                      
200 Port request OK.                                                          
EZA1701I >>> LIST                                                              
125 List started OK                                                           
EZA2284I Volume Unit    Referred Ext Used Recfm Lrecl BlkSz Dsorg Dsname      
EZA2284I PCP421 3390   1452/11/27  1   15  FB      80  8000  PO  CNTLCARD     
EZA2284I Migrated                                                COBOL        
EZA2284I Migrated                                                COPYBOOK     
EZA2284I PCH123 3390   1452/12/24  1  398  FB      80 23440  PO  CTC          
EZA2284I Migrated                                                CTC1         
EZA2284I Migrated                                                DATA         
EZA2284I Migrated                                                DWTBLBKP     
EZA2284I PCP21B 3390   1453/01/01  1  278  FB      80   800  PO  JCL          
EZA2284I Migrated                                                OBJ          
EZA2284I Migrated                                                OUTPUT       
EZA2284I Migrated                                                PROCLIB      
250 List completed successfully.                                              
EZA1460I Command:                                                            

Note that it has provided all the datasets starting with  M0001.test

If remote system is Unix:

dir
-rw-r-----   1 M0001     isaacrdo   1291675 Feb 15 15:25 test3.txt
-rw-r-----   1 M0001     isaacrdo   1291465 Feb 15 15:31 test4.txt
-rw-r-----   1 M0001     isaacrdo   3114546 Feb 15 15:36 test5.txt
-rw-r-----   1 M0001     isaacrdo   3101928 Feb 15 15:50 test6.txt
-rw-r-----   1 M0001     isaacrdo     77420 Feb 15 15:51 test7.txt
-rw-r-----   1 M0001     isaacrdo   2799592 Feb 15 16:01 test8.csv
-rw-r-----   1 M0001     isaacrdo    196012 Feb 15 16:02 test9.csv
-rw-r-----   1 M0001     isaacrdo      2544 Aug  5  1451 testfile
-rw-r-----   1 M0001     isaacrdo      2501 Aug  5  1451 testfile2
-rw-r-----   1 M0001     isaacrdo   1291675 Feb 15 15:01 text.txt
-rw-r-----   1 M0001     isaacrdo    123955 Feb 15 15:17 text2.txt
-rw-r-----   1 M0001     isaacrdo      1487 Aug  5  1451 unix
226 Transfer complete.
16160 bytes received in 0.34 seconds (45.99 Kbytes/s)

Output is similar to ls –lrt
LS
Used to list only the names of a set of remote files, file group, or directory.

Difference between DIR and LS is that DIR provides detailed information about the data sets under the remote working directory, while LS shows the data set names only.


If remote system is Mainframe:

ls                                             
 EZA1701I >>> PORT 199,145,86,225,161,208      
 200 Port request OK.                          
 EZA1701I >>> NLST                             
 125 List started OK                           
 EZA2284I CNTLCARD                             
 EZA2284I COBOL                                
 EZA2284I COPYBOOK                              
 EZA2284I CTC                                  
 EZA2284I CTC1                                 
 EZA2284I DATA                                 
 EZA2284I DWTBLBKP                             
 EZA2284I JCL                                   
 EZA2284I OBJ                                  
 EZA2284I OUTPUT                               
 EZA2284I PROCLIB                              
 250 List completed successfully.              
 EZA1460I Command:                             
                                                
If remote system is unix:

text2.txt
test3.txt
test4.txt
test5.txt
test6.txt
test7.txt
test8.csv
test9.csv
226 Transfer complete.
5141 bytes received in 0.03 seconds (164.83 Kbytes/s)





NOte : All the information about FTP and the syntax diagrams are taken from the site http://publib.boulder.ibm.com.
Things are put here in simplified words and Many commands that are not used normally are omitted.
Refer the website http://publib.boulder.ibm.com. in case you need more details.

No comments:

Post a Comment