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
 

 

Comparing the dates in File1 and File2

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Aravind_mf

New User


Joined: 06 Mar 2009
Posts: 13
Location: chennai

PostPosted: Thu Jun 25, 2009 1:22 pm    Post subject: Comparing the dates in File1 and File2
Reply with quote

Hi,

I have a requirement of comparing two GDG files(File1 and File2). The two GDG files will have date in the format CCYYMMDDHHMMSS.
Example 20090625103311.

I have to compare for date in File1 is greater that date in File2. If File1 date is greater then I have to call an abend routine (we have our own abend routine) else proceed to execute the other steps.

Please help me in acheving my requirement.

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

arvind.m

Active User


Joined: 28 Aug 2008
Posts: 205
Location: Hyderabad

PostPosted: Thu Jun 25, 2009 1:47 pm    Post subject:
Reply with quote

i think its a simple compare of two file. you can you a COBOL program with the below logic...

Code:

INI-Para

read file1
read file2

PROCESS-Para

if date1 > date2
    call abend
else
    proceed further and read the files again.




Back to top
View user's profile Send private message
Aravind_mf

New User


Joined: 06 Mar 2009
Posts: 13
Location: chennai

PostPosted: Thu Jun 25, 2009 3:18 pm    Post subject: Reply to: Comparing the dates in File1 and File2
Reply with quote

Sorry guys, I should have been more specific. I want the above requirement to be implemented through JCL.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Thu Jun 25, 2009 3:48 pm    Post subject:
Reply with quote

As the requirement is been posted in JCL section of the Forum, what kind of solution you are looking for-- probably SORT?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Thu Jun 25, 2009 4:04 pm    Post subject: Re: Reply to: Comparing the dates in File1 and File2
Reply with quote

Aravind_mf wrote:
Sorry guys, I should have been more specific. I want the above requirement to be implemented through JCL.

As is so often stated in the forum, JCL by itself does nothing except communicate to the processor which program is to be executed, which files are to be used for the specific DD names, and also may be used to pass parameters to the selected program.

Given that you wish to achieve this through JCL you need to specify which program you would like executed to achieve the end result.
Back to top
View user's profile Send private message
Aravind_mf

New User


Joined: 06 Mar 2009
Posts: 13
Location: chennai

PostPosted: Fri Jun 26, 2009 10:28 am    Post subject:
Reply with quote

OK. I would like to use SORT,DFSORT or ICETOOL(may be?).
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Fri Jun 26, 2009 9:13 pm    Post subject:
Reply with quote

Is there only one record in each input file?

What is the starting position, length and format of the date field?

If I show you how to get a RC=16 if the file1 date is greater, or RC=0 otherwise, do you know how to use the return codes to determine whether or not to call your routine?
Back to top
View user's profile Send private message
Aravind_mf

New User


Joined: 06 Mar 2009
Posts: 13
Location: chennai

PostPosted: Mon Jun 29, 2009 2:20 pm    Post subject:
Reply with quote

Frank,

yes each file will have one record in it in the format (CCYYMMDDHHMMSS). Starting pos is 1 and End pos is 14.

For example, if File1 contains - 20090621112255 and File2 contains 20090621122250 then if I compare File1>File2 then it should abend.

Yes I know how to use return codes using COND statement to call my routine. Please let me know how to get RC=16 or RC=0 for the comparision.

Thanks
Aravind
Back to top
View user's profile Send private message
sankaranarayanan parasura

New User


Joined: 28 Oct 2007
Posts: 10
Location: chennai

PostPosted: Mon Jun 29, 2009 6:23 pm    Post subject: Reply to: Comparing the dates in File1 and File2
Reply with quote

Aravind,

Why can't you use a jobstep calling REXX program to parse two input files to check the dates and set the RC =16 or 0 based on the timestamp record in the files.

Sankar
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Mon Jun 29, 2009 9:52 pm    Post subject:
Reply with quote

Here's a DFSORT job that will do what you asked for. If date1>date2, DFSORT will pass back RC=16. Otherwise, DFSORT will pass back RC=0.

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file1
//       DD DSN=...  input file2
//OUT DD DUMMY
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=GROUP,RECORDS=2,PUSH=(15:1,14))
  OUTFIL FNAMES=OUT,STARTREC=2,OMIT=(15,14,ZD,GT,1,14,ZD),
    NULLOFL=RC16
