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

Sort card to know that creation date of gdg file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Digvijay Singh

Active User


Joined: 20 Apr 2022
Posts: 153
Location: India

PostPosted: Thu Apr 17, 2025 6:21 pm
Reply with quote

Hi all,

I am working on an automation and I have a validation step ,where operation team manually validate few set of GDG file for example Diggi.ax0.tictoc.f1(0) ,Diggi.ax0.tictoc.f2(0),Diggi.ax0.tictoc.f3(0)...Opration team manually check that these files creation data is today date it means current date if it creation date matches the current date operation team take further action. Can anyone help me how we can achieve this using sort or any way.?? I want to automate the one process and this one is one of the validation step that we have to automate.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2194
Location: USA

PostPosted: Fri Apr 18, 2025 12:14 am
Reply with quote

1) Use a JCL step with PGM=IDCAMS, and LISTCAT control statement.

2) Direct it's output //SYSPRINT into a temporary dataset.

3) Use the temporary dataset as //SORTIN for the PGM=SORT step, to parse the listing from IDCAMS, extract the creation date, and to handle it in any manner.
Back to top
View user's profile Send private message
Digvijay Singh

Active User


Joined: 20 Apr 2022
Posts: 153
Location: India

PostPosted: Mon Apr 21, 2025 8:46 pm
Reply with quote

Thanks for your response I am working on it.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2194
Location: USA

PostPosted: Mon Apr 21, 2025 10:03 pm
Reply with quote

Digvijay Singh wrote:
Thanks for your response I am working on it.

If you searched this forum, there are similar examples.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2194
Location: USA

PostPosted: Tue Apr 22, 2025 10:47 pm
Reply with quote

Code:
//*====================================================================
//LISTCAT  EXEC PGM=IDCAMS                                             
//*SYSPRINT DD  SYSOUT=*                                               
//SYSPRINT DD  DISP=(NEW,PASS),SPACE=(TRK,(5,5)),DSN=&&LISTCAT         
//*                                                                   
//SYSIN    DD  *                                                       
 LISTCAT ENTRIES('TEST.AAA.BBB.EEE.SSS.REPORT.*') HISTORY     
 LISTCAT ENTRIES('TEST.BBB.AAA.REPORT.*')         HISTORY     
//*====================================================================
//LASTDATE EXEC PGM=SORT,PARM='VLTESTI=2',COND=(4,LT)                 
//SYSOUT   DD  SYSOUT=*                                               
//*                                                                   
//SORTIN   DD  DISP=(OLD,DELETE),DSN=&&LISTCAT                         
//*--------------------------------------------------------------------
//SYSIN    DD  *                                                       
 INCLUDE COND=(5,80,SS,EQ,L(C'NONVSAM ------- ',                       
                            C' CREATION--------'))                     
                                                                       
 INREC IFTHEN=(WHEN=(5,80,SS,EQ,C'NONVSAM ------- ',                   
                 AND,5,80,SS,EQ,C'.G00'),                             
              PARSE=(%1=(STARTAFT=C'NONVSAM ------- ',                 
                         ENDBEFR=C'.G00',                             
                         FIXLEN=44)),                                 
              OVERLAY=(80:%1))                                         
                                                                       
 SORT FIELDS=COPY                                                     
                                                                       
 OUTREC IFTHEN=(WHEN=GROUP,                                           
                BEGIN=(5,80,SS,EQ,C'NONVSAM ------- '),               
                END=(5,80,SS,EQ,C' CREATION--------'),                 
                PUSH=(80:80,44)),                                     
        IFTHEN=(WHEN=(5,80,SS,EQ,C' CREATION--------',                 
                  AND,80,44,CH,NE,C' '),                               
                OVERLAY=(124:58,4,63,3,                               
                         132:124,7,Y4T,TOGREG=Y4T))                   
                                                                       
 OUTFIL INCLUDE=(124,7,CH,NE,C' '),                                   
        VTOF,REMOVECC,NODETAIL,                                       
        SECTIONS=(80,44,                                               
           TRAILER3=(X,80,44,                                         
                     X,MAX=(124,7,CSF),                               
                     X,MAX=(132,8,CSF)))                               
 END                                                                   
//*--------------------------------------------------------------------
//SORTOUT  DD  SYSOUT=*                                               
//*====================================================================


Code:
********************************* TOP OF DATA ********************
TEST.AAA.BBB.EEE.SSS.REPORT                 2023164  20230613   
TEST.BBB.AAA.REPORT                         2018093  20180403   
******************************** BOTTOM OF DATA ******************
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1381
Location: Bamberg, Germany

