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

More GDG generation creation date


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

New User


Joined: 25 Aug 2009
Posts: 12
Location: india

PostPosted: Wed Apr 14, 2010 6:15 pm
Reply with quote

Hi,
I am new to rexx and using the code snippet given by Escapa in the topic GDG generation creation date.
I am trying to find creation date for gdg generation using LMDLIST command and gdg is on Tape.I am getting proper output if dataset is not on Tape.
If I am passing value "XXXXXX.XXXXX204.N01.GXX00V00" for 'lvl' paramter then on executing the rexx exec,receiving rc=0 under prompt as:
Name Prompt
_______ RXDATE *RC=0

and If I pass lvl = "xxxxxx.xxxxx204.N01(-230) then receiving ouput as :-
*************************************************
* ISRLD006
*
* Invalid data set level
* Qualifiers cannot be longer than 8 characters.
*
*
*
The purpose will be finish if I could get the output by passing value as :
lvl = "xxxxxx.xxxxx204.N01(-230).
Please help....

Thanks.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Wed Apr 14, 2010 6:35 pm
Reply with quote

Because you can not use the relative generation. You will need to find the absolute generation and use that in LMDLIST.

This has been discussed before on the forum because I
a) Contributed to the thread
b) Copied another solution where another forum member had posted
Back to top
View user's profile Send private message
valyk

Active User


Joined: 16 Apr 2008
Posts: 104
Location: South Carolina

PostPosted: Thu Apr 15, 2010 1:47 am
Reply with quote

Try something like this to find the absolute generation from a relative offset:

Code:
ADDRESS TSO
X=OUTTRAP(MEMBERS.)
"LISTC ENT('YOUR.GDG.BASE')"
X=OUTTRAP(OFF)

GEN = ABS(GEN)
CNT = 0

DO I = MEMBERS.0 - 1 TO 3 BY - 2
  GDG = SUBWORD(MEMBERS.I,3)
  CNT = CNT + 1

  IF CNT = GEN THEN
    LEAVE
END I

SAY GDG


Your input will be GEN. GEN will be the relative offset, ie -230. After the loop, GDG will contain the absolute dataset name.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Thu Apr 15, 2010 11:36 am
Reply with quote

valyk

Your code doesn't work, I tried it using -1 as the required generation and it resulted in -2.

In fact I tried it again after adding a few more generations and it then gave the -5 generation.

In fact both times it resulted in the lowest generation number available.

please DO NOT post code that does not work.
Back to top
View user's profile Send private message
Satya06

New User


Joined: 25 Aug 2009
Posts: 12
Location: india

PostPosted: Thu Apr 15, 2010 1:07 pm
Reply with quote

Hi expat,
I tried to find required thread now and before posting the query as well but didn't get any.It will be great if u can suggest more in this.
Here I had requirement to pass the creation date of GDG generation as a suffix of new dataset and source dataset is on Tape.If I pass the relative generation one time then its absolute value will be changing day by day and I can get the creation date accordingly.
If I use LMDLIST command for dataset on DASD then its reponding fine but not for tape dataset.
Please guide....
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Thu Apr 15, 2010 1:53 pm
Reply with quote

Click HERE icon_cool.gif
Back to top
View user's profile Send private message
Satya06

New User


Joined: 25 Aug 2009
Posts: 12
Location: india

PostPosted: Thu Apr 15, 2010 6:08 pm
Reply with quote

Thanks Expat...
I got about absolute generation but still base questin is unanswered(How to find creation date for gdg generation which is on Tape).and will LMDLIST returns the date in julian or gregorian format.i want it in gregorian format(I.e. YYMMDD)
please guide for this as well.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Thu Apr 15, 2010 6:12 pm
Reply with quote

Ok, so now you know the absolute generation, you can invoke LISTCAT from withing the same REXX code and get the creation date from there.

Will you run this in batch or online ?
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Thu Apr 15, 2010 6:49 pm
Reply with quote

Ok, I am in a really good mood at the moment, and have spent a couple of minutes tweaking something that I had written a few years ago.

This REXX code will give you the absolute generation using the GDG base and a relative value, and also the creation date of the selected generation.

The JCL
Code:
//STEP0010 EXEC PGM=IKJEFT01,           
//         PARM='Member GDGbase relative'
//SYSEXEC  DD DSN=Your REXX library,DISP=SHR     
//SYSOUT   DD SYSOUT=*                 
//SYSTSPRT DD SYSOUT=*                 
//SYSTSIN  DD DUMMY                     


The REXX
Code:
/* REXX ** CREATION DATE                                             */
ARG BASE RGEN .
IF RGEN = ''
   THEN RGEN = 0
