FTP Transfer from PC to MVS with no file type ending

FTP Transfer from PC to MVS with no file type ending

1
NewbieNewbie
1

    May 10, 2007#1

    I want to transfer a local COBOL file c:\temp\testabc.cob to the mainframe.
    Name on mainframe should be 'testabc'.
    If I use the FTP - Save As option, I have to change the file name manually to 'testabc', because a transfer with ending is not possible.
    But I need the .cob ending on my local computer for syntax highlighting.

    After saving the file UE opens the FTP View of the file.

    How can I cut the file type ending automatically and
    how can I prevent the FTP View of the file.
    Is there any way to solve this problem with a script/macro ?

    I use UE 12.20B+1

    262
    MasterMaster
    262

      May 10, 2007#2

      Hi moka11

      As far as I know there are no possibilities for automatic renaming of files in the FTP/SFTP dialog.

      You could create a macro which
      - select all text in your current document to clipboard
      - open new blank file
      - paste from clipboard
      - find out how to construct a FTP path and filename without extension
      - SaveAs with this name
      - CloseFile

      This should be possible in UE12, but as I am more of a script freak than a macro freak, in UE13 it could look like this:

      Code: Select all

      // Save local *.cob-file to FTP location without cob-extension in name
      // Created: Jørgen Rasmussen, 2007-05-10. Please use and modify freely.
      var myFTPaccount = "FTPSRVACCOUNT01";
      var myFTPfolder = "/pathonserver/subfolder";
      
      saveToMyFTP();
      
      function saveToMyFTP() {
      
        /* If already on a FTP server, save it directly and exit */
        if (UltraEdit.activeDocument.isFTP()) {
          UltraEdit.save();
          return; /* exit now */
        }
      
      	/* all unsaved and all local files that is not cob (Cobol) = end with error pop-up */
        if (! UltraEdit.activeDocument.isExt("cob")) {
        	var errorTxt = UltraEdit.getString("Not saved locally as cob file. Enter any char and OK");
          return; /* exit now */
        }
      
        /* otherwise: Construct a FTP path: "FTP::account\\path" */
        var myFTPpath = "FTP::" + myFTPaccount + "\\"+ myFTPfolder;
      
      	/* Get local filepath */
      	var path = UltraEdit.activeDocument.path;
      
      	/* Get name path of file without extension */
      	var cobFileName = path.substr(path.lastIndexOf("\\")+1);
      	cobFileName = cobFileName.substr(0,cobFileName.lastIndexOf(".cob"));
      
      	/* Construct full path for FTP */
      	cobFilePath = myFTPpath+"|"+cobFileName;
      
      	UltraEdit.selectClipboard(8); /* choose user clipboard 8 */
      	UltraEdit.clearClipboard(); 
      
        UltraEdit.save(); /* save local file */
      
      	UltraEdit.activeDocument.selectAll();
      	UltraEdit.activeDocument.copy();
      	UltraEdit.newFile();
      	UltraEdit.activeDocument.paste();
      	UltraEdit.saveAs(cobFilePath);
      	UltraEdit.closeFile(UltraEdit.activeDocument.path,2);
      
      	UltraEdit.clearClipboard();
      	UltraEdit.selectClipboard(0); /* restore to windows clipboard */
      }
      
      (Missing some setActive() in the end to return to the original tab, but setActive() still crashes UE, so it is omitted).

      Assign to a hotkey and you have a nice "Save As Cob file to Mainframe" function.

      It is not meant to force you to buy UE13, but it could serve as inspiration for you when writing a macro instead.