IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

GDG file Access in REXX


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Gay251319

New User


Joined: 17 Jun 2009
Posts: 57
Location: Kochi

PostPosted: Fri Nov 25, 2011 6:32 pm
Reply with quote

Hi,

To Access the normal dataset we are using like

Code:
"ALLOC DD(****) DA("*****") SHR REUSE"     
"EXECIO * DISKR **** (STEM OUDATA. FINIS)" 
"FREE F(KART)" 


but to use the GDG if I use

Code:
 ALLOCSTR="ALLOC DD(****) DA("****") SHR REUSE"         
      QUEUE "  DEF GDG (NAME(****) EMP NSCR LIM(255))"     
          "EXECIO "QUEUED()" DISKW (STEM INDATA. FINIS)"   
CALL BPXWDYN(ALLOCSTR)           

am getting DD positional parameter missing error . Can anyone please help me for the same .

Can anyone please help me for the same,, In the Queue What exactly I shld give,,
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Nov 25, 2011 6:34 pm
Reply with quote

You are mixing up things...
the ALLOC and the DEFine

and You are also mixing up the EXECIO parameters

what has the QUEUED() have to do with the STEM construct
the two things are normally used separately !

start over and do one thing at the time
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Nov 25, 2011 6:37 pm
Reply with quote

Might help if you explained what you are trying to achieve
Back to top
View user's profile Send private message
Gay251319

New User


Joined: 17 Jun 2009
Posts: 57
Location: Kochi

PostPosted: Mon Nov 28, 2011 8:18 am
Reply with quote

Hi,

I want to read the data from the dataset which is a GDG ..

Can you please help me for the same


Regards,
Gayathiri Ravi
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Nov 28, 2011 11:24 am
Reply with quote

Hello,

Quote:
Can you please help me for the same
Not until you post the code you tried and explain where you are stuck.

Running a trace would probably help as well.
Back to top
View user's profile Send private message
Gay251319

New User


Joined: 17 Jun 2009
Posts: 57
Location: Kochi

PostPosted: Mon Nov 28, 2011 11:38 am
Reply with quote

Hi,

To get the currrent version of the GDG I have tried this step ...

GDGDA = "****************************"
/*-- LIST ALL GDG ENTRIES FOR THIS DATASET. --*/
RECS= OUTTRAP(DATA.)
"LISTC ENT('"||GDGDA||"')"
RECS= OUTTRAP(OFF)

/*-- DETERMINE THE CURRENT GDG DATASET NAME --*/
TOT = DATA.0 -1
PARSE VAR DATA.TOT . . NAME
SAY 'DATASET==>' NAME

But to read the Datas from the current version of the GDG .. nomal read statement is not working,,, i.e ,,
"EXECIO * DISKR **** (STEM OUDATA. FINIS)"

So while serching thru some sites,, I get to know that I shld use QUEUE () parameter,,, As I am not having enough idea of the same,, Can anyone pls me for the same
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Mon Nov 28, 2011 1:12 pm
Reply with quote

Gay251319 wrote:
I want to read the data from the dataset which is a GDG ..

To get the currrent version of the GDG I have tried this step ...


As there is only ever ONE VERSION of a GDS perhaps you mean generations.

The whole GDG base, the 0 gen, the -1 gen, or what.

As I'm in a good mood so far, here's a snippet

Code:
GDG = "TEST.GDG"
DSN = STRIP(GDG||".G0000V00")               /* DEFAULT IF NOT EXIST  */
X=OUTTRAP(LST.)                             /* LISTCAT GDG BASE      */
" LISTC ENT('"GDG"')"
X=OUTTRAP(OFF)
DO A = LST.0 TO 1 BY -1                     /* FIRST FIND = 0 GEN    */
  IF POS('NONVSAM',LST.A) > 0 THEN DO
    DSN = SUBSTR(LST.A,POS('NONVSAM',LST.A)+13,44)
    A = 0
  END
END
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Mon Nov 28, 2011 7:32 pm
Reply with quote

