Discussion:
How to Create a Generation Data Set via REXX?
(too old to reply)
Walls, Lucious G CONT , SITC
2005-06-22 03:16:44 UTC
Permalink
Hello,

I've just about given up trying to create a new generation data set using the TSO ALLOCATE command and the EXECIO command. Would someone provide a sample Rexx procedure that creates a new generation data set or point out the mistakes in the following one I created?


/* REXX */
/* THIS Pgm WILL read 10 records onto the data stack and then */
/* Write them to an output file using the rexx EXECIO command. */
/* P-L-E-A-S-E D-O-N-T D-E-L-E-T-E */
/*********************************************************************/
SAY "ENTER INPUT DATA SET NAME:"
SAY
PARSE EXTERNAL INFILE
IF INFILE = '' THEN DO
SAY "NO INPUT DATASET NAME ENTERED - ",
"PROGRAM TERMINATED!"
EXIT 12
END
SAY "ENTER OUTPUT DATA SET NAME:"
SAY
PARSE EXTERNAL OUTFILE
IF OUTFILE = '' THEN DO
SAY "NO OUTPUT DATASET NAME ENTERED - ",
"PROGRAM TERMINATED!"
EXIT 12
END
"NEWSTACK"
"ALLOCATE DSNAME('"INFILE"') DDNAME(INRECS) OLD"
SAY "NO OUTPUT DATASET NAME ENTERED - ",
"PROGRAM TERMINATED!"
EXIT 12
END
"NEWSTACK"
"ALLOCATE DSNAME('"INFILE"') DDNAME(INRECS) OLD"
"EXECIO 10 DISKR INRECS (FINIS"
QUEUE ""
"ALLOCATE DSNAME('"OUTFILE"') DDNAME(NEWGENR)",
"NEW CATALOG DSORG(PS) RECFM(F,B) LRECL(80) SPACE (1 1) TRACKS"
"EXECIO * DISKW NEWGENR (FINIS"
"DELSTACK"
"FREE DDNAME(INRECS NEWGENR)"
SELECT
WHEN RC=0 THEN
SAY "EXECIO COMMAND EXECUTED SUCCESSFULLY."
WHEN RC=2 THEN
SAY "EXECIO COMMAND DID NOT EXECUTE SUCCESSFULLY, ",
"BECAUSE THE DATA QUEUE IS EMPTY."
OTHERWISE DO
SAY "EXECIO COMMAND DID NOT EXECUTE SUCCESSFULLY."
SAY "EXECIO ERROR CODE IS - " RC
END
END

I got the following error message when I executed this REXX procedure:

IKJ56709I INVALID DATA SET NAME, 'ORPT.P.GHIT1AP4.GHR03CN1(+1)'
IKJ56701I MISSING DATA SET NAME OR *+
IKJ56701I MISSING NAME OF DATA SET TO BE ALLOCATED
IRX0555E The input or output file NEWGENR is not allocated. It cannot be opened
for I/O.
IRX0670E EXECIO error while trying to GET or PUT a record.
IKJ56247I FILE NEWGENR NOT FREED, IS NOT ALLOCATED
EXECIO COMMAND DID NOT EXECUTE SUCCESSFULLY.
EXECIO ERROR CODE IS - 12
***

Thanks,

Lucious Walls
SPAWAR ITC (Washington)
***@navy.mil
703-693-0940 DSN 223-0940

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
Robert Zenuk
2005-06-22 05:32:04 UTC
Permalink
TSO ALLOC does not support the relative generation number in a dataset name.
You have to translate the dataset name to the absolute generation dataset
name (goovoo).

When creating the next entry in a GDG, you can EITHER create the "plus 1"
generation in JCL using the XXX.YYY(+1) syntax OR you can create the next
goovoo (assuming you know it). When using REXX or CLIST, the only way to do this
is to create the next goovoo.

Here is a subroutine called GOOVOO that will return the goovoo DSN when
given a relative GDG DSN.

