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


  • Subject: Re: Odp: Re: Data mapping
  • From: Marcin Sagan <itbamsag@xxxxxxxxx>
  • Date: Thu, 22 Mar 2001 08:46:22 +0100

Absolutely clear.
All incoming types (data) are text so it will be no problem

Thank You 

>>> Jim Langston <jlangston@conexfreight.com> 03/21 6:28  >>>
Wow, that message was full of typos and errors.

Okay, you create a lookup file.  This file would have 5 fields.
FileName, FieldName, Start, Length, Decimals, Type
The file would be keyed on FileName and FieldName.

When you read a record from your File1 and File2, you then do a chain to
the lookup file.  From this lookup file you will get the starting position
in the file buffer and the length of the field, and the type of the field.

You can then change the buffer of the file based on this info.

Select
When      Type = 'CHAR'
Eval      %SubSt(FileBuffer, Start, Length) = ReadValue
When      Type = 'ZONED'
Eval      %SubSt(FileBuffer, Start, Length) = EDIToZoned(ReadValue, Length, 
Decimals)
When      Type = 'PACKED'
Eval      %SubSt(FileBuffer, Start, Length) = EDIToPacked(ReadValue, Length, 
Decimals)
When
...
Other
*** Throw exception, unknown type ***
End If

EDIToField would be a routine you would create to convert a numeric value from
the format being read, to the format DB2 expects.

You may have to look at the Type from File2 and what Type it is being converted 
to
and figure out how to get different From and To types to work.

I hope this makes what I was trying to say a little more clear.

Regards,

Jim Langston

Jim Langston wrote:
> 
> Okay, say you have a 3rd field with 2 keys, FileName and FieldName.
> Each record would also contain Start and Length.
> 
> So...  You get a record from File1.  You look at your File2, and it says
> HD   2   CHR   LOGFILE   FLD2
> 
> Chain to this new key file you made on "LOGFILE" and "FLD2", and you would
> have a record,  LOGFILE    FLD2    32    10
> (32 being the starting position and 10 being the length).
> 
> Now, it is fairly simple to open up, or have open, the LOGFILE.  You would 
>have
> the buffer as one long character string.
> 
> Eval    %SubSt(LOGBUFF, 32, 10) = ReadVal
> 
> Creating your Keyfile is not as hard as you would think.  DSPFFD (Display File
> Field Description) to an Outfile.  Create your key file from that.
> 
> Regards,
> 
> Jim Langston
> 
> Marcin Sagan wrote:
> >
> > >>> "James W. Kilgore" <qappdsn@attglobal.net> 03/21 12:51  >>>
> > File 1 has a variable format string of data.  Sort of like a data queue.  
>It's just a character string of varying length.  Within the string (like the 
>first few positions) is there a code that let's you know what the string 
>identifier or format is?
> >
> > Exactly it is.
> >
> > >>>Is this a CGI application where each an every variable can have 
>different lengths or is it a fixed format?
> >
> > No, this is EDI aplication. And fixed format of variable/message is given 
>in format file.
> >
> > >>>Now when you talk about file 2, is it a list of from-to positions so you 
>can walk down the character string of file 1 and parse out the data or is file 
>2 an externally defined file that you can use in your program as a data 
>structure and parse by a simple MOVE command or is it a list of keyword/value 
>pairs to assist you in parsing?
> >
> > No, we know the data separator "+" and with this we can tokenize string. 
>File 2 contains description of each subsequent token. I will paste simplified 
>format of this file again:
> >
> > Tag      Element     Type    ..   Destination File   Destination Field
> > HDR         1        Num     ..     LOGFILE             FLD1
> > HDR         2        Char    ..     LOGFILE             FLD2
> > SND         1        Num     ..     ORDERS              FLD1
> > SND         2        Num     ..     ORDERS              FLD2
> > .
> > .
> > SND         N        Date    ..     ORDERS              FLDN
> > ADD         1        Num     ..     DETAILS             FLD1
> > .
> > .
> > ADD         N        Char    ..     DETAILS             FLDN
> > EOD         1        Num     ..     LOGFILE             FLD3
> >
> > The goal is to write data from message to files/fields specified in this 
>file 2
> >
> > Than You  James
> >                                                                             
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>                                        !
   !
>    !
> >    !
> >                                                                             
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>                                        !
   !
>    !
> >    !
> >
> > +---
> > | This is the RPG/400 Mailing List!
> > | To submit a new message, send your mail to RPG400-L@midrange.com.
> > | To subscribe to this list send email to RPG400-L-SUB@midrange.com.
> > | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
> > | Questions should be directed to the list owner/operator: 
>david@midrange.com 
> > +---
> +---
> | This is the RPG/400 Mailing List!
> | To submit a new message, send your mail to RPG400-L@midrange.com.
> | To subscribe to this list send email to RPG400-L-SUB@midrange.com.
> | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
> | Questions should be directed to the list owner/operator: david@midrange.com 
> +---
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com 
+---
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                               !
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                               !
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                               !
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                               !
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                               !
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                               !
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
           
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.