What the integrated file system is?
The integrated file system is a part of OS/400 that supports stream input/output and storage management similar to personal computer and UNIX operating systems, while providing an integrating structure over all information stored in your server.The key features of the integrated file system are the following:
- Support for storing information in stream files that can contain long continuous strings of data. These strings of data might be, for example, the text of a document or the picture elements in a picture. The stream file support is designed for efficient use in client/server applications.
- A hierarchical directory structure that allows objects to be organized like fruit on the branches of a tree. Specifying the path through the directories to an object accesses the object.
- A common interface that allows users and applications to access not only the stream files but also database files, documents, and other objects that are stored in your server.
- A common view of stream files that are stored locally on your server, Integrated xSeries Server for iSeries, or a remote Windows NT server. Stream files can also be stored remotely on a Local Area Network (LAN) server, a Novell NetWare server, another remote iSeries server, or a Network File System server.
The integrated file system is comprised of 11 file systems, each with their own set of logical structures and rules for interacting with information in storage.
Sample RPGLE Program Reading an IFS File
H Option(*SrcStmt : *NoDebugIO) bnddir('QC2LE') h dftactgrp(*no) D/copy *libl/QRPGLESRC,IFSIO_H D readline PR 10I 0 D fd 10I 0 value D text * value D maxlen 10I 0 value D fd S 10I 0 D line S 100A D Msg S 50A D Len S 10I 0 /free fd = open('/directory1/directory2/aaa.htm' : O_RDONLY+O_TEXTDATA+O_CCSID : S_IRGRP: 37); /end-free c if fd < 0 c eval Msg = 'open(): failed for reading' c dsply Msg c eval *inlr = *on c return c endif c dow readline(fd: %addr(line): c %size(line))>=0 c eval Msg = line c Msg dsply c enddo c callp close(fd) c eval *inlr = *on c return P readline B D readline PI 10I 0 D fd 10I 0 value D text * value D maxlen 10I 0 value D rdbuf S 1024A static D rdpos S 10I 0 static D rdlen S 10I 0 static D p_retstr S * D RetStr S 32766A based(p_retstr) D len S 10I 0 c eval len = 0 c eval p_retstr = text c eval %subst(RetStr:1:MaxLen) = *blanks c dow 1 = 1 C* Load the buffer c if rdpos>=rdlen c eval rdpos = 0 c eval rdlen=read(fd:%addr(rdbuf):%size(rdbuf)) c if rdlen < 1 c return -1 c endif c endif C* Is this the end of the line? c eval rdpos = rdpos + 1 c if %subst(rdbuf:rdpos:1) = x'25' c return len c endif C* Otherwise, add it to the text string. c if %subst(rdbuf:rdpos:1) <> x'0d' c and len<>maxlen c eval len = len + 1 c eval %subst(retstr:len:1) = c %subst(rdbuf:rdpos:1) c endif c enddo c return len P E
Sample C++ Program Reading an IFS File
- Source Member type = CPP
#include <iostream> #include <iomanip> #include <fstream> using namespace std; int main() { int sum = 0; char str[250]; int x; ifstream inFile; inFile.open("/directory1/directory2/abc.txt"); if (!inFile) { cout << "Unable to open file"; exit(1); // terminate with error } while(inFile) { inFile.getline(str, 255); cout << str << endl; } inFile.close(); return 0; }
No comments:
Post a Comment
NO JUNK, Please try to keep this clean and related to the topic at hand.
Comments are for users to ask questions, collaborate or improve on existing.