Gayathiri, why aren't you just allocating the GDG as you normally would in your job that's using this REXX exec? Also, as an additional comment, reading the entire contents of a dataset into a stem variable is never a good idea unless you have some control over how much data is actually present.
Back to top
View user's profile Send private message
Gay251319

New User


Joined: 17 Jun 2009
Posts: 57
Location: Kochi

PostPosted: Wed Nov 30, 2011 8:45 am
Reply with quote

Hi,

Thanks all for ur valuable help..

Hi Superk,

" why aren't you just allocating the GDG as you normally would in your job that's using this REXX exec"

Can you tell this more clearly as I couldnt get exactly what you are meaning..

I always want to read the contents the current version of the GDG and do some process,, How it is possible ??????????
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Wed Nov 30, 2011 10:16 am
Reply with quote

Gayathiri, since I've been involved with this forum, there's been certain assumptions and standards applied here, which I know I've stated before. This forum is about REXX, not TSO or ISPF (there's a seperate forum for those). The assumption here is that the code is standard REXX and that it's running in batch or an environment outside of foreground TSO. If it's not, that fact needs to be clearly stated.

The REXX langauge, like most others, doesn't allocate the datasets. That function is left up to the operating system to manage. In that case, based on the basic assumptions of this forum, since you haven't stated otherwise, I have to presume that there is a job running your exec. In that job, you would use DD statements to refer to the Generation Data Set. That can be accomplished either by a relative definition:

//DDNAME DD DSN=TEST.GDG(0),DISP=SHR or something similar, which will give you the most current generation at that moment in time, or by using the explicit definition:

//DDNAME DD DSN=TEST.GDG.G0001V00,DISP=SHR or something similar.

For a process running outside of the batch environment, dealing with GDG's gets to be trickier. The TSO/E ALLOCATE command can only work with an explicit definition of a GDG. For these environments, if relative allocation of a GDG is required, then I've found that the BPXWDYN dynamic allocation routine can mamage these allocations. I created a topic on this:

www.ibmmainframes.com/viewtopic.php?t=24474

to describe my experience with this function.
Back to top
View user's profile Send private message
Gay251319

New User


Joined: 17 Jun 2009
Posts: 57
Location: Kochi

PostPosted: Thu Dec 01, 2011 4:41 pm
Reply with quote

Hi All,

Thanks a Lot for ur valuable solution
Back to top
View user's profile Send private message
rohanthengal

Active User


Joined: 19 Mar 2009
Posts: 206
Location: Globe, India

PostPosted: Thu Dec 08, 2011 10:30 am
Reply with quote

i have a similar problem:
i want to check the list of datasets if they are existing through REXX EXEC.
I am able to do this task for NON GDG datsets using below code:
Code:
 
/* REXX */                                                   
 "ALLOC DA('"MFID.REXX.INPUT"') F(ENTRIES) SHR REUSE" 
 "ALLOC DA('"MFID.REXX.OUTPUT"') F(OUTPUT) SHR REUSE" 
 "EXECIO * DISKR ENTRIES (STEM LIST. FINIS"                   
 DO I=1 TO LIST.0                                             
 PARSE VAR LIST.I INLIST ' '                                   
 CHK=SYSDSN("'"INLIST"'")                                     
 FOUND.I=INLIST||' = '||CHK                                   
 END                                                           
 "EXECIO * DISKW OUTPUT (STEM FOUND. FINIS"                   


But whenever i pass GDG latest generation / current generation in the input file, it says invalid dataset name:(just like shown below)

Code:
MFID.PJKS.BBG002I.ACCT.UNLOAD(0) - invalid dataset name


i guess my function
Code:
CHK=SYSDSN("'"INLIST"'") 
is not able to identify GDG generation.

Please let me know if any other mechanism to be used to do this job of checking if the gdg generation is cataloged.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Dec 08, 2011 1:25 pm
Reply with quote

So you should have started a new, similar, tiopic, with a link to this one if you felt the content is relevant (that's with the URL button).
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Dec 08, 2011 1:30 pm
Reply with quote

There is my code in the above post, Kevin has given a link to his code, and here you are asking how it's done icon_rolleyes.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 2
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top