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

How to Generate system date


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

New User


Joined: 13 Jun 2004
Posts: 85

PostPosted: Mon Feb 27, 2006 6:23 pm
Reply with quote

Hi all,

Can anyone please tell me how to generate a date and appending it to the dataset name.

For Eg.

G1XXXX.PSFILE.DS.DZZZZZ

where ZZZZZ - system date (in any format)
Back to top
View user's profile Send private message
amitava
Warnings : 1

Active User


Joined: 30 Oct 2005
Posts: 186
Location: India

PostPosted: Mon Feb 27, 2006 6:34 pm
Reply with quote

HI meetsrk,
U can do one thing. U can call a rexx routine from a JCL and in the REXX routine u can get the date function and append it in a DSs name and allocate the DS. If u want the code, i will send u back.
Back to top
View user's profile Send private message
superk

Global Moderator


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

PostPosted: Mon Feb 27, 2006 6:49 pm
Reply with quote

This is my preferred method:
Code:

//STEP0001 EXEC PGM=ICEGENER /* REXX EXAMPLE */                                 
//SYSUT1   DD   *,DLM=@@                                     
/* REXX */                                                   
RC = LISTDSI(SYSUT1 'FILE')                                 
OLD_DSN = SYSDSNAME                                         
NEW_DSN = OLD_DSN||'.D'||DATE(J)                             
"ALLOC DD(SYSUT2) DA('"NEW_DSN"') NEW REU CATALOG",         
"LIKE('"OLD_DSN"')"                                         
"CALL *(ICEGENER)"                                           
EXIT 0                                                       
@@                                                           
//SYSUT2   DD   DSN=&&X(XDATE),DISP=(,PASS),UNIT=VIO,       
//         SPACE=(TRK,(1,1,1),RLSE)                         
//SYSPRINT DD   SYSOUT=*                                     
//SYSIN    DD   DUMMY                           
//*                                                     
//STEP0002 EXEC PGM=IKJEFT01,PARM='%XDATE'               
//SYSEXEC  DD   DSN=&&X,DISP=(OLD,PASS)                 
//SYSTSPRT DD   SYSOUT=*                                 
//SYSTSIN  DD   DUMMY                                   
//SYSUT1   DD   DSN=INPUT.DATASET,DISP=SHR
//SYSPRINT DD   SYSOUT=*                                 
//SYSIN    DD   DUMMY                                   
//*         
//*                                                             
//STEP0003 EXEC PGM=ICEGENER /* CLIST EXAMPLE */                                     
//SYSUT1   DD   *,DLM=@@                                         
PROC 0                                                           
CONTROL NOMSG                                                   
LISTDSI SYSUT1 FILE                                             
SET &OLDDSN = &STR(&SYSDSNAME)                                   
SET &YY  = &SUBSTR(1:2,&SYSJDATE)                               
SET &DDD = &SUBSTR(4:6,&SYSJDATE)                               
SET &NEWDSN = &STR(&OLDDSN)&STR(.D)&STR(&YY)&STR(&DDD)           
ALLOC DD(SYSUT2) DA('&NEWDSN') NEW REU LIKE('&OLDDSN')           
CALL *(ICEGENER)                                                 
EXIT CODE(0)                                                     
@@                                                               
//SYSUT2   DD   DSN=&&C(XDATE),DISP=(,PASS),UNIT=VIO,           
//         SPACE=(TRK,(1,1,1),RLSE)                             
//SYSPRINT DD   SYSOUT=*                                         
//SYSIN    DD   DUMMY                                           
//*                                                   
//STEP0004 EXEC PGM=IKJEFT01,PARM='%XDATE'             
//SYSPROC  DD   DSN=&&C,DISP=(OLD,PASS)               
//SYSTSPRT DD   SYSOUT=*                               
//SYSTSIN  DD   DUMMY                                 
//SYSUT1   DD   DSN=INPUT.DATASET,DISP=SHR
//SYSPRINT DD   SYSOUT=*                               
//SYSIN    DD   DUMMY                                 
//*                                                         
Back to top
View user's profile Send private message
brgr88

New User


Joined: 05 Mar 2006
Posts: 6

PostPosted: Sun Mar 05, 2006 5:45 am
Reply with quote

meetsrk,


/* REXX */
yymmdd = RIGHT(DATE('S'),6)
dsname = 'G1XXXX.PSFILE.DS.D'yymmdd


Here, the variable "yymmdd" equals the date in yymmdd format, so:
March 4, 2006 = 060304

Your datasetname would be:
G1XXXX.PSFILE.DS.D060304

I prefer this method since the datasets will list in chronological order in ISPF 3.4.
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 Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Sysplex System won't IPL at DR site I... All Other Mainframe Topics 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Generate random number from range of ... COBOL Programming 3
No new posts Need to convert date format DFSORT/ICETOOL 20
Search our Forums:

Back to Top