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
 

 

check dates are in accending order

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: check dates are in accending order
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: 130
Location: Guntur

PostPosted: Thu Dec 06, 2007 12:00 pm    Post subject:
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    Post subject: Reply to: check dates are in accending order
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: 130
Location: Guntur

PostPosted: Thu Dec 06, 2007 1:29 pm    Post subject:
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

Site Director


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

PostPosted: Thu Dec 06, 2007 9:54 pm    Post subject:
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    Post subject: Reply to: check dates are in accending order
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Order BY AND Index Nileshkul DB2 2 Sat Dec 31, 2016 6:33 pm
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 7 Fri Nov 18, 2016 1:48 pm
No new posts Check System time(Minute) Using TIME1... balaji81_k DFSORT/ICETOOL 5 Fri Nov 11, 2016 10:53 am
No new posts Syntax to check the first 4 digits of... kshirabdhi DFSORT/ICETOOL 10 Tue May 03, 2016 12:21 pm
No new posts Check special resource availability w... pinimo JCL & VSAM 8 Fri Apr 15, 2016 8:18 pm


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