Is there a way to copy a *savf to the IFS. I save the source files in my library to a *savf several times a week. I would like to store the save file on the IFS but when I use CPYTOIMPF or CPYTOSTMF, I get errors indicating that the file I am copying is not a data base file. Is there a way to do this with out using FTP.
Announcement
Collapse
No announcement yet.
Copy *savf to the IFS
Collapse
X
-
You may try the following small SQLRPGLE program.
Code:DCL-S ParToIFSFile VarChar(256) inz('/home/Dir/XYSAVF.savf'); DCL-S ParFromObj VarChar(256) inz('/QSYS.lib/XXLIB.lib/XYSAVF.file'); DCL-S MyFromBlob SQLType(BLOB_FILE); DCL-S MyToBlob SQLTYPE(BLOB_FILE); //------------------------------------------------------------------------------- Exec SQL Set Option Commit=*NONE, DatFmt=*ISO, TimFmt=*ISO, Naming=*SYS, CloSQLCsr=*EndActGrp; //Save file Information MyFromBLOB_Name = %Trim(ParFromObj); MyFromBLOB_NL = %Len(%Trim(MyFromBLOB_Name)); MyFromBLOB_FO = SQFRD; //Read Only //IFS File Information MyToBLOB_Name = %Trim(ParToIFSFile); MyToBLOB_NL = %Len(%Trim(MyToBLOB_Name)); MyToBLOB_FO = SQFOVR; //Replace if exists Exec SQL Set :MyToBLOB = :MyFromBLOB; If SQLCODE < *Zeros; Dsply ('Error: ' + %Char(SQLCODE)); Else; Dsply 'Success'; EndIf; *InLR = *On;
Last edited by B.Hauser; July 21, 2018, 12:36 AM.
Comment
Comment