Hi Marco

I'm not sure you need to declare something like an externally-defined DS - when you use JDBC I believe you have a result set, which has a collection (probably the wrong word) of the columns. ODBC has this kind of thing - the resutlset.Fields() collection. There are ways to get all the attributes, too.

Now you should look at jt400 - I have to think that there are constructs for handling data sets as you want.

HTH
Vern

On 12/2/2015 1:58 AM, Marco Facchinetti wrote:
Hi Jon, I'm sure I can read the file without problems, both using record
level access or via Sql (jdbc).

The problem I can see is how to emulate what I ordinary do in RPG: transfer
a string into an externally desrcibed DS:

dow not %eof();
read af2wk;
if %eof();
leave;
endif;
Select;
When AWDSOPE = 'Ds_w_StampaTesto';
Ds_w_StampaTesto = AWFLD;
When AWDSOPE = 'Ds_w_StampaBox';
Ds_w_StampaBox = AWFLD;
Ds_w_StampaBoxExtended = AWFLDEX;
....
endsl;
enddo;

How do I declare an external defined DS in Java?

TIA

--
Marco Facchinetti

Mr S.r.l.

Tel. 035 962885
Cel. 393 9620498

Skype: facchinettimarco

2015-12-01 19:55 GMT+01:00 Jon Paris <jon.paris@xxxxxxxxxxxxxx>:

It is not clear to me why you think you need to worry about column
positions etc.

Any externally described file on the IBM i can be treated as a database
table. So as a minimum you could perform data retrieval via a JDBC
connection.

Your best bet is probably to get the JT400 toolbox *
http://jt400.sourceforge.net/) and that gives you both record level and
SQL access to the table.

Is there a reason why that won’t work?


On Dec 1, 2015, at 4:55 AM, Marco Facchinetti <
marco.facchinetti@xxxxxxxxx> wrote:
Hi, as implied by the title I have to read (and use) this file (and
cannot
modify it) in a Java program:

A R AF2WK TEXT('Afpds: workfile')
A*
A AWIDDOC 5 0 TEXT('Id doc')
A AWIDPAG 10 0 TEXT('Id page')
A AWIDOPE 14 0 TEXT('Id')
A AWNMOPE 20 TEXT('Operation')
A AWDSOPE 40 TEXT('Ds name')

A AWFLD 256 VARLEN(30) CCSID(1144)
A AWFLDEX 32000 VARLEN(1) ALWNULL DFT('')
A CCSID(1144)
A*
A K AWIDDOC
A K AWIDPAG
A K AWIDOPE

I use in RPG programs AWFLD and AWFLDEX as DS:

dDs_w_StampaTesto...

d ds qualified

d h like(Ubase)
Pos. Hor.
d v like(Ubase)
Pos. Ver.
d punti 4s 1
Punti, serve?
d font 8
Font
d codepage 8
Code page
d Orientamento 3s 0
0/90/180/270
d Lunghezza 3s 0
Len testo stampa
d Colore 3s 0
Colore testo

so the code is very easy:

Select;
When AWDSOPE = 'Ds_w_StampaTesto';
Ds_w_StampaTesto = AWFLD;
...
Endsl;

So my question is: how to do the same in Java with hardcoding positions,
names and types?

TIA

--
Marco Facchinetti

Mr S.r.l.

Tel. 035 962885
Cel. 393 9620498

Skype: facchinettimarco
--
This is the Java Programming on and around the IBM i (JAVA400-L) mailing
list
To post a message email: JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.

Jon Paris

www.partner400.com
www.SystemiDeveloper.com

--
This is the Java Programming on and around the IBM i (JAVA400-L) mailing
list
To post a message email: JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2021 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.