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

check dates are in accending order


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
nmr

New User


Joined: 27 Sep 2007
Posts: 14
Location: hyderabad

PostPosted: Thu Dec 06, 2007 11:25 am
Reply with quote

my requirement is to read one file and send the key(policy number) to another file to read that file and check all transactions in the file effective dates are in assending order if the effective dates are not in acending order we need to send that records to one report file,can any body suggest me how give conditon to check all the dates are in acending order.

for example

eff date
---------
8/20/2007
8/22/2007
8/26/2007
9/12/2007
9/06/2007
9/28/2007
10/8/2007
10/6/2007

from the above effective dates

9/06/2007
10/6/2007

are not in order those records need to write in report file
Back to top
View user's profile Send private message
balakrishna reddy

Active User


Joined: 13 Jul 2007
Posts: 128
Location: Guntur

PostPosted: Thu Dec 06, 2007 12:00 pm
Reply with quote

Hello,

I am giving you the logic for only date checking.put this in a separate para and call this para after reading the second file randomly.

Code:

data division.

working-storage section.

01 date1.
    05  mm1   pic 9(2).
    05  dd1     pic 9(2).
    05  yyyy1  pic 9(4).
01 tdate.
    05  tmm1  pic 9(2).
    05  tdd1    pic  9(2).
    05  tyyyy1 pic  9(4).
01 rdate.
    05  rmm   pic 9(2).
    05  rdd     pic 9(2).
    05  ryyyy pic  9(4).

procedure division.

................
...............  (After reading the second file randomly move the date1 to tdate and dont perform the condition check para for first read)
...............
       if(yyyy1 >= tyyyy1)
           if(mm1 >= tmm1)
               if(dd1 < tdd1)
                     move date1 to rdate
                      perform  report-wrt-para
               else
                      move date1 to tdate
               end-if
           end-if
      end-if.
.............
.............


if you need any clarifications don't hesitate to ask.
Back to top
View user's profile Send private message
nmr

New User


Joined: 27 Sep 2007
Posts: 14
Location: hyderabad

PostPosted: Thu Dec 06, 2007 12:42 pm
Reply with quote

hi balakrishnareddy,

the logic you send is good,how we implement this logic for second record
on words can you please ellaborate your code,it is very helpful to me,
i am new to cobol coding.
Back to top
View user's profile Send private message
balakrishna reddy

Active User


Joined: 13 Jul 2007
Posts: 128
Location: Guntur

PostPosted: Thu Dec 06, 2007 1:29 pm
Reply with quote

Hi,

initialize i to '0'

Code:


read-second-file-para.

read scnd-file at end move 'Y' to eof.
move date1 to tdate.
perform check-date-para varying i from 1 by 1 until 0 < i and eof = 'Y'.

move 1 to i.

read-secondfile-exit.
exit.



you have any confusion please let me know
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: Thu Dec 06, 2007 9:54 pm
Reply with quote

Hello,

What will happen if the year or month is out of sequence?

I'd suggest reformatting the dates to yyyymmdd and comparing the entire date rather than comparing the pieces separately.
Back to top
View user's profile Send private message
nmr

New User


Joined: 27 Sep 2007
Posts: 14
Location: hyderabad

PostPosted: Fri Dec 07, 2007 11:24 am
Reply with quote

Thanks balakrishnareddy and dick
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
No new posts Rotate partition-logical & physic... DB2 0
No new posts How to check whether who renamed the ... JCL & VSAM 3
No new posts No ++JCLIN, APPLY CHECK job JCL & VSAM 1
Search our Forums:

Back to Top