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

compare timestamp columns using dfsort


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

New User


Joined: 11 Oct 2004
Posts: 69
Location: chennai

PostPosted: Mon Aug 02, 2010 1:46 pm
Reply with quote

Hi,
I have a file which have timestamp values present in columns 30-47 and 48-65 in YYYY/MM/DDHR.SEC.MIN.

Please find below the example records.

3----+----4----+----5----+----6----+
Top of Data ***********************
2010/08/2305.15.002010.08.2321.31.00
2010/08/2405.15.002010.08.2421.31.00
2010/08/2505.15.002010.08.2521.31.00


i want to split in to two based on the timestamp which in 30-47 greater than timestamp in 48-65 in one output file and the other in to another file.

Regards,
Rajan BOSE.
Back to top
View user's profile Send private message
nareshdacha

New User


Joined: 12 Jan 2010
Posts: 66
Location: US

PostPosted: Mon Aug 02, 2010 4:59 pm
Reply with quote

Try this....

Code:
//STEP1    EXEC  PGM=SORT
//SORTIN   DD  DSN=INPUT,DISP=SHR
//SORTOF01 DD  DSN=INPUT.X1,DISP=(,CATLG),
//             SPACE=(CYL,(5,5))
//SORTOF02 DD  DSN=INPUT.X2,DISP=(,CATLG),
//             SPACE=(CYL,(5,5))
//SYSOUT   DD  SYSOUT=*
//SYSIN    DD  *
  OPTION COPY
  OUTFIL FILES=01,
      INCLUDE=(30,17,ZD,GT,48,17,ZD)
  OUTFIL FILES=02,
      SAVE

30 is start position
17 is length
48 is start position
17 is length
GT = Greater than
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: Mon Aug 02, 2010 11:05 pm
Reply with quote

Rajan,

Here's a DFSORT job that will do what you asked for:

Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/65)
//OUT1 DD DSN=...  output file1 (FB/65)
//OUT2 DD DSN=...  output file2 (FB/65)
//SYSIN DD *
  OPTION COPY
  OUTFIL FNAMES=OUT1,INCLUDE=(30,17,UFF,GT,48,17,UFF)
  OUTFIL FNAMES=OUT2,SAVE
/*


Naresh,

ZD is NOT the appropriate format for values that have slashes and dots as those are NOT valid ZD characters. UFF is the correct format.
Back to top
View user's profile Send private message
nareshdacha

New User


Joined: 12 Jan 2010
Posts: 66
Location: US

PostPosted: Tue Aug 03, 2010 8:30 am
Reply with quote

Thanks for the correction Frank........
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Tue Aug 03, 2010 10:18 am
Reply with quote

Quote:
CH is equivalent to BI as long as options like LOCALE and CHALT are not in effect. ZD is not as efficient as BI or CH. UFF is not as efficient as ZD
Frank,

I saw your above post in another topic. Can we give 'CH' here instead of 'UFF' for the timestamp field?
Back to top
View user's profile Send private message
srajanbose

New User


Joined: 11 Oct 2004
Posts: 69
Location: chennai

PostPosted: Tue Aug 03, 2010 4:54 pm
Reply with quote

Hi Frank,

It worked fine for me.Thanks a Lot. Could you please explain me the 'UFF' in sortcard. Its the syntax used only for Timestamp comparison?


Regards,
Rajan BOSE
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Aug 03, 2010 4:59 pm
Reply with quote

Commonly Used Data Formats
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: Tue Aug 03, 2010 11:35 pm
Reply with quote

Here's a more complete description of DFSORT's formats:

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA40/C.0?DT=20090527161936
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: Tue Aug 03, 2010 11:38 pm
Reply with quote

Quote:
Can we give 'CH' here instead of 'UFF' for the timestamp field?


No, because one date field has / separators and the other has . separators so they aren't equivalent CH values. UFF extracts just the digits so the different separators won't matter.
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 2
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
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 Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top