Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using ISPF 3.16 (Table export) in a REXX program

551 views
Skip to first unread message

Jürgen Kehr

unread,
Jun 23, 2010, 10:40:44 AM6/23/10
to
Hello,

is there anywhere out someone, who has an example how to use ISPF option
3.16 in a REXX program instead of using in online. This would be very
helpful to build an application which should export a given table regulary.

Thanks in advance for any help.

--

Freundliche Gruesse / Kind regards

Dipl. Math. Juergen Kehr

IT Schulung & Beratung, IT Education + Consulting

Rengershaeuser Str. 28

34132 Kassel

Germany

Tel. +49-561-9528788

Fax +49-561-9528789

Mobil +49-172-5129389

ICQ 292-318-696 (JKehr)

mailto:KehrJ...@t-online.de

mailto:KehrJ...@JKehr.de

Steve Comstock

unread,
Jun 23, 2010, 11:34:33 AM6/23/10
to
Jürgen Kehr wrote:
> Hello,
>
> is there anywhere out someone, who has an example how to use ISPF option
> 3.16 in a REXX program instead of using in online. This would be very
> helpful to build an application which should export a given table regulary.
>
> Thanks in advance for any help.
>

Well, there doesn't seem to be a callable service available. But
it looks like 3.16 lets you import table data, not export.

In any case, you should be able to use ISPF table services to
accomplish the function you need on your own, from a REXX-driven
dialog.


<ad>
Our five day course, "Developing Dialog Manager Applications in z/OS"
should help with this. It covers virtually all the callable services
and uses both CLIST and REXX in all examples and labs (you choose the
language to use).

More details at:

http://www.trainersfriend.com/TSO_Clist_REXX_Dialog_Mgr/a810descrpt.htm

(Follow the link "course outline" for even more details).

</ad>

--

Kind regards,

-Steve Comstock
The Trainer's Friend, Inc.

303-393-8716
http://www.trainersfriend.com

* To get a good Return on your Investment, first make an investment!
+ Training your people is an excellent investment

Pedro Vera

unread,
Jun 23, 2010, 12:52:38 PM6/23/10
to
I am not sure what you mean by 'export a table'. Please elaborate.
Normally, the table is a member of the ISPTLIB concatenation. You should
be be able to make a copy if it with IEBCOPY and then do whatever you want
with it.

> you should be able to use ISPF table services

I agree. If you want to make a copy of a table that is currently open,
you can use the TBSAVE service. You can direct it to another dataset or
save it under a different name.


Pedro Vera
IMS Tools
http://www.ibm.com/software/data/db2imstools/products/ims-tools.html

Rob Zenuk

unread,
Jun 23, 2010, 1:25:31 PM6/23/10
to
Here are the basics for an unload program. This was a quick and dirty
program I wrote a while back... This one unloads an ISPF table to a CSV file.

000001 /* rexx TBCSV - unload a table to a CSV file */

000002 arg table

000003 address ISPEXEC "QTABOPEN LIST(TABLES)"

000004 if wordpos(table,tables) = 0 then

000005 address ISPEXEC "TBOPEN" table "NOWRITE"

000006 address ISPEXEC "TBQUERY" table "KEYS(KEYS) NAMES(NAMES)
ROWNUM(ROWS)"
000007 parse var keys '(' keys ')'

000008 parse var names '(' names ')'

000009 say 'TABLE :' table

000010 say 'KEYS :' keys

000011 say 'NAMES :' names

000012 say 'ROWS :' rows

000013 rowlen = 0

000014 do i=1 to rows

000015 csv.i = ''

000016 address ISPEXEC "TBSKIP" table

000017 address ISPEXEC "TBGET" table

000018 do k=1 to words(keys)

000019 csv.i = csv.i||',"'||value(word(keys,k))||'"'

000020 end

000021 do n=1 to words(names)

000022 csv.i = csv.i||',"'||value(word(names,n))||'"'

000023 end

000024 csv.i = strip(strip(csv.i,'L',","))

000025 rowlen = max(length(csv.i),rowlen)

000026 end

000027 say 'ROWLEN:' rowlen

000028 bytes = rows * rowlen

000029 tracks = trunc(bytes / 55000) + 1

000030 cylinders = trunc(tracks / 15) + 1

000031 if cylinders = 1 then

000032 spacetype = 'TRACKS'

000033 else

000034 spacetype = 'CYLINDERS'

000035 address ISPEXEC "TBEND" table

000036 unloadsn = userid()'.TBCSV.'table

000037 address TSO "ALLOC F(CSV) DA('"unloadsn"') LRECL("rowlen")",

000038 "SPACE("value(spacetype)")" spacetype "NEW CATALOG",

000039 "UNIT(SYSDA) RECFM(F B)"

000040 EXITRC = RC

000041 if EXITRC <> 0 then say 'ALLOC error on' unloadsn', RC='RC

000042 address TSO "EXECIO * DISKW CSV (STEM CSV. FINIS"

000043 EXITRC = RC

000044 if EXITRC <> 0 then say 'EXECIO error on' unloadsn', RC='RC

