× 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.



Rich

You can download powerEXT Core and use the csvNode support to create
the file, here is a program example:

/copy qsrc,pxapihdr General H-Spec's

* powerEXT API Connectors
/copy qsrc,pxapicgicn Basic HTTP connecter & Basic Services

/free
clearsrvpgm();
setContent('*none');

csvDelimiter('|');

csvNode('01');
csvNode('FILE DESWCRIPTION');
csvNode('20140717');
csvNode('HOSPF001');
csvNode(' ');
csvNode(' ');
csvNode(' ');
csvNode(' ');

csvNode('10');
csvNode('123456789');
csvNode('123456789');
csvNode('111223333');
csvNode('LAST NAME');
csvNode('FIRST NAME');
csvNode('MIDDLE NAME');
csvNode('SUFFIX');
csvNode('ALIAS LST NAME');
csvNode('NICKNAME');
csvEndNode();

echoToStmf('/csvtest2.txt':819);

*inlr = *on;
/end-free

This code generates an IFS file like this:

01|"FILE DESWCRIPTION"|20140717|"HOSPF001"|||||

10|123456789|123456789|111223333|"LAST NAME"|"FIRST NAME"|"MIDDLE
NAME"|"SUFFIX"|"ALIAS LST NAME"|"NICKNAME"|


On Fri, Jul 18, 2014 at 12:41 AM, John Yeung <gallium.arsenide@xxxxxxxxx>
wrote:

On Thu, Jul 17, 2014 at 4:47 PM, Buck Calabro <kc2hiz@xxxxxxxxx> wrote:
If you wanted to, you could use the QUSLFLD API to list the fields in
each file and set up automatic code to deal with each one, whether you
need to edit numeric fields, trim character fields, etc. Carsten wrote
an article on that:

http://iprodeveloper.com/rpg-programming/apis-example-list-fields-quslfld
This has a bit of a learning curve.

Yeah, probably too much for his deadline. If he were going to put in
that level of effort, he might as well just learn enough Python to do
his task (which isn't a lot).

Step 2 would be to write an RPG program that reads the work file by key
and writes only the text field out to the IFS. Scott's IFS APIs can
help, as might Jon's RPGOA article. Either one is easy to use and will
not impose a huge learning curve. Basically just READ the table and
write() the IFS file.

Um, I suspect it would actually be quicker and simpler, once he's set
up the work file with the keys, to use files and CL commands,
particularly if he isn't already versed in working with IFS stream
files. For example, RGZPFM the work file. Copy it to another
workfile, which doesn't have the keys, using FMTOPT(*MAP *DROP). Then
CPYTOSTMF.

I don't miss dealing with home grown EDI one bit.

I hear you, and I doubt it's many people's idea of a fun project. But
it is stunningly less painful if you use Python (or similar-level
language). All that delimiter stuff, heterogeneous data types (even
if not known until run time), and especially the quoting if that's
something you need to do, just goes away (because well-established
libraries to do all that are either already included or just a free
download away, and whatever logic is left that isn't in those
libraries tends to be easier to write in Python than in RPG).

John Y.
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.