# RXS_GetStmf() This subprocedure retrieves up to 16MB of data from a specified IFS stream file. ## Subprocedure Prototype | Field | Description | |---|---| | ` D RXS_GetStmf... D PR Extproc('RXS_GetStmf') Opdesc D Like(RXS_Var16Mv_t) D Rtnparm` | Returns data retrieved from the specified IFS stream file. | | ` D DS Likeds(RXS_GetStmfDS_t) D Options(*Varsize)` | RXS_GetStmfDS_t data structure used to configure the RXS_GetStmf() call and specify the IFS stream file to read. | ## Example Code ### Ex. 1: Read Character String from IFS stream file ```rpgle *-------------------------------------------------------------- * This example code reads the contents of the file * /tmp/rxs_getstmf.txt into the Data field. *-------------------------------------------------------------- H DFTACTGRP(*NO) BNDDIR('RXSBND') ACTGRP(*CALLER) /copy QRPGLECPY,RXSCB D GetStmfDS DS LikeDS(RXS_GetStmfDS_t) D Data S Like(RXS_Var64Kv_t) /free RXS_ResetDS( GetStmfDS : RXS_DS_TYPE_GETSTMF ); GetStmfDS.Stmf = '/tmp/rxs_getstmf.txt'; Data = RXS_GetStmf( GetStmfDS ); *INLR = *ON; /end-free ``` ### Ex. 2: Read Chunks of Characters from an IFS stream file while looping ```rpgle *-------------------------------------------------------------- * This example code reads the contents of the file * /tmp/rxs_getstmf.txt and outputs the entire file to STDOUT, * even if the length of the file is greater than the Data variable. *-------------------------------------------------------------- H DFTACTGRP(*NO) BNDDIR('RXSBND') ACTGRP(*CALLER) /copy QRPGLECPY,RXSCB D GetStmfDS DS LikeDS(RXS_GetStmfDS_t) D Data S Like(RXS_Var64Kv_t) /free RXS_ResetDS( GetStmfDS : RXS_DS_TYPE_GETSTMF ); GetStmfDS.Stmf = '/tmp/rxs_getstmf.txt'; GetStmfDS.ChunkedLength = %size(Data - 4); Dou %len(Data) = 0; Data = RXS_GetStmf( GetStmfDS ); RXS_PutStdOut( Data ); Enddo; *INLR = *ON; /end-free ``` ## Data Structures ### RXS_GetStmfDS_t | Field | Description | |---|---| | ` D RXS_GetStmfDS_t... D DS Qualified Template Inz` | | | ` D ReturnedErrorInfo... D LikeDS(RXS_ReturnedErrorInfoDS_t) Inz` | | | ` D DataStructureType... D 5I 0 Inz(RXS_DS_TYPE_GETSTMF)` | **Internal use only** | | ` D OnErrorMessageType... D 5I 0` | | | ` D Stmf Like(RXS_Var1Kv_t)` | Specifies IFS path to a stream file to retrieve. | | ` D ToCcsid 10I 0` | The CCSID to convert the data read from the IFS stream file into. | | ` D OutputPointer... D * Inz(*Null)` | **Internal use only** | | ` D OutputLength 10I 0` | **Internal use only** | | ` D StmfSize 10I 0` | This is a returned value containing the number of bytes stored in the stream file. | | ` D ChunkedLength... D 10I 0` | The length to use when "chunks" of the stream file are to be returned. See example 2. | | ` D ChunkedOffset... D 128A` | **Internal use only** |