.NET "Record Layouts"... like Dibol?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
Below is sample output in x12 EDI format. I'm using vb.net to create this
output file but i'm not sure if .NET has any tools to make the coding more
organized and/or efficient. Right now the only way i can think to create
each segment is by hardcoding the different elements into a string. For
example, to create the N1 segment i'll do this:

Dim sN1 as string = "N1*IM*" & drv("importer_name") & "*" &
drv("consignee_code") & "*" & drv("consignee_name")

I would do this for each record. This looks a little clumsy and was
wondering if there's maybe a way to predefine these record layouts or create
a template or some sort which can be used to make things easier to read. I'm
used to working with Dibol where you can create record layouts for this kind
of stuff. Advice will be greatly appreciated. Thanks!

ISA*00* *00* *ZZ*SENDER *ZZ*CBP
*070822*0940*#*00501*000000001*0*T*:
GS*SF*SENDER*CBP*070822*0940*1*Y*005010
ST*333*0001
BGN*00*1234567-8*20070822*1005*LT**ET
V1*7777777*******L*S
N9*FC*FLR
N7*SCA1*1234567
N7*SCA2*9876543
N1*IM*Importer*93*99-999999900
N1*CN**93*99-999999900
N1*IU*SCA3
N9*BM*1111111111
N1*IU*MAEU
N9*MB*2222222222
N1*SE*SellerName1
N3*123 Seller Street
N4*SHENZHEN**518008*CN
N1*SE*SellerName2
N3*555 POS Avenue
N4*SHENZHEN**518008*CN
N1*BY*Buyer
N3*777 Buyer Boulevard
N4*Seattle*WA*98101*US
N1*ST*Buyer - Loc1
N3*555 Shipto Avenue
N4*Seattle*WA*98101*US
N1*X2*StuffingLoc
N3*333 StuffLoc Street
N4*SHENZHEN**518008*CN
N1*CS*ConsolidatorName
N3*999 Consolidator Court
N4*SHENZHEN**518008*CN
N1*ST*Buyer - Loc2
N3*987 Shipto Street
N4*Indianapolis*IN*98101*US
N1*MF*ManufacturerName1
N3*1357 Manufacturer Way
N4*SHENZHEN**518008*CN
TC2*A*HTSCD1
N1*CT*China*38*CN
TC2*A*HTSCD2
N1*CT*China*38*CN
N1*MF*ManufacturerName2
N3*555 Maker's Street
N4*TSIM SHA TSUI EAST KOWLOON***HK
TC2*A*HTSCD3
N1*CT*Hong Kong*38*HK
SE*46*0001
GE*1*1
IEA*1*000000001
 
Dim sN1 as string = "N1*IM*" & drv("importer_name") & "*" &
drv("consignee_code") & "*" & drv("consignee_name")

I would use a template String and a string.Format thus:
 
I wrote classes for each segment type and a class called X12Segment that
they all inherit from.
 
Back
Top