View previous topic :: View next topic
|
Author |
Message |
sunnybunny
New User
Joined: 29 Nov 2005 Posts: 49
|
|
|
|
Hello all,
I have following requirement.
I have some set of file names. I need to know the following.
1. If dataset is GDG then need to know the current generation of file.
2. If dataset is not GDG then it should display as it is saying not a GDG file.
I am going to put all file names in one file as input and want to get output file with above mentioned two points.
Say my input file xxx.xxx.xxx contains following files.
a.a.a
b.b.b
c.c.c
output file need to have in following format
a.a.a is not a GDG file
b.b.b.G0012V00
c.c.c.G0009V00
Please help me on this.
Thanks
Ram |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
Write a Rexx exec that reads the DSNs from a file. For each DSN, do a LISTCAT, OUTTRAPping the results. If the first trapped line does not contain the token "GDG BASE", it is not a GDG; otherwise, parse the last line containing the token "NONVSAM" for the highest version number (won't work if any of your GDGs have wrapped, but this usually takes a while). |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Good Grief! How many times THIS YEAR has this sort of question been asked? |
|
Back to top |
|
|
sunnybunny
New User
Joined: 29 Nov 2005 Posts: 49
|
|
|
|
Hi
Thanks for your reply.
I am not familiar with REXX...I started learning it. Can you please help me with the REXX code for this.
Thanks
Ram. |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
sunnybunny wrote: |
Hi
Thanks for your reply.
I am not familiar with REXX...I started learning it. Can you please help me with the REXX code for this. |
Kids these days
The Rexx:
Code: |
/* Rexx */
/* Written Heisei 23.10.19 by Akatsukami-sama */
trace o
/* Allocation of TULIN and TULOUT must be done if exec is not run in */
/* the background. */
"EXECIO 1 DISKR TULIN"
do while (rc=0)
pull dsn .
x = outtrap("LC.")
"LISTCAT ENTRIES('"dsn"')"
x = outtrap("OFF")
if (pos("GDG BASE",lc.1)=0) then do
line = dsn "is not a GDG"
push line
"EXECIO 1 DISKW TULOUT"
end
else if (lc.0=2) then do
line = "No generations of" dsn
push line
"EXECIO 1 DISKW TULOUT"
end
else do
i = lc.0 - 1
parse var lc.i . . g
p = lastpos('.',g)
gen = substr(g,p+1)
push g
"EXECIO 1 DISKW TULOUT"
end
"EXECIO 1 DISKR TULIN"
end
/* If TULIN and TULOUT are allocated in the exec, they must also be */
/* freed in it. */
exit |
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Browse the forum for some likely-looking titles, try google. |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1042 Location: Richmond, Virginia
|
|
|
|
There's also IDCAMS LISTCAT.
Write the report to a file and write a program or other extraction method to parse the report. |
|
Back to top |
|
|
|