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

Creating dataset with current date & timestamp


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
chkiran2

New User


Joined: 24 Jun 2004
Posts: 24
Location: Gurgoan

PostPosted: Sat Oct 16, 2004 6:31 pm
Reply with quote

Hi

I got this done by 2 methods. One using only JCL and the other using COBOL program. I am giving both the methods so that it will be useful for some one in future.

Method 1: (USING JCL)

The following JCL creates a dataset with Current date & time at the time of creation of dataset and copies the data from a source dataset into the newly created dataset.

Code:


//ABAB77V1 JOB (0400,PT,PES),'KIRAN',CLASS=C,MSGCLASS=X,             
//         MSGLEVEL=(1,1),NOTIFY=ABAB77,REGION=0008192K             
//STEP0100 EXEC PGM=EZACFSM1                                         
//SYSOUT    DD SYSOUT=(*,INTRDR)                                     
//SYSIN     DD DATA,DLM=@@                                           
//ABAB77V2 JOB (0400,PT,PES),                                       
//             'VIJAY',                                             
//             CLASS=C,                                             
//             MSGCLASS=X,                                           
//             NOTIFY=&SYSUID                                       
//STEPK1   EXEC PGM=IEBGENER                                         
//SYSPRINT DD SYSOUT=*                                               
//SYSUT1   DD DSN=ABAB.TX.SND.SQUS0001.SI,DISP=SHR                   
//SYSUT2   DD DSN=ABAB.TX.SND.SQUS0001.SI.D&LYYMMDD..T&LHHMMSS,     
//            DISP=(NEW,CATLG,DELETE),                               
//            SPACE=(CYL,(2,2),RLSE),                 
//            DCB=(LRECL=890,RECFM=FB)                 
//SYSIN   DD  DUMMY                                   
@@                                                     



Method 2:

we can get the desired result using COBOL program. Here is the tested program which allocates/creates a new dataset and then copies the data from an file to the newly created file using IEBGENER.

I am sharing this so that it may be useful for some one later.


Code:

 
COBOL PROGRAM:
 
       IDENTIFICATION DIVISION.
       PROGRAM-ID. DSDATE.
       ENVIRONMENT DIVISION.
       DATA DIVISION.             
       WORKING-STORAGE SECTION.
       01 WS-DATE                       PIC X(06).
       01 WS-TIME-IN                    PIC X(08).                     
       01 WS-TIME                       PIC X(06).                     
      *                                                                 
       PROCEDURE DIVISION.                                             
      *                                                                 
       000-MAIN.                                                       
           ACCEPT WS-DATE               FROM  DATE.                     
           ACCEPT WS-TIME-IN            FROM  TIME.                     
           MOVE WS-TIME-IN (1:6)        TO WS-TIME.                     
           DISPLAY '//KIRAN1CD JOB (0400,XXX),''KIRAN CH'',CLASS=B,'   
           DISPLAY '//        MSGLEVEL=(1,1),NOTIFY=MGPB16,REGION=4M,'
           DISPLAY '//         MSGCLASS=X'                             
           DISPLAY '//GENER01  EXEC PGM=IEBGENER'                       
           DISPLAY '//SYSIN    DD DUMMY'                               
           DISPLAY '//SYSPRINT DD SYSOUT=*'                             
           DISPLAY '//SYSUT1   DD DSN=XYXYXY.TST.DATA,DISP=SHR'         
           DISPLAY '//SYSUT2   DD DSN=XYXYXY.D' WS-DATE '.'             
                    'T' WS-TIME ','                                     
           DISPLAY '//         DISP=(NEW,CATLG,DELETE),'               
           DISPLAY '//      DCB=(LRECL=80,RECFM=FB,BLKSIZE=0,DSORG=PS),'
           DISPLAY '//         SPACE=(TRK,(09,03),RLSE),'               
           DISPLAY '//         UNIT=DISK'                               
           DISPLAY '/*EOF'                                             
           DISPLAY '//'.                                               
       000-EXIT.                                                       
           STOP RUN.                                                   
 

Compile above program and use following JCL to execute this:
 
//KIRANCD  JOB (0400,XXX),'KIRAN CH',CLASS=B,           
//         MSGLEVEL=(1,1),NOTIFY=MGPB16,REGION=4M,     
//         MSGCLASS=X                                   
//STEP01   EXEC PGM=DSDATE                             
//STEPLIB  DD DSN=XYXYXY.TEST.PRG,DISP=SHR             
//SYSOUT   DD SYSOUT=(*,INTRDR)                         
//SYSIN    DD DUMMY                                     
//                                                     
 
 
Back to top
View user's profile Send private message
Ramya A

Active User


Joined: 26 Jul 2004
Posts: 104

PostPosted: Wed Oct 20, 2004 3:10 pm
Reply with quote

Hi,

Could you tell me what is this pgm EZACFSM1 in your JCL. Is it an Ezitrive code? Also it would be nice if you can explain how your JCL achieves the result i.e. from where it gets the date and time parameters LYYMMDD and LHHMMSS.

Thanks,
Ramya icon_smile.gif
Back to top
View user's profile Send private message
superk

Global Moderator


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

PostPosted: Wed Oct 20, 2004 3:30 pm
Reply with quote

The EZACFSM1 program is part of TCP/IP. It is known as the "symbol translator utility". EZACFSM1 reads an input file and writes to an output file, translating any symbols in the process.

See reference here: publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/f1a1b330/1.1.9.1?DT=20030829121943

The symbols it translates are the MVS built-in dynamic system symbols. A basic set is provided by IBM, and others can be created by your MVS systems programmers. You can check here for the list of standard dynamic system variables: publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IEA1E241/2.2.2
Back to top
View user's profile Send private message
Ramya A

Active User


Joined: 26 Jul 2004
Posts: 104

PostPosted: Wed Oct 20, 2004 5:18 pm
Reply with quote

Thanks Superk. I'll try the references given by you.
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 -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
Search our Forums:

Back to Top