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

Find the date of creation of GDG


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
loga_nathan_m

New User


Joined: 07 Jun 2007
Posts: 40
Location: India

PostPosted: Wed Aug 12, 2009 4:04 pm
Reply with quote

Hi all,

I have a requirement where i need to find the date of creation of a GDG inside the JCL itself. Actually i need to find last file of the previous month.
For example:
If todays date is 5th august 2009, i need to find the GDG which was last created in month july.

Please guide me.

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

Global Moderator


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

PostPosted: Wed Aug 12, 2009 4:11 pm
Reply with quote

As stated more times ever to mention - IDCAMS LISTCAT will tell you that.

Although I can not see the relevence of knowing when a file was created, especially a GDS. Would you care to enlighten us.
Back to top
View user's profile Send private message
loga_nathan_m

New User


Joined: 07 Jun 2007
Posts: 40
Location: India

PostPosted: Wed Aug 12, 2009 4:33 pm
Reply with quote

I need to compare current generation file with previous months last file. To find which GDG it corresponds to i need to fine the date of creation of each file then do a logic to get the last date, then identify the GDG version and proceed with comparison.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Wed Aug 12, 2009 4:36 pm
Reply with quote

It seems to me that had a little more planning have been given to the application in the first place, then these types of checks and controils would not be required.

If you care to elaborate what you check, and why you check, then maybe a suitable answer may be available.

Also PLEASE use the correct terminology regarding a GDS. Version and generation are both valid in terms of a GDS. I guess you just used the wrong term icon_cry.gif
Back to top
View user's profile Send private message
Bill Dennis

Active Member


Joined: 17 Aug 2007
Posts: 562
Location: Iowa, USA

PostPosted: Wed Aug 12, 2009 7:22 pm
Reply with quote

Also, be aware that LISTCAT shows the date the catalog entry was added. This may not be the actual creation date due to uncatalog/recatalog activity by some user.
Back to top
View user's profile Send private message
loga_nathan_m

New User


Joined: 07 Jun 2007
Posts: 40
Location: India

PostPosted: Thu Aug 13, 2009 12:35 pm
Reply with quote

Hi,

i tried the code found in below link

www.ibmmainframes.com/viewtopic.php?t=42664&postdays=0&postorder=asc&start=0

I'm using SYNCSORT FOR Z/OS 1.3.0.2R version. i guess because of version problem i get syntax error.

Can you kindly modify the code for my SYNCSORT version.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Thu Aug 13, 2009 12:40 pm
Reply with quote

loga_nathan_m wrote:
Hi,
i tried the code found in below link
www.ibmmainframes.com/viewtopic.php?t=42664&postdays=0&postorder=asc&start=0
I'm using SYNCSORT FOR Z/OS 1.3.0.2R version. i guess because of version problem i get syntax error.
Can you kindly modify the code for my SYNCSORT version.

What is wrong withYOU performing the modification, and then asking when you get problems.

Please remember that this is a HELP forum, not a Do my job for me forum
Back to top
View user's profile Send private message
loga_nathan_m

New User


Joined: 07 Jun 2007
Posts: 40
Location: India

PostPosted: Thu Aug 13, 2009 2:16 pm
Reply with quote

Quote:

i tried the code found in below link
www.ibmmainframes.com/viewtopic.php?t=42664&postdays=0&postorder=asc&start=0


Hi Expat,

I tried the code and then only posted here for help. I didn't ask for some one to do my job. Please understand and never hurt others like this. I used the word "guess" because that was told by one of the member in the other link(please refer to the link).

If my question is in 2 place thought i could get answer soon.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Aug 13, 2009 3:38 pm
Reply with quote

Quote:
I tried the code and then only posted here for help. I didn't ask for some one to do my job
Hello,

Trying the code available somewhere is not a big deal. expat was trying to ask you to make the code changes for your version and if you face any difficulty in that, sombody will be around to help you out.

