Clearing a password from an FTP script

After creating an automated script for FTP, this will clear the password that was used to authenticate the user ID. Although the file is defined for our use, it can be easily modified for any flat file used for an FTP script. The FTP source file is a multi-membered file with a member created for each workstation using the FTP scripting programs.

0002.00  * Clear password from source file                                         
0004.00 H option(*nodebugio)                                                       
0007.00 Fftpsrc    uf   f  500        disk    usropn                               
0009.00 D w_data          s                   like(data)                           
0010.00 D pos             s              3  0                                      
0011.00 D w_cmd           s            256a   inz varying                          
0012.00 D cmd             s            256a   inz                                  
0013.00 D length          s             15  5                                      
0015.00 D                sds                                                       
0016.00 D ftpdev                244    253                                         
0018.00 Iftpsrc    aa                                                              
0019.00 I                                  1  500  data                            
0021.00 C                   eval      w_cmd = 'OVRDBF FILE(FTPSRC) MBR('           
0022.00 C                                   + %trim(ftpdev) + ')'                  
0023.00 C                   exsr      DoCmd                                        
0025.00 C                   open      ftpsrc                                       
0026.00 C                   read      ftpsrc                                       
0027.00 C                   clear                   w_data                         
0028.00 C                   reset                   pos                            
0029.00 C                   eval      pos = %scan(' ' : data )                     
0030.00 C                   eval      w_data = %subst(data : 1 : pos - 1 )         
0031.00 C                   clear                   data                           
0032.00 C                   eval      data = w_data                                
0033.00 C                   except    upddata                                      
0034.00 C                   close     ftpsrc                                       
0036.00 C                   eval      w_cmd = 'DLTOVR *ALL'                        
0037.00 C                   exsr      DoCmd                                        
0039.00 C                   eval      *inlr = *on                                  
0041.00  *-----------------------                                                  
0042.00 C     DoCmd         begsr                                                  
0044.00 C                   eval      length = %len(w_cmd)                         
0045.00 C                   reset                   cmd                            
0046.00 C                   movel     w_cmd         cmd                            
0047.00 C                   call(e)   'QCMDEXC'     p_cmd                          
0048.00 C                   reset                   w_cmd                          
0050.00 C                   endsr                                                  
0052.00  *-----------------------                                                  
0053.00 C     *inzsr        begsr                                                  
0055.00 C     p_cmd         plist                                                  
0056.00 C                   parm                    cmd                            
0057.00 C                   parm                    length                         
0059.00 C                   endsr                                                  
0061.00  *-----------------------                                                  
0062.00  * output with exception                                                   
0063.00 Oftpsrc    e            upddata                                            
0064.00 O                       data               500                             



The Best Web Links: tips, tutorials and more.

Ask your programming questions--or help out your peers by answering them--in our live discussion forums.

Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.

This was first published in December 2003

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.