PostPosted: Wed Apr 23, 2025 6:21 am
Reply with quote

One must also ensure that only true ACTIVE GDS are being processed, not ROLLED-OFF or DEFERRED ones.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2194
Location: USA

PostPosted: Wed Apr 23, 2025 11:43 pm
Reply with quote

Joerg.Findeisen wrote:
One must also ensure that only true ACTIVE GDS are being processed, not ROLLED-OFF or DEFERRED ones.


Step by step.

First of all, one needs to understand: how to get the required info by using the standard utilities only. (No need to write any code, though it might be possible as well)
Back to top
View user's profile Send private message
Digvijay Singh

Active User


Joined: 20 Apr 2022
Posts: 153
Location: India

PostPosted: Thu Apr 24, 2025 9:21 am
Reply with quote

I am able to achieve that but my code length is too I mean my jcl has many steps I want to cut it short. Currently the challeng i am facing is that I only want to know the current version of gdg creation date nothing else and I have 10 files likes that.

ENV.CQP0045.SORT.STMTRCD1(0)
ENV.CQP0045.SORT.STMTRCD2(0)
ENV.CQP0045.SORT.STMTRCD3(0)
ENV.CQP0045.SORT.STMTRCD4(0)
ENV.CQP0045.SORT.STMTRCD5(0)
ENV.CQP0045.SORT.STMTRCD6(0)
ENV.CQP0045.SORT.STMTRCD7(0)
ENV.CQP0045.SORT.STMTRCD8(0)
ENV.CQP0045.SORT.STMTRCD9(0)
ENV.CQP0045.SORT.STMTRCD0(0)

IF i process above gdg individually i am able to get the current date but there are multiple step in each file processing.