But finding the GDG creation date alone is not going to solve your problem. You need to find the previous month and then find the last file created during previous month and compare with the latest generation. How you are planning to do all these? And I wonder why do you need to do all these checking stuff?
Back to top
View user's profile Send private message
loga_nathan_m

New User


Joined: 07 Jun 2007
Posts: 40
Location: India

PostPosted: Thu Aug 13, 2009 7:02 pm
Reply with quote

hi,

Atlast found code that works for SYNCSORT FOR Z/OS 1.3.0.2R version.

Code:

//STEP0100 EXEC PGM=IKJEFT01                   
//SYSTSPRT DD DSN=&&L,                         
//            DISP=(,PASS),                     
//            SPACE=(CYL,(1,1),RLSE),           
//            DCB=(LRECL=80,RECFM=FB,BLKSIZE=0)
//SYSTSIN  DD *                                 
  LISTCAT ENT('DW3T.CEV.DALS380.ILA') ALL       
//*                                             
//STEP0200 EXEC PGM=SORT                       
//SYSOUT   DD SYSOUT=*                         
//SORTIN   DD DSN=&&L,DISP=(OLD,PASS)           
//SORTOUT  DD SYSOUT=*                         
//SYSIN    DD *                                 
  INCLUDE COND=(01,8,CH,EQ,C'GDG BASE',OR,     
                04,7,CH,EQ,C'NONVSAM',OR,       
                37,8,CH,EQ,C'CREATION')         

  INREC IFTHEN=(WHEN=(1,8,CH,EQ,C'GDG BASE',OR,4,7,CH,EQ,C'NONVSAM'),
  BUILD=(17,44,+0,TO=PD,LENGTH=4,81:SEQNUM,4,ZD)),                   
  IFTHEN=(WHEN=(37,8,CH,EQ,C'CREATION'),                             
  BUILD=(44X,X'01',55,6,UFF,PD,LENGTH=3,81:SEQNUM,4,ZD))             
                                                                     
  SORT FIELDS=COPY                                                   
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(45:45,4,DT1,EDIT=(TTTTTTTT)))   
/*                                                                   
//*                                                                 



output:

Code:


DW3T.CEV.DALS380.ILA                        19000100
                                            20090425
DW3T.CEV.DALS380.ILA.G0001V00               19000100
                                            20090427
DW3T.CEV.DALS380.ILA.G0002V00               19000100
                                            20090428
DW3T.CEV.DALS380.ILA.G0003V00               19000100
                                            20090428



In the output the number followed by dataset is invalid and date below the number is actual creation date.
i'm expecting an output as below
Code:

DW3T.CEV.DALS380.ILA                        20090425
DW3T.CEV.DALS380.ILA.G0001V00               20090427
DW3T.CEV.DALS380.ILA.G0002V00               20090428
DW3T.CEV.DALS380.ILA.G0003V00               20090428
                                           


WHEN=GROUP,BEGIN=(),RECORDS=2,PUSH=() are not working for my version of syncsort.

Hence can someone suggest a technique to get above expected output.

Can u also give me a link or send document that explain INREC/OUTREC IFTHEN. I searched but couldn't get a good document that explain these concept well.

Arun,
Once i get the expected ouput i would sort the file on date in decending order and pick the dataset which holds the first occurance of last month.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Thu Aug 13, 2009 7:17 pm
Reply with quote

I do have a little REXX code that will give you what you want if that is easier than the SORT solution.
Back to top
View user's profile Send private message
loga_nathan_m

New User


Joined: 07 Jun 2007
Posts: 40
Location: India

PostPosted: Thu Aug 13, 2009 7:38 pm
Reply with quote

Thanks Expat, but I need to do it using SORT JCL only.
Can u suggest me some doc that explains INREC/OUTREC IFTHEN that would be great help.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1248
Location: Richfield, MN, USA

PostPosted: Thu Aug 13, 2009 7:40 pm
Reply with quote

The Syncsort manual should explain it I would think.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Thu Aug 13, 2009 7:43 pm
Reply with quote

The JCL
Code:

//STEP0020 EXEC PGM=IKJEFT01,PARM='member' 
//SYSEXEC  DD DSN=Your REXX library,DISP=SHR         
//SYSOUT   DD SYSOUT=*                     
//SYSTSPRT DD SYSOUT=*                     
//SYSTSIN  DD DUMMY                         
//CATIN    DD *                             
DW3T.CEV.DALS380.ILA.*
/*
//


The REXX.
Put it into a PDS, and put the PDS name and member name into the areas above, and it will give you what you want
Code:
 
/* REXX ** CREATION DATE                                             */
 "EXECIO * DISKR CATIN ( STEM CAT. FINIS"
 DO KCNT = 1 TO CAT.0
 KEY = SUBSTR(CAT.KCNT,1,44)
