|
We *used* to do something similar to this. Our old EDI software (which we scrapped 5 years ago) was Sterling Software's GENTRAN: Basic for DOS. It would output the EDI data in a file where all of the EDI elements had been expanded to fixed-length fields in a flat file. We would upload that file to our AS/400 and process it in an RPG program. The way I implemented that was I wrote a program that ran on the PC that would generate RPG source for all of the different segment types. and make a big SELEC group that moved the record data to the appopriate data structure based on the segment ID. Then I'd upload that source member to the iSeries... add the code that manipulated the data, etc. As I recall, the fields in the data structure were all set to alphanumeric so that I didn't have to deal with decimal data errors. I had subroutines (though, now I'd use subprocedures) that would do the data conversion when I needed it. To avoid problems in the namespace, I used the segment names followed by a number to name the fields... so I'd have something like this: D*************************************************** D* Segment N9 -- Reference Number D*************************************************** D dsSegN9 DS D* N901 = Reference Number Qualifier D wkN901 18 19 D* N902 = Reference Number D wkN902 20 49 D* N903 = Free-form Description D wkN903 50 94 D* N904 = Date D wkN904 95 100 D* N905 = Time D wkN905 101 108 D* N906 = Time Code D wkN906 109 110 I'm not sure if this longwinded tale helps you... but who knows? > > There are dozens of fields on each record type. I'm doing maintenance and > want to make this RPG IV so I can use reasonable names, etc. Unfortunately, > I need to use FIXNBR(*ZONED *INPUTPACKED) in order for it to run as-is. > This generates tens of thousands of messages in the job log as each > 'invalid' number is 'fixed'. Understand that for a 500 record type, the > program only references the 500 fields. > > I want something like: > d struc0001 ds > d sensType 3p 0 > d sensID 7p 0 > d roType 3p 0 > d roID 7p 0 > > d struc0360 ds > d sensType 3p 0 > d sensID 7p 0 > d roType 3p 0 > d roID 7p 0 > > But that won't compile because the same field is in a different DS. I could > use qualified, but as far as the calculations go, eval sensType=sensType0001 > isn't much different from eval sensType=struc0001.sensType. I still have to > copy all the fields by hand as it were. > > I have two goals: > 1) I don't want to use FIXNBR; so I'm separating the fields > into separate structures > 2) I'd rather use one set of names to describe the same fields; > not SEA500, SEA625, SEA364, but SEA. > > Since the input data is packed, I can't readily use the old standby I specs > because I can't specify the hex codes needed to recognise the packed fields. > I'm stuck, aren't I? It gets worse when having to support this back to > V4R5. Just thought I'd post a tale of woe on a rainy Northeast US Friday. > --buck
As an Amazon Associate we earn from qualifying purchases.
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.