/*********************************************************************/
/* REXX */
/*********************************************************************/
/* Purpose: Return the GDS for a relative GDG */
/*-------------------------------------------------------------------*/
/* Syntax: dsn = goovoo(xxx.yyy(-2)) */
/*-------------------------------------------------------------------*/
/* Parms: relgdg - Fully qualified relative GDG DSN */
/* */
/*********************************************************************/
/* Change Log */
/* */
/* Author Date Reason */
/* -------- --------- ----------------------------------------- */
/* R. Zenuk Aug 2001 Initial Creation */
/* */
/*********************************************************************/
arg gdgbase
if gdgbase = '' then exit(99)
/*********************************************************************/
/* Parse the relative number if present, set to 0 if missing */
/*********************************************************************/
parse var gdgbase gdgbase '(' relgdg ')' .
if relgdg = '' then relgdg = 0
gdg = 0
/*********************************************************************/
/* Trap the LISTC output from a LISTC LVL(dsn) ALL */
/*********************************************************************/
x = outtrap(listc.)
"LISTC LVL('"gdgbase"') ALL"
/*********************************************************************/
/* Parse through output putting each GDS in a stem variable */
/*********************************************************************/
do i=1 to listc.0
if word(listc.i,1) = 'NONVSAM' then
do
gdg = gdg + 1
parse var listc.i . . dsn.gdg
end
else
do
iterate
end
end
/*********************************************************************/
/* Determine the offset within the stem and return the GDS */
/*********************************************************************/
absgdg = gdg + relgdg
select
when abs(relgdg) > gdg - 1 then
return 'INVALID'
/*********************************************************************/
/* Get and parse the GOOVOO and add the +n to it for new DSN's */
/*********************************************************************/
when relgdg > 0 then
do
goovoo = reverse(left(reverse(dsn.gdg),8))
parse var goovoo 'G' gen 'V' ver
gen = gen + relgdg
if gen = 10000 then
do
gen = 0
ver = ver + 1
end
goovoo = 'G'||right(gen,4,0)||'V'||right(ver,2,0)
return gdgbase||'.'||goovoo
end
otherwise return dsn.absgdg
end


This is a little tester routine for goovoo.


/* rexx - goovoo tester */
say goovoo('archive.daily.cics(-4)')
say goovoo('archive.daily.cics(-3)')
say goovoo('archive.daily.cics(-2)')
say goovoo('archive.daily.cics(-1)')
say goovoo('archive.daily.cics(0)')
say goovoo('archive.daily.cics(+1)')
say goovoo('archive.daily.cics(+2)')
say goovoo('archive.daily.cics(+3)')
say goovoo('archive.daily.cics(+4)')



Hope This Helps,

Rob

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
Richards.Bob
2005-06-22 06:40:15 UTC
Permalink
Or just get Doug Nadel's *REALNAME* or Lionel Dyck's *GDGALLOC* <g,d,&r>

Bob

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-***@VM.MARIST.EDU] On Behalf Of Robert Zenuk
Sent: Wednesday, June 22, 2005 1:32 AM
To: TSO-***@VM.MARIST.EDU
Subject: Re: How to Create a Generation Data Set via REXX?

TSO ALLOC does not support the relative generation number in a dataset name.
You have to translate the dataset name to the absolute generation dataset
name (goovoo).

When creating the next entry in a GDG, you can EITHER create the "plus 1"
generation in JCL using the XXX.YYY(+1) syntax OR you can create the next
goovoo (assuming you know it). When using REXX or CLIST, the only way to do this
is to create the next goovoo.

Here is a subroutine called GOOVOO that will return the goovoo DSN when
given a relative GDG DSN.

/*********************************************************************/
/* REXX */
/*********************************************************************/
/* Purpose: Return the GDS for a relative GDG */
/*-------------------------------------------------------------------*/
/* Syntax: dsn = goovoo(xxx.yyy(-2)) */
/*-------------------------------------------------------------------*/
/* Parms: relgdg - Fully qualified relative GDG DSN */
/* */
/*********************************************************************/
/* Change Log */
/* */
/* Author Date Reason */
/* -------- --------- ----------------------------------------- */
/* R. Zenuk Aug 2001 Initial Creation */
/* */
/*********************************************************************/
arg gdgbase
if gdgbase = '' then exit(99)
/*********************************************************************/
/* Parse the relative number if present, set to 0 if missing */
/*********************************************************************/
parse var gdgbase gdgbase '(' relgdg ')' .
if relgdg = '' then relgdg = 0
gdg = 0
/*********************************************************************/
/* Trap the LISTC output from a LISTC LVL(dsn) ALL */
/*********************************************************************/
x = outtrap(listc.)
"LISTC LVL('"gdgbase"') ALL"
/*********************************************************************/
/* Parse through output putting each GDS in a stem variable */
/*********************************************************************/
do i=1 to listc.0
if word(listc.i,1) = 'NONVSAM' then
do
gdg = gdg + 1
parse var listc.i . . dsn.gdg
end
else
do
iterate
end
end
/*********************************************************************/
/* Determine the offset within the stem and return the GDS */
/*********************************************************************/
absgdg = gdg + relgdg
select
when abs(relgdg) > gdg - 1 then
return 'INVALID'
/*********************************************************************/
/* Get and parse the GOOVOO and add the +n to it for new DSN's */
/*********************************************************************/
when relgdg > 0 then
do
goovoo = reverse(left(reverse(dsn.gdg),8))
parse var goovoo 'G' gen 'V' ver
gen = gen + relgdg
if gen = 10000 then
do
gen = 0
ver = ver + 1
end
goovoo = 'G'||right(gen,4,0)||'V'||right(ver,2,0)
return gdgbase||'.'||goovoo
end
otherwise return dsn.absgdg
end


This is a little tester routine for goovoo.