MODRSNRC = SUBSTR(' ',1,4)
CSIFILTK = SUBSTR(KEY,1,44)
CSICATNM = SUBSTR(' ',1,44)
CSIRESNM = SUBSTR(' ',1,44)
CSIDTYPS = 'BH              '
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 DO
         CATNAME=SUBSTR(DWORK,POS1+2,44)
         IF CATNAME <> CATNAMET THEN DO
           CATNAMET = CATNAME
          END
         POS1 = POS1 + 50
         END
   DNAME = SUBSTR(DWORK,POS1+2,44)
   IF SUBSTR(DWORK,POS1+1,1) = 'C' THEN DTYPE = 'CLUSTER '
   ELSE IF SUBSTR(DWORK,POS1+1,1) = 'D' THEN DTYPE = 'DATA    '
   ELSE IF SUBSTR(DWORK,POS1+1,1) = 'I' THEN DTYPE = 'INDEX   '
   ELSE IF SUBSTR(DWORK,POS1+1,1) = 'A' THEN DTYPE = 'NONVSAM '
   ELSE IF SUBSTR(DWORK,POS1+1,1) = 'H' THEN DTYPE = 'GDS     '
   ELSE IF SUBSTR(DWORK,POS1+1,1) = 'B' THEN DTYPE = 'GDG     '
   ELSE IF SUBSTR(DWORK,POS1+1,1) = 'R' THEN DTYPE = 'PATH    '
   ELSE IF SUBSTR(DWORK,POS1+1,1) = 'G' THEN DTYPE = 'AIX     '
   ELSE IF SUBSTR(DWORK,POS1+1,1) = 'X' THEN DTYPE = 'ALIAS   '
   ELSE IF SUBSTR(DWORK,POS1+1,1) = 'U' THEN DTYPE = 'UCAT    '
   ELSE DTYPE = '        '
    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 DNAMET <> DNAME THEN DO
     DNAMET=DNAME
    IF CRCENT <> 'FF' & CRJUL <> '00000' THEN DO
      CRSTD   = DATE('S',CRJUL,'J')
        SAY   DTYPE DNAME CRSTD
    END

    END
    POS1 = POS1 + C2D(SUBSTR(DWORK,POS1,2))
  END
END
END
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Aug 18, 2009 1:52 pm
Reply with quote

loga_nathan_m,

You might want to try this one too. OUT will have the latest generation created during previous month.
Code:
//STEP1  EXEC PGM=IKJEFT01                     
//SYSTSPRT DD DSN=&&L,                         
//            DISP=(,PASS),                     
//            SPACE=(CYL,(1,1),RLSE),           
//            DCB=(LRECL=80,RECFM=FB,BLKSIZE=0)
//SYSTSIN  DD *                                 
  LISTCAT ENT('Your.gdg.base') ALL             
//*                                             
//STEP2  EXEC PGM=SYNCTOOL                                           
//TOOLMSG  DD SYSOUT=*                                               
//DFSMSG   DD SYSOUT=*                                               
//IN       DD DSN=&&L,DISP=(OLD,PASS)                               
//T1       DD DSN=&&T1,DISP=(,PASS)                                 
//OUT      DD SYSOUT=*                                               
//TOOLIN   DD *                                                     
  SPLICE FROM(IN) TO(T1) ON(135,4,CH) WITH(125,4) WITHALL -         
  USING(CTL1)                                                       
  SORT   FROM(T1) TO(OUT) USING(CTL2)                               
