MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Timestamp in Easytrieve

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
yugee
Beginner


Joined: 17 Sep 2005
Posts: 25
Topics: 8

PostPosted: Wed Jan 11, 2006 8:57 am    Post subject: Timestamp in Easytrieve Reply with quote

Hi,

I have a GDG file and I want to append the header and trailer records to that file as shown below:
Input File:

I0001ABC XXXXX XXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXX
I0002BCE XXXXX XXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXX

My output should look like this:
H2006-01-11-12.01.37.046607
I0001ABC XXXXX XXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXX
I0002BCE XXXXX XXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXX
T000000000000002


header record should contain the current timestamp and trailer record should have the total number of records in that file. Could any one please help me how to get the current time stamp in easy trieve?.

Thanks in advance,
Yugee
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12370
Topics: 75
Location: San Jose

PostPosted: Wed Jan 11, 2006 9:22 am    Post subject: Reply with quote

yugee,

Are you restricted to easytrieve only ? Can you use Sort to do the task? With sort it is easy. However you cannnot the Micro seconds portion of the timestamp field.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
yugee
Beginner


Joined: 17 Sep 2005
Posts: 25
Topics: 8

PostPosted: Wed Jan 11, 2006 11:24 am    Post subject: Reply with quote

Hi Kolusu,
Thanks for your quick reply.
the output file, we will be sending to some external system and we have alreadyy committed that we will be sending that format. if we use Sort, we will be missing the micro second part of the time stamp. Is there any way we can inlude that also?.
we are thinking of having a COBOL program, but this is at the worst case scenario...

Thanks,
Ugandhar.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12370
Topics: 75
Location: San Jose

PostPosted: Wed Jan 11, 2006 12:01 pm    Post subject: Reply with quote

Yugee,

Neither SORT nor Easytrieve has the capability of getting the timestamp (year, month, day, hour, minute, second, and microsecond ) in the form yyyy-mm-dd-hh.mm.ss.nnnnnn

Do you really care about microsecond portion? Can't you just hardcode '000001' for microsecond portion ?

Code:

//STEP0100 EXEC PGM=EZTPA00                               
//STEPLIB  DD DSN=CORP.EASYTREV.PROD.LOADLIB,             
//            DISP=SHR                                   
//SYSPRINT DD SYSOUT=*                                   
//SYSSNAP  DD SYSOUT=*                                   
//INFILE   DD *                                           
I0001ABC XXXXX XXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXX         
I0002BCE XXXXX XXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXX         
//OUTFILE  DD SYSOUT=*,LRECL=80                           
//SYSIN    DD *                                           
                                                         
  FILE INFILE                                             
                                                         
  FILE OUTFILE FB (0 0)                                   
       OUT-REC                 01 80 A                   
                                                         
  CURRENT-DATE                  W  10  A                 
  CURRENT-MM  CURRENT-DATE         02  A                 
  CURRENT-DD  CURRENT-DATE      +3 02  A                 
  CURRENT-YY  CURRENT-DATE      +6 04  A                 
                                                         
  W-HDR-REC                     W  80  A                 
    W-HDR-IND     W-HDR-REC        01  A VALUE 'H'       
    W-HDR-DATE-YY W-HDR-REC    +01 04  A                 
    W-HDR-DATE-S1 W-HDR-REC    +05 01  A VALUE '-'       
    W-HDR-DATE-MM W-HDR-REC    +06 02  A                 
    W-HDR-DATE-S2 W-HDR-REC    +08 01  A VALUE '-'       
    W-HDR-DATE-DD W-HDR-REC    +09 02  A                 
    W-FIL1        W-HDR-REC    +11 01  A VALUE '.'       
    W-HDR-TIME    W-HDR-REC    +12 08  A                 
    W-HDR-MSEC    W-HDR-REC    +20 07  A VALUE '.000001' 
                                                         
  W-TRLR-REC                    W  80  A                 
    W-TRLR-IND   W-TRLR-REC        01  A VALUE 'T'       
    W-TRLR-COUNT W-TRLR-REC    +01 15  N                 
                                                         
  JOB INPUT INFILE START HDR FINISH TRLR   
                                           
     PUT OUTFILE FROM INFILE               
                                           
  HDR. PROC                                 
                                           
     CURRENT-DATE   = SYSDATE-LONG         
     W-HDR-DATE-YY  = CURRENT-YY           
     W-HDR-DATE-MM  = CURRENT-MM           
     W-HDR-DATE-DD  = CURRENT-DD           
     W-HDR-TIME     = SYSTIME               
     OUT-REC        = W-HDR-REC             
     PUT OUTFILE                           
                                           
  END-PROC                                 
                                           
  TRLR. PROC                               
                                           
     W-TRLR-COUNT   = INFILE:RECORD-COUNT   
     OUT-REC        = W-TRLR-REC           
     PUT OUTFILE                           
                                           
  END-PROC                                 
/*                                         


This will produce

Code:

H2006-01-11.11.47.16.000001                     
I0001ABC XXXXX XXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXX
I0002BCE XXXXX XXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXX
T000000000000002                                 


Sort Solution:

Code:

//STEP0100 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD *                                               
I0001ABC XXXXX XXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXX               
I0002BCE XXXXX XXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXX               
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD *                                               
 SORT FIELDS=COPY                                             
 OUTFIL REMOVECC,                                             
        HEADER1=(C'H',DATE=(4MD-),C'.',TIME(24.),C'.000001'), 
        TRAILER1=(C'T',COUNT=(M11,LENGTH=15))                 
/*                                                             


If you really want the timestamp microseconds then use the following job.

Code:

//STEP0100 EXEC PGM=IKJEFT01                             
//SYSTSPRT DD  SYSOUT=*,DCB=BLKSIZE=121                 
//SYSPRINT DD  SYSOUT=*                                 
//SYSTSIN  DD  *                                         
 DSN SYSTEM(xxxx)                                       
 RUN  PROGRAM(DSNTIAUL) -                               
      PLAN(DSNTIAUL)    -                               
      PARMS('SQL')      -                               
      LIB('DB2P.RUNLIB.LOAD')                           
//SYSREC00 DD DSN=&T1,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)
//SYSPUNCH DD SYSOUT=*                                   
//SYSIN    DD *                                         
SELECT CHAR('TSTMP,C')                                   
      ,CHAR('''')                                       
      ,CURRENT TIMESTAMP                                 
      ,CHAR('''')                                       
      ,CHAR(' ',45)                                     
   FROM SYSIBM.SYSDUMMY1                                 
  ;                                                     
//STEP0200 EXEC PGM=SORT                                 
//SYSOUT    DD SYSOUT=*                                 
//SYMNAMES DD DSN=&T1,DISP=OLD                           
//SORTIN    DD *                                         
I0001ABC XXXXX XXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXX         
I0002BCE XXXXX XXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXX         
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                         
 SORT FIELDS=COPY                                       
 OUTFIL REMOVECC,                                       
        HEADER1=(C'H',TSTMP),                           
        TRAILER1=(C'T',COUNT=(M11,LENGTH=15))           
/*                                                       


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
yugee
Beginner


Joined: 17 Sep 2005
Posts: 25
Topics: 8

PostPosted: Wed Jan 11, 2006 2:28 pm    Post subject: Reply with quote

Thanks a lot..it worked wonderfully..
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group