View previous topic :: View next topic
|
Author |
Message |
ksk
Active User
Joined: 08 Jun 2006 Posts: 355 Location: New York
|
|
|
|
Hi,
I have a requirement to insert TIMESTAMP dynamically. Can we do this using SORT?
I have searched the forum and found the below card
Code: |
OUTREC FIELDS=(1,9,10:DATE4,C'.000000')
|
I am using for the time being this card. But can we produce TIMESTAMP with micro seconds part also dynamically? My requirement is to get total TIMESTAMP as below.
YYYY-MM-DD-hh.mm.ss.nnnnnn |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
DFSORT does NOT have any built-in functions for getting the microsecond part dynamically. |
|
Back to top |
|
|
ganeshcet
New User
Joined: 25 Jan 2007 Posts: 11 Location: New York
|
|
|
|
Is there a utility that creates Timestamp into a file ?
I would like to have a sort/step which creates a Fixed LRECL file with time stamp alone (micro seconds can be 0)
Only option which i m using is sort
Code: |
//EXEC1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=FILE1,DISP=SHR
//SORTOUT DD DSN=FILE1===>BOTH SAME,DISP=SHR
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1:DATE4,C'.000000')
|
Note: file1 should have a single record !
Is there an utility which creates the file with timestamp only ? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
Is there a utility that creates Timestamp into a file ? |
Not that i'm aware of, but you could write your own in very few lines of code. . . |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Quote: |
micro seconds can be 0 |
If you are OK with the microsecond part, what is wrong in the current DFSORT approach? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
ganeshcet,
Assuming FILE1 has RECFM=FB, you can use a DFSORT job like the following to do what you asked for. Just replace n with the LRECL of FILE1 (e.g. if FILE1 has LRECL=80, replace n with 80).
Code: |
//EXEC1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
RECORD
//SORTOUT DD DSN=FILE1,DISP=OLD
//SYSIN DD *
SORT FIELDS=COPY
OUTREC BUILD=(1:DATE4,C'.000000',n:X)
/*
|
|
|
Back to top |
|
|
Mumblez
New User
Joined: 27 Apr 2007 Posts: 7 Location: Philippines
|
|
|
|
Hi Frank,
I just want to bring this topic up again. If DFSORT can't get the microsecond dynamically? Does any other tool can?
Thanks! |
|
Back to top |
|
|
kaushik8205
New User
Joined: 10 Nov 2006 Posts: 49 Location: Canada
|
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
what about REXX,
Code: |
TIME = TIME('L') /* HH:MM:SS.UUUUUU */
|
Quote: |
Long returns time in the format: hh:mm:ss.uuuuuu (uuuuuu is the
fraction of seconds, in microseconds). The first eight
characters of the result follow the same rules as for the Normal
form, and the fractional part is always six digits.
|
Gerry |
|
Back to top |
|
|
Mumblez
New User
Joined: 27 Apr 2007 Posts: 7 Location: Philippines
|
|
|
|
Thanks gcicchet,
I'm not that really familiar with REXX, and I tried reading a few REXX stuff. How do you write REXX displays into a Dataset?
I tried the simple command:
/* REXX */
SAY 'TEST'
But I can't find the display output anywhere.Should it be in the SYSTSPRT, SYSPRINT, SYSOUT or OUTDD? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
here is a jcl snippet ( modify according to Your needs )
jcl stream not tested ... but no reason it should not work
Code: |
// ... JOB ...
//* CREATE THE PDS CONTAINING THE REXX SCRIPT
//IEB1 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY
//SYSUT1 DD *
/* REXX */
timec.0 = 1
timec.1 = time("L")
do i = 1 to timec.0
say ">"timec.i"<"
end
Address TSO "EXECIO" timec.0 "DISKW SYSUT2 (STEM TIMEC. FINIS"
exit
/*
//SYSUT2 DD DISP=(NEW,PASS),
// DSN=&&SCRIPT(TIMEC),
// UNIT=SYSDA,SPACE=(TRK,(1,1,1))
// DCB=(RECFM=FB,LRECL=80)
//*
//* RUN THE REXX SCRIPT TO WRITE TIME CARD
//IKJ EXEC PGM=IKJEFT01
//SYSPROC DD DISP=(OLD,PASS),
// DSN=&&SCRIPT
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *
TIMEC
//SYSUT2 DD DISP=(NEW,PASS),
// DSN=&&TIMEC,
// UNIT=SYSDA,SPACE=(TRK,(1,1))
// DCB=(RECFM=FB,LRECL=80)
//*
//*
//* SEE THAT THE REXX SCRIPT PRODUCED THE RIGHT TIME CARD
//IEB2 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY
//SYSUT1 DD DISP=(OLD,PASS),
// DSN=&&TIMEC
//SYSUT2 DD SYSOUT=*
//*
|
|
|
Back to top |
|
|
Mumblez
New User
Joined: 27 Apr 2007 Posts: 7 Location: Philippines
|
|
|
|
Thanks Enrico,
But the first step IEB1 doesn't work, SYSUT2 has no data for TIMEC when i tried to execute it.
Also, when i tried to store the display to a dataset, it has 'START' and 'END', is there a command to omit them? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
my bad... I forgot about the rexx comment statement
change
to
Code: |
//SYSUT1 DD *,DLM=$$ |
after the rexx exit statement
change
to
|
|
Back to top |
|
|
|