//CTL1CNTL DD *                                                     
  INCLUDE COND=(01,8,CH,EQ,C'GDG BASE',OR,                           
                04,7,CH,EQ,C'NONVSAM',OR,                           
                37,8,CH,EQ,C'CREATION')                             
  INREC IFTHEN=(WHEN=INIT,                                           
  OVERLAY=(81:44X,X'01',55,6,UFF,PD,LENGTH=3,&DATE2-1)),             
        IFTHEN=(WHEN=(1,8,CH,EQ,C'GDG BASE',OR,4,7,CH,EQ,C'NONVSAM'),
  OVERLAY=(81:17,44,135:SEQNUM,4,ZD),HIT=NEXT),                     
        IFTHEN=(WHEN=(37,8,CH,EQ,C'CREATION'),                       
  OVERLAY=(135:SEQNUM,4,ZD),HIT=NEXT),                               
        IFTHEN=(WHEN=(55,2,CH,EQ,C'19'),                             
  OVERLAY=(125:X'00'))                                               
  OUTFIL BUILD=(81,44,125,4,DT1,129,6)                               
//CTL2CNTL DD *                                                     
  SORT FIELDS=(1,44,CH,D),SKIPREC=1                                 
  INCLUDE COND=(45,6,CH,EQ,53,6,CH)                                 
  OUTFIL BUILD=(1,44),ENDREC=1                                       
