Re: Euphoria and fixed field record formats .....
- Posted by Jonas Temple <jtemple at yhti.net> Nov 20, 2004
- 511 views
John Dutcher wrote: > > I am new but have used Euphoria very happily and > effectively for several projects and really like it. > > I am interested in how those who have a depth of knowledge do code to > handle fixed format data records usually viewed as structures as in > Cobol, Basic etc. I processed them in a CGI app using Euphoria by > just "slicing" every field from the record level "sequence"...but had > the luxury that all data was "text" or character. > > But consider a tiny sample Cobol created record: > 01 AAA. > character ---> 03 BBB pic x(12). > packed decimal ---> 03 CCC pic s9(5) comp-3. > zoned decimal ---> 03 DDD pic s999 display. > signed binary ---> 03 EEE pic s999 comp. > > This representative sequence often repeats in some pattern many times > per record. > > What is the "right" way to address these values after one has read > them into a sequence or object that is the result the I/O operation ? > Are the records in a database (i.e. Mainframe) or on the local PC? If it's on a mainframe are they flat files or do they have external descriptions? If the data is on the PC then you'll just have to substring the sequence to get the data. The trick is going to be converting the packed decimal into a Euphoria atom. I think there is an EBCDIC translation library somewhere in the archives that might help with the text stuff. I work on the AS/400 so I use Client Access to get to the database and CA has functions to convert from packed to a float. Jonas Temple http://www.yhti.net/~jktemple