Problem solve Get help with specific problems with your technologies, process and projects.

Add notes/comments to FTP output logs

Easily add notes or comments to FTP output logs with command FTPNOTE and program FTPNOTER.

The standard method of running scripted FTP is to override INPUT and OUTPUT to members of a source file. I wanted to add notes and especially a timestamp to the output log, so I created the command FTPNOTE and program FTPNOTER.

Typical use:

ovrdbf input tofile(ftp) mbr(job103i)
ovrdbf output tofile(ftp) mbr(job103o)
ftpnote 'test run'
ftp ''

The output member will contain
 04/23/2003 10:44:58    test run                     
Output redirected to a file.                                       
Input read from spec...
> QUIT               
221 Good-Bye         
 04/23/2003 10:45:10        

ftpnote <'optional comment'>
always inserts a date/timestamp

The date/time stamps have the highlight attribute. 
  Code: ----------------------
source for ftpnote cmd
crtcmd ftpnote pgm(ftpnoter)
cmd prompt('add note to ftp output')                                 
             PARM       KWD(TEXT) TYPE(*CHAR) LEN(60) MIN(0) +       
                          EXPR(*YES) CASE(*MIXED) CHOICE('Message +  
                          to put in output') PROMPT('(opt.) Message')

source for ftpnoter rpgle
use CRTBNDRPG to compile
**NOTE my ftp script file is named FTP.
** if yours is not, correct the RENAME()  on the f-spec

h dftactgrp(*no) actgrp(*caller)
** Write a line to the FTP output file                              
** textline automatically starts with the current date/time         
** file OUTPUT should be overridden to correct file/mbr before call!
** failing to override will result in record added to first member  
Foutput    o    e             disk    rename(ftp:ftprec)            
D Now             s               z                                 
D test            s              6s 0                               
c                   time                    now                     
c                   eval      srcdta = %char(now)                   
** timestamp format: 2003-02-20-                     
** x'22 is highlight, x'20 is normal                                
c                   eval      srcdta = x'22'                        
c                                    + %subst(srcdta:6:6)           
c                                    + %subst(srcdta:1:4)      
c                                    + ' '                     
c                                    + %subst(srcdta:12:8)     
c                                    + x'20'                   
** change 02-20-2003 11.37 into 02/20/2003 11:37               
c     '.-':':/'     xlate     srcdta        srcdta             
c                   if        %parms = 1                       
C     *entry        plist                                      
C                   parm                    message          60
c                   eval      test = %len(message)             
c                   eval      test = %len(%trim(message))      
c                   eval      srcdta = %trim(srcdta)           
c                                    + %trim(message)          
c                   endif                                      
c                   write     ftprec                           
c                   eval      *inlr=*on                        


Dig Deeper on FTP