/*
Back to top
View user's profile Send private message
sherrypeter

New User


Joined: 01 Sep 2010
Posts: 7
Location: bangalore

PostPosted: Wed Sep 01, 2010 7:36 pm
Reply with quote

hi !

this is in reference of the above post by Arun Raj.
my requirement is i want to find the gdg version for a given date.
i can provide that date in the overlay fields i suppose
i tried but not sure why its giving syntax error.

this is how i modified the above jcl

OVERLAY=(81:44X,X'01',55,6,UFF,CH,LENGTH=10,C'2010-08-11')),

can anyone please help me?

Sherry Peter
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Wed Sep 01, 2010 7:55 pm
Reply with quote

The version will always be 00 unless manually changed, so in effect the question is pointless.

Please learn the difference between version and generation when refering to a GDS as both are valid terms with totally different meanings.
Back to top
View user's profile Send private message
sherrypeter

New User


Joined: 01 Sep 2010
Posts: 7
Location: bangalore

PostPosted: Thu Sep 02, 2010 2:02 pm
Reply with quote

Dear expat,

I mean "generation".
Sorry for that icon_neutral.gif

can anybody guide me how to do it?

Sherry Peter
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Thu Sep 02, 2010 2:38 pm
Reply with quote

You need to post the output from the failed run to be able to get some useful suggestions.
Back to top
View user's profile Send private message
sherrypeter

New User


Joined: 01 Sep 2010
Posts: 7
Location: bangalore

PostPosted: Thu Sep 02, 2010 5:52 pm
Reply with quote

hi expat,

The below job works fine ,

Code:
//A376057U JOB (P931,FBSI),'A479144-SORT ',NOTIFY=A479144,              JOB13743
// CLASS=R,MSGCLASS=U
//*********************************************************************
//STEP0100 EXEC PGM=IKJEFT01                                            00033600
//SYSTSPRT DD DSN=&&T,
//            DISP=(,PASS),                                             00130000
//            SPACE=(CYL,(1,1),RLSE),
//            DCB=(LRECL=80,RECFM=FB,BLKSIZE=0)
//SYSTSIN  DD *
  LISTCAT ENT('FBSI.FBDCT10.ECR.NA.FILE') ALL
//*
//STEP0200 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD DSN=&&T,DISP=(OLD,PASS)
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  INCLUDE COND=(01,8,CH,EQ,C'GDG BASE',OR,
                04,7,CH,EQ,C'NONVSAM',OR,
                37,8,CH,EQ,C'CREATION')

  INREC IFTHEN=(WHEN=GROUP,RECORDS=2,PUSH=(81:17,44),
  BEGIN=(1,8,CH,EQ,C'GDG BASE',OR,4,7,CH,EQ,C'NONVSAM'))
  SORT FIELDS=COPY

  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(125:X'01',55,6,UFF,PD,LENGTH=3)),
  IFTHEN=(WHEN=(53,2,ZD,LT,20),OVERLAY=(125:X'00'))
  OUTFIL INCLUDE=(37,8,CH,EQ,C'CREATION'),
  BUILD=(81,44,C' IS CREATED ON : ',125,4,DT1,EDIT=(TTTT-TT-TT))
//*


but when i change the sysout from * to a dataset,it giving the below error.

SORTIN : RECFM=FB ; LRECL= 80; BLKSIZE= 80
INREC RECORD LENGTH = 124
POTENTIALLY INEFFICIENT USE OF INREC
OUTREC RECORD LENGTH = 128
SORTOUT : RECFM=FB ; LRECL= 128; BLKSIZE= 27904
SORTOUT HAS INCOMPATIBLE LRECL
SYNCSMF CALLED BY SYNCSORT; RC=0000
SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Thu Sep 02, 2010 6:26 pm
Reply with quote

First, please learn the code tags shown below. I have changed this for you on this post.
Code:
 [code] your code
goes here [/code]


Try changing
Code:
  BUILD=(81,44,C' IS CREATED ON : ',125,4,DT1,EDIT=(TTTT-TT-TT))

to
Code:
  BUILD=(81,44,C' IS CREATED ON : ',121,4,DT1,EDIT=(TTTT-TT-TT))
Back to top
View user's profile Send private message
sherrypeter

New User


Joined: 01 Sep 2010
Posts: 7
Location: bangalore

PostPosted: Thu Sep 02, 2010 8:06 pm
Reply with quote

Dear expat,

Thanks for helping me.I tried your suggestion,still getting the same error.

32K BYTES OF EMERGENCY SPACE ALLOCATED
SORTIN : RECFM=FB ; LRECL= 80; BLKSIZE= 80
INREC RECORD LENGTH = 124
POTENTIALLY INEFFICIENT USE OF INREC
OUTREC RECORD LENGTH = 128
SORTOUT : RECFM=FB ; LRECL= 128; BLKSIZE= 27904
SORTOUT HAS INCOMPATIBLE LRECL
SYNCSMF CALLED BY SYNCSORT; RC=0000
SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Thu Sep 02, 2010 9:42 pm
Reply with quote

Hello,

How is SORTOUT defined when a dataset is used (rather than SYSOUT)?
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6248
Location: Mumbai, India

PostPosted: Thu Sep 02, 2010 10:05 pm
Reply with quote

Quote:
but when i change the sysout from * to a dataset,it giving the below error
Have you "hardcodeed" some LRECL on the sortout? As Dick said, please tell us How is SORTOUT defined?
Back to top
View user's profile Send private message
sherrypeter

New User


Joined: 01 Sep 2010
Posts: 7
Location: bangalore

PostPosted: Fri Sep 03, 2010 11:19 am
Reply with quote

This is how i have defined the sortout

Code:
 
//SORTOUT  DD DSN=FBSIT.A376057.SORTOUT,           
//            DISP=(NEW,CATLG,DELETE),             
//            SPACE=(CYL,(1,1),RLSE),             
//            DCB=(LRECL=128,RECFM=FB,BLKSIZE=0)   



Thanks everyone !!
Sherry
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 -> All Other Mainframe Topics Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts Help with SORT - I need to validate d... DFSORT/ICETOOL 1
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
No new posts Pull data using date difference betwe... DB2 6
Search our Forums:

Back to Top