# RXS_ProcessStmf() This subprocedure can be used to create, copy, move, rename, or delete a specified IFS stream file. ## Subprocedure Prototype | Field | Description | |---|---| | ` D RXS_ProcessStmf... D PR Extproc('RXS_ProcessStmf') Opdesc` | | | ` D pDS Like(RXS_Var64K_t) D Options(*Varsize)` | Contains the IFS file path as well as configuration options to control how the data is written. May be one of a few possible data structures, listed below. | ## Example Code ### Ex. 1: Create an IFS Stream File ```rpgle *-------------------------------------------------------------- * This example code creates a stream file named new_file.xml in * the IFS directory /tmp with CCSID 819. *-------------------------------------------------------------- H DFTACTGRP(*NO) BNDDIR('RXSBND') ACTGRP(*CALLER) /copy QRPGLECPY,RXSCB D CreateStmfDS DS LikeDS(RXS_CreateStmfDS_t) D Inz(*LikeDS) /free RXS_ResetDS( CreateStmfDS : RXS_DS_TYPE_CREATESTMF ); CreateStmfDS.Stmf = '/tmp/new_file.xml'; CreateStmfDS.Ccsid = RXS_CCISD_ISO88591; RXS_ProcessStmf( CreateStmfDS ); *INLR = *ON; /end-free ``` ### Ex. 2: Copy an IFS Stream File ```rpgle *-------------------------------------------------------------- * This example code copies an IFS file from /tmp/new_file.xml to * /tmp/copied_new_file.xml. *-------------------------------------------------------------- H DFTACTGRP(*NO) BNDDIR('RXSBND') ACTGRP(*CALLER) /copy QRPGLECPY,RXSCB D CopyStmfDS DS LikeDS(RXS_CopyStmfDS_t) D Inz(*LikeDS) /free RXS_ResetDS( CopyStmfDS : RXS_DS_TYPE_COPYSTMF ); CopyStmfDS.FromStmf = '/tmp/new_file.xml'; CopyStmfDS.ToStmf = '/tmp/copied_new_file.xml'; RXS_ProcessStmf( CopyStmfDS ); *INLR = *ON; /end-free ``` ### Ex. 3: Move an IFS Stream File ```rpgle *-------------------------------------------------------------- * This example code moves an IFS file from /tmp/new_file.xml * to /tmpdir/new_file.xml. Note that this can only be used * to move the file to a new directory, not to rename the file. *-------------------------------------------------------------- H DFTACTGRP(*NO) BNDDIR('RXSBND') ACTGRP(*CALLER) /copy QRPGLECPY,RXSCB D MoveStmfDS DS LikeDS(RXS_MoveStmfDS_t) D Inz(*LikeDS) /free RXS_ResetDS( MoveStmfDS : RXS_DS_TYPE_MOVESTMF ); MoveStmfDS.Stmf = '/tmp/new_file.xml'; MoveStmfDS.ToDir = '/tmpdir/new_file.xml'; RXS_ProcessStmf( MoveStmfDS ); *INLR = *ON; /end-free ``` ### Ex. 4: Delete an IFS Stream File ```rpgle *-------------------------------------------------------------- * This example code deletes an IFS file named /tmp/moved_new_file.xml. *-------------------------------------------------------------- H DFTACTGRP(*NO) BNDDIR('RXSBND') ACTGRP(*CALLER) /copy QRPGLECPY,RXSCB D DeleteStmfDS DS LikeDS(RXS_DeleteStmfDS_t) D Inz(*LikeDS) /free RXS_ResetDS( DeleteStmfDS : RXS_DS_TYPE_DELETESTMF ); DeleteStmfDS.Stmf = '/tmp/new_file.xml'; RXS_ProcessStmf( DeleteStmfDS ); *INLR = *ON; /end-free ``` ### Ex. 5: Rename an IFS Stream File ```rpgle *-------------------------------------------------------------- * This example code renames an IFS file from /tmp/new_file.xml * to /tmp/renamed_new_file.xml. Note that this can only be used * to rename the file, not move it to a new directory. *-------------------------------------------------------------- H DFTACTGRP(*NO) BNDDIR('RXSBND') ACTGRP(*CALLER) /copy QRPGLECPY,RXSCB D RenameStmfDS DS LikeDS(RXS_RenameStmfDS_t) D Inz(*LikeDS) /free RXS_ResetDS( RenameStmfDS : RXS_DS_TYPE_RENAMESTMF ); RenameStmfDS.FromStmf = '/tmp/new_file.xml'; RenameStmfDS.ToStmf = '/tmp/renamed_new_file.xml'; RXS_ProcessStmf( RenameStmfDS ); *INLR = *ON; /end-free ``` ## Data Structures ### RXS_CopyStmfDS_t | Field | Description | |---|---| | ` D RXS_CopyStmfDS_t... D DS Qualified Template Inz` | | | ` D ReturnedErrorInfo... D LikeDS(RXS_ReturnedErrorInfoDS_t) Inz` | | | ` D DataStructureType... D 5I 0 Inz(RXS_DS_TYPE_COPYSTMF)` | **Internal use only** | | ` D OnErrorMessageType... D 5I 0` | | | ` D FromStmf Like(RXS_Var1Kv_t)` | Specify the IFS file path to copy from. | | ` D ToStmf Like(RXS_Var1Kv_t)` | Specify the IFS file path to copy to. | | ` D ToCcsid 10I 0` | Specify the CCSID the copied file will use. | | ` D Reserved 2048A` | **Internal use only** | ### RXS_CreateStmfDS_t | Field | Description | |---|---| | ` D RXS_CreateStmfDS_t... D DS Qualified Template Inz` | | | ` D ReturnedErrorInfo... D LikeDS(RXS_ReturnedErrorInfoDS_t) Inz` | | | ` D DataStructureType... D 5I 0 Inz(RXS_DS_TYPE_CREATESTMF)` | **Internal use only** | | ` D OnErrorMessageType... D 5I 0` | | | ` D Stmf Like(RXS_Var1Kv_t)` | Specify IFS path where the file will be created. | | ` D Ccsid 10I 0` | Specify the CCSID to create the file with. | | ` D Reserved 2048A` | **Internal use only** | ### RXS_DeleteStmfDS_t | Field | Description | |---|---| | ` D RXS_DeleteStmfDS_t... D DS Qualified Template Inz` | | | ` D ReturnedErrorInfo... D LikeDS(RXS_ReturnedErrorInfoDS_t) Inz` | | | ` D DataStructureType... D 5I 0 Inz(RXS_DS_TYPE_DELETESTMF)` | **Internal use only** | | ` D OnErrorMessageType... D 5I 0` | | | ` D Stmf Like(RXS_Var1Kv_t)` | Specify the IFS file path to delete. | | ` D Reserved 2048A` | **Internal use only** | ### RXS_MoveStmfDS_t | Field | Description | |---|---| | ` D RXS_MoveStmfDS_t... D DS Qualified Template Inz` | | | ` D ReturnedErrorInfo... D LikeDS(RXS_ReturnedErrorInfoDS_t) Inz` | | | ` D DataStructureType... D 5I 0 Inz(RXS_DS_TYPE_MOVESTMF)` | **Internal use only** | | ` D OnErrorMessageType... D 5I 0` | | | ` D Stmf Like(RXS_Var1Kv_t)` | Specify the IFS file path to move from. | | ` D ToDir Like(RXS_Var1Kv_t)` | Specify an IFS file directory to move to. Note: You should only specify a directory path, not a full path to a file. | | ` D Reserved 2048A` | **Internal use only** | ### RXS_RenameStmfDS_t | Field | Description | |---|---| | ` D RXS_RenameStmfDS_t... D DS Qualified Template Inz` | | | ` D ReturnedErrorInfo... D LikeDS(RXS_ReturnedErrorInfoDS_t) Inz` | | | ` D DataStructureType... D 5I 0 Inz(RXS_DS_TYPE_RENAMESTMF)` | **Internal use only** | | ` D OnErrorMessageType... D 5I 0` | | | ` D FromStmf Like(RXS_Var1Kv_t)` | Specify the IFS file path to rename from. | | ` D ToStmf Like(RXS_Var1Kv_t)` | Specify the IFS file path to rename to. | | ` D Reserved 2048A` | **Internal use only** |