View previous topic :: View next topic
Author
Message
Mazahar New User Joined: 11 Dec 2007Posts: 82 Location: hyderabad
Hi All,
Can you please help me if we can get file creation date and file name in a output file?
EX:-
DSN : X.Y.Z >>> Creation date 20090515
DSN : A.B.C >>> Creation date 20090513
I need to get these dataset names as well creation dates in a output dataset...
//IN DD DSN=X.Y.Z,DISP=SHR
// DD DSN=A.B.C,DISP=SHR
//OUT DD DSN=M.N.Q,DISP=(NEW,CATLG)
M.N.Q SHOULD HAVE THE RECORD
X.Y.Z20090515A.B.C20090513 >>> RECORD
Back to top
expat Global Moderator Joined: 14 Mar 2007Posts: 8796 Location: Welsh Wales
I've probably got a REXX code archived somewhere
Back to top
expat Global Moderator Joined: 14 Mar 2007Posts: 8796 Location: Welsh Wales
This is for batch mode, you will need a CATIN DD * statement to select the HLQ etc.
You can use full * ** % %% functionality in the CATIN DD *.
Code:
/* REXX ** */
"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 = SUBSTR(' ',1,16)
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
SAY 'CATALOG ' CATNAME
SAY ' '
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))
EXCENT = SUBSTR(TES01,7,2)
EXYEAR = SUBSTR(TES01,1,2)
EXDATE = SUBSTR(TES01,3,3)
IF DNAMET <> DNAME THEN DO
DNAMET=DNAME
IF DTYPE <> 'GDG ' & DTYPE <> 'ALIAS ' THEN DO
IF EXYEAR <> 0 | EXDATE /= 0 THEN DO
IF EXCENT = 0 THEN DO
EXYEAR = EXYEAR + 1900
SAY COPIES(' ',8) DTYPE DNAME EXYEAR"/"EXDATE
END
ELSE IF EXCENT = 1 THEN DO
EXYEAR = EXYEAR + 2000
SAY COPIES(' ',8) DTYPE DNAME EXYEAR"/"EXDATE
END
ELSE DO
EXYEAR = EXYEAR + (EXCENT * 100)
SAY COPIES(' ',8) DTYPE DNAME EXYEAR"/"EXDATE
END
END
END
END
POS1 = POS1 + C2D(SUBSTR(DWORK,POS1,2))
END
END
END
Back to top
Skolusu Senior Member Joined: 07 Dec 2007Posts: 2205 Location: San Jose
mazahar,
The following JCL will give you the desired results
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('X.Y.Z') ALL
LISTCAT ENT('A.B.C') ALL
//*
//STEP0200 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=&&L,DISP=(OLD,PASS)
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INCLUDE COND=(01,7,CH,EQ,C'NONVSAM',OR,
37,8,CH,EQ,C'CREATION')
INREC IFTHEN=(WHEN=(1,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=(81,4,CH,A),EQUALS
SUM FIELDS=(45,4,PD)
OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(45:45,4,DT1,EDIT=(TTTTTTTT))),
IFTHEN=(WHEN=GROUP,BEGIN=(81,4,ZD,EQ,1),PUSH=(54:1,52))
OUTFIL REMOVECC,NODETAIL,BUILD=(114X),
TRAILER1=(54,52,1,52,C'>>> RECORD')
/*
Back to top
Mazahar New User Joined: 11 Dec 2007Posts: 82 Location: hyderabad
Skolusu Thanks a lot,
But i dont think we can use IFTHEN in our org, because i am getting the below error when i submit it.
wer251a Include/Omit invalid self def term
wer268a Inrec statement : syntax error
wer275a No Keywords found on control statement
As well, we are passing dataset names in SYSIN in the job which you have provided, actually my job needs to run in prod, i cant edit sysin daily, can i pass the names of datasets to sysin in any other way? i mean my input data sets are GDG's which will get created by my upstream, once GDG version is created, that latest version needs to be processed and same ones NAME and Creation date needs to be printed on a report.
Back to top
expat Global Moderator Joined: 14 Mar 2007Posts: 8796 Location: Welsh Wales
Skolusu has given a DFsORT solution, your product is SYNCSORT. Although similar products, there will be differences between syntax and functionality.
Back to top
Mazahar New User Joined: 11 Dec 2007Posts: 82 Location: hyderabad
Expat,
Please can you give me Syncsort sntax for the same.
Back to top
expat Global Moderator Joined: 14 Mar 2007Posts: 8796 Location: Welsh Wales
Mazahar wrote:
Expat,
Please can you give me Syncsort sntax for the same.
DFSORT installed here, but the REXX code works perfectly well.
Back to top
dick scherrer Moderator Emeritus Joined: 23 Nov 2006Posts: 19243 Location: Inside the Matrix
Hello,
Quote:
Please can you give me Syncsort sntax for the same.
I believe that is correct syntax for Syncsort. . .
I suspect your system is not running the current version of Syncsort.
You need to post the complete informational output from the failed run.
Back to top
Mazahar New User Joined: 11 Dec 2007Posts: 82 Location: hyderabad
Dick,
thanks for your reply, those aer only the messages i am getting when i submit.
thanks
Back to top
Mazahar New User Joined: 11 Dec 2007Posts: 82 Location: hyderabad
Dick, Skolusu
I made a stupid mistake, now its fine. It gave me what exactly i require.
Thanks a lot.
And one more thing,
I am giving dataset names in LISTCAT ENT manually, Cant we make it with a symobolic or something else to pick my job input data sets automatically?
Back to top
dick scherrer Moderator Emeritus Joined: 23 Nov 2006Posts: 19243 Location: Inside the Matrix
Hello,
Good to hear it is working
Quote:
those aer only the messages i am getting when i submit.
For future reference, i'll wager there is more in the sysout than only those 3 messages. . . Your control statements will be repeated and at the top of the page is almost surely the version release information.
When we ask for the complete info, we really do mean the complete info, not just some subset you choose. . .
Back to top
Mazahar New User Joined: 11 Dec 2007Posts: 82 Location: hyderabad
Dick,
Understood :-)
I am giving dataset names in LISTCAT ENT manually, Cant we make it with a symobolic or something else to pick my job input data sets automatically?
Back to top
Douglas Wilder Active User Joined: 28 Nov 2006Posts: 305 Location: Deerfield IL
Would you mean something like this?
Code:
// SET HLQ=X
// SET NODE2=Y
// SET NODE3=Z
//STEP10 EXEC PGM=IKJEFT01,
// PARM='LISTCAT ENT(''&HLQ..&NODE2..&NODE3'') ALL'
Back to top
Mazahar New User Joined: 11 Dec 2007Posts: 82 Location: hyderabad
douglas
Yes, thanks a lot.
Back to top
Bill Dennis Active Member Joined: 17 Aug 2007Posts: 562 Location: Iowa, USA
Just to clarify, the date returned from LISTCAT is the date the catalog entry was created. This may not be the same as when the dataset was created. An uncatalog/recatalog process could alter the date.
Back to top
Mazahar New User Joined: 11 Dec 2007Posts: 82 Location: hyderabad
Douglas,
When i give
// SET FILE1=X.Y.Z
// SET FILE2=A.B.C
PARM='LISTCAT ENT(''&FILE1..&FILE2'') ALL'
its taking file names as X.Y.Z.A.B.C and giving me Invalid file name
if i give
PARM='LISTCAT ENT(''&FILE1&FILE2'') ALL'
its taking file names as X.Y.ZA.B.C and giving me Invalid file name
if i give
PARM='LISTCAT ENT(''&FILE1 &FILE2'') ALL'
its taking file names as X.Y.Z A.B.C and giving me Invalid file name
Can you please tell me exact PARM for IKJEFT
Back to top
dick scherrer Moderator Emeritus Joined: 23 Nov 2006Posts: 19243 Location: Inside the Matrix
Hello,
Quote:
Can you please tell me exact PARM for IKJEFT
You need 2 separate executions. . . .
Back to top
Mazahar New User Joined: 11 Dec 2007Posts: 82 Location: hyderabad
Hi All,
Just wanted to update you guys that I made it like this and it has worked for me.
// SET FILE1=X.Y.Z,
// FILE2=A.B.C
//STEP0100 EXEC PGM=IKJEFT01,
// PARM='LISTCAT ENT(''&FILE1'') ALL'
//SYSTSPRT DD DSN=&&L,
// DISP=(NEW,PASS),
// SPACE=(CYL,(1,1),RLSE),
// DCB=(LRECL=80,RECFM=FB,BLKSIZE=0)
//SYSTSIN DD *
/*
//STEP0200 EXEC PGM=IKJEFT01
//SYSTSPRT DD DSN=&&L,
// PARM='LISTCAT ENT(''&FILE2'') ALL'
// DISP=(MOD,PASS),
// SPACE=(CYL,(1,1),RLSE),
// DCB=(LRECL=80,RECFM=FB,BLKSIZE=0)
//SYSTSIN DD *
//*
//STEP0200 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=&&L,DISP=(OLD,PASS)
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INCLUDE COND=(01,7,CH,EQ,C'NONVSAM',OR,
37,8,CH,EQ,C'CREATION')
INREC IFTHEN=(WHEN=(1,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=(81,4,CH,A),EQUALS
SUM FIELDS=(45,4,PD)
OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(45:45,4,DT1,EDIT=(TTTTTTTT))),
IFTHEN=(WHEN=GROUP,BEGIN=(81,4,ZD,EQ,1),PUSH=(54:1,52))
OUTFIL REMOVECC,NODETAIL,BUILD=(114X),
TRAILER1=(54,52,1,52,C'>>> RECORD')
/*
Back to top
dick scherrer Moderator Emeritus Joined: 23 Nov 2006Posts: 19243 Location: Inside the Matrix
Good to hear it is working - thanks for letting us know
d
Back to top
Please enable JavaScript!