• Introducing Dark Mode! Switch by clicking on the lightbulb icon next to Search or by clicking on Default style at the bottom left of the page!

Extract a City and State from one fields using ER??

ErpRob

Well Known Member
I have an interface setup for the fed-ex shipment software. Therefore I provide a file
with various information, i.e. address, COD, Third party billing, etc. and get the
information back via an outbound file.

In the outbound file I get back the City and State in a combined field even though I
send two separate fields. I guess they combine it in the interface. I would like to
extract the city and state. The problem is that in ER you cannot sent the text
character to a DS and work backwards from a loop. How can I set something up. Normally
in the RPG world I would send it to a DS find the first blank after a text field was
found and work it out.

The purpose is if the shipping clerk changed the address because it was wrong. I would
to compare what was sent and update the drop shipment file (F4006) before invoicing.

Any help would be good and If I knew how to write a BSFN I could perhaps solve my
problem. But I do not know C at this time.

thanks
Rob
 

Larry_Jones

Legendary Poster
Hi Rob,

actually you can implement the backwards loop you want. Here's the psuedo code to do it:

Declare Numeric Variables - I'll call them evt_X and evt_Y
evt_Y = Length(RTRIM(BC_Address5," "))
evt_X = evt_Y
While evt_X > 0 and SubStr(BC_Address5,evt_X,1) <> " "
evt_X = evt_X - 1
End While
evt_City = SubStr(BC_Address5, evt_X+1, evt_Y - evt_X)

Cheers,


Larry Jones
ljones@wagstaff.com
OneWorld B733.1, SP 11.3
HPUX 11, Oracle SE 8.1.6
SandBox: OneWorld XE
 

Zoltan_Gyimesi

Legendary Poster
Rob, Larry

Larry is right, as usual.
Let me an addition.
If your state isn't represented by acronym then it can also contain
space character.
In this case examine the position of the state in the field.
If it starts always on the same position then you can use the "substr"
string function to extract it.
Be aware, the start position for substr is null based, the first
character is on the 0. position.

Assume the following:

Combined field length: 60
City resides on the first 40 character
State resides on the last 20 character

Pseudo code:

Declare string variables szCity and szState (min.40 and 20 length)
Combined field is already in szCityState field (60 length)

szCity = substr(szCityState, 0, 40)
rtrim(szCity, " ")
szState = substr(szCityState, 40, 20)
rtrim(szState, " ")

If your state isn represented by acronym and starts at fix position then
you can also use this method.

Regards,
Zoltán


> From: Larry_Jones [SMTP:ljones@wagstaff.com]
> Sent: Friday, March 23, 2001 00:13
> To: jdeowdevml@jdelist.com
> Subject: Re: Extract a City and State from one fields using ER??
>
> Hi Rob,
>
> actually you can implement the backwards loop you want. Here's the
> psuedo code to do it:
>
> Declare Numeric Variables - I'll call them evt_X and evt_Y
> evt_Y = Length(RTRIM(BC_Address5," "))
> evt_X = evt_Y
> While evt_X > 0 and SubStr(BC_Address5,evt_X,1) <> " "
> evt_X = evt_X - 1
> End While
> evt_City = SubStr(BC_Address5, evt_X+1, evt_Y - evt_X)
>
> Cheers,
>
>
> Larry Jones
> ljones@wagstaff.com
> OneWorld B733.1, SP 11.3
> HPUX 11, Oracle SE 8.1.6
> SandBox: OneWorld XE
> --------------------------
> Visit the forum to view this thread at:
> http://198.144.193.139/cgi-bin/wwwthreads/showflat.pl?Cat=&Board=OWDEV
> &Number=7852
> + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
> This is the JDEList One World / XE Developers Mailing List.
> Archives and information on how to SUBSCRIBE, and
> UNSUBSCRIBE can be found at http://www.JDELIST.com
> + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
>



B7332 SP11, ESU 4116422, Intel NT4, SQL 7 SP1
(working with B7321, B7331, XE too)
 
Top