KEY = SUBSTR(BASE||".*",1,44)
CNT = 0
MODRSNRC = SUBSTR(' ',1,4)
CSIFILTK = SUBSTR(KEY,1,44)
CSICATNM = SUBSTR(' ',1,44)
CSIRESNM = SUBSTR(' ',1,44)
CSIDTYPS = 'H               '
CSICLDI  = SUBSTR('Y',1,1)
CSIRESUM = SUBSTR(' ',1,1)
CSIS1CAT = SUBSTR(' ',1,1)
CSIRESRV = SUBSTR(' ',1,1)
CSINUMEN = '0001'X
CSIFLD1  = 'DSCRDT2 '
CSIOPTS  = CSICLDI || CSIRESUM || CSIS1CAT || CSIRESRV
CSIFIELD = CSIFILTK || CSICATNM || CSIRESNM || CSIDTYPS || CSIOPTS
CSIFIELD = CSIFIELD || CSINUMEN || CSIFLD1
WORKLEN = 64000
DWORK = '0000FA00'X || COPIES('00'X,WORKLEN-4)
RESUME = 'Y'
CATNAMET = SUBSTR(' ',1,44)
DNAMET = SUBSTR(' ',1,44)
DO WHILE RESUME = 'Y'
 ADDRESS LINKPGM 'IGGCSI00  MODRSNRC  CSIFIELD  DWORK'
 RESUME = SUBSTR(CSIFIELD,150,1)
 USEDLEN = C2D(SUBSTR(DWORK,9,4))
 POS1=15
 DO WHILE POS1 < USEDLEN
   IF SUBSTR(DWORK,POS1+1,1) = '0'
    THEN POS1 = POS1 + 50
   DNAME = SUBSTR(DWORK,POS1+2,44)
    POS1 = POS1 + 46
    POS2 = POS1 +  6
    TES01   = C2X(SUBSTR(DWORK,POS2,4))
    CRCENT  = SUBSTR(TES01,7,2)
    CRYEAR  = SUBSTR(TES01,1,2)
    CRDATE  = SUBSTR(TES01,3,3)
    CRJUL   = STRIP(CRYEAR)||STRIP(CRDATE)
    IF CRCENT <> 'FF' & CRJUL <> '00000' THEN DO
      CRSTD   = DATE('S',CRJUL,'J')
    END
    IF DNAMET <> DNAME THEN DO
     DNAMET=DNAME
      IF CRCENT <> 'FF' & CRJUL <> '00000' THEN DO
        CNT = CNT + 1
        GDGLST.CNT = DNAME CRSTD
      END
    END
    POS1 = POS1 + C2D(SUBSTR(DWORK,POS1,2))
  END
END
GDGLST.0 = CNT
IF RGEN <> 0
   THEN IF RGEN * -1 > CNT - 1
      THEN DO
         SAY "GENERATION "RGEN" DOES NOT EXIST"
         EXIT
      END
IF RGEN = 0
   THEN RGEN = CNT
   ELSE RGEN = CNT - (RGEN * -1)
SAY GDGLST.RGEN
Back to top
View user's profile Send private message
Satya06

New User


Joined: 25 Aug 2009
Posts: 12
Location: india

PostPosted: Thu Apr 15, 2010 7:52 pm
Reply with quote

