* ABN Amro to end trade and financing operations

* To reduce risks after string of losses in offshore energy

* 800 job cuts as corporate bank retreats

* Q2 net loss of 5 million euros not as bad as forecast

AMSTERDAM, Aug 12 (Reuters) - ABN Amro is to end all trade and commodity financing after a string of losses, in a massive overhaul of its activities that will see the Dutch bank cut 800 jobs.

Shares in ABN, which had lost almost half their value this year, were up 6.8% at 0925 GMT after it said its corporate bank will retreat to northwest Europe, exiting the United States, Asia, Australia and Brazil, except for clearing operations.

"We are over-exposed to global sectors and we had more than our fair share of exceptional client files", Robert Swaak, who became chief executive in April, told reporters on Wednesday.

ABN, in which the Dutch state still has a 56% stake, will focus on areas where it has significant scale, he added, including local energy markets, where the European Union's "green deal" is expected to lead to huge demand for finance.

The restructuring will affect around 45% of client loans, worth 18 billion euros ($21 billion) and follows several failed attempts to increase the profitability of the corporate bank, which has grappled with losses in offshore energy markets.

"Finally what we wanted", Barclays analysts wrote in a note.

Several other European banks have been rethinking their trade and commodity finance operations, including Natixis and BNP Paribas after energy trading losses and a shift to greener finance initiatives.

IMPAIRMENTS

Write-offs at ABN's corporate bank hit 1.4 billion euros in the first half, up from 128 million euros a year before, as oil and gas sector loans soured along with the economic outlook and large Asian clients got into trouble.

In China, ABN was lead arranger of a $430 million syndicated loan for two companies under the Fangyuan group, which had liquidity problems last year.

It also had nearly $300 million in outstanding loans to Singapore-based Hin Leong Trading, whose founder admitted to hiding hundreds of millions of dollars in losses.

"This has been the higher risk and more volatile part of the bank, which is why we are choosing to wind it down", Chief Financial Officer Clifford Abrahams told Reuters.

The clearing and European parts which ABN aims to keep, however, were not without their own problems as impairments jumped to 591 million euros in the second quarter.

This was partly due to a "potential fraud case" in Germany, where ABN had a significant exposure to Wirecard.

ABN took a $200 million first quarter loss on clearing after a U.S. hedge fund missed its margin requirements.

ABN said impairments led to an overall net loss of 5 million euros in the second quarter, which was not as bad as analyst expectations for a loss of 46 million euros. ($1 = 0.8538 euros) (Reporting by Bart Meijer; Additional reporting by Tom Daly in Beijing and Roslan Khasawneh in Singapore; Editing by Tom Hogue, Stephen Coates, Louise Heavens and Alexander Smith)