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

How to get Current week data


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

New User


Joined: 11 Dec 2006
Posts: 13
Location: bangalore

PostPosted: Tue Feb 27, 2007 5:21 pm
Reply with quote

hi frnds
i have one daily job that should have record , if i run on saturday it should have records of saturday and friday but if i run the job on sunday it should only have saturday recordand it should not have the records of sundays...i have to move the records of sundays job to one recycle file. rest to one more file.(this is output file).
Can u guys plz suggest me the way to do it in cobol..
Thanks
Back to top
View user's profile Send private message
manihcl85
Warnings : 1

New User


Joined: 11 Jan 2007
Posts: 52
Location: chennai

PostPosted: Tue Feb 27, 2007 5:54 pm
Reply with quote

Hi,

U can use day command it will give an integer ranging from 0 to 7. find out the value for sunday. then using if loop u can change right.
if i am not clear get back to me.

Regards,
Mani
Back to top
View user's profile Send private message
deepthijanardhana

New User


Joined: 11 Dec 2006
Posts: 13
Location: bangalore

PostPosted: Tue Feb 27, 2007 6:40 pm
Reply with quote

hi,
can u plz explain it in breif.. like i have one date feild in file, how can i proceed .. how can i add the logic.
Back to top
View user's profile Send private message
deepthijanardhana

New User


Joined: 11 Dec 2006
Posts: 13
Location: bangalore

PostPosted: Tue Feb 27, 2007 6:40 pm
Reply with quote

hi,
can u plz explain it in breif.. like i have one date feild in file, how can i proceed .. how can i add the logic.
Back to top
View user's profile Send private message
deepthijanardhana

New User


Joined: 11 Dec 2006
Posts: 13
Location: bangalore

PostPosted: Tue Feb 27, 2007 6:44 pm
Reply with quote

hi,
can u plz explain how to write logic part for this..
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Tue Feb 27, 2007 7:04 pm
Reply with quote

Slow down deepthijanardhana...... icon_rolleyes.gif

One way:
If this is the sunday run, open the sunday output file
read input
if sunday run, and sunday data, write to sunday output, go read again
if not sunday run, report, go read again.
if no more input, close files
if no more input and sunday run, close sunday output.
"All the way, to EOJ"
Back to top
View user's profile Send private message
manihcl85
Warnings : 1

New User


Joined: 11 Jan 2007
Posts: 52
Location: chennai

PostPosted: Wed Feb 28, 2007 9:56 am
Reply with quote

Hi,

can u please give me an example input file with what format date is there in ur input file. suppose if the job run on monday means it should have both sunday and monday files or what?

Regards,
Mani
Back to top
View user's profile Send private message
deepthijanardhana

New User


Joined: 11 Dec 2006
Posts: 13
Location: bangalore

PostPosted: Wed Feb 28, 2007 10:12 am
Reply with quote

hi,
this is the input feild date format.
05 DTL-TRAN-DATE G
10 DTL-TRAN-DATECC G
15 DTL-TRAN-DATE-CC C 2
10 DTL-TRAN-DATE-YYMMDD G
15 DTL-TRAN-DATE-YY C 2
15 DTL-TRAN-DATE-MM C 2
15 DTL-TRAN-DATE-DD C 2


How can i check this date as sunday?

and also on monday we run weekly job , so no need to worry abt that.
Back to top
View user's profile Send private message
manihcl85
Warnings : 1

New User


Joined: 11 Jan 2007
Posts: 52
Location: chennai

PostPosted: Wed Feb 28, 2007 10:57 am
Reply with quote

Hi,

i am not able find the date in ur input file. cobol code is quite a big logic. if u have access to db2 means use the query below. it will return a integer from 1 t0 7 if 1 means sunday using this u can perform ur operation i think.

SELECT DAYOFWEEK (CAST('10/11/1998' AS DATE)) INTO :VAR1
FROM SYSIBM.SYSDUMMY1;

Correct me if i am wrong

Regards,
Mani
Back to top
View user's profile Send private message
deepthijanardhana

New User


Joined: 11 Dec 2006
Posts: 13
Location: bangalore

PostPosted: Wed Feb 28, 2007 10:59 am
Reply with quote

i have written logic like this . will it work.
it should take,only if today is sunday it should fetch that day data and write it to recycle file else to output file.

ACCEPT WS-SYSTEM-DATE FROM DATE.

IF DAY-OF-WEEK == 7
MOVE DTL-TRAN-DATE (3:6) TO WS-CUR-SUN-DATE.
END-IF.

IF WS-CUR-SUN-DATE = WS-SYSTEM-DATE
MOVE IN-SAFEWAY-RECORD TO OT-RECY-RECORD
ELSE
MOVE IN-SAFEWAY-RECORD TO OT-EXTRACT-RECORD
END-IF.
Back to top
View user's profile Send private message
manihcl85
Warnings : 1

New User


Joined: 11 Jan 2007
Posts: 52
Location: chennai

PostPosted: Wed Feb 28, 2007 11:03 am
Reply with quote

HI,

Sorry still i am not clear with how ur input file is and what ur doing.

Regards,
Mani
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 Store the data for fixed length COBOL Programming 1
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
No new posts To get the the current time DFSORT/ICETOOL 13
No new posts Check data with Exception Table DB2 0
Search our Forums:

Back to Top