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

TIMESTAMP using DFSORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ksk

Active User


Joined: 08 Jun 2006
Posts: 355
Location: New York

PostPosted: Wed Dec 03, 2008 11:33 am
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Dec 03, 2008 10:40 pm
Reply with quote

DFSORT does NOT have any built-in functions for getting the microsecond part dynamically.
Back to top
View user's profile Send private message
ganeshcet

New User


Joined: 25 Jan 2007
Posts: 11
Location: New York

PostPosted: Fri Dec 19, 2008 9:28 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Dec 19, 2008 9:47 am
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Dec 19, 2008 10:06 am
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Dec 19, 2008 9:13 pm
Reply with quote

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
View user's profile Send private message
Mumblez

New User


Joined: 27 Apr 2007
Posts: 7
Location: Philippines

PostPosted: Tue Nov 10, 2009 9:18 am
Reply with quote

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
View user's profile Send private message
kaushik8205

New User


Joined: 10 Nov 2006
Posts: 49
Location: Canada

PostPosted: Tue Nov 10, 2009 1:14 pm
Reply with quote

Hi Mumblez,

If your system supports DB2, then you get the microsecond from the timestamp.
This can be accomplished using SYSIBM.* tables and using IKJEFT in JCL misrosecond can be written to a file.

Please refer to the link:- www.ibm.com/developerworks/data/library/techarticle/0211yip/0211yip3.html?S_TACT=105AGX01&S_CMP=TOPTEN

Thanks.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Tue Nov 10, 2009 1:37 pm
Reply with quote

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
View user's profile Send private message
Mumblez

New User


Joined: 27 Apr 2007
Posts: 7
Location: Philippines

PostPosted: Wed Nov 11, 2009 2:33 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Nov 11, 2009 2:49 pm
Reply with quote

here is a jcl snippet ( modify according to Your needs )
jcl stream not tested ... but no reason it should not work icon_biggrin.gif

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
View user's profile Send private message
Mumblez

New User


Joined: 27 Apr 2007
Posts: 7
Location: Philippines

PostPosted: Mon Nov 16, 2009 7:33 am
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Nov 16, 2009 2:24 pm
Reply with quote

my bad... I forgot about the rexx comment statement

change
Code:
//SYSUT1    DD *

to
Code:
//SYSUT1    DD *,DLM=$$

after the rexx exit statement
change
Code:
/*

to
Code:
$$
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
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 Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts DFsort help with SUM() DFSORT/ICETOOL 12
Search our Forums:

Back to Top