× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Alan,

That would be awesome. My deadline is Monday so all of this help from
the group is overwhelming and very much appreciated. They are on V6R1.

Many thanks to all.

Rich


On Thu, Jul 17, 2014 at 6:12 PM, Alan Campin <alan0307d@xxxxxxxxx> wrote:

Richard, don't know if you would interested but i can send you a save file
with an API that I wrote called XVIFSX, some documentation and an example
program that does what you are talking about.

XVIFSX is a service program that wrappers the Unix API that people have
been talking about so that you don't have to know anything about them. Just
use the API. Pretty simple.

What release level is your OS/400 at. The save file is at V6R1M0.

Here is what the example program looks like.

*_> CNLLSTSPLF SRCFILE(@SRCLIB/@SRCFIL) SRCMBR(@SRCMBR)
*_> DLTMOD MODULE(@OBJLIB/@OBJNAM)
*_> DLTPGM PGM(@OBJLIB/@OBJNAM)
*_> CRTSQLRPGI OBJ(@OBJLIB/@OBJNAM) +
*_> SRCFILE(@SRCLIB/@SRCFIL) +
*_> SRCMBR(@SRCMBR) DATFMT(*ISO) +
*_> OBJTYPE(*MODULE) CLOSQLCSR(*ENDMOD) COMMIT(*NONE) +
*_> DBGVIEW(*SOURCE) OPTION(*EVENTF)
*_> CRTPGM PGM(@OBJLIB/@OBJNAM) +
*_> MODULE(@OBJLIB/@OBJNAM) +
*_> TEXT('Build file') +
*_> BNDSRVPGM(XVIFSX) +
*_> ACTGRP(EXAM)
h Option(*Srcstmt:*Nodebugio:*Nounref)
h Main(BuildFile)

/copy *libl/qsrcf,cb_std_con
/copy *libl/qsrcf,cb_stdtype

/copy *libl/qsrcf,xvifsx_pr

d BuildFile...
d pr ExtPgm('EXAMPLEIFS')

d BuildLine...
d pr
d PR_InOutLine...
d 80a Varying
d PR_InString...
d 32a Varying
d Options(*Trim)
d Value
d PR_InDelimitor...
d 1a Value
d Options(*NoPass)
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* BuildFile
* Build an IFS file from database table
* In - None
* Out - None
* In/Out - None
* Returns - None
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
p BuildFile...
p b
d pi

d RecordIn...
d ds Qualified
d Key...
d 11p 0
d Name...
d 20a
d Area...
d 3p 0
d Phone...
d 7p 0

d Id...
d s Like(StdInt)
d Line...
d s 80a Varying
/Free

Exec Sql Declare C1 Cursor For
Select UPHKY,
ULNAM,
UAREA,
UPHON
From PHPUNIT;

Exec Sql Open C1;

Id = XVIFSX_OpenText('/home/acampin/script.txt':
O_CREAT + O_TRUNC +
O_WRONLY + O_CCSID +
O_TEXTDATA + O_TEXT_CREAT:
S_IRWXU + S_IRWXG + S_IRWXO:
819:
0);
DoU 0 = 1;
Exec Sql Fetch From C1
Into :RecordIn;
Select;
When SqlState = cSqlStateNoRow;
Exec Sql Close C1;
XVIFSX_WriteText(Id:
cTrue:
Line);
XVIFSX_CloseFile(Id);
Return;
When SqlState = cSqlStateOk;
BuildLine(Line:
%Editc(RecordIn.Key:'L'));
BuildLine(Line:
RecordIn.Name:
',');
BuildLine(Line:
%Editc(RecordIn.Area:'X'):
',');
BuildLine(Line:
%Editc(RecordIn.Phone:'X'):
',');
XVIFSX_WriteText(Id:
cTrue:
Line);
Other;
Dsply SqlState;
EndSl;
EndDo;

/End-Free
p e
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* BuildLine
* Builds a line.
* In - String to write
* Delimitator(Optional)
* Out - None
* In/Out - Line To Build
* Returns - None
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
p BuildLine...
p b
d pi
d InOutLine...
d 80a Varying
d InString...
d 32a Varying
d Options(*Trim)
d Value
d InDelimitator...
d 1a Value
d Options(*NoPass)
/Free

If %Parms() = 3;
InOutLine += (InDelimitator + InString);
Else;
InOutLine += InString;
EndIf;

Return;

/End-Free
p e



As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.