Thanks a lot Expat.....
As I am running short of time this time,I had executed this code and its jcl gave maxcc=0 ,but how can i see the output.(as per my limited knowledge in Rexx,we can see output on tso screen only and I had checked logs as well for this job but didn't find output.Can you help in this as well.
I'll try to learn more about terms used in this code so next time I can use my hand before calling you for help.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Thu Apr 15, 2010 7:59 pm
Reply with quote

The result will be displayed in the SYSTSPRT output. If you have problems, post the job that you submitted and the output from it.
satya06 wrote:
I'll try to learn more about terms used in this code so next time I can use my hand before calling you for help.
Aaaaah, if only more were like that icon_biggrin.gif
Back to top
View user's profile Send private message
Satya06

New User


Joined: 25 Aug 2009
Posts: 12
Location: india

PostPosted: Thu Apr 15, 2010 8:12 pm
Reply with quote

Hi,
Sorry posted the query in a diffrent way.I had submitted above stated jcl only and checking the ouput in spool.
I got the output but its not coming with creation date.
Output came as :-
******************************** Top of Data *****************
ABSOLUTE GENERATION FOR -248 IS XXXXXX.XXXXX204.N01.GXXXXV00
READY
END
******************************* Bottom of Data **************

Next query is as I need to pass the gen no only one time and day by day its absolute value will be changing so the creation date accordingly.So by keeping this in mind can we make the code less lenthy......
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Fri Apr 16, 2010 11:31 am
Reply with quote

You need to run the code and batch job shown in the latest example.

The example in the linked topic does not supply the creation date.
Back to top
View user's profile Send private message
Satya06

New User


Joined: 25 Aug 2009
Posts: 12
Location: india

PostPosted: Mon Apr 19, 2010 4:53 pm
Reply with quote

Hi Expat,
I executed above mentioned code and its working fine to get absolute generation.
I had searched more for required code which can help to find creation date of gdg generation and I got it as well (I'll post it later as complete issue resolved) but in that code LISTCAT command is used for creation date.Now I had query as:-
1. Can we use relative generation with LISTCAT command as I am getting maxcc=12,if tried to use and out put is coming as:
LISTCAT LEVEL(XXXXXX.XXXXX204.N01(-240)) -

IDC3203I ITEM 'XXXXXX.XXXXX204.N01(' DOES NOT ADHERE TO RESTRICTIONS

ALL

IDC3202I ABOVE TEXT BYPASSED UNTIL NEXT COMMAND. CONDITION CODE IS 12

If it can be done,then please suggest required parameters.

Note:- we can't use LISTDSI command as dataset is on Tape. &
With absolute generation,LISTCAT is working fine.

2. Is REXX is only solution to get the absolute generation from relative generation(using above mentioned code from Expat) and then use LISTCAT command to get creation date.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Mon Apr 19, 2010 5:03 pm
Reply with quote

This is the code that you should be running.
Output comes as
Code:
GDG_base_name.GnnnnV00                         yyyymmdd
READY                                               
END


expat wrote:
OK, I am in a really good mood at the moment, and have spent a couple of minutes tweaking something that I had written a few years ago.

This REXX code will give you the absolute generation using the GDG base and a relative value, and also the creation date of the selected generation.

The JCL
Code:
//STEP0010 EXEC PGM=IKJEFT01,           
//         PARM='Member GDGbase relative'
//SYSEXEC  DD DSN=Your REXX library,DISP=SHR     
//SYSOUT   DD SYSOUT=*                 
//SYSTSPRT DD SYSOUT=*                 
//SYSTSIN  DD DUMMY                     


The REXX
Code:
/* REXX ** CREATION DATE                                             */
ARG BASE RGEN .
IF RGEN = ''
   THEN RGEN = 0
KEY = SUBSTR(BASE||".*",1,44)
CNT = 0
MODRSNRC = SUBSTR(' ',1,4)
CSIFILTK = SUBSTR(KEY,1,44)
CSICATNM = SUBSTR(' ',1,44)
CSIRESNM = SUBSTR(' ',1,44)
CSIDTYPS = 'H               '
CSICLDI  = SUBSTR('Y',1,1)
CSIRESUM = SUBSTR(' ',1,1)
CSIS1CAT = SUBSTR(' ',1,1)
CSIRESRV = SUBSTR(' ',1,1)
CSINUMEN = '0001'X
CSIFLD1  = 'DSCRDT2 '
CSIOPTS  = CSICLDI || CSIRESUM || CSIS1CAT || CSIRESRV
CSIFIELD = CSIFILTK || CSICATNM || CSIRESNM || CSIDTYPS || CSIOPTS
CSIFIELD = CSIFIELD || CSINUMEN || CSIFLD1
WORKLEN = 64000
DWORK = '0000FA00'X || COPIES('00'X,WORKLEN-4)
RESUME = 'Y'
CATNAMET = SUBSTR(' ',1,44)
DNAMET = SUBSTR(' ',1,44)
DO WHILE RESUME = 'Y'
 ADDRESS LINKPGM 'IGGCSI00  MODRSNRC  CSIFIELD  DWORK'
 RESUME = SUBSTR(CSIFIELD,150,1)
 USEDLEN = C2D(SUBSTR(DWORK,9,4))
 POS1=15
 DO WHILE POS1 < USEDLEN
   IF SUBSTR(DWORK,POS1+1,1) = '0'
    THEN POS1 = POS1 + 50
   DNAME = SUBSTR(DWORK,POS1+2,44)
    POS1 = POS1 + 46
    POS2 = POS1 +  6
    TES01   = C2X(SUBSTR(DWORK,POS2,4))
    CRCENT  = SUBSTR(TES01,7,2)
    CRYEAR  = SUBSTR(TES01,1,2)
    CRDATE  = SUBSTR(TES01,3,3)
    CRJUL   = STRIP(CRYEAR)||STRIP(CRDATE)
    IF CRCENT <> 'FF' & CRJUL <> '00000' THEN DO
      CRSTD   = DATE('S',CRJUL,'J')
    END
    IF DNAMET <> DNAME THEN DO
     DNAMET=DNAME
      IF CRCENT <> 'FF' & CRJUL <> '00000' THEN DO
        CNT = CNT + 1
        GDGLST.CNT = DNAME CRSTD
      END
    END
    POS1 = POS1 + C2D(SUBSTR(DWORK,POS1,2))
  END
END
GDGLST.0 = CNT
IF RGEN <> 0
   THEN IF RGEN * -1 > CNT - 1
      THEN DO
         SAY "GENERATION "RGEN" DOES NOT EXIST"
         EXIT
      END
IF RGEN = 0
   THEN RGEN = CNT
   ELSE RGEN = CNT - (RGEN * -1)
SAY GDGLST.RGEN
Back to top
View user's profile Send private message
Satya06

New User


Joined: 25 Aug 2009
Posts: 12
Location: india

PostPosted: Mon Apr 19, 2010 6:36 pm
Reply with quote

Hi Expat,
I am thankful for your guidance.
Your code is working fine.
I want to take creation date in variable and use that as a suffix in some other dataset (as XXXXXX.XXXXXX.D'Creation date of gdg generation')So I had made changes on 2 places in your code as:
1.
IF CRCENT <> 'FF' & CRJUL <> '00000' THEN DO
CRSTD1 = DATE('S',CRJUL,'J')
CRSTD = SUBSTR(CRSTD1,3,6)
END
2.
ELSE RGEN = CNT - (RGEN * -1)
DATA = SUBSTR(GDGLST.RGEN,46,6)
SAY DATA

Now ouput is coming as :
**************
090809
READY
END
*************
Now requirement is to put this date(only Date as &date) in a variable and use that in JCl for dsn=XXXXXXX.XXXXXX.D&Date.
How it can be done...plz suggest.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Mon Apr 19, 2010 7:29 pm
Reply with quote

Dynamic dataset allocation or submit another batch job using the fully qualified dataset name built using the variable but before the job is submitted.
Back to top
View user's profile Send private message
Satya06

New User


Joined: 25 Aug 2009
Posts: 12
Location: india

PostPosted: Mon Apr 19, 2010 7:39 pm
Reply with quote

Hi,
I am not getting your words.Please put some more light on your statment.
And
I am going to discuss complete requirement with the intent that you can suggest me better solution as its coding is taking too much time.
Requirement:- Want to take backup of source(say XXXXXX.XXXXX111.N01(-230)) in a object file(XXXXXX.XXXXXX.D&creation date) where both datasets are on tape and &creation date is creation date of particular gdg generation.
So everyday absolute generation for gdg will be different and accordingly object file will be created.
Till now we are able to take creation date in dataset but how it can be taken in temp variable and passed to object file as a suffix(format YYMMDD).
Do we need to write full program in REXX only(I.e 1. take creation date of generation 2. then allocate 2 dataset in rexx to copy source dataset to object dataset where both are on tape)or some better approach to resolve the issue in a simple manner.
Plz Help.....
Thanks in advance...
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Mon Apr 19, 2010 7:48 pm
Reply with quote

OK, so now you have the creation date, and you want to perform a tape to tape copy. Two ways to do it ...............

1) Build a batch job using ISPF file tailoring, or the cruder method of queueing the JCL to INTRDR.

2) Perform the copy from within the REXX code. However this will not work for foreground.
Back to top
View user's profile Send private message
superk

Global Moderator


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

PostPosted: Tue Apr 20, 2010 1:16 am
Reply with quote

Well, expat, I'm glad you understood this topic since it lost me from the beginning, and only got me more confused as it progressed.

I never did understand, why couldn't a simple job and program have been created to call for a mount of the specified generation, at which time it could've easily performed the task of finding the explicit dataset name for that generation, as well as running LISTCAT or using ISPF Services and finding the creation date. I'm also a bit lost as to concept of copying an existing tape to another tape under a different name.

I'll need to look at that IGGCSI00 program your exec used and see how it does what it did in this case.
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 Help with SORT - I need to validate d... DFSORT/ICETOOL 0
No new posts GDG generation name to GDG Base name ... DFSORT/ICETOOL 3
No new posts Date format correction using dfsort DFSORT/ICETOOL 3
No new posts Sorting Date Field DFSORT/ICETOOL 4
No new posts CONVERT a given date from UTC TO BST CICS 0
Search our Forums:

Back to Top