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



It is not clear to me what exactly you are trying to do but I get the hint
that you are trying to apply a monolith solution to an ILE problem and
return everything in one call.

I think you are trying to do a read line combined with a tokenize a string
function.

By read line, I mean read all the characters up to the <CR><LF> characters
and then by tokenize I mean break the line down into individual strings
each one being delimited by an '*'.

Is this an accurate description of the problem?

If yes, I accomplish this with two service programs.

the IFS service program has a Read LIne function and the string function
has a tokenizer with the following functions.

XVSTGF_Tokenize
XVSTGF_GetToken
XVSTGF_GetTokenSize
etc

My point being that you need to break things down into small functions.

If you are interested I can send you the code.


On Sun, Mar 30, 2014 at 10:50 AM, Jack Tucky <jacktucky@xxxxxxxxx> wrote:

I modified Scott K's CSV code to process a string passed in instead of
reading from an IFS file. I called the function EDI_GetFld. I also added
parameters for field delimiter and record delimiter so that I could process
an EDI segment like this:



ISA*00* *00* *ZZ*SENDER *ZZ*RECEIVER
*140102*1141*U*00400*000047073*0*P**~



I use 18 EDI_GetFld's to fill all of the ISA's 18 fields. Everything looks
good.



EDI_getfld(peFldData: isa00: %size(isa00):sep:term)

EDI_getfld(peFldData: isa01: %size(isa01):sep:term), etc.



Isa00-ISA018 are defined as varying fields. They are in a DS that
represents all of the fields in an ISA Segment, ISA00 -ISA18.



My goal is to replace some 3rd party code that is no longer working. To
accomplish this and not have to change a bunch of programs, I need to move
this data structure to a 512 character max string, like this:



OutDta = ISA;



My problem is that OutDta contains varying field length bytes?



If you look at the individual fields, they look good:



ISA00 OF ISA = 'ISA'

ISA01 OF ISA = '00'

ISA02 OF ISA = ' '

ISA03 OF ISA = '00'

ISA04 OF ISA = ' '

ISA05 OF ISA = 'ZZ'

ISA06 OF ISA = 'SENDER '

ISA07 OF ISA = 'ZZ'

ISA08 OF ISA = 'RECEIVER '

ISA09 OF ISA = '140102'

ISA10 OF ISA = '1141'

ISA11 OF ISA = 'U'

ISA12 OF ISA = '00400'



But OutDta in debug/hex shows this:



0003C9E2 C10002F0 F0000A40 40404040 - ..ISA..00..

40404040 400002F0 F0000A40 40404040 - ..00..

40404040 400002E9 E9000FC7 C9C9C940 - ..ZZ..SEND

40404040 40404040 40400002 E9E9000F - ..ZZ..

C4E8D5C1 D4C9C340 40404040 40404000 - XXXXXXX .

06F1F4F0 F1F0F200 04F1F1F4 F10001E4 - .140102..1141..U

0005F0F0 F4F0F000 09F0F0F0 F0F4F7F0 - ..00400..0000470

F7F30001 F00001D7 00004000 01A10000 - 73..0..P.. ..~..



Is there a way to move my data structure that contains all varying fields
into a 512 character string and strip the lengths out? I've tried
changing
Scott's code to use 512 fixed length fields as input and output but I
can't
get that to work if I don't pass in 512 characters.



Sorry for the long post and I hope this makes sense. Thanks



Jack

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

Follow-Ups:
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.