Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
kris_vliegen
Partner - Creator III
Partner - Creator III

Do while with variable

Hello all,

I'm trying to load data from an Iseries.

And every bookyear is in another Company and also an other filepath(accesspath)

I have an excel with Year and CompanyNumber.

Boekjaar,     BoekLib

2011     11E

2012     12E

2013     13E

2014     14E

I have only need to refresh the last 2 years (current year and CurrentYear -1)

Now I need to do a select like this

select *

FROM S0678ADT.X62FIL13EO.PBP;

and

Select *

FROM S0678ADT.X62FIL14EO.PBP;

Here is an example of my script where my BoekLib (in Yellow) is empty...

How can I fill up "BoekLib"?

DOWHILE.PNG.png

Regards,

Kris

1 Solution

Accepted Solutions
marcus_sommer

$(TMP) is a string and need to write with quotes: '$(TMP)'.

- Marcus

View solution in original post

11 Replies
marcus_sommer

You could use peek('BoekLib', $(vFileNo), 'Lib') to run and read your Lib-Table.

- Marcus

alexandros17
Partner - Champion III
Partner - Champion III

After your FOR iinstruction write:

LET TMP = Peek('BoekLib',$(vFileNo)-1,'Lib'');

then replace your yellow BoekLib with $(TMP)

Let me know ...

kris_vliegen
Partner - Creator III
Partner - Creator III
Author

Thanks for te response.

I've made this script but I get an error (see below)

Dow1.PNG.png

Error:

DowError.PNG.png

marcus_sommer

$(TMP) is a string and need to write with quotes: '$(TMP)'.

- Marcus

alexandros17
Partner - Champion III
Partner - Champion III

LET vFileName = 'S0678ADT.X62FIL$(TMP)=.PBP'

kris_vliegen
Partner - Creator III
Partner - Creator III
Author

Thanks!

But I was expecting he was only giving the yellow records...

tabeldow.PNG.png

marcus_sommer

It seems that in your Lib-Table are more/other values as you expect - perhaps you need to extend your where-clause.

- Marcus

kris_vliegen
Partner - Creator III
Partner - Creator III
Author

It's working fine. I was linking some data in the table that wasn't matching.

kris_vliegen
Partner - Creator III
Partner - Creator III
Author

Hi All,

Everything was working fine.

But if I try to use it for another file I get some strange things...

Fot the file PBD he is filling one table "PBD

ResultPBD1.PNG.png

If I do the same for the PBP file he is making 2 tables PBP and PBP-1

Why is he doing this

ResiltPBP1.PNG.png

And this is the excel I'm using for both the scripts

Excel.PNG.png