MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Allocating current GDG version in Rexx

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
Hilltop
Beginner


Joined: 14 Oct 2004
Posts: 62
Topics: 21

PostPosted: Thu Oct 14, 2004 2:55 pm    Post subject: GDG allocate problem Reply with quote

Hello,

I am new to this forum. I tried to allocate GDG current version in REXX and it is giving me RC 12. Could you please help.

Also after successful allocation, Is there any way to read from middle of the file instead using * in "EXECIO * DISKR INPUT( STEM IN. FINIS " . I know you can mention number to read from that line onwards.

Thanks. Smile in advance.
Back to top
View user's profile Send private message
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Thu Oct 14, 2004 3:21 pm    Post subject: Reply with quote

Hilltop, first of all, don't add a new subject to the end of another exising discussion. This should be opened as a new discussion.

First, you said
Quote:

I tried to allocate GDG current version in REXX and it is giving me RC 12.

I know of no REXX function or facility for allocating DD's. That process is handled by other environments. If the REXX is running in a batch environment (PGM=IRXJCL or PGM=IKJEFT0x), then the DD's are usually allocated within the JCL. If this is the case, then the JCL should be able to handle the GDG current generation dataset allocation easily:
Code:

//STEP0001 EXEC PGM=IRXJCL,PARM='%MYREXX'
//SYSPROC  DD DISP=SHR,DSN=MY.REXX.PDS
//SYSTSPRT DD SYSOUT=*
//SYSTSIN  DD DUMMY
//INFILE   DD DISP=SHR,DSN=MY.GDG(0)


If the REXX is running in a TSO/E environment, then the TSO "ALLOCATE" command can be used to allocate a DD statement. For a GDG, you would need to use the absolute generation number:
Code:

"ALLOC DD(INFILE) DA('MY.GDG.G0002V00') SHR REU"   
Back to top
View user's profile Send private message
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Thu Oct 14, 2004 3:35 pm    Post subject: Reply with quote

For the second part of your question, if you know the number of records, you can divide that number by 2, and start reading from that point:

Code:

/* REXX */
/ * reccnt is the total number of records */
. . .
halfway = reccnt % 2
"EXECIO * DISKR DDNAME "halfway" (STEM stemarray. FINIS"
. . .
Back to top
View user's profile Send private message
Hilltop
Beginner


Joined: 14 Oct 2004
Posts: 62
Topics: 21

PostPosted: Thu Oct 14, 2004 4:52 pm    Post subject: Reply with quote

Thanks Mr SuperK for your quick response.

from your response I came to know there is no way to ALLOC a current generation dataset in REXX. I was spending couple of days in searching for some kind of command to do that. Thanks again.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Thu Oct 14, 2004 6:25 pm    Post subject: Reply with quote

Hilltop,


Quote:

from your response I came to know there is no way to ALLOC a current generation dataset in REXX. I was spending couple of days in searching for some kind of command to do that.


Not exactly true. The following exec will successfully allocate the current generation

Code:

/* REXX*/                                             
GDG_NAME = 'YOUR GDG BASE'                         
CALL OUTTRAP DSLIST.                                 
ADDRESS "TSO"                                         
"LISTCAT ENT('"GDG_NAME"') ALL"                       
CALL GET_GDG_VER                                     
IF RC=0 THEN DO                                       
/* DISPLAY THE FULL NAME OF CURRENT VERSION */       
     SAY 'THE CURRENT GEN IS : ' CURR_GEN             
/* ALLOCATE THE CURRENT VERSION */       
     CALL ALLOC_CURR_GDGVER                           
      IF RC > 0 THEN DO                               
          SAY 'ALLOCATION FAILED FOR : ' CURR_GEN     
          SAY 'THE RETURN CODE IS    : ' RC
      END                                               
END                                                   

GET_GDG_VER:                                                   
/* THIS ROUTINE GETS THE CURRENT VERSION FOR THE GDG BASE*/     
/* READ THE TRAPPED OUTPUT OF LISTCAT BACKWARDS*/               
DO L = DSLIST.0 TO 1 BY -1                                     
  IF SUBSTR(DSLIST.L,4,12) = 'NONVSAM ----' THEN DO             
     GDGGEN = SUBSTR(DSLIST.L,34,8)                             
     CURR_GEN = GDG_NAME||'.'||GDGGEN                           
     CURR_GEN = STRIP(CURR_GEN)                                 
     RETURN                                                     
  END                                                           
END                                                             
                                                               
ALLOC_CURR_GDGVER :                                             
/* ROUTINE TO ALLOCATE CURRENT VERSION OF GDG */               
ADDRESS TSO                                                     
"ALLOC DSNAME('"CURR_GEN"') F(INDD) SHR REUSE"                 
RETURN                                                         
                                                               


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group