Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Creating dataset with current date & timestamp

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
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    Post subject: Creating dataset with current date & timestamp
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    Post subject:
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

Moderator Team Head


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

PostPosted: Wed Oct 20, 2004 3:30 pm    Post subject:
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: http://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: http://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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts FTP - JCL failed while passing FTP co... Suneetha1612 JCL & VSAM 12 Wed Nov 16, 2016 7:33 pm
No new posts TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
This topic is locked: you cannot edit posts or make replies. Get correct date and time when curren... balaji81_k DB2 24 Fri Oct 14, 2016 10:40 pm
No new posts To trim spaces in a pipe delimited da... Nish84 COBOL Programming 16 Mon Oct 10, 2016 1:54 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us