× 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 very common that EDI translators (EDIfact or X12) "just" create fixed
format records
and nothing else as "inhouse files" however it requires a specific DS for
each segment and
that is a huge job to replace unless you can reengineer the documentation
like (EDIfact doc)

S UNB INTERCHANGE HEADER
*
* Function: To start, identify and specify an interchange
*
+
C S001 SYNTAX IDENTIFIER M
F 0001 Syntax identifier M an..4
F 0002 Syntax version number M n..1
+
C S002 INTERCHANGE SENDER M
F 0004 Sender identification M an..35
F 0007 Partner identification code qualifier C an..4
F 0008 Address for reverse routing C an..14
+
C S003 INTERCHANGE RECIPIENT M
F 0010 Recipient identification M an..35
F 0007 Partner identification code qualifier C an..4
F 0014 Routing address C an..14
+

into (taken from the QRY definition)

EDIFMT EDI Segment Id 3
E0001 Syntax identifier 4
E0002 Syntax version number 1 0
E0004 Sender identification 35
E00071 Partner identification codequalifier 4
E0008 Address for reverse routing 14
E0010 Recipient identification 35
E00072 Partner identification codequalifier 4
E0014 Routing address 14


Today I just convert EDIfact into XML so EDIfact

UNB+UNOC:3+7080000426621:14+5790000251896:14+140324:1715+IC00039870++++
0++0'

becomes

<UNB>
<UNB1_1>UNOC</UNB1_1>
<UNB1_2>3</UNB1_2>
<UNB2_1>7080000426621</UNB2_1>
<UNB2_2>14</UNB2_2>
<UNB3_1>5790000251896</UNB3_1>
<UNB3_2>14</UNB3_2>
<UNB4_1>140321</UNB4_1>
<UNB4_2>1715</UNB4_2>
<UNB5_1>IC00039870</UNB5_1>
<UNB9_1>0</UNB9_1>
<UNB11_1>0</UNB11_1>
</UNB>

The same could be done with X12




On Sun, Mar 30, 2014 at 8:34 PM, Jack Tucky <jacktucky@xxxxxxxxx> wrote:

We are trying to move away from a 3rd party program that has failed to
work once we moved to V7R1. They have been unable to fix the problem for
over a month. Their "translator" as we use it really only receives a 256
character input string and separates it into numbered fields for each
element.

Other in house programs read the IFS file and adds CR/LF to write a 256
character flat file. Then the production code reads that file, calls the
translator for each segment, then moves those ISA fields to the production
database as needed.

Per Paul's response, I created duplicate data structures with fixed fields
and moved them one by one into the fixed fields and that looks like it is
working.

Alan, I would like to see your example code.

Thanks all for Sunday responses!

Jack

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Henrik Rützou
Sent: Sunday, March 30, 2014 2:03 PM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: Varying fields questions

your file will look like

ISA*00* *00* *ZZ*RECEIVERID *12*SENDERID
*100325*1113*U*00403*000011436*0*T*>~
GS*FA*RECEIVERID*SENDERID*20100325*1113*24712*X*004030~
ST*997*1136~
AK1*PO*142~
AK2*850*0142~
AK5*A~
AK9*A*1*1*1~
SE*6*1136~
GE*1*24712~
IEA*1*000011436~



On Sun, Mar 30, 2014 at 8:02 PM, Henrik Rützou <hr@xxxxxxxxxxxx> wrote:

The string is an EDI X12 string. The question are how much you need to
read in the entire document?


On Sun, Mar 30, 2014 at 7:32 PM, Alan Campin <alan0307d@xxxxxxxxx>
wrote:

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.


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




--
Regards,
Henrik Rützou

http://powerEXT.com <http://powerext.com/>





--
Regards,
Henrik Rützou

http://powerEXT.com <http://powerext.com/>
--
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.


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