Code:
Step 1:  LISTCAT
 //****************************************************
 //LISTCAT  EXEC PGM=IKJEFT01                         
 //SYSTSPRT DD DSN=ENV.DIGGI.LISTCAT.SORT01,         
 //            DISP=(NEW,CATLG,DELETE),               
 //             DCB=(LRECL=80,RECFM=FB,BLKSIZE=0),     
 //            SPACE=(TRK,(2,1),RLSE),UNIT=SYSDA       
 //SYSTSIN  DD *                                       
   LISTCAT ENT('ENV.CQP0045.SORT.STMTRCD1') ALL       
 /*                                                   

Step 2:
 //*******************************************************************
 //* GET CURRENT VERSION OF THE FILE AND DATE                         
 //*******************************************************************
 //SORT03   EXEC PGM=SORT                                             
 //SYSOUT   DD  SYSOUT=*                                             
 //SORTIN   DD DISP=SHR,DSN=VST0.DIGGI.LISTCAT.SORT01                 
 //SORTOUT  DD DSN=VST0.DIGGI.LISTCAT.SORT02,                         
 //            DISP=(NEW,CATLG,DELETE),                               
 //            SPACE=(TRK,(2,1),RLSE),UNIT=SYSDA,                     
 //            DCB=(LRECL=80,BLKSIZE=8000,RECFM=FB)                   
 //SYSIN    DD *                                                     
   INCLUDE COND=(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=(55,8,UFF,D,81,44,CH,D)                               
   OUTFIL ENDREC=1,BUILD=(1:C'DATE=',6:DATE1-1,C' DSN=',81,44,       
                          C' ',80:X)                                 
 /*                                                                   

step 3:

Once i have the current version of gdg name from above step  which looks like below

ENV.CQP0045.SORT.STMTRCD1.G1610V00

I use my sorting  step to get the current date created on

//*BELOW STEP WILL FETCH OUT THE CREATION DATE OF THE FILE        ++**
//***+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++**
//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=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))
 //*                         


above step output looks like in spool.

 COMMAND ===>                                                  SCROLL ==
 FILE>        DCSQRFSH.JOB02.JOB11048.D0000104.?,2025.111,07:19:57     
                                             IS CREATED ON : 2024-04-15

 


I have challenge to make this whole code short and i want the created date of all the gdg file curretn verison in one file
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2194
Location: USA

PostPosted: Thu Apr 24, 2025 5:23 pm
Reply with quote

Digvijay Singh wrote:
I have challenge to make this whole code short and i want the created date of all the gdg file curretn verison in one file


I am not sure: did you read my previous post?
And more important: did you understand it?

Code:
//*====================================================================
//LISTCAT  EXEC PGM=IDCAMS                                             
//*SYSPRINT DD  SYSOUT=*                                               
//SYSPRINT DD  DISP=(NEW,PASS),SPACE=(TRK,(5,5)),DSN=&&LISTCAT         
//*                                                                   
//SYSIN    DD  *                                                       
 LISTCAT ENTRIES('ENV.CQP0045.SORT.STMTRCD1.*') HISTORY     
 LISTCAT ENTRIES('ENV.CQP0045.SORT.STMTRCD2.*') HISTORY     
 LISTCAT ENTRIES('ENV.CQP0045.SORT.STMTRCD3.*') HISTORY     
 LISTCAT ENTRIES('ENV.CQP0045.SORT.STMTRCD4.*') HISTORY     
 LISTCAT ENTRIES('ENV.CQP0045.SORT.STMTRCD5.*') HISTORY     
 LISTCAT ENTRIES('ENV.CQP0045.SORT.STMTRCD6.*') HISTORY     
 LISTCAT ENTRIES('ENV.CQP0045.SORT.STMTRCD7.*') HISTORY     
 LISTCAT ENTRIES('ENV.CQP0045.SORT.STMTRCD8.*') HISTORY     
 LISTCAT ENTRIES('ENV.CQP0045.SORT.STMTRCD9.*') HISTORY     
 LISTCAT ENTRIES('ENV.CQP0045.SORT.STMTRCD0.*') HISTORY     
//*====================================================================
//LASTDATE EXEC PGM=SORT,PARM='VLTESTI=2',COND=(4,LT)                 
//SYSOUT   DD  SYSOUT=*                                               
//*                                                                   
//SORTIN   DD  DISP=(OLD,DELETE),DSN=&&LISTCAT                         
//*--------------------------------------------------------------------
//SYSIN    DD  *                                                       
 INCLUDE COND=(5,80,SS,EQ,L(C'NONVSAM ------- ',                       
                            C' CREATION--------'))                     
                                                                       
 INREC IFTHEN=(WHEN=(5,80,SS,EQ,C'NONVSAM ------- ',                   
                 AND,5,80,SS,EQ,C'.G00'),                             
              PARSE=(%1=(STARTAFT=C'NONVSAM ------- ',                 
                         ENDBEFR=C'.G00',                             
                         FIXLEN=44)),                                 
              OVERLAY=(80:%1))                                         
                                                                       
 SORT FIELDS=COPY                                                     
                                                                       
 OUTREC IFTHEN=(WHEN=GROUP,                                           
                BEGIN=(5,80,SS,EQ,C'NONVSAM ------- '),               
                END=(5,80,SS,EQ,C' CREATION--------'),                 
                PUSH=(80:80,44)),                                     
        IFTHEN=(WHEN=(5,80,SS,EQ,C' CREATION--------',                 
                  AND,80,44,CH,NE,C' '),                               
                OVERLAY=(124:58,4,63,3,                               
                         132:124,7,Y4T,TOGREG=Y4T))                   
                                                                       
 OUTFIL INCLUDE=(124,7,CH,NE,C' '),                                   
        VTOF,REMOVECC,NODETAIL,                                       
        SECTIONS=(80,44,                                               
           TRAILER3=(X,80,44,                                         
                     X,MAX=(124,7,CSF),                               
                     X,MAX=(132,8,CSF)))                               
 END                                                                   
//*--------------------------------------------------------------------
//SORTOUT  DD  SYSOUT=*                                               
//*====================================================================
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2194
Location: USA

PostPosted: Thu Apr 24, 2025 9:23 pm
Reply with quote

You can also try a more compact option. I'm lazy to do all your work for you.


Code:
//*====================================================================
//LISTCAT  EXEC PGM=IDCAMS                                             
//*SYSPRINT DD  SYSOUT=*                                               
//SYSPRINT DD  DISP=(NEW,PASS),SPACE=(TRK,(5,5)),DSN=&&LISTCAT         
//*                                                                   
//SYSIN    DD  *                                                       
 LISTCAT ENTRIES('ENV.CQP0045.SORT.STMTRCD*.*') HISTORY     
//*====================================================================
// . . . . . . . . . etc. . . . . . . . . . . . .
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Convert CSV to flat file. DFSORT/ICETOOL 6
No new posts Multiple INSPECTS on a big size file COBOL Programming 6
No new posts Create a specific record/file based o... SYNCSORT 8
No new posts using symbolics in the destination fi... All Other Mainframe Topics 12
No new posts Can BPXBATCH update TAPE file COBOL Programming 3
Search our Forums:

Back to Top