000045 address TSO "FREE F(CSV)"

000046 if EXITRC = 0 then say rows 'rows successfully loaded into'
unloadsn


Rob




In a message dated 6/23/2010 7:40:03 A.M. US Mountain Standard Time,
kehrj...@T-ONLINE.DE writes:

Hello,

is there anywhere out someone, who has an example how to use ISPF option
3.16 in a REXX program instead of using in online. This would be very
helpful to build an application which should export a given table regulary.

Thanks in advance for any help.

--

Jürgen Kehr

unread,
Jun 23, 2010, 1:48:18 PM6/23/10
to
Hello,

Am 23.06.2010 17:33, schrieb Steve Comstock:
>
> Well, there doesn't seem to be a callable service available. But
> it looks like 3.16 lets you import table data, not export.

thanks for your fast answer. Function 3.16 in fact does allow table
EXPORT ! Try the EXPORT command, otherwise the import wouldn't make much
sense anyway.
BTW: If you hold ISPF training classes, you should know that EXPORT is
although available. ;-)

>
> In any case, you should be able to use ISPF table services to
> accomplish the function you need on your own, from a REXX-driven
> dialog.
>

Of course I know that I can write a routine using ISPF table services to
export or import a table to a dataset, but using function 3.6. allows to
have a standard import/export format independant of the actual table
structure and I only want to reinvent the wheel.

Steve Comstock

unread,
Jun 23, 2010, 2:10:54 PM6/23/10
to
Jürgen Kehr wrote:
> Hello,
>
> Am 23.06.2010 17:33, schrieb Steve Comstock:
>>
>> Well, there doesn't seem to be a callable service available. But
>> it looks like 3.16 lets you import table data, not export.
>
> thanks for your fast answer. Function 3.16 in fact does allow table
> EXPORT ! Try the EXPORT command, otherwise the import wouldn't make much
> sense anyway.
> BTW: If you hold ISPF training classes, you should know that EXPORT is
> although available. ;-)

Wow! Guess what: my reply was based at just looking at the
ISPF 3.16 screen, since it was available at the moment.

But based on your comment I went and looked at my ISPF course
and it has a whole chapter (20 pages)on 3.16 including importing
and exporting tables and even a lab on using. It's been a year
since I wrote that chapter so I even forgot I had it in there.
Good on me!


>
>>
>> In any case, you should be able to use ISPF table services to
>> accomplish the function you need on your own, from a REXX-driven
>> dialog.
>>
>
> Of course I know that I can write a routine using ISPF table services to
> export or import a table to a dataset, but using function 3.6. allows to
> have a standard import/export format independant of the actual table
> structure and I only want to reinvent the wheel.

It seems to be the case that the ISPF group often puts out a new
function as an ISPF option and then in one or two releases puts
out an ISPF service to allow non-IBM developers access to the
service. Maybe in z/OS 1.12?

Good luck.

James Campbell

unread,
Jun 24, 2010, 8:26:24 AM6/24/10
to
Just a word of warning to anyone writing code like Rob's - consider what would happen if one
of the fields in the table was named TABLE, KEYS, K, NAMES, N, ROWLEN, or I.

Certainly as Q+D code that you use yourself it's pretty easy to fix the code if an error occurs.
But for myself I try to use REXX variable names that contain a non-ISPF valid character (!)
when it's possible that a random ISPF variable could enter the mix. So code below would
become:

...


address ISPEXEC "TBQUERY" table "KEYS(KEYS) NAMES(NAMES) ROWNUM(ROWS)"

parse var keys '(' !keys ')'
parse var names '(' !names ')'
!table = table
!rows = rows
say 'TABLE :' !table
say 'KEYS :' !keys
say 'NAMES :' !names
say 'ROWS :' !rows
!rowlen = 0
do !i=1 to !rows
csv.!i = ''
address ISPEXEC "TBSKIP" !table "SAVENAME(EXTRAS) NOREAD"
!extras = extras
address ISPEXEC "TBSKIP" !table "NUMBER(0)"
do !k=1 to words(!keys)
csv.!i = csv.!i||',"'||value(word(!keys,!k))||'"'
end
...

(I've also added code to get any 'extra' columns in a row, how you would handle that in a
CSV unload is left to your imagination.)

James Campbell

> Date: Wed, 23 Jun 2010 13:24:32 EDT
> From: Rob Zenuk <Robz...@AOL.COM>

....

Paul Gilmartin

unread,
Jun 24, 2010, 10:12:44 AM6/24/10
to
On Jun 24, 2010, at 06:25, James Campbell wrote:

> Just a word of warning to anyone writing code like Rob's - consider what would happen if one
> of the fields in the table was named TABLE, KEYS, K, NAMES, N, ROWLEN, or I.
>
> Certainly as Q+D code that you use yourself it's pretty easy to fix the code if an error occurs.
> But for myself I try to use REXX variable names that contain a non-ISPF valid character (!)
> when it's possible that a random ISPF variable could enter the mix. So code below would
> become:
>

ISPF really ought to provide a "stem" capability as
better-designed Rexx APIs do.

-- gil

0 new messages