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

Comparing the dates in File1 and File2


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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
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
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

Superior Member


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

PostPosted: Thu Jun 25, 2009 3:48 pm
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: 8797
Location: Welsh Wales

PostPosted: Thu Jun 25, 2009 4:04 pm
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
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 Developer


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

PostPosted: Fri Jun 26, 2009 9:13 pm
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
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
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 Developer


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

PostPosted: Mon Jun 29, 2009 9:52 pm
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
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: 8797
Location: Welsh Wales

PostPosted: Tue Jun 30, 2009 11:35 am
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
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: 2481
Location: @my desk

PostPosted: Tue Jun 30, 2009 6:13 pm
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
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: 8797
Location: Welsh Wales

PostPosted: Wed Jul 01, 2009 12:31 pm
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: 2481
Location: @my desk

PostPosted: Wed Jul 01, 2009 1:32 pm
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 Use [URL] BBCode for External Links 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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Amount of days between two dates PL/I & Assembler 8
No new posts Comparing Header and Trailer. DFSORT/ICETOOL 7
This topic is locked: you cannot edit posts or make replies. Trying to put date from File1 into fi... SYNCSORT 14
This topic is locked: you cannot edit posts or make replies. copy file 2 data into file1 for match... DFSORT/ICETOOL 4
No new posts to Insert Rows from File1 to File 2 ... DFSORT/ICETOOL 1
Search our Forums:

Back to Top