/* rexx - goovoo tester */
say goovoo('archive.daily.cics(-4)')
say goovoo('archive.daily.cics(-3)')
say goovoo('archive.daily.cics(-2)')
say goovoo('archive.daily.cics(-1)')
say goovoo('archive.daily.cics(0)')
say goovoo('archive.daily.cics(+1)')
say goovoo('archive.daily.cics(+2)')
say goovoo('archive.daily.cics(+3)')
say goovoo('archive.daily.cics(+4)')



LEGAL DISCLAIMER
The information transmitted is intended solely for the individual or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you have received this email in error please contact the sender and delete the material from any computer.

Seeing Beyond Money is a service mark of SunTrust Banks, Inc.
[ST:XCL]





----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
Walls, Lucious G CONT , SITC
2005-06-22 23:43:05 UTC
Permalink
Thanks Bob Richards and a special thanks to Robert for submitting the 'GOOVOO' Rexx routine. I incorporated 'GOOVOO' in my Rexx procedure and call it as a function. Returns the valid GDG for the Generation data set entered. Works like a charm.

Lucious Walls
SPAWAR ITC (Washington)
***@navy.mil
703-693-0940 DSN 223-0940


-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-***@VM.MARIST.EDU]On Behalf
Of Robert Zenuk
Sent: Wednesday, June 22, 2005 1:32 AM
To: TSO-***@VM.MARIST.EDU
Subject: Re: How to Create a Generation Data Set via REXX?


TSO ALLOC does not support the relative generation number in a dataset name.
You have to translate the dataset name to the absolute generation dataset
name (goovoo).

When creating the next entry in a GDG, you can EITHER create the "plus 1"
generation in JCL using the XXX.YYY(+1) syntax OR you can create the next
goovoo (assuming you know it). When using REXX or CLIST, the only way to do this
is to create the next goovoo.

Here is a subroutine called GOOVOO that will return the goovoo DSN when
given a relative GDG DSN.

/*********************************************************************/
/* REXX */
/*********************************************************************/
/* Purpose: Return the GDS for a relative GDG */
/*-------------------------------------------------------------------*/
/* Syntax: dsn = goovoo(xxx.yyy(-2)) */
/*-------------------------------------------------------------------*/
/* Parms: relgdg - Fully qualified relative GDG DSN */
/* */
/*********************************************************************/
/* Change Log */
/* */
/* Author Date Reason */
/* -------- --------- ----------------------------------------- */
/* R. Zenuk Aug 2001 Initial Creation */
/* */
/*********************************************************************/
arg gdgbase
if gdgbase = '' then exit(99)
/*********************************************************************/
/* Parse the relative number if present, set to 0 if missing */
/*********************************************************************/
parse var gdgbase gdgbase '(' relgdg ')' .
if relgdg = '' then relgdg = 0
gdg = 0
/*********************************************************************/
/* Trap the LISTC output from a LISTC LVL(dsn) ALL */
/*********************************************************************/
x = outtrap(listc.)
"LISTC LVL('"gdgbase"') ALL"
/*********************************************************************/
/* Parse through output putting each GDS in a stem variable */
/*********************************************************************/
do i=1 to listc.0
if word(listc.i,1) = 'NONVSAM' then
do
gdg = gdg + 1
parse var listc.i . . dsn.gdg
end
else
do
iterate
end
end
/*********************************************************************/
/* Determine the offset within the stem and return the GDS */
/*********************************************************************/
absgdg = gdg + relgdg
select
when abs(relgdg) > gdg - 1 then
return 'INVALID'
/*********************************************************************/
/* Get and parse the GOOVOO and add the +n to it for new DSN's */
/*********************************************************************/
when relgdg > 0 then
do
goovoo = reverse(left(reverse(dsn.gdg),8))
parse var goovoo 'G' gen 'V' ver
gen = gen + relgdg
if gen = 10000 then
do
gen = 0
ver = ver + 1
end
goovoo = 'G'||right(gen,4,0)||'V'||right(ver,2,0)
return gdgbase||'.'||goovoo
end
otherwise return dsn.absgdg
end


This is a little tester routine for goovoo.


/* rexx - goovoo tester */
say goovoo('archive.daily.cics(-4)')
say goovoo('archive.daily.cics(-3)')
say goovoo('archive.daily.cics(-2)')
say goovoo('archive.daily.cics(-1)')
say goovoo('archive.daily.cics(0)')
say goovoo('archive.daily.cics(+1)')
say goovoo('archive.daily.cics(+2)')
say goovoo('archive.daily.cics(+3)')
say goovoo('archive.daily.cics(+4)')



Hope This Helps,

Rob

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
Continue reading on narkive:
Search results for 'How to Create a Generation Data Set via REXX?' (Questions and Answers)
5
replies
what are programming languages?
started 2007-11-14 02:15:22 UTC
programming & design
Loading...