When using the QDBRTVSN, you can pass either the long or short name with
library or with special value *LIBL.
You'll get the long and short names as well as the library/schema in which
the file is found.
When searching the SYSTABLES view, you need to know whether it is a long or
short name and in which library the file is found.
If you don't pass the library you may get several files with the same name
in different libraries but you won't know which is the right one.
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
?Train people well enough so they can leave, treat them well enough so they
don't want to.? (Richard Branson)
-----Ursprüngliche Nachricht-----
Von: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im Auftrag von Rob
Berendt
Gesendet: Thursday, 29.12 2016 14:06
An: RPG programming on the IBM i (AS/400 and iSeries)
Betreff: Re: Long file names for external data structures
Bryan,
I sat on this email the first time but now I feel compelled to send it...
Will the use of that API allow my data structure to work, or is that just
some interesting trivia I can utilize if I have too much time on my hands
and decide that
select system_table_name
from qsys2.systables
where table_name='MEDIA_LIBRARY_INFO'
is too simple and there must be some api I can call to complicate that?
Rob Berendt
--
IBM Certified System Administrator - IBM i 6.1 Group Dekko Dept 1600 Mail
to: 2505 Dekko Drive
Garrett, IN 46738
Ship to: Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com
From: Bryan Dietz <bdietz400@xxxxxxxxx>
To: "RPG programming on the IBM i (AS/400 and iSeries)"
<rpg400-l@xxxxxxxxxxxx>
Date: 12/28/2016 05:19 PM
Subject: Re: Long file names for external data structures
Sent by: "RPG400-L" <rpg400-l-bounces@xxxxxxxxxxxx>
Here is a simple example of calling the API from CL
sorry for wordwrap still having issues with code.midrange.com
=======================================
CMD PROMPT('Get Short Name')
PARM KWD(LONG) TYPE(*CHAR) LEN(128) MIN(1) +
CHOICE('Long File Name') PROMPT('Long +
File Name')
PARM KWD(LIB) TYPE(*CHAR) LEN(10) DFT(*LIBL) +
CHOICE('Library Name, *LIBL') +
PROMPT('Library Name')
=============
PGM PARM(&LONGNAME &LIB)
DCL VAR(&OBJNAME) TYPE(*CHAR) LEN(20)
DCL VAR(&FILE) TYPE(*CHAR) STG(*DEFINED) LEN(10)
DEFVAR(&OBJNAME)
DCL VAR(&FLIB) TYPE(*CHAR) STG(*DEFINED) LEN(10)
DEFVAR(&OBJNAME 11)
DCL VAR(&LONGNAME) TYPE(*CHAR) LEN(128)
DCL VAR(&MSG) TYPE(*CHAR) LEN(128)
DCL VAR(&L_NME_LEN) TYPE(*INT) VALUE(128)
DCL VAR(&LIB) TYPE(*CHAR) LEN(10)
CALL PGM(QDBRTVSN) PARM(&OBJNAME &LONGNAME &L_NME_LEN &LIB 0)
CHGVAR VAR(&MSG) VALUE(&FLIB *TCAT '/' || &FILE)
Call QUILNGTX (&msg x'00000015' ' ' ' ' x'0000000000000000')
ENDPGM
=======================================
Rob Berendt wrote on 12/28/2016 3:52 PM:
Turns out that I did have to use the short name for extname here:
dcl-ds Media_library_info extname('MEDIA_INFO') qualified end-ds;
but if I modified that to
dcl-ds Media_library_info extname('MEDIA_INFO') qualified alias end-ds;
I could use the column long names like
fetch ... :Media_Library_Info.Device_Status
and not have to use their short names like
fetch ... :Media_Library_Info.Device_Sts
'alias' does not seem to apply to the extname
Rob Berendt
As an Amazon Associate we earn from qualifying purchases.