/*
Back to top
View user's profile Send private message
Aravind_mf

New User


Joined: 06 Mar 2009
Posts: 13
Location: chennai

PostPosted: Tue Jun 30, 2009 11:29 am    Post subject:
Reply with quote

Frank,

Thanks for your reply. the INREC statement
INREC IFTHEN=(WHEN=GROUP,RECORDS=2,PUSH(15:1,14)) is not working and says as the statement has syntax error.

SYNCSORT FOR Z/OS 1.2.3.1R U.S. PATENTS: 4210961, 5117495 (C) 2005 SYNCSO
BANK OF AMERICA-Z/OS SYNCSORT R1.2 MARCH 2006 z/O
PRODUCT LICENSED FOR CPU SERIAL NUMBER 1630E, MODEL 2094 603 LICEN
SYSIN :
OPTION COPY 0000005
INREC IFTHEN=(WHEN=GROUP,RECORDS=2,PUSH(15:1,14)) 0000006
*
OUTFIL FNAMES=OUT,STARTREC=2,OMIT=(15,14,ZD,GT,1,14,ZD),NULLOFL=RC16 0000007
WER268A INREC STATEMENT : SYNTAX ERROR
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE


I suppose IFTHEN statement is not being recognised. please need your expertise help.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Jun 30, 2009 11:35 am    Post subject:
Reply with quote

The product that you are using is SYNCSORT, not DFSORT.

These are two different products, developed and marketed by two seperate companies.

Please be aware, hopefully BEFORE you post which product you use.

ICE messages indicate DFSORT, WER messages for SYNCSORT. Hardly rocket science ......... is it icon_rolleyes.gif

Topic moved to the JCL forum for SYNCSORT solutions.
Back to top
View user's profile Send private message
Aravind_mf

New User


Joined: 06 Mar 2009
Posts: 13
Location: chennai

PostPosted: Tue Jun 30, 2009 4:41 pm    Post subject:
Reply with quote

Apologies, it seems my shop will support only SYNCSORT. Can you please help to acheive this requirement in SYNCSORT
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Tue Jun 30, 2009 6:13 pm    Post subject:
Reply with quote

Aravind,

The below SyncSort job would produce the desired results.
Code:
//STEP0100 EXEC PGM=SORT           
//SYSOUT   DD SYSOUT=*             
//SORTJNF1 DD DSN=...  input file1 
//SORTJNF2 DD DSN=...  input file2 
//SORTOUT  DD DUMMY                 
//SYSIN    DD *                     
  JOINKEYS FILE=F1,FIELDS=(15,1,A) 
  JOINKEYS FILE=F2,FIELDS=(15,1,A) 
  REFORMAT FIELDS=(F1:1,14,F2:1,14)
  INCLUDE COND=(1,14,ZD,GT,15,14,ZD)
  SORT FIELDS=COPY                 
  OPTION NULLOUT=RC4               
If date-1 > date-2, RC=0 else RC=4
Back to top
View user's profile Send private message
Aravind_mf

New User


Joined: 06 Mar 2009
Posts: 13
Location: chennai

PostPosted: Wed Jul 01, 2009 12:28 pm    Post subject:
Reply with quote

Its working. Thanks a lot Arun. Also can you let me know what are the return codes that can be specified in the NULLOUT statement?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Wed Jul 01, 2009 12:31 pm    Post subject:
Reply with quote

Aravind_mf wrote:
Its working. Thanks a lot Arun. Also can you let me know what are the return codes that can be specified in the NULLOUT statement?

Do YOU not have access to the product documentation ?
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Wed Jul 01, 2009 1:32 pm    Post subject:
Reply with quote

Quote:
can you let me know what are the return codes that can be specified in the NULLOUT statement?
SyncSort for z/OS 1.2 Manual wrote:
NULLOUT= RC0 /RC4 /RC16

If you dont have access to a manual, request for one from www.syncsort.com or send a PM to Alissa Margulies(JCL Moderator). They'll help you further.
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am
No new posts comparing comp-3 and unpacked numbers juares castro COBOL Programming 3 Mon May 30, 2016 6:46 pm
No new posts Need help on comparing hexadecimal va... ashok_uddaraju DFSORT/ICETOOL 4 Thu Apr 28, 2016 2:08 am
No new posts Comparing two VB files phani_nittice SYNCSORT 8 Fri Jan 22, 2016 1:19 am
No new posts Comparing timestamp in Synscort l.nethaji SYNCSORT 13 Wed Jan 20, 